WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
178171
Add preliminary support for fetch event
https://bugs.webkit.org/show_bug.cgi?id=178171
Summary
Add preliminary support for fetch event
youenn fablet
Reported
2017-10-11 09:39:54 PDT
Add preliminary support for fetch event
Attachments
Patch
(56.95 KB, patch)
2017-10-11 13:39 PDT
,
youenn fablet
no flags
Details
Formatted Diff
Diff
Patch
(56.93 KB, patch)
2017-10-11 16:06 PDT
,
youenn fablet
no flags
Details
Formatted Diff
Diff
Patch
(57.09 KB, patch)
2017-10-11 16:31 PDT
,
youenn fablet
no flags
Details
Formatted Diff
Diff
Patch
(57.09 KB, patch)
2017-10-11 17:04 PDT
,
youenn fablet
no flags
Details
Formatted Diff
Diff
Archive of layout-test-results from ews102 for mac-elcapitan
(1.16 MB, application/zip)
2017-10-11 18:49 PDT
,
Build Bot
no flags
Details
Archive of layout-test-results from ews115 for mac-elcapitan
(1.77 MB, application/zip)
2017-10-11 18:50 PDT
,
Build Bot
no flags
Details
Patch
(57.11 KB, patch)
2017-10-12 08:29 PDT
,
youenn fablet
no flags
Details
Formatted Diff
Diff
Patch
(61.09 KB, patch)
2017-10-12 13:09 PDT
,
youenn fablet
no flags
Details
Formatted Diff
Diff
Patch
(61.08 KB, patch)
2017-10-12 13:20 PDT
,
youenn fablet
no flags
Details
Formatted Diff
Diff
Patch
(78.44 KB, patch)
2017-10-16 16:26 PDT
,
youenn fablet
no flags
Details
Formatted Diff
Diff
Patch
(77.95 KB, patch)
2017-10-16 16:28 PDT
,
youenn fablet
no flags
Details
Formatted Diff
Diff
Patch
(72.35 KB, patch)
2017-10-16 18:20 PDT
,
youenn fablet
no flags
Details
Formatted Diff
Diff
Patch
(72.40 KB, patch)
2017-10-16 20:12 PDT
,
youenn fablet
no flags
Details
Formatted Diff
Diff
Patch for landing
(72.60 KB, patch)
2017-10-17 10:53 PDT
,
youenn fablet
no flags
Details
Formatted Diff
Diff
build fix
(1.43 KB, patch)
2017-10-17 14:00 PDT
,
youenn fablet
no flags
Details
Formatted Diff
Diff
Show Obsolete
(14)
View All
Add attachment
proposed patch, testcase, etc.
youenn fablet
Comment 1
2017-10-11 13:39:29 PDT
Created
attachment 323456
[details]
Patch
youenn fablet
Comment 2
2017-10-11 16:06:43 PDT
Created
attachment 323477
[details]
Patch
youenn fablet
Comment 3
2017-10-11 16:31:03 PDT
Created
attachment 323483
[details]
Patch
youenn fablet
Comment 4
2017-10-11 17:04:12 PDT
Created
attachment 323491
[details]
Patch
Build Bot
Comment 5
2017-10-11 18:49:26 PDT
Comment on
attachment 323491
[details]
Patch
Attachment 323491
[details]
did not pass mac-ews (mac): Output:
http://webkit-queues.webkit.org/results/4830506
New failing tests: http/wpt/service-workers/fetchEvent.https.html http/wpt/service-workers/extendableEvent.https.html
Build Bot
Comment 6
2017-10-11 18:49:27 PDT
Created
attachment 323501
[details]
Archive of layout-test-results from ews102 for mac-elcapitan The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: ews102 Port: mac-elcapitan Platform: Mac OS X 10.11.6
Build Bot
Comment 7
2017-10-11 18:50:02 PDT
Comment on
attachment 323491
[details]
Patch
Attachment 323491
[details]
did not pass mac-debug-ews (mac): Output:
http://webkit-queues.webkit.org/results/4830402
New failing tests: http/wpt/service-workers/fetchEvent.https.html http/wpt/service-workers/extendableEvent.https.html
Build Bot
Comment 8
2017-10-11 18:50:03 PDT
Created
attachment 323502
[details]
Archive of layout-test-results from ews115 for mac-elcapitan The attached test failures were seen while running run-webkit-tests on the mac-debug-ews. Bot: ews115 Port: mac-elcapitan Platform: Mac OS X 10.11.6
youenn fablet
Comment 9
2017-10-12 08:29:00 PDT
Created
attachment 323526
[details]
Patch
Sam Weinig
Comment 10
2017-10-12 12:45:59 PDT
Comment on
attachment 323526
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=323526&action=review
> Source/WebCore/workers/service/ExtendableEvent.h:63 > + WTF::Function<void()> m_onFinishedWaiting; > + > +};
Extra newline.
> Source/WebCore/workers/service/ExtendableEvent.idl:2 > +//FIXME: Should be exposed on ServiceWorker only. > +[
This needs a license.
> Source/WebCore/workers/service/ExtendableEventInit.idl:2 > +dictionary ExtendableEventInit : EventInit { > +};
This needs a license.
> Source/WebCore/workers/service/FetchEvent.idl:1 > +//FIXME: Should be exposed on ServiceWorker only.
This needs a license.
> Source/WebCore/workers/service/FetchEventInit.idl:1 > +dictionary FetchEventInit : ExtendableEventInit {
This needs a license.
Sam Weinig
Comment 11
2017-10-12 12:49:21 PDT
Comment on
attachment 323526
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=323526&action=review
> Source/WebCore/WebCore.xcodeproj/project.pbxproj:3425 > + 7E4C96DC1AD4483500365A52 /* WebCore/JSFetchEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7E4C96D81AD4483500365A52 /* WebCore/JSFetchEvent.cpp */; }; > + 7E4C96DC1AD4483500365A53 /* WebCore/JSExtendableEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7E4C96D81AD4483500365A53 /* WebCore/JSExtendableEvent.cpp */; };
This looks wrong. I don't think there should be a WebCore/ there.
youenn fablet
Comment 12
2017-10-12 13:09:36 PDT
Created
attachment 323553
[details]
Patch
youenn fablet
Comment 13
2017-10-12 13:12:35 PDT
Thanks for the feedback. Fixed the license and newline issues. (In reply to Sam Weinig from
comment #11
)
> Comment on
attachment 323526
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=323526&action=review
> > > Source/WebCore/WebCore.xcodeproj/project.pbxproj:3425 > > + 7E4C96DC1AD4483500365A52 /* WebCore/JSFetchEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7E4C96D81AD4483500365A52 /* WebCore/JSFetchEvent.cpp */; }; > > + 7E4C96DC1AD4483500365A53 /* WebCore/JSExtendableEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7E4C96D81AD4483500365A53 /* WebCore/JSExtendableEvent.cpp */; }; > > This looks wrong. I don't think there should be a WebCore/ there.
Agreed. I did it this way since all JSServiceWorker* are done this way. Changing that for the JSEvent* would mean changing all of them. I can do that as a follow-up.
youenn fablet
Comment 14
2017-10-12 13:20:43 PDT
Created
attachment 323555
[details]
Patch
Chris Dumez
Comment 15
2017-10-16 12:20:59 PDT
Comment on
attachment 323555
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=323555&action=review
> Source/WebCore/bindings/js/JSDOMPromise.cpp:70 > +void DOMPromise::whenSettled(std::function<void()>&& callback)
Why isn't this using WTF::Function?
> Source/WebCore/testing/Internals.cpp:4201 > +void Internals::fetchEventFinishedWaiting(FetchEvent& event, DOMPromiseDeferred<IDLInterface<FetchResponse>>&& promise)
I do not like the naming. I think this should start with "set" prefix. Maybe setFetchEventResponseHandler?
> Source/WebCore/testing/Internals.cpp:4211 > +void Internals::extendableEventFinishedWaiting(ExtendableEvent& event, DOMPromiseDeferred<void>&& promise)
I do not like the naming. I think this should start with "set" prefix.
> Source/WebCore/testing/Internals.cpp:4218 > +Ref<ExtendableEvent> Internals::trustedExtendableEvent()
createTrustedExtendableEvent() ?
> Source/WebCore/workers/service/ExtendableEvent.cpp:38 > +ExceptionOr<void> ExtendableEvent::waitUntil(JSC::ExecState& execState, JSC::JSValue promise)
We call this "state" usually I believe, not execState.
> Source/WebCore/workers/service/ExtendableEvent.cpp:43 > + if (!m_pendingPromises.size() && dispatched())
m_pendingPromises.isEmpty() Any reason we cannot use Event::isBeingDispatched() ?
> Source/WebCore/workers/service/ExtendableEvent.cpp:67 > + if (m_pendingPromises.size())
!m_pendingPromises.isEmpty()
> Source/WebCore/workers/service/ExtendableEvent.h:49 > + WEBCORE_EXPORT void onFinishedWaiting(WTF::Function<void()>&&);
I think the name should indicate this is only used for testing purposes (e.g. ForTesting suffix).
> Source/WebCore/workers/service/ExtendableEvent.h:61 > + WTF::Function<void()> m_onFinishedWaiting;
Name should indicate this is only used for testing.
> Source/WebCore/workers/service/ExtendableEvent.idl:28 > + Constructor(DOMString type, optional EventInit eventInitDict),
I think we should have a ExtendableEventInit like in the spec, even if empty for now.
> Source/WebCore/workers/service/FetchEvent.cpp:37 > + , m_request(WTFMove(initializer.request))
initializer.request.releaseNonNull()
> Source/WebCore/workers/service/FetchEvent.cpp:46 > + if (dispatched())
isBeingDispatched() is the getter that indicates if an event is being dispatched.
> Source/WebCore/workers/service/FetchEvent.h:56 > + FetchRequest* request() { return m_request.get(); }
This should return a reference. m_request can never be null.
> Source/WebCore/workers/service/FetchEvent.h:70 > + RefPtr<FetchRequest> m_request;
Should use Ref<>
> Source/WebCore/workers/service/FetchEvent.h:78 > + RefPtr<DOMPromise> m_respondPromise { nullptr };
{ nullptr } is useless and should be omitted.
> Source/WebCore/workers/service/FetchEvent.idl:36 > + [SameObject] readonly attribute FetchRequest request;
I believe you need a: void JSFetchEvent::visitAdditionalChildren(SlotVisitor& visitor) { visitor.addOpaqueRoot(&wrapped().request()); } in JSFetchEventCustom.cpp, as [SameObject] is currently unsupported. This is needed so that the request wrapper stays alive at least as long as its FetchEvent. This is observable like so: fetchEvent.request.myTestExpando = 2; gc(); console.log(fetchEvent.request.myTestExpando); // Should be 2, not undefined. We should add a test for this.
> Source/WebCore/workers/service/FetchEvent.idl:45 > +dictionary FetchEventInit : EventInit {
Should inherit ExtendableEventInit.
youenn fablet
Comment 16
2017-10-16 14:19:29 PDT
Thanks, I'll upload a new patch fixing most issues.
> > Source/WebCore/bindings/js/JSDOMPromise.cpp:70 > > +void DOMPromise::whenSettled(std::function<void()>&& callback) > > Why isn't this using WTF::Function?
JSFunction does not take a WTF::Function right now. We should fix that and then use a WTF::Function here.
> > Source/WebCore/testing/Internals.cpp:4201 > > +void Internals::fetchEventFinishedWaiting(FetchEvent& event, DOMPromiseDeferred<IDLInterface<FetchResponse>>&& promise) > > I do not like the naming. I think this should start with "set" prefix. Maybe > setFetchEventResponseHandler?
Changed to whenFetch>..
> This is observable like so: > fetchEvent.request.myTestExpando = 2; > gc(); > console.log(fetchEvent.request.myTestExpando); // Should be 2, not undefined. > > We should add a test for this.
Will add the test
youenn fablet
Comment 17
2017-10-16 16:26:11 PDT
Created
attachment 323954
[details]
Patch
youenn fablet
Comment 18
2017-10-16 16:28:44 PDT
Created
attachment 323955
[details]
Patch
youenn fablet
Comment 19
2017-10-16 18:20:32 PDT
Created
attachment 323964
[details]
Patch
youenn fablet
Comment 20
2017-10-16 20:12:06 PDT
Created
attachment 323978
[details]
Patch
Chris Dumez
Comment 21
2017-10-17 09:28:31 PDT
Comment on
attachment 323978
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=323978&action=review
r=me with comments.
> Source/WebCore/bindings/js/JSDOMPromise.cpp:105 > + WTFCrash();
RELEASE_ASSERT_NOT_REACHED() or ASSERT_NOT_REACHED();
> Source/WebCore/testing/Internals.cpp:4201 > +void Internals::waitFetchEventToFinish(FetchEvent& event, DOMPromiseDeferred<IDLInterface<FetchResponse>>&& promise)
waitForFetchEventToFinish()
> Source/WebCore/testing/Internals.cpp:4211 > +void Internals::waitExtendableEventToFinish(ExtendableEvent& event, DOMPromiseDeferred<void>&& promise)
waitForExtendableEventToFinish()
> Source/WebCore/testing/Internals.cpp:4220 > + return ExtendableEvent::create("ExtendableEvent", { }, Event::IsTrusted::Yes);
ASCIILiteral("ExtendableEvent") ?
youenn fablet
Comment 22
2017-10-17 10:53:29 PDT
Created
attachment 324029
[details]
Patch for landing
WebKit Commit Bot
Comment 23
2017-10-17 11:39:56 PDT
Comment on
attachment 324029
[details]
Patch for landing Clearing flags on attachment: 324029 Committed
r223562
: <
https://trac.webkit.org/changeset/223562
>
WebKit Commit Bot
Comment 24
2017-10-17 11:39:58 PDT
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 25
2017-10-17 11:40:41 PDT
<
rdar://problem/35033934
>
youenn fablet
Comment 26
2017-10-17 14:00:18 PDT
Reopening to attach new patch.
youenn fablet
Comment 27
2017-10-17 14:00:19 PDT
Created
attachment 324054
[details]
build fix
WebKit Commit Bot
Comment 28
2017-10-17 14:19:42 PDT
Comment on
attachment 324054
[details]
build fix Clearing flags on attachment: 324054 Committed
r223577
: <
https://trac.webkit.org/changeset/223577
>
WebKit Commit Bot
Comment 29
2017-10-17 14:19:43 PDT
All reviewed patches have been landed. Closing bug.
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