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

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

Issue 2142523004: M52: Merge "Reland: service worker: Don't control a subframe of an insecure context" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2743
Patch Set: fix compile errors Created 4 years, 5 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/Document.h ('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/dom/Document.cpp
diff --git a/third_party/WebKit/Source/core/dom/Document.cpp b/third_party/WebKit/Source/core/dom/Document.cpp
index f7cf824556ef3d486913c8007efe342ae8016a16..014b461bf5e84eba8fe8303a4894498fbe15a2b3 100644
--- a/third_party/WebKit/Source/core/dom/Document.cpp
+++ b/third_party/WebKit/Source/core/dom/Document.cpp
@@ -352,15 +352,6 @@ static bool acceptsEditingFocus(const Element& element)
return element.document().frame() && element.rootEditableElement();
}
-static bool isOriginPotentiallyTrustworthy(SecurityOrigin* origin, String* errorMessage)
-{
- if (origin->isPotentiallyTrustworthy())
- return true;
- if (errorMessage)
- *errorMessage = origin->isPotentiallyTrustworthyErrorMessage();
- return false;
-}
-
uint64_t Document::s_globalTreeVersion = 0;
static bool s_threadedParsingEnabledForTesting = true;
@@ -3354,7 +3345,7 @@ void Document::cloneDataFromDocument(const Document& other)
setMimeType(other.contentType());
}
-bool Document::isSecureContextImpl(String* errorMessage, const SecureContextCheck privilegeContextCheck) const
+bool Document::isSecureContextImpl(const SecureContextCheck privilegeContextCheck) const
{
// There may be exceptions for the secure context check defined for certain
// schemes. The exceptions are applied only to the special scheme and to
@@ -3384,7 +3375,7 @@ bool Document::isSecureContextImpl(String* errorMessage, const SecureContextChec
//
// In all cases, a frame must be potentially trustworthy in addition to
// having an exception listed in order for the exception to be granted.
- if (!isOriginPotentiallyTrustworthy(getSecurityOrigin(), errorMessage))
+ if (!getSecurityOrigin()->isPotentiallyTrustworthy())
return false;
if (SchemeRegistry::schemeShouldBypassSecureContextCheck(getSecurityOrigin()->protocol()))
@@ -3395,7 +3386,7 @@ bool Document::isSecureContextImpl(String* errorMessage, const SecureContextChec
return true;
Frame* parent = m_frame->tree().parent();
while (parent) {
- if (!isOriginPotentiallyTrustworthy(parent->securityContext()->getSecurityOrigin(), errorMessage))
+ if (!parent->securityContext()->getSecurityOrigin()->isPotentiallyTrustworthy())
return false;
parent = parent->tree().parent();
}
@@ -5864,12 +5855,15 @@ v8::Local<v8::Object> Document::associateWithWrapper(v8::Isolate* isolate, const
bool Document::isSecureContext(String& errorMessage, const SecureContextCheck privilegeContextCheck) const
{
- return isSecureContextImpl(&errorMessage, privilegeContextCheck);
+ if (isSecureContextImpl(privilegeContextCheck))
+ return true;
+ errorMessage = SecurityOrigin::isPotentiallyTrustworthyErrorMessage();
+ return false;
}
bool Document::isSecureContext(const SecureContextCheck privilegeContextCheck) const
{
- return isSecureContextImpl(nullptr, privilegeContextCheck);
+ return isSecureContextImpl(privilegeContextCheck);
}
WebTaskRunner* Document::loadingTaskRunner() const
« no previous file with comments | « third_party/WebKit/Source/core/dom/Document.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698