Changeset 256460 in webkit


Ignore:
Timestamp:
Feb 12, 2020 11:13:35 AM (4 years ago)
Author:
youenn@apple.com
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):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r256458 r256460  
     12020-02-12  Youenn Fablet  <youenn@apple.com>
     2
     3        Refactor DocumentLoader::commitData to use a Document& internally
     4        https://bugs.webkit.org/show_bug.cgi?id=207579
     5
     6        Reviewed by Chris Dumez.
     7
     8        Once we write some bytes, the frame has a Document.
     9        Put it in a local variable to improve readability of the code.
     10        No change of behavior.
     11
     12        * loader/DocumentLoader.cpp:
     13        (WebCore::DocumentLoader::commitData):
     14
    1152020-02-12  Zalan Bujtas  <zalan@apple.com>
    216
  • trunk/Source/WebCore/loader/DocumentLoader.cpp

    r256381 r256460  
    10721072        m_writer.setDocumentWasLoadedAsPartOfNavigation();
    10731073
     1074        auto& document = *m_frame->document();
     1075
    10741076        if (SecurityPolicy::allowSubstituteDataAccessToLocal() && m_originalSubstituteDataWasValid) {
    10751077            // If this document was loaded with substituteData, then the document can
     
    10771079            // and https://bugs.webkit.org/show_bug.cgi?id=19760 for further
    10781080            // discussion.
    1079             m_frame->document()->securityOrigin().grantLoadLocalResources();
     1081            document.securityOrigin().grantLoadLocalResources();
    10801082        }
    10811083
     
    10851087#if ENABLE(WEB_ARCHIVE) || ENABLE(MHTML)
    10861088        if (m_archive && m_archive->shouldOverrideBaseURL())
    1087             m_frame->document()->setBaseURLOverride(m_archive->mainResource()->url());
     1089            document.setBaseURLOverride(m_archive->mainResource()->url());
    10881090#endif
    10891091#if ENABLE(SERVICE_WORKER)
    10901092        if (RuntimeEnabledFeatures::sharedFeatures().serviceWorkerEnabled()) {
    10911093            if (m_serviceWorkerRegistrationData && m_serviceWorkerRegistrationData->activeWorker) {
    1092                 m_frame->document()->setActiveServiceWorker(ServiceWorker::getOrCreate(*m_frame->document(), WTFMove(m_serviceWorkerRegistrationData->activeWorker.value())));
     1094                document.setActiveServiceWorker(ServiceWorker::getOrCreate(document, WTFMove(m_serviceWorkerRegistrationData->activeWorker.value())));
    10931095                m_serviceWorkerRegistrationData = { };
    1094             } else if (auto* parent = m_frame->document()->parentDocument()) {
    1095                 if (shouldUseActiveServiceWorkerFromParent(*m_frame->document(), *parent))
    1096                     m_frame->document()->setActiveServiceWorker(parent->activeServiceWorker());
     1096            } else if (auto* parent = document.parentDocument()) {
     1097                if (shouldUseActiveServiceWorkerFromParent(document, *parent))
     1098                    document.setActiveServiceWorker(parent->activeServiceWorker());
    10971099            }
    10981100
    1099             if (m_frame->document()->activeServiceWorker() || LegacySchemeRegistry::canServiceWorkersHandleURLScheme(m_frame->document()->url().protocol().toStringWithoutCopying()))
    1100                 m_frame->document()->setServiceWorkerConnection(&ServiceWorkerProvider::singleton().serviceWorkerConnection());
     1101            if (m_frame->document()->activeServiceWorker() || LegacySchemeRegistry::canServiceWorkersHandleURLScheme(document.url().protocol().toStringWithoutCopying()))
     1102                document.setServiceWorkerConnection(&ServiceWorkerProvider::singleton().serviceWorkerConnection());
    11011103
    11021104            // We currently unregister the temporary service worker client since we now registered the real document.
     
    11141116            return;
    11151117
    1116         if (auto* window = m_frame->document()->domWindow())
     1118        if (auto* window = document.domWindow())
    11171119            window->prewarmLocalStorageIfNecessary();
    11181120
Note: See TracChangeset for help on using the changeset viewer.