Title: [226185] trunk/Source/WebCore
Revision
226185
Author
[email protected]
Date
2017-12-20 09:22:36 -0800 (Wed, 20 Dec 2017)

Log Message

Do not search for service worker registration in case of non HTTP navigation loads
https://bugs.webkit.org/show_bug.cgi?id=180976

Patch by Youenn Fablet <[email protected]> on 2017-12-20
Reviewed by Chris Dumez.

Covered by manual testing using perf test app uploaded in https://bugs.webkit.org/show_bug.cgi?id=180929.
In case we are sure there is no possiblity for getting a service worker, skip the search step.
Simialrly, do not report any Document as a Service Worker client if it can never be controlled.
A follow-up patch should handle the case of local URLs service worker selection.

* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::startLoadingMainResource):
(WebCore::DocumentLoader::commitData):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (226184 => 226185)


--- trunk/Source/WebCore/ChangeLog	2017-12-20 17:19:39 UTC (rev 226184)
+++ trunk/Source/WebCore/ChangeLog	2017-12-20 17:22:36 UTC (rev 226185)
@@ -1,3 +1,19 @@
+2017-12-20  Youenn Fablet  <[email protected]>
+
+        Do not search for service worker registration in case of non HTTP navigation loads
+        https://bugs.webkit.org/show_bug.cgi?id=180976
+
+        Reviewed by Chris Dumez.
+
+        Covered by manual testing using perf test app uploaded in https://bugs.webkit.org/show_bug.cgi?id=180929.
+        In case we are sure there is no possiblity for getting a service worker, skip the search step.
+        Simialrly, do not report any Document as a Service Worker client if it can never be controlled.
+        A follow-up patch should handle the case of local URLs service worker selection.
+
+        * loader/DocumentLoader.cpp:
+        (WebCore::DocumentLoader::startLoadingMainResource):
+        (WebCore::DocumentLoader::commitData):
+
 2017-12-20  Andy Estes  <[email protected]>
 
         [Apple Pay] Tell PassKit whether Apple Pay JS or Payment Request was used to start an Apple Pay session

Modified: trunk/Source/WebCore/loader/DocumentLoader.cpp (226184 => 226185)


--- trunk/Source/WebCore/loader/DocumentLoader.cpp	2017-12-20 17:19:39 UTC (rev 226184)
+++ trunk/Source/WebCore/loader/DocumentLoader.cpp	2017-12-20 17:22:36 UTC (rev 226185)
@@ -890,7 +890,8 @@
                 m_frame->document()->setActiveServiceWorker(ServiceWorker::getOrCreate(*m_frame->document(), WTFMove(m_serviceWorkerRegistrationData->activeWorker.value())));
                 m_serviceWorkerRegistrationData = { };
             }
-            m_frame->document()->setServiceWorkerConnection(&ServiceWorkerProvider::singleton().serviceWorkerConnectionForSession(m_frame->page()->sessionID()));
+            if (SchemeRegistry::canServiceWorkersHandleURLScheme(m_frame->document()->url().protocol().toStringWithoutCopying()))
+                m_frame->document()->setServiceWorkerConnection(&ServiceWorkerProvider::singleton().serviceWorkerConnectionForSession(m_frame->page()->sessionID()));
         }
 #endif
         // Call receivedFirstData() exactly once per load. We should only reach this point multiple times
@@ -1568,7 +1569,8 @@
         RELEASE_LOG_IF_ALLOWED("startLoadingMainResource: Starting load (frame = %p, main = %d)", m_frame, m_frame->isMainFrame());
 
 #if ENABLE(SERVICE_WORKER)
-        auto tryLoadingThroughServiceWorker = !frameLoader()->isReloadingFromOrigin() && m_frame->page() && RuntimeEnabledFeatures::sharedFeatures().serviceWorkerEnabled();
+        // FIXME: Implement local URL interception by getting the service worker of the parent.
+        auto tryLoadingThroughServiceWorker = !frameLoader()->isReloadingFromOrigin() && m_frame->page() && RuntimeEnabledFeatures::sharedFeatures().serviceWorkerEnabled()            && SchemeRegistry::canServiceWorkersHandleURLScheme(request.url().protocol().toStringWithoutCopying());
         if (tryLoadingThroughServiceWorker) {
             auto origin = (!m_frame->isMainFrame() && m_frame->document()) ? makeRef(m_frame->document()->topOrigin()) : SecurityOrigin::create(request.url());
             auto& connection = ServiceWorkerProvider::singleton().serviceWorkerConnectionForSession(m_frame->page()->sessionID());
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to