Closed Bug 718274 Opened 8 years ago Closed 8 years ago

Add a ::DispatchUntrustedEvent and ::DispatchEvent to nsContentUtils

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla13

People

(Reporter: mounir, Assigned: mjschranz)

References

Details

(Whiteboard: [mentor=volkmar][lang=c++])

Attachments

(1 file)

nsContentUtils allows us to dispatch a trusted event with ::DispatchTrustedEvent() but doesn't help to dispatch an untrusted event. We want to create a ::DispatchUntrustedEvent() and a ::DispatchEvent() functions. Both Untrusted and Trusted function would call the ::DispatchEvent() one with a different aTrusted parameter.
We can make ::DispatchEvent() method private to nsContentUtils or not.

Doing this will require adding a aTrusted boolean parameter to GetEventAndTarget which is private to nsContentUtils.cpp AFAICT.
(In reply to Mounir Lamouri (:volkmar) (:mounir) from comment #0)
> Doing this will require adding a aTrusted boolean parameter to
> GetEventAndTarget which is private to nsContentUtils.cpp AFAICT.

To be exact:
content/base/src/nsContentUtils.cpp
Looking to do something more challenging now for my third set of tickets and this one is definitely interesting so I'm going to pick this up if no one objects.
Status: NEW → ASSIGNED
Assignee: nobody → schranz.m
As far as I can tell this covers the bug's requirements. Set it for feedback because I'm assuming some tests for DispatchUntrustedEvent are needed.
Attachment #591358 - Flags: feedback?(mounir)
Comment on attachment 591358 [details] [diff] [review]
Implementation with no tests

Review of attachment 591358 [details] [diff] [review]:
-----------------------------------------------------------------

Seems good. Do you have try access?
Attachment #591358 - Flags: feedback?(mounir) → review+
(In reply to Matthew Schranz [:mjschranz] from comment #3)
> Created attachment 591358 [details] [diff] [review]
> Implementation with no tests
> 
> As far as I can tell this covers the bug's requirements. Set it for feedback
> because I'm assuming some tests for DispatchUntrustedEvent are needed.

No tests are required here: callers will have to write tests to make sure the behavior they are looking for is ok.
(In reply to Mounir Lamouri (:volkmar) (:mounir) from comment #4)
> Comment on attachment 591358 [details] [diff] [review]
> Implementation with no tests
> 
> Review of attachment 591358 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> Seems good. Do you have try access?

That I do not. Been meaning to start the process for that.
Man have I disregarded this for much longer than I should have. Either way I was granted level 1 try server access today so I'll get this patch up on there in a bit.
Obviously not finished yet, but here is a link to my build on the try server.

https://tbpl.mozilla.org/?tree=Try&rev=bfd739d2f726
Keywords: checkin-needed
Comment on attachment 591358 [details] [diff] [review]
Implementation with no tests

Pushed to inbound. Thank you for the patch :)
Attachment #591358 - Flags: checkin+
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/d316d6781d6e
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla13
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.