Commit 62acf2e5 authored by Hiroshige Hayashizaki's avatar Hiroshige Hayashizaki Committed by Commit Bot

Use GetMutableSecurityOrigin() for modifying SecurityContext's SecurityOrigin

No behavior changes.

Bug: 779730
Change-Id: Iee799336a5f5f2db61d6990edfead3c31b377c50
Reviewed-on: https://chromium-review.googlesource.com/762342Reviewed-by: default avatarKinuko Yasuda <kinuko@chromium.org>
Reviewed-by: default avatarMike West <mkwst@chromium.org>
Commit-Queue: Hiroshige Hayashizaki <hiroshige@chromium.org>
Cr-Commit-Position: refs/heads/master@{#520845}
parent 9281d2eb
...@@ -5171,7 +5171,7 @@ void Document::setDomain(const String& raw_domain, ...@@ -5171,7 +5171,7 @@ void Document::setDomain(const String& raw_domain,
? WebFeature::kDocumentDomainSetWithDefaultPort ? WebFeature::kDocumentDomainSetWithDefaultPort
: WebFeature::kDocumentDomainSetWithNonDefaultPort); : WebFeature::kDocumentDomainSetWithNonDefaultPort);
bool was_cross_domain = frame_->IsCrossOriginSubframe(); bool was_cross_domain = frame_->IsCrossOriginSubframe();
GetSecurityOrigin()->SetDomainFromDOM(new_domain); GetMutableSecurityOrigin()->SetDomainFromDOM(new_domain);
if (View() && (was_cross_domain != frame_->IsCrossOriginSubframe())) if (View() && (was_cross_domain != frame_->IsCrossOriginSubframe()))
View()->CrossOriginStatusChanged(); View()->CrossOriginStatusChanged();
...@@ -6082,23 +6082,23 @@ void Document::InitSecurityContext(const DocumentInit& initializer) { ...@@ -6082,23 +6082,23 @@ void Document::InitSecurityContext(const DocumentInit& initializer) {
// Web security is turned off. We should let this document access every // Web security is turned off. We should let this document access every
// other document. This is used primary by testing harnesses for web // other document. This is used primary by testing harnesses for web
// sites. // sites.
GetSecurityOrigin()->GrantUniversalAccess(); GetMutableSecurityOrigin()->GrantUniversalAccess();
} else if (GetSecurityOrigin()->IsLocal()) { } else if (GetSecurityOrigin()->IsLocal()) {
if (settings->GetAllowUniversalAccessFromFileURLs()) { if (settings->GetAllowUniversalAccessFromFileURLs()) {
// Some clients want local URLs to have universal access, but that // Some clients want local URLs to have universal access, but that
// setting is dangerous for other clients. // setting is dangerous for other clients.
GetSecurityOrigin()->GrantUniversalAccess(); GetMutableSecurityOrigin()->GrantUniversalAccess();
} else if (!settings->GetAllowFileAccessFromFileURLs()) { } else if (!settings->GetAllowFileAccessFromFileURLs()) {
// Some clients do not want local URLs to have access to other local // Some clients do not want local URLs to have access to other local
// URLs. // URLs.
GetSecurityOrigin()->BlockLocalAccessFromLocalOrigin(); GetMutableSecurityOrigin()->BlockLocalAccessFromLocalOrigin();
} }
} }
} }
if (GetSecurityOrigin()->IsUnique() && if (GetSecurityOrigin()->IsUnique() &&
SecurityOrigin::Create(url_)->IsPotentiallyTrustworthy()) SecurityOrigin::Create(url_)->IsPotentiallyTrustworthy())
GetSecurityOrigin()->SetUniqueOriginIsPotentiallyTrustworthy(true); GetMutableSecurityOrigin()->SetUniqueOriginIsPotentiallyTrustworthy(true);
ApplyFeaturePolicy({}); ApplyFeaturePolicy({});
......
...@@ -1765,7 +1765,7 @@ void WebLocalFrameImpl::InitializeCoreFrame(Page& page, ...@@ -1765,7 +1765,7 @@ void WebLocalFrameImpl::InitializeCoreFrame(Page& page,
CHECK(frame_->Loader().StateMachine()->IsDisplayingInitialEmptyDocument()); CHECK(frame_->Loader().StateMachine()->IsDisplayingInitialEmptyDocument());
if (!Parent() && !Opener() && if (!Parent() && !Opener() &&
frame_->GetSettings()->GetShouldReuseGlobalForUnownedMainFrame()) { frame_->GetSettings()->GetShouldReuseGlobalForUnownedMainFrame()) {
frame_->GetDocument()->GetSecurityOrigin()->GrantUniversalAccess(); frame_->GetDocument()->GetMutableSecurityOrigin()->GrantUniversalAccess();
} }
if (!owner) { if (!owner) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment