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

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: Fp2 Created 4 years, 1 month 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 007130b587986e9900406f02e011767d1a3da4ab..7295970722fb013c062b429aaf3ddcf280c8acaa 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 WebVector<WebFeaturePolicy::ParsedWhitelist>& 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