Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(595)

Unified Diff: third_party/WebKit/Source/core/loader/DocumentLoader.cpp

Issue 2905113002: Initialize a default feature policy for all documents (Closed)
Patch Set: Nits Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/dom/SecurityContext.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/loader/DocumentLoader.cpp
diff --git a/third_party/WebKit/Source/core/loader/DocumentLoader.cpp b/third_party/WebKit/Source/core/loader/DocumentLoader.cpp
index e2748316bd289881730b735b71928f1f6c78c310..2ffab139274ac931b62e85c87cbc97a8967dcb3b 100644
--- a/third_party/WebKit/Source/core/loader/DocumentLoader.cpp
+++ b/third_party/WebKit/Source/core/loader/DocumentLoader.cpp
@@ -995,41 +995,6 @@ void DocumentLoader::DidCommitNavigation() {
frame_->GetPage()->DidCommitLoad(frame_);
}
-void SetFeaturePolicy(Document* document, const String& feature_policy_header) {
- if (!RuntimeEnabledFeatures::featurePolicyEnabled())
- return;
- LocalFrame* frame = document->GetFrame();
- WebFeaturePolicy* parent_feature_policy =
- frame->IsMainFrame()
- ? nullptr
- : frame->Tree().Parent()->GetSecurityContext()->GetFeaturePolicy();
- Vector<String> messages;
- const WebParsedFeaturePolicy& parsed_header = ParseFeaturePolicy(
- feature_policy_header, frame->GetSecurityContext()->GetSecurityOrigin(),
- &messages);
- WebParsedFeaturePolicy container_policy;
- if (frame->Owner())
- container_policy = frame->Owner()->ContainerPolicy();
- // Check that if there is a parent frame, that its feature policy is
- // correctly initialized. Crash if that is not the case. (Temporary crash for
- // isolating the cause of https://crbug.com/722333)
- // Note that even with this check removed, the process will stil crash in
- // feature_policy.cc when it attempts to dereference parent_feature_policy.
- // This check is to distinguish between two possible causes.
- if (!container_policy.empty())
- CHECK(frame->IsMainFrame() || parent_feature_policy);
- frame->GetSecurityContext()->InitializeFeaturePolicy(
- parsed_header, container_policy, parent_feature_policy);
-
- for (auto& message : messages) {
- document->AddConsoleMessage(
- ConsoleMessage::Create(kOtherMessageSource, kErrorMessageLevel,
- "Error with Feature-Policy header: " + message));
- }
- if (!parsed_header.empty())
- frame->Client()->DidSetFeaturePolicyHeader(parsed_header);
-}
-
// static
bool DocumentLoader::ShouldClearWindowName(
const LocalFrame& frame,
@@ -1096,8 +1061,8 @@ void DocumentLoader::InstallNewDocument(
// FeaturePolicy is reset in the browser process on commit, so this needs to
// be initialized and replicated to the browser process after commit messages
// are sent in didCommitNavigation().
- SetFeaturePolicy(document,
- response_.HttpHeaderField(HTTPNames::Feature_Policy));
+ document->SetFeaturePolicy(
+ response_.HttpHeaderField(HTTPNames::Feature_Policy));
GetFrameLoader().DispatchDidClearDocumentOfWindowObject();
}
« no previous file with comments | « third_party/WebKit/Source/core/dom/SecurityContext.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698