Chromium Code Reviews| Index: third_party/WebKit/Source/core/loader/FrameLoader.cpp |
| diff --git a/third_party/WebKit/Source/core/loader/FrameLoader.cpp b/third_party/WebKit/Source/core/loader/FrameLoader.cpp |
| index f1c213b5bf03e0997d45847aee93c68852bd73ef..56cb0b276b978207efff87d6a963682a317aa2ef 100644 |
| --- a/third_party/WebKit/Source/core/loader/FrameLoader.cpp |
| +++ b/third_party/WebKit/Source/core/loader/FrameLoader.cpp |
| @@ -60,11 +60,9 @@ |
| #include "core/frame/csp/ContentSecurityPolicy.h" |
| #include "core/html/HTMLFormElement.h" |
| #include "core/html/HTMLFrameOwnerElement.h" |
| -#include "core/html/parser/HTMLParserIdioms.h" |
| #include "core/input/EventHandler.h" |
| #include "core/inspector/ConsoleMessage.h" |
| #include "core/inspector/InspectorInstrumentation.h" |
| -#include "core/inspector/InspectorTraceEvents.h" |
| #include "core/loader/DocumentLoadTiming.h" |
| #include "core/loader/DocumentLoader.h" |
| #include "core/loader/FormSubmission.h" |
| @@ -75,7 +73,6 @@ |
| #include "core/loader/NetworkHintsInterface.h" |
| #include "core/loader/ProgressTracker.h" |
| #include "core/loader/appcache/ApplicationCacheHost.h" |
| -#include "core/origin_trials/OriginTrialContext.h" |
| #include "core/page/ChromeClient.h" |
| #include "core/page/CreateWindow.h" |
| #include "core/page/FrameTree.h" |
| @@ -88,7 +85,6 @@ |
| #include "platform/PluginScriptForbiddenScope.h" |
| #include "platform/ScriptForbiddenScope.h" |
| #include "platform/UserGestureIndicator.h" |
| -#include "platform/feature_policy/FeaturePolicy.h" |
| #include "platform/instrumentation/tracing/TraceEvent.h" |
| #include "platform/loader/fetch/ResourceFetcher.h" |
| #include "platform/loader/fetch/ResourceRequest.h" |
| @@ -99,7 +95,6 @@ |
| #include "platform/weborigin/SecurityPolicy.h" |
| #include "platform/weborigin/Suborigin.h" |
| #include "public/platform/WebCachePolicy.h" |
| -#include "public/platform/WebFeaturePolicy.h" |
| #include "public/platform/WebURLRequest.h" |
| #include "public/platform/modules/serviceworker/WebServiceWorkerNetworkProvider.h" |
| #include "wtf/AutoReset.h" |
| @@ -475,9 +470,6 @@ static HistoryCommitType loadTypeToCommitType(FrameLoadType type) { |
| } |
| void FrameLoader::receivedFirstData() { |
| - if (m_stateMachine.creatingInitialEmptyDocument()) |
|
Nate Chapin
2017/03/17 23:33:18
This early-exit, and the second half of the functi
|
| - return; |
| - |
| FrameLoadType loadType = m_documentLoader->loadType(); |
| HistoryCommitType historyCommitType = loadTypeToCommitType(loadType); |
| if (historyCommitType == StandardCommit && |
| @@ -502,43 +494,9 @@ void FrameLoader::receivedFirstData() { |
| // Policies that have accumulated so far for the new navigation. |
| m_frame->securityContext()->contentSecurityPolicy()->reportAccumulatedHeaders( |
| client()); |
| - |
| - // didObserveLoadingBehavior() must be called after dispatchDidCommitLoad() is |
| - // called for the metrics tracking logic to handle it properly. |
| - if (m_documentLoader->getServiceWorkerNetworkProvider() && |
| - m_documentLoader->getServiceWorkerNetworkProvider() |
| - ->isControlledByServiceWorker()) { |
| - client()->didObserveLoadingBehavior( |
| - WebLoadingBehaviorServiceWorkerControlled); |
| - } |
| - |
| - // Links with media values need more information (like viewport information). |
| - // This happens after the first chunk is parsed in HTMLDocumentParser. |
| - m_documentLoader->dispatchLinkHeaderPreloads(nullptr, |
| - LinkLoader::OnlyLoadNonMedia); |
| - |
| - TRACE_EVENT1("devtools.timeline", "CommitLoad", "data", |
| - InspectorCommitLoadEvent::data(m_frame)); |
| - probe::didCommitLoad(m_frame, m_documentLoader.get()); |
| - m_frame->page()->didCommitLoad(m_frame); |
| - dispatchDidClearDocumentOfWindowObject(); |
| - |
| - takeObjectSnapshot(); |
|
Nate Chapin
2017/03/17 23:33:18
Removed. I don't think this snapshot is adding a l
|
| } |
| -void FrameLoader::didInstallNewDocument(bool dispatchWindowObjectAvailable) { |
| - DCHECK(m_frame); |
| - DCHECK(m_frame->document()); |
| - |
| - m_frame->document()->setReadyState(Document::Loading); |
|
Nate Chapin
2017/03/17 23:33:18
All this stuff moved to DocumentLoader::didInstall
|
| - |
| - if (dispatchWindowObjectAvailable) |
| - dispatchDidClearDocumentOfWindowObject(); |
| - |
| - m_frame->document()->initContentSecurityPolicy( |
| - m_documentLoader ? m_documentLoader->releaseContentSecurityPolicy() |
| - : ContentSecurityPolicy::create()); |
| - |
| +void FrameLoader::didInstallNewDocument() { |
| if (m_provisionalItem && |
|
Nate Chapin
2017/03/17 23:33:18
Like the remainder of receivedFirstData(), I want
|
| isBackForwardLoadType(m_documentLoader->loadType())) { |
| m_frame->document()->setStateForNewFormElements( |
| @@ -546,101 +504,6 @@ void FrameLoader::didInstallNewDocument(bool dispatchWindowObjectAvailable) { |
| } |
| } |
| -void FrameLoader::didBeginDocument() { |
|
Nate Chapin
2017/03/17 23:33:18
Most of this moved to DocumentLoader::didInstallNe
|
| - DCHECK(m_frame); |
| - DCHECK(m_frame->client()); |
| - DCHECK(m_frame->document()); |
| - DCHECK(m_frame->document()->fetcher()); |
| - |
| - if (m_documentLoader) { |
| - String suboriginHeader = |
| - m_documentLoader->response().httpHeaderField(HTTPNames::Suborigin); |
| - if (!suboriginHeader.isNull()) { |
| - Vector<String> messages; |
| - Suborigin suborigin; |
| - if (parseSuboriginHeader(suboriginHeader, &suborigin, messages)) |
| - m_frame->document()->enforceSuborigin(suborigin); |
| - |
| - for (auto& message : messages) { |
| - m_frame->document()->addConsoleMessage( |
| - ConsoleMessage::create(SecurityMessageSource, ErrorMessageLevel, |
| - "Error with Suborigin header: " + message)); |
| - } |
| - } |
| - m_frame->document()->clientHintsPreferences().updateFrom( |
| - m_documentLoader->clientHintsPreferences()); |
| - } |
| - |
| - Settings* settings = m_frame->document()->settings(); |
| - if (settings) { |
| - m_frame->document()->fetcher()->setImagesEnabled( |
| - settings->getImagesEnabled()); |
| - m_frame->document()->fetcher()->setAutoLoadImages( |
| - settings->getLoadsImagesAutomatically()); |
| - } |
| - |
| - if (m_documentLoader) { |
| - const AtomicString& dnsPrefetchControl = |
| - m_documentLoader->response().httpHeaderField( |
| - HTTPNames::X_DNS_Prefetch_Control); |
| - if (!dnsPrefetchControl.isEmpty()) |
| - m_frame->document()->parseDNSPrefetchControlHeader(dnsPrefetchControl); |
| - |
| - String headerContentLanguage = m_documentLoader->response().httpHeaderField( |
| - HTTPNames::Content_Language); |
| - if (!headerContentLanguage.isEmpty()) { |
| - size_t commaIndex = headerContentLanguage.find(','); |
| - headerContentLanguage.truncate( |
| - commaIndex); // kNotFound == -1 == don't truncate |
| - headerContentLanguage = |
| - headerContentLanguage.stripWhiteSpace(isHTMLSpace<UChar>); |
| - if (!headerContentLanguage.isEmpty()) { |
| - m_frame->document()->setContentLanguage( |
| - AtomicString(headerContentLanguage)); |
| - } |
| - } |
| - |
| - OriginTrialContext::addTokensFromHeader( |
| - m_frame->document(), |
| - m_documentLoader->response().httpHeaderField(HTTPNames::Origin_Trial)); |
| - if (RuntimeEnabledFeatures::featurePolicyEnabled()) { |
| - WebFeaturePolicy* parentFeaturePolicy = |
| - (isLoadingMainFrame() ? nullptr |
| - : m_frame->client() |
| - ->parent() |
| - ->securityContext() |
| - ->getFeaturePolicy()); |
| - const String& featurePolicyHeader = |
| - m_documentLoader->response().httpHeaderField( |
| - HTTPNames::Feature_Policy); |
| - Vector<String> messages; |
| - const WebParsedFeaturePolicy& parsedHeader = parseFeaturePolicy( |
| - featurePolicyHeader, m_frame->securityContext()->getSecurityOrigin(), |
| - &messages); |
| - m_frame->securityContext()->initializeFeaturePolicy(parsedHeader, |
| - parentFeaturePolicy); |
| - for (auto& message : messages) { |
| - m_frame->document()->addConsoleMessage(ConsoleMessage::create( |
| - OtherMessageSource, ErrorMessageLevel, |
| - "Error with Feature-Policy header: " + message)); |
| - } |
| - if (!parsedHeader.isEmpty()) |
| - client()->didSetFeaturePolicyHeader(parsedHeader); |
| - } |
| - } |
| - |
| - if (m_documentLoader) { |
| - String referrerPolicyHeader = m_documentLoader->response().httpHeaderField( |
| - HTTPNames::Referrer_Policy); |
| - if (!referrerPolicyHeader.isNull()) { |
| - UseCounter::count(*m_frame->document(), UseCounter::ReferrerPolicyHeader); |
| - m_frame->document()->parseAndSetReferrerPolicy(referrerPolicyHeader); |
| - } |
| - } |
| - |
| - client()->didCreateNewDocument(); |
| -} |
| - |
| void FrameLoader::finishedParsing() { |
| if (m_stateMachine.creatingInitialEmptyDocument()) |
| return; |
| @@ -1840,6 +1703,8 @@ void FrameLoader::runScriptsAtDocumentElementAvailable() { |
| void FrameLoader::dispatchDidClearDocumentOfWindowObject() { |
| DCHECK(m_frame->document()); |
| + if (m_stateMachine.creatingInitialEmptyDocument()) |
| + return; |
| if (!m_frame->document()->canExecuteScripts(NotAboutToExecuteScript)) |
| return; |