Changeset 135765 in webkit
- Timestamp:
- Nov 26, 2012 2:24:31 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r135753 r135765 1 2012-11-26 Dan Carney <dcarney@google.com> 2 3 Refactor V8 bindings to allow content scripts to access subframes 4 https://bugs.webkit.org/show_bug.cgi?id=93646 5 6 Reviewed by Adam Barth. 7 8 Test modified to check isolated world access across frames. 9 10 * http/tests/security/isolatedWorld/world-reuse-expected.txt: 11 * http/tests/security/isolatedWorld/world-reuse.html: 12 1 13 2012-11-26 Tony Chang <tony@chromium.org> 2 14 -
trunk/LayoutTests/http/tests/security/isolatedWorld/world-reuse-expected.txt
r49963 r135765 3 3 Expecting bar: bar 4 4 Expecting undefined: undefined 5 Expecting true: true 6 Expecting true: true 5 7 Expecting undefined,undefined: undefined,undefined 6 8 Expecting undefined,undefined: undefined,undefined -
trunk/LayoutTests/http/tests/security/isolatedWorld/world-reuse.html
r120174 r135765 31 31 document.body.insertBefore(document.createElement("br"), iframe.nextSibling); 32 32 var iframeComplete = function(result) { 33 34 // Isolated world executing in frame should be able to to access parent content. 35 testRunner.evaluateScriptInIsolatedWorld(1, 36 "parent.document.body.appendChild(parent.document.createTextNode('Expecting true: ' + (parent.frames[0].document == this.document)));" + 37 "parent.document.body.appendChild(parent.document.createElement('br'));"); 38 33 39 document.body.appendChild(document.createTextNode('Expecting undefined,undefined: ' + result)); 34 40 document.body.appendChild(document.createElement('br')); 35 41 reloadFrame(); 36 42 } 43 44 // Isolated world executing in window should be able to to access frame content. 45 testRunner.evaluateScriptInIsolatedWorld(1, 46 "document.body.appendChild(document.createTextNode('Expecting true: ' + !!frames[0].document));" + 47 "document.body.appendChild(document.createElement('br'));"); 48 37 49 iframe.src = "resources/iframe.html"; 38 50 -
trunk/Source/WebCore/ChangeLog
r135763 r135765 1 2012-11-26 Dan Carney <dcarney@google.com> 2 3 Refactor V8 bindings to allow content scripts to access subframes 4 https://bugs.webkit.org/show_bug.cgi?id=93646 5 6 Reviewed by Adam Barth. 7 8 Isolated window shells are now initialized on the fly 9 as needed. 10 11 No new tests. Existing test modified. 12 13 * bindings/v8/DOMWrapperWorld.cpp: 14 (WebCore::DOMWrapperWorld::ensureIsolatedWorld): 15 * bindings/v8/DOMWrapperWorld.h: 16 (WebCore::DOMWrapperWorld::createdFromUnitializedWorld): 17 (DOMWrapperWorld): 18 * bindings/v8/ScriptController.cpp: 19 (WebCore::ScriptController::currentWorldContext): 20 1 21 2012-11-26 Alex Christensen <alex.christensen@flexsim.com> 2 22 -
trunk/Source/WebCore/bindings/v8/DOMWrapperWorld.cpp
r135601 r135765 138 138 { 139 139 ASSERT(worldId != mainWorldId); 140 ASSERT(worldId >= uninitializedWorldId); 140 141 141 142 WorldMap& map = isolatedWorldMap(); -
trunk/Source/WebCore/bindings/v8/DOMWrapperWorld.h
r135601 r135765 97 97 bool isMainWorld() const { return m_worldId == mainWorldId; } 98 98 bool isIsolatedWorld() const { return isIsolatedWorldId(m_worldId); } 99 bool createdFromUnitializedWorld() const { return m_worldId < uninitializedWorldId; } 100 99 101 int worldId() const { return m_worldId; } 100 102 int extensionGroup() const { return m_extensionGroup; } -
trunk/Source/WebCore/bindings/v8/ScriptController.cpp
r135687 r135765 437 437 v8::Local<v8::Context> ScriptController::currentWorldContext() 438 438 { 439 if (v8::Context::InContext()) { 440 v8::Handle<v8::Context> context = v8::Context::GetEntered(); 441 if (DOMWrapperWorld::isolated(context)) { 442 if (m_frame == toFrameIfNotDetached(context)) 443 return v8::Local<v8::Context>::New(context); 444 return v8::Local<v8::Context>(); 445 } 446 } 447 return v8::Local<v8::Context>::New(windowShell(mainThreadNormalWorld())->context()); 439 if (!v8::Context::InContext()) 440 return v8::Local<v8::Context>::New(windowShell(mainThreadNormalWorld())->context()); 441 442 v8::Handle<v8::Context> context = v8::Context::GetEntered(); 443 DOMWrapperWorld* isolatedWorld = DOMWrapperWorld::isolated(context); 444 if (!isolatedWorld) 445 return v8::Local<v8::Context>::New(windowShell(mainThreadNormalWorld())->context()); 446 447 Frame* frame = toFrameIfNotDetached(context); 448 if (!m_frame) 449 return v8::Local<v8::Context>(); 450 451 if (m_frame == frame) 452 return v8::Local<v8::Context>::New(context); 453 454 // FIXME: Need to handle weak isolated worlds correctly. 455 if (isolatedWorld->createdFromUnitializedWorld()) 456 return v8::Local<v8::Context>(); 457 458 return v8::Local<v8::Context>::New(windowShell(isolatedWorld)->context()); 448 459 } 449 460
Note: See TracChangeset
for help on using the changeset viewer.