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

Side by Side Diff: Source/bindings/v8/V8WindowShell.cpp

Issue 345893002: Implement an infrastructure of Blink-in-JS Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/bindings/v8/V8PerIsolateData.h ('k') | Source/bindings/v8/v8.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008, 2009, 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2008, 2009, 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 // origins that should only allow access to themselves. In this 396 // origins that should only allow access to themselves. In this
397 // case, we use the global object as the security token to avoid 397 // case, we use the global object as the security token to avoid
398 // calling canAccess when a script accesses its own objects. 398 // calling canAccess when a script accesses its own objects.
399 v8::HandleScope handleScope(m_isolate); 399 v8::HandleScope handleScope(m_isolate);
400 v8::Handle<v8::Context> context = m_scriptState->context(); 400 v8::Handle<v8::Context> context = m_scriptState->context();
401 if (token.isEmpty() || token == "null") { 401 if (token.isEmpty() || token == "null") {
402 context->UseDefaultSecurityToken(); 402 context->UseDefaultSecurityToken();
403 return; 403 return;
404 } 404 }
405 405
406 if (m_world->isPrivateScriptIsolatedWorld())
407 token = "private-script://" + token;
408
406 CString utf8Token = token.utf8(); 409 CString utf8Token = token.utf8();
407 // NOTE: V8 does identity comparison in fast path, must use a symbol 410 // NOTE: V8 does identity comparison in fast path, must use a symbol
408 // as the security token. 411 // as the security token.
409 context->SetSecurityToken(v8AtomicString(m_isolate, utf8Token.data(), utf8To ken.length())); 412 context->SetSecurityToken(v8AtomicString(m_isolate, utf8Token.data(), utf8To ken.length()));
410 } 413 }
411 414
412 void V8WindowShell::updateDocument() 415 void V8WindowShell::updateDocument()
413 { 416 {
414 ASSERT(m_world->isMainWorld()); 417 ASSERT(m_world->isMainWorld());
415 if (!isGlobalInitialized()) 418 if (!isGlobalInitialized())
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 495
493 void V8WindowShell::updateSecurityOrigin(SecurityOrigin* origin) 496 void V8WindowShell::updateSecurityOrigin(SecurityOrigin* origin)
494 { 497 {
495 ASSERT(m_world->isMainWorld()); 498 ASSERT(m_world->isMainWorld());
496 if (!isContextInitialized()) 499 if (!isContextInitialized())
497 return; 500 return;
498 setSecurityToken(origin); 501 setSecurityToken(origin);
499 } 502 }
500 503
501 } // WebCore 504 } // WebCore
OLDNEW
« no previous file with comments | « Source/bindings/v8/V8PerIsolateData.h ('k') | Source/bindings/v8/v8.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698