Bug 205225

Summary: WebSWServerConnection::startFetch() should never fail synchronously
Product: WebKit Reporter: Chris Dumez <cdumez>
Component: Service WorkersAssignee: Chris Dumez <cdumez>
Severity: Normal CC: beidson, commit-queue, ggaren, webkit-bug-importer, youennf
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=205261
Description Flags
Patch none

Description Chris Dumez 2019-12-13 16:10:34 PST
WebSWServerConnection::startFetch() should never fail synchronously. If it does, it will confuse the NetworkResourceLoader. NetworkResourceLoader::serviceWorkerDidNotHandle() will get called *before* NetworkResourceLoader::m_serviceWorkerFetchTask has been sent, which means that we would not properly deal with redirects. Worse, the call site which creates the ServiceWorkerFetchTask would then null out m_networkLoad, which would silently cancel the load that WebSWServerConnection::startFetch() started synchronously.
Comment 1 Chris Dumez 2019-12-13 16:10:47 PST
Comment 2 Chris Dumez 2019-12-13 16:21:25 PST
Created attachment 385654 [details]
Comment 3 Geoffrey Garen 2019-12-14 11:59:10 PST
Comment 4 WebKit Commit Bot 2019-12-14 13:49:18 PST
Comment on attachment 385654 [details]

Clearing flags on attachment: 385654

Committed r253528: <https://trac.webkit.org/changeset/253528>
Comment 5 WebKit Commit Bot 2019-12-14 13:49:19 PST
All reviewed patches have been landed.  Closing bug.
Comment 6 youenn fablet 2019-12-16 02:26:59 PST
http/wpt/service-workers/postMessage-fetch-order.https.html fails consistently.
The spec does not mandate the order between fetch and postMessage since these are different sources so we could update the test accordingly.

An alternative would be to only delay the didNotHandle case, which would remove an unnecessary dispatch in the usual case.