Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 447 // origins that should only allow access to themselves. In this | 447 // origins that should only allow access to themselves. In this |
| 448 // case, we use the global object as the security token to avoid | 448 // case, we use the global object as the security token to avoid |
| 449 // calling canAccess when a script accesses its own objects. | 449 // calling canAccess when a script accesses its own objects. |
| 450 v8::HandleScope handleScope(m_isolate); | 450 v8::HandleScope handleScope(m_isolate); |
| 451 v8::Local<v8::Context> context = m_scriptState->context(); | 451 v8::Local<v8::Context> context = m_scriptState->context(); |
| 452 if (token.isEmpty() || token == "null") { | 452 if (token.isEmpty() || token == "null") { |
| 453 context->UseDefaultSecurityToken(); | 453 context->UseDefaultSecurityToken(); |
| 454 return; | 454 return; |
| 455 } | 455 } |
| 456 | 456 |
| 457 if (m_world->isPrivateScriptIsolatedWorld()) | 457 if (m_world->isPrivateScriptIsolatedWorld()) { |
| 458 token = "private-script://" + token; | 458 token = "private-script://" + token; |
| 459 } else if (m_world->isIsolatedWorld()) { | |
| 460 String frameSecurityToken = m_frame->securityContext()->securityOrigin() ->toString(); | |
| 461 if (frameSecurityToken.isEmpty() || frameSecurityToken == "null") { | |
| 462 context->UseDefaultSecurityToken(); | |
| 463 return; | |
| 464 } | |
| 465 token = frameSecurityToken + token; | |
|
haraken
2015/09/10 23:34:20
Just help me understand: Why do we need to add a p
epertoso
2015/09/11 13:18:22
The rationale here is: the extension can access so
| |
| 466 } | |
| 459 | 467 |
| 460 CString utf8Token = token.utf8(); | 468 CString utf8Token = token.utf8(); |
| 461 // NOTE: V8 does identity comparison in fast path, must use a symbol | 469 // NOTE: V8 does identity comparison in fast path, must use a symbol |
| 462 // as the security token. | 470 // as the security token. |
| 463 context->SetSecurityToken(v8AtomicString(m_isolate, utf8Token.data(), utf8To ken.length())); | 471 context->SetSecurityToken(v8AtomicString(m_isolate, utf8Token.data(), utf8To ken.length())); |
| 464 } | 472 } |
| 465 | 473 |
| 466 void WindowProxy::updateDocument() | 474 void WindowProxy::updateDocument() |
| 467 { | 475 { |
| 468 ASSERT(m_world->isMainWorld()); | 476 ASSERT(m_world->isMainWorld()); |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 548 | 556 |
| 549 void WindowProxy::updateSecurityOrigin(SecurityOrigin* origin) | 557 void WindowProxy::updateSecurityOrigin(SecurityOrigin* origin) |
| 550 { | 558 { |
| 551 ASSERT(m_world->isMainWorld()); | 559 ASSERT(m_world->isMainWorld()); |
| 552 if (!isContextInitialized()) | 560 if (!isContextInitialized()) |
| 553 return; | 561 return; |
| 554 setSecurityToken(origin); | 562 setSecurityToken(origin); |
| 555 } | 563 } |
| 556 | 564 |
| 557 } // namespace blink | 565 } // namespace blink |
| OLD | NEW |