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

Side by Side 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights
3 * reserved. 3 * reserved.
4 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 4 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
5 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. 5 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved.
6 * (http://www.torchmobile.com/) 6 * (http://www.torchmobile.com/)
7 * Copyright (C) 2008 Alp Toker <alp@atoker.com> 7 * Copyright (C) 2008 Alp Toker <alp@atoker.com>
8 * Copyright (C) Research In Motion Limited 2009. All rights reserved. 8 * Copyright (C) Research In Motion Limited 2009. All rights reserved.
9 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com> 9 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com>
10 * Copyright (C) 2011 Google Inc. All rights reserved. 10 * Copyright (C) 2011 Google Inc. All rights reserved.
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 #include "platform/UserGestureIndicator.h" 90 #include "platform/UserGestureIndicator.h"
91 #include "platform/feature_policy/FeaturePolicy.h" 91 #include "platform/feature_policy/FeaturePolicy.h"
92 #include "platform/network/HTTPParsers.h" 92 #include "platform/network/HTTPParsers.h"
93 #include "platform/network/ResourceRequest.h" 93 #include "platform/network/ResourceRequest.h"
94 #include "platform/scroll/ScrollAnimatorBase.h" 94 #include "platform/scroll/ScrollAnimatorBase.h"
95 #include "platform/tracing/TraceEvent.h" 95 #include "platform/tracing/TraceEvent.h"
96 #include "platform/weborigin/SecurityOrigin.h" 96 #include "platform/weborigin/SecurityOrigin.h"
97 #include "platform/weborigin/SecurityPolicy.h" 97 #include "platform/weborigin/SecurityPolicy.h"
98 #include "platform/weborigin/Suborigin.h" 98 #include "platform/weborigin/Suborigin.h"
99 #include "public/platform/WebCachePolicy.h" 99 #include "public/platform/WebCachePolicy.h"
100 #include "public/platform/WebFeaturePolicy.h"
100 #include "public/platform/WebURLRequest.h" 101 #include "public/platform/WebURLRequest.h"
101 #include "wtf/AutoReset.h" 102 #include "wtf/AutoReset.h"
102 #include "wtf/text/CString.h" 103 #include "wtf/text/CString.h"
103 #include "wtf/text/WTFString.h" 104 #include "wtf/text/WTFString.h"
104 #include <memory> 105 #include <memory>
105 106
106 using blink::WebURLRequest; 107 using blink::WebURLRequest;
107 108
108 namespace blink { 109 namespace blink {
109 110
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 FeaturePolicy* parentFeaturePolicy = 582 FeaturePolicy* parentFeaturePolicy =
582 (isLoadingMainFrame() ? nullptr 583 (isLoadingMainFrame() ? nullptr
583 : m_frame->client() 584 : m_frame->client()
584 ->parent() 585 ->parent()
585 ->securityContext() 586 ->securityContext()
586 ->getFeaturePolicy()); 587 ->getFeaturePolicy());
587 const String& featurePolicyHeader = 588 const String& featurePolicyHeader =
588 m_documentLoader->response().httpHeaderField( 589 m_documentLoader->response().httpHeaderField(
589 HTTPNames::Feature_Policy); 590 HTTPNames::Feature_Policy);
590 Vector<String> messages; 591 Vector<String> messages;
592 const WebParsedFeaturePolicy& parsedHeader =
593 FeaturePolicy::parseFeaturePolicy(
594 featurePolicyHeader,
595 m_frame->securityContext()->getSecurityOrigin(), &messages);
591 m_frame->securityContext()->setFeaturePolicyFromHeader( 596 m_frame->securityContext()->setFeaturePolicyFromHeader(
592 featurePolicyHeader, parentFeaturePolicy, &messages); 597 parsedHeader, parentFeaturePolicy);
593 for (auto& message : messages) { 598 for (auto& message : messages) {
594 m_frame->document()->addConsoleMessage(ConsoleMessage::create( 599 m_frame->document()->addConsoleMessage(ConsoleMessage::create(
595 OtherMessageSource, ErrorMessageLevel, 600 OtherMessageSource, ErrorMessageLevel,
596 "Error with Feature-Policy header: " + message)); 601 "Error with Feature-Policy header: " + message));
597 } 602 }
598 if (!featurePolicyHeader.isEmpty()) 603 if (!parsedHeader.isEmpty())
599 client()->didSetFeaturePolicyHeader(featurePolicyHeader); 604 client()->didSetFeaturePolicyHeader(parsedHeader);
600 } 605 }
601 } 606 }
602 607
603 if (m_documentLoader) { 608 if (m_documentLoader) {
604 String referrerPolicyHeader = m_documentLoader->response().httpHeaderField( 609 String referrerPolicyHeader = m_documentLoader->response().httpHeaderField(
605 HTTPNames::Referrer_Policy); 610 HTTPNames::Referrer_Policy);
606 if (!referrerPolicyHeader.isNull()) { 611 if (!referrerPolicyHeader.isNull()) {
607 m_frame->document()->parseAndSetReferrerPolicy(referrerPolicyHeader); 612 m_frame->document()->parseAndSetReferrerPolicy(referrerPolicyHeader);
608 } 613 }
609 } 614 }
(...skipping 1347 matching lines...) Expand 10 before | Expand all | Expand 10 after
1957 m_documentLoader ? m_documentLoader->url() : String()); 1962 m_documentLoader ? m_documentLoader->url() : String());
1958 return tracedValue; 1963 return tracedValue;
1959 } 1964 }
1960 1965
1961 inline void FrameLoader::takeObjectSnapshot() const { 1966 inline void FrameLoader::takeObjectSnapshot() const {
1962 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID("loading", "FrameLoader", this, 1967 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID("loading", "FrameLoader", this,
1963 toTracedValue()); 1968 toTracedValue());
1964 } 1969 }
1965 1970
1966 } // namespace blink 1971 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698