Title: [256460] trunk/Source/WebCore
Revision
256460
Author
[email protected]
Date
2020-02-12 11:13:35 -0800 (Wed, 12 Feb 2020)

Log Message

Refactor DocumentLoader::commitData to use a Document& internally
https://bugs.webkit.org/show_bug.cgi?id=207579

Reviewed by Chris Dumez.

Once we write some bytes, the frame has a Document.
Put it in a local variable to improve readability of the code.
No change of behavior.

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

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (256459 => 256460)


--- trunk/Source/WebCore/ChangeLog	2020-02-12 19:09:54 UTC (rev 256459)
+++ trunk/Source/WebCore/ChangeLog	2020-02-12 19:13:35 UTC (rev 256460)
@@ -1,3 +1,17 @@
+2020-02-12  Youenn Fablet  <[email protected]>
+
+        Refactor DocumentLoader::commitData to use a Document& internally
+        https://bugs.webkit.org/show_bug.cgi?id=207579
+
+        Reviewed by Chris Dumez.
+
+        Once we write some bytes, the frame has a Document.
+        Put it in a local variable to improve readability of the code.
+        No change of behavior.
+
+        * loader/DocumentLoader.cpp:
+        (WebCore::DocumentLoader::commitData):
+
 2020-02-12  Zalan Bujtas  <[email protected]>
 
         [LFC][IFC] Display::Run should not have any geometry mutation functions.

Modified: trunk/Source/WebCore/loader/DocumentLoader.cpp (256459 => 256460)


--- trunk/Source/WebCore/loader/DocumentLoader.cpp	2020-02-12 19:09:54 UTC (rev 256459)
+++ trunk/Source/WebCore/loader/DocumentLoader.cpp	2020-02-12 19:13:35 UTC (rev 256460)
@@ -1071,12 +1071,14 @@
         bool hasBegun = m_writer.begin(documentURL(), false);
         m_writer.setDocumentWasLoadedAsPartOfNavigation();
 
+        auto& document = *m_frame->document();
+
         if (SecurityPolicy::allowSubstituteDataAccessToLocal() && m_originalSubstituteDataWasValid) {
             // If this document was loaded with substituteData, then the document can
             // load local resources. See https://bugs.webkit.org/show_bug.cgi?id=16756
             // and https://bugs.webkit.org/show_bug.cgi?id=19760 for further
             // discussion.
-            m_frame->document()->securityOrigin().grantLoadLocalResources();
+            document.securityOrigin().grantLoadLocalResources();
         }
 
         if (frameLoader()->stateMachine().creatingInitialEmptyDocument())
@@ -1084,20 +1086,20 @@
 
 #if ENABLE(WEB_ARCHIVE) || ENABLE(MHTML)
         if (m_archive && m_archive->shouldOverrideBaseURL())
-            m_frame->document()->setBaseURLOverride(m_archive->mainResource()->url());
+            document.setBaseURLOverride(m_archive->mainResource()->url());
 #endif
 #if ENABLE(SERVICE_WORKER)
         if (RuntimeEnabledFeatures::sharedFeatures().serviceWorkerEnabled()) {
             if (m_serviceWorkerRegistrationData && m_serviceWorkerRegistrationData->activeWorker) {
-                m_frame->document()->setActiveServiceWorker(ServiceWorker::getOrCreate(*m_frame->document(), WTFMove(m_serviceWorkerRegistrationData->activeWorker.value())));
+                document.setActiveServiceWorker(ServiceWorker::getOrCreate(document, WTFMove(m_serviceWorkerRegistrationData->activeWorker.value())));
                 m_serviceWorkerRegistrationData = { };
-            } else if (auto* parent = m_frame->document()->parentDocument()) {
-                if (shouldUseActiveServiceWorkerFromParent(*m_frame->document(), *parent))
-                    m_frame->document()->setActiveServiceWorker(parent->activeServiceWorker());
+            } else if (auto* parent = document.parentDocument()) {
+                if (shouldUseActiveServiceWorkerFromParent(document, *parent))
+                    document.setActiveServiceWorker(parent->activeServiceWorker());
             }
 
-            if (m_frame->document()->activeServiceWorker() || LegacySchemeRegistry::canServiceWorkersHandleURLScheme(m_frame->document()->url().protocol().toStringWithoutCopying()))
-                m_frame->document()->setServiceWorkerConnection(&ServiceWorkerProvider::singleton().serviceWorkerConnection());
+            if (m_frame->document()->activeServiceWorker() || LegacySchemeRegistry::canServiceWorkersHandleURLScheme(document.url().protocol().toStringWithoutCopying()))
+                document.setServiceWorkerConnection(&ServiceWorkerProvider::singleton().serviceWorkerConnection());
 
             // We currently unregister the temporary service worker client since we now registered the real document.
             // FIXME: We should make the real document use the temporary client identifier.
@@ -1113,7 +1115,7 @@
         if (!isLoading())
             return;
 
-        if (auto* window = m_frame->document()->domWindow())
+        if (auto* window = document.domWindow())
             window->prewarmLocalStorageIfNecessary();
 
         bool userChosen;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to