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

Unified Diff: third_party/WebKit/Source/core/dom/Document.cpp

Issue 1670173002: Don't set the origin twice when navigating for javascript: URLs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: steal dcheng's tests Created 4 years, 10 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
Index: third_party/WebKit/Source/core/dom/Document.cpp
diff --git a/third_party/WebKit/Source/core/dom/Document.cpp b/third_party/WebKit/Source/core/dom/Document.cpp
index 349b9f4c0e9af9b58c61ec56299843e99d568930..46adc2123a9414a43b92a94147ada65814bb21ab 100644
--- a/third_party/WebKit/Source/core/dom/Document.cpp
+++ b/third_party/WebKit/Source/core/dom/Document.cpp
@@ -315,16 +315,9 @@ static inline bool isValidNamePart(UChar32 c)
return true;
}
-static bool shouldInheritSecurityOriginFromOwner(const KURL& url)
+static bool shouldInheritContentSecurityPolicyFromOwner(const KURL& url)
{
- // http://www.whatwg.org/specs/web-apps/current-work/#origin-0
- //
- // If a Document has the address "about:blank"
- // The origin of the Document is the origin it was assigned when its browsing context was created.
- //
- // Note: We generalize this to all "blank" URLs and invalid URLs because we
- // treat all of these URLs as about:blank.
- //
+ // TODO(jochen): Somehow unify this with DocumentInit::shouldInheritSecurityOriginFromOwner.
return url.isEmpty() || url.protocolIsAbout();
}
@@ -4936,7 +4929,7 @@ void Document::initSecurityContext(const DocumentInit& initializer)
setBaseURLOverride(initializer.parentBaseURL());
}
- if (!shouldInheritSecurityOriginFromOwner(m_url))
+ if (!initializer.shouldInheritSecurityOriginFromOwner())
return;
// If we do not obtain a meaningful origin from the URL, then we try to
@@ -4968,7 +4961,7 @@ void Document::initContentSecurityPolicy(PassRefPtrWillBeRawPtr<ContentSecurityP
setContentSecurityPolicy(csp ? csp : ContentSecurityPolicy::create());
if (m_frame && m_frame->tree().parent() && m_frame->tree().parent()->isLocalFrame()) {
ContentSecurityPolicy* parentCSP = toLocalFrame(m_frame->tree().parent())->document()->contentSecurityPolicy();
- if (shouldInheritSecurityOriginFromOwner(m_url)) {
+ if (shouldInheritContentSecurityPolicyFromOwner(m_url)) {
contentSecurityPolicy()->copyStateFrom(parentCSP);
} else if (isPluginDocument()) {
// Per CSP2, plugin-types for plugin documents in nested browsing

Powered by Google App Engine
This is Rietveld 408576698