Title: [223944] trunk/Source
Revision
223944
Author
commit-qu...@webkit.org
Date
2017-10-24 17:47:27 -0700 (Tue, 24 Oct 2017)

Log Message

ServiceWorkerClientFetch should return an error that is not null in case of failure
https://bugs.webkit.org/show_bug.cgi?id=178761

Patch by Youenn Fablet <you...@apple.com> on 2017-10-24
Reviewed by Geoffrey Garen.

Source/WebCore:

Covered by existing tests.

As per spec, ServiceWorkerJob should not go through Service Worker Handle Fetch
for fetching scripts.

* workers/WorkerScriptLoader.cpp:
(WebCore::WorkerScriptLoader::loadAsynchronously):
* workers/WorkerScriptLoaderClient.h:
(WebCore::WorkerScriptLoaderClient::isServiceWorkerClient const):
* workers/service/ServiceWorkerJob.h:

Source/WebKit:

* WebProcess/Storage/ServiceWorkerClientFetch.cpp:
(WebKit::ServiceWorkerClientFetch::didFail): Generating a General error.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (223943 => 223944)


--- trunk/Source/WebCore/ChangeLog	2017-10-25 00:36:58 UTC (rev 223943)
+++ trunk/Source/WebCore/ChangeLog	2017-10-25 00:47:27 UTC (rev 223944)
@@ -1,3 +1,21 @@
+2017-10-24  Youenn Fablet  <you...@apple.com>
+
+        ServiceWorkerClientFetch should return an error that is not null in case of failure
+        https://bugs.webkit.org/show_bug.cgi?id=178761
+
+        Reviewed by Geoffrey Garen.
+
+        Covered by existing tests.
+
+        As per spec, ServiceWorkerJob should not go through Service Worker Handle Fetch
+        for fetching scripts.
+
+        * workers/WorkerScriptLoader.cpp:
+        (WebCore::WorkerScriptLoader::loadAsynchronously):
+        * workers/WorkerScriptLoaderClient.h:
+        (WebCore::WorkerScriptLoaderClient::isServiceWorkerClient const):
+        * workers/service/ServiceWorkerJob.h:
+
 2017-10-24  Keith Miller  <keith_mil...@apple.com>
 
         Move inspector and loader to unified sources.

Modified: trunk/Source/WebCore/workers/WorkerScriptLoader.cpp (223943 => 223944)


--- trunk/Source/WebCore/workers/WorkerScriptLoader.cpp	2017-10-25 00:36:58 UTC (rev 223943)
+++ trunk/Source/WebCore/workers/WorkerScriptLoader.cpp	2017-10-25 00:47:27 UTC (rev 223944)
@@ -87,7 +87,10 @@
     options.mode = mode;
     options.sendLoadCallbacks = SendCallbacks;
     options.contentSecurityPolicyEnforcement = contentSecurityPolicyEnforcement;
-
+#if ENABLE(SERVICE_WORKER)
+    options.serviceWorkersMode = m_client->isServiceWorkerClient() ? ServiceWorkersMode::None : ServiceWorkersMode::All;
+    options.serviceWorkerIdentifier = scriptExecutionContext->selectedServiceWorkerIdentifier();
+#endif
     // During create, callbacks may happen which remove the last reference to this object.
     Ref<WorkerScriptLoader> protectedThis(*this);
     m_threadableLoader = ThreadableLoader::create(*scriptExecutionContext, *this, WTFMove(*request), options);

Modified: trunk/Source/WebCore/workers/WorkerScriptLoaderClient.h (223943 => 223944)


--- trunk/Source/WebCore/workers/WorkerScriptLoaderClient.h	2017-10-25 00:36:58 UTC (rev 223943)
+++ trunk/Source/WebCore/workers/WorkerScriptLoaderClient.h	2017-10-25 00:47:27 UTC (rev 223944)
@@ -34,6 +34,7 @@
 public:
     virtual void didReceiveResponse(unsigned long identifier, const ResourceResponse&) = 0;
     virtual void notifyFinished() = 0;
+    virtual bool isServiceWorkerClient() const { return false; }
 
 protected:
     virtual ~WorkerScriptLoaderClient() = default;

Modified: trunk/Source/WebCore/workers/service/ServiceWorkerJob.h (223943 => 223944)


--- trunk/Source/WebCore/workers/service/ServiceWorkerJob.h	2017-10-25 00:36:58 UTC (rev 223943)
+++ trunk/Source/WebCore/workers/service/ServiceWorkerJob.h	2017-10-25 00:47:27 UTC (rev 223944)
@@ -69,7 +69,9 @@
     // WorkerScriptLoaderClient
     void didReceiveResponse(unsigned long identifier, const ResourceResponse&) final;
     void notifyFinished() final;
+    bool isServiceWorkerClient() const final { return true; }
 
+
     Ref<ServiceWorkerJobClient> m_client;
     ServiceWorkerJobData m_jobData;
     Ref<DeferredPromise> m_promise;

Modified: trunk/Source/WebKit/ChangeLog (223943 => 223944)


--- trunk/Source/WebKit/ChangeLog	2017-10-25 00:36:58 UTC (rev 223943)
+++ trunk/Source/WebKit/ChangeLog	2017-10-25 00:47:27 UTC (rev 223944)
@@ -1,5 +1,15 @@
 2017-10-24  Youenn Fablet  <you...@apple.com>
 
+        ServiceWorkerClientFetch should return an error that is not null in case of failure
+        https://bugs.webkit.org/show_bug.cgi?id=178761
+
+        Reviewed by Geoffrey Garen.
+
+        * WebProcess/Storage/ServiceWorkerClientFetch.cpp:
+        (WebKit::ServiceWorkerClientFetch::didFail): Generating a General error.
+
+2017-10-24  Youenn Fablet  <you...@apple.com>
+
         Enable service worker to use cache storage api
         https://bugs.webkit.org/show_bug.cgi?id=178684
 

Modified: trunk/Source/WebKit/WebProcess/Storage/ServiceWorkerClientFetch.cpp (223943 => 223944)


--- trunk/Source/WebKit/WebProcess/Storage/ServiceWorkerClientFetch.cpp	2017-10-25 00:36:58 UTC (rev 223943)
+++ trunk/Source/WebKit/WebProcess/Storage/ServiceWorkerClientFetch.cpp	2017-10-25 00:47:27 UTC (rev 223944)
@@ -89,7 +89,7 @@
 void ServiceWorkerClientFetch::didFail()
 {
     auto protectedThis = makeRef(*this);
-    m_loader->didFail({ });
+    m_loader->didFail({ ResourceError::Type::General });
 
     if (auto callback = WTFMove(m_callback))
         callback(Result::Succeeded);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to