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

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

Issue 2520223002: Replicate a parsed feature policy representation so it doesn't need to be parsed in the browser pro… (Closed)
Patch Set: Replicate a parsed feature policy representation so it doesn't need to be parsed in the browser pro… Created 4 years 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
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 59426dd8146ebbc2ff770d250539ebfa8f54c7a1..c0c540c076e962a5c74a2f5b7e81207ba25bcefd 100644
--- a/third_party/WebKit/Source/core/loader/FrameLoader.cpp
+++ b/third_party/WebKit/Source/core/loader/FrameLoader.cpp
@@ -97,6 +97,7 @@
#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 "wtf/AutoReset.h"
#include "wtf/text/CString.h"
@@ -588,15 +589,19 @@ void FrameLoader::didBeginDocument() {
m_documentLoader->response().httpHeaderField(
HTTPNames::Feature_Policy);
Vector<String> messages;
+ const WebParsedFeaturePolicy& parsedHeader =
+ FeaturePolicy::parseFeaturePolicy(
+ featurePolicyHeader,
+ m_frame->securityContext()->getSecurityOrigin(), &messages);
m_frame->securityContext()->setFeaturePolicyFromHeader(
- featurePolicyHeader, parentFeaturePolicy, &messages);
+ parsedHeader, parentFeaturePolicy);
for (auto& message : messages) {
m_frame->document()->addConsoleMessage(ConsoleMessage::create(
OtherMessageSource, ErrorMessageLevel,
"Error with Feature-Policy header: " + message));
}
- if (!featurePolicyHeader.isEmpty())
- client()->didSetFeaturePolicyHeader(featurePolicyHeader);
+ if (!parsedHeader.isEmpty())
+ client()->didSetFeaturePolicyHeader(parsedHeader);
}
}

Powered by Google App Engine
This is Rietveld 408576698