WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
203919
Port Worker to the HTML5 event loop
https://bugs.webkit.org/show_bug.cgi?id=203919
Summary
Port Worker to the HTML5 event loop
Chris Dumez
Reported
2019-11-06 14:16:21 PST
Port Worker to the HTML5 event loop.
Attachments
Patch
(7.38 KB, patch)
2019-11-06 19:29 PST
,
Chris Dumez
rniwa
: review+
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Chris Dumez
Comment 1
2019-11-06 19:29:31 PST
Created
attachment 383014
[details]
Patch
Ryosuke Niwa
Comment 2
2019-11-07 14:00:17 PST
Comment on
attachment 383014
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=383014&action=review
> Source/WebCore/workers/Worker.cpp:208 > + queueTaskToDispatchEvent(*this, TaskSource::DOMManipulation, Event::create(eventNames().errorEvent, Event::CanBubble::No, Event::IsCancelable::Yes));
Shouldn't this be Networking?
> Source/WebCore/workers/WorkerMessagingProxy.cpp:107 > - workerObject->enqueueEvent(MessageEvent::create(WTFMove(ports), message.message.releaseNonNull())); > + ActiveDOMObject::queueTaskToDispatchEvent(*workerObject, TaskSource::DOMManipulation, MessageEvent::create(WTFMove(ports), message.message.releaseNonNull()));
Shouldn't this be unshipped port message queue?
https://html.spec.whatwg.org/multipage/web-messaging.html#message-port-post-message-steps
> Source/WebCore/workers/WorkerMessagingProxy.cpp:180 > - workerObject->enqueueEvent(ErrorEvent::create(errorMessage, sourceURL, lineNumber, columnNumber, { })); > + ActiveDOMObject::queueTaskToDispatchEvent(*workerObject, TaskSource::DOMManipulation, ErrorEvent::create(errorMessage, sourceURL, lineNumber, columnNumber, { }));
Ditto.
Chris Dumez
Comment 3
2019-11-07 14:03:11 PST
Comment on
attachment 383014
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=383014&action=review
>> Source/WebCore/workers/Worker.cpp:208 >> + queueTaskToDispatchEvent(*this, TaskSource::DOMManipulation, Event::create(eventNames().errorEvent, Event::CanBubble::No, Event::IsCancelable::Yes)); > > Shouldn't this be Networking?
The spec says: "The task source for the tasks mentioned above is the DOM manipulation task source."
Chris Dumez
Comment 4
2019-11-07 14:04:36 PST
Comment on
attachment 383014
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=383014&action=review
>> Source/WebCore/workers/WorkerMessagingProxy.cpp:107 >> + ActiveDOMObject::queueTaskToDispatchEvent(*workerObject, TaskSource::DOMManipulation, MessageEvent::create(WTFMove(ports), message.message.releaseNonNull())); > > Shouldn't this be unshipped port message queue? >
https://html.spec.whatwg.org/multipage/web-messaging.html#message-port-post-message-steps
We don't exactly match the spec here indeed but I am unclear how to exactly match the spec. Would you like me to add a FIXME comment?
Ryosuke Niwa
Comment 5
2019-11-07 14:07:50 PST
(In reply to Chris Dumez from
comment #4
)
> Comment on
attachment 383014
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=383014&action=review
> > >> Source/WebCore/workers/WorkerMessagingProxy.cpp:107 > >> + ActiveDOMObject::queueTaskToDispatchEvent(*workerObject, TaskSource::DOMManipulation, MessageEvent::create(WTFMove(ports), message.message.releaseNonNull())); > > > > Shouldn't this be unshipped port message queue? > >
https://html.spec.whatwg.org/multipage/web-messaging.html#message-port-post-message-steps
> > We don't exactly match the spec here indeed but I am unclear how to exactly > match the spec. > Would you like me to add a FIXME comment?
I think using DOM manipulation task source is super confusing here because it clearly isn't that. I think the closest thing is
https://html.spec.whatwg.org/multipage/web-messaging.html#port-message-queue
See
https://html.spec.whatwg.org/multipage/web-messaging.html#message-port-post-message-steps
, which is invoked by postMessage on Worker, which uses the implicitly defined MessagePort of Worker.
Chris Dumez
Comment 6
2019-11-07 14:10:16 PST
Comment on
attachment 383014
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=383014&action=review
>>>> Source/WebCore/workers/WorkerMessagingProxy.cpp:107 >>>> + ActiveDOMObject::queueTaskToDispatchEvent(*workerObject, TaskSource::DOMManipulation, MessageEvent::create(WTFMove(ports), message.message.releaseNonNull())); >>> >>> Shouldn't this be unshipped port message queue? >>>
https://html.spec.whatwg.org/multipage/web-messaging.html#message-port-post-message-steps
>> >> We don't exactly match the spec here indeed but I am unclear how to exactly match the spec. >> Would you like me to add a FIXME comment? > > I think using DOM manipulation task source is super confusing here because it clearly isn't that. I think the closest thing is
https://html.spec.whatwg.org/multipage/web-messaging.html#port-message-queue
> > See
https://html.spec.whatwg.org/multipage/web-messaging.html#message-port-post-message-steps
, which is invoked by postMessage on Worker, which uses the implicitly defined MessagePort of Worker.
I used DOMManipulation for consistency with the rest of the spec. Yes, the spec is using DOMManipulation for things that are not DOMManipulation. See also:
https://w3c.github.io/ServiceWorker/#dom-serviceworker-postmessage-message-options
Even in service workers, the spec says to use DOMManipulation for postMessage.
Ryosuke Niwa
Comment 7
2019-11-07 14:17:43 PST
(In reply to Chris Dumez from
comment #6
)
> Comment on
attachment 383014
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=383014&action=review
> > >>>> Source/WebCore/workers/WorkerMessagingProxy.cpp:107 > >>>> + ActiveDOMObject::queueTaskToDispatchEvent(*workerObject, TaskSource::DOMManipulation, MessageEvent::create(WTFMove(ports), message.message.releaseNonNull())); > >>> > >>> Shouldn't this be unshipped port message queue? > >>>
https://html.spec.whatwg.org/multipage/web-messaging.html#message-port-post-message-steps
> >> > >> We don't exactly match the spec here indeed but I am unclear how to exactly match the spec. > >> Would you like me to add a FIXME comment? > > > > I think using DOM manipulation task source is super confusing here because it clearly isn't that. I think the closest thing is
https://html.spec.whatwg.org/multipage/web-messaging.html#port-message-queue
> > > > See
https://html.spec.whatwg.org/multipage/web-messaging.html#message-port-post-message-steps
, which is invoked by postMessage on Worker, which uses the implicitly defined MessagePort of Worker. > > I used DOMManipulation for consistency with the rest of the spec. Yes, the > spec is using DOMManipulation for things that are not DOMManipulation. See > also: >
https://w3c.github.io/ServiceWorker/#dom-serviceworker-postmessage-message
- > options > > Even in service workers, the spec says to use DOMManipulation for > postMessage.
That's very strange. Perhaps we need a spec bug to clarify what task source is used for messaging. I'd much prefer having a single task source for all messaging related APIs than ramp it together with DOM manipulation.
Chris Dumez
Comment 8
2019-11-07 15:24:46 PST
Committed
r252212
: <
https://trac.webkit.org/changeset/252212
>
Radar WebKit Bug Importer
Comment 9
2019-11-07 15:25:19 PST
<
rdar://problem/57000977
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug