Closed Bug 1313762 Opened 8 years ago Closed 8 years ago

SharedWorker::PreHandleEvent doesn't deal with widget events

Categories

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

50 Branch
defect

Tracking

()

RESOLVED FIXED
mozilla52
Tracking Status
firefox52 --- fixed

People

(Reporter: smaug, Assigned: baku)

References

Details

Attachments

(1 file)

The method queues[1] only DOMEvents, but what if DOMEvent hasn't been created yet and there is just WidgetEvent? We do nothing with those in case the worker is frozen.
I guess we should explicitly create DOMEvent and queue that, something similar to
http://searchfox.org/mozilla-central/rev/445097654c1cc1098ee0171a29c439afe363a588/dom/events/EventListenerManager.cpp#1231-1237


[1] http://searchfox.org/mozilla-central/rev/445097654c1cc1098ee0171a29c439afe363a588/dom/workers/SharedWorker.cpp#187
Blocks: 643325
(it is possible that we don't currently dispatch WidgetEvents without DOMEvent in workers)
We just dispatch DOMEvents in workers.
by accident. I don't anything guaranteeing that. And dispatching widget events should be just fine.
Priority: -- → P3
Assignee: nobody → amarchesini
Attached patch event2.patchSplinter Review
Attachment #8809745 - Flags: review?(bugs)
Comment on attachment 8809745 [details] [diff] [review]
event2.patch


> nsresult
> SharedWorker::PreHandleEvent(EventChainPreVisitor& aVisitor)
> {
>   AssertIsOnMainThread();
> 
>-  nsIDOMEvent*& event = aVisitor.mDOMEvent;
>+  nsCOMPtr<nsIDOMEvent> event = aVisitor.mDOMEvent;
>+  if (!event) {
>+    nsCOMPtr<EventTarget> et =
>+      do_QueryInterface(aVisitor.mEvent->mOriginalTarget);
Useless QI. mOriginalTarget is nsCOMPtr<dom::EventTarget>.

>+    event = EventDispatcher::CreateEvent(et, aVisitor.mPresContext,
>+                                         aVisitor.mEvent, EmptyString());
>+  }
You don't want to create the event all the time. Only when we're frozen.
So, move the new code inside 'if (IsFrozen())' check.



Those fixed, r+
Attachment #8809745 - Flags: review?(bugs) → review+
Pushed by amarchesini@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/3f11622c5a78
SharedWorker::PreHandleEvent must be able to deal with widget events, r=smaug
https://hg.mozilla.org/mozilla-central/rev/3f11622c5a78
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla52
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: