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

Unified Diff: Source/bindings/v8/V8WindowShell.cpp

Issue 261883004: set isolated world security origins (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 8 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/v8/V8WindowShell.cpp
diff --git a/Source/bindings/v8/V8WindowShell.cpp b/Source/bindings/v8/V8WindowShell.cpp
index 4f80fa4cd19920098f0e9bea828f8ed0292c18be..32098b4e076c4370f6a8df095b574d6ff1ef88af 100644
--- a/Source/bindings/v8/V8WindowShell.cpp
+++ b/Source/bindings/v8/V8WindowShell.cpp
@@ -230,15 +230,8 @@ bool V8WindowShell::initialize()
context->SetErrorMessageForCodeGenerationFromStrings(v8String(m_isolate, csp->evalDisabledErrorMessage()));
}
} else {
- // Using the default security token means that the canAccess is always
- // called, which is slow.
- // FIXME: Use tokens where possible. This will mean keeping track of all
- // created contexts so that they can all be updated when the
- // document domain
- // changes.
- context->UseDefaultSecurityToken();
-
SecurityOrigin* origin = m_world->isolatedWorldSecurityOrigin();
+ setSecurityToken(origin);
if (origin && InspectorInstrumentation::hasFrontends()) {
InspectorInstrumentation::didCreateIsolatedContext(m_frame, ScriptState::current(m_isolate), origin);
}
@@ -376,7 +369,6 @@ void V8WindowShell::clearDocumentProperty()
void V8WindowShell::setSecurityToken(SecurityOrigin* origin)
{
- ASSERT(m_world->isMainWorld());
// If two tokens are equal, then the SecurityOrigins canAccess each other.
// If two tokens are not equal, then we have to call canAccess.
// Note: we can't use the HTTPOrigin if it was set from the DOM.
@@ -384,8 +376,10 @@ void V8WindowShell::setSecurityToken(SecurityOrigin* origin)
// We stick with an empty token if document.domain was modified or if we
// are in the initial empty document, so that we can do a full canAccess
// check in those cases.
- if (!origin->domainWasSetInDOM()
- && !m_frame->loader().stateMachine()->isDisplayingInitialEmptyDocument())
+ bool delaySet = m_world->isMainWorld()
+ && (origin->domainWasSetInDOM()
+ || m_frame->loader().stateMachine()->isDisplayingInitialEmptyDocument());
+ if (origin && !delaySet)
token = origin->toString();
// An empty or "null" token means we always have to call
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698