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 31fc6ea8cb15a5647a48fb5028b512b8c708d52b..e2003b6379bb26d4e6330d331aa7999506afe7bc 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()) |
- 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(); |
} |
-void FrameLoader::didInstallNewDocument(bool dispatchWindowObjectAvailable) { |
- DCHECK(m_frame); |
- DCHECK(m_frame->document()); |
- |
- m_frame->document()->setReadyState(Document::Loading); |
- |
- if (dispatchWindowObjectAvailable) |
- dispatchDidClearDocumentOfWindowObject(); |
- |
- m_frame->document()->initContentSecurityPolicy( |
- m_documentLoader ? m_documentLoader->releaseContentSecurityPolicy() |
- : ContentSecurityPolicy::create()); |
- |
+void FrameLoader::didInstallNewDocument() { |
if (m_provisionalItem && |
isBackForwardLoadType(m_documentLoader->loadType())) { |
m_frame->document()->setStateForNewFormElements( |
@@ -546,107 +504,6 @@ void FrameLoader::didInstallNewDocument(bool dispatchWindowObjectAvailable) { |
} |
} |
-void FrameLoader::didBeginDocument() { |
- 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); |
- WebParsedFeaturePolicy containerPolicy; |
- if (m_frame->owner()) { |
- containerPolicy = getContainerPolicyFromAllowedFeatures( |
- m_frame->owner()->allowedFeatures(), |
- m_frame->securityContext()->getSecurityOrigin()); |
- } |
- m_frame->securityContext()->initializeFeaturePolicy( |
- parsedHeader, containerPolicy, 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; |
@@ -1878,6 +1735,8 @@ void FrameLoader::runScriptsAtDocumentElementAvailable() { |
void FrameLoader::dispatchDidClearDocumentOfWindowObject() { |
DCHECK(m_frame->document()); |
+ if (m_stateMachine.creatingInitialEmptyDocument()) |
+ return; |
if (!m_frame->document()->canExecuteScripts(NotAboutToExecuteScript)) |
return; |