SharedWorker::PreHandleEvent doesn't deal with widget events

RESOLVED FIXED in Firefox 52

Status

()

Core
DOM
P3
normal
RESOLVED FIXED
a year ago
a year ago

People

(Reporter: smaug, Assigned: baku)

Tracking

50 Branch
mozilla52
Points:
---

Firefox Tracking Flags

(firefox52 fixed)

Details

Attachments

(1 attachment)

(Reporter)

Description

a year ago
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
(Reporter)

Updated

a year ago
Blocks: 643325
(Reporter)

Comment 1

a year ago
(it is possible that we don't currently dispatch WidgetEvents without DOMEvent in workers)
(Assignee)

Comment 2

a year ago
We just dispatch DOMEvents in workers.
(Reporter)

Comment 3

a year ago
by accident. I don't anything guaranteeing that. And dispatching widget events should be just fine.
Priority: -- → P3
(Assignee)

Updated

a year ago
Assignee: nobody → amarchesini
(Assignee)

Comment 4

a year ago
Created attachment 8809745 [details] [diff] [review]
event2.patch
Attachment #8809745 - Flags: review?(bugs)
(Reporter)

Comment 5

a year ago
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+

Comment 6

a year ago
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

Comment 7

a year ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/3f11622c5a78
Status: NEW → RESOLVED
Last Resolved: a year ago
status-firefox52: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla52
You need to log in before you can comment on or make changes to this bug.