Commit b8d3bfaa authored by Joey Arhar's avatar Joey Arhar Committed by Commit Bot

[DevTools] Fix isolated world crash by always adding a SecurityOrigin

Bug: 879219
Change-Id: I6cf01b36326a8b7727a870f2f7e2d061774d1c5b
Reviewed-on: https://chromium-review.googlesource.com/1226797Reviewed-by: default avatarDmitry Gozman <dgozman@chromium.org>
Commit-Queue: Joey Arhar <jarhar@chromium.org>
Cr-Commit-Position: refs/heads/master@{#592888}
parent 226c6cce
Verifies fetch() doesn't cause a crash in isolated world
Got execution context id
Response received
url: http://127.0.0.1:8000/inspector-protocol/resources/test-page.html
type: Fetch
(async function(testRunner) {
const {page, session, dp} = await testRunner.startBlank(
"Verifies fetch() doesn't cause a crash in isolated world");
await dp.Runtime.enable();
await dp.Page.enable();
const getResourceTreeResponse = await dp.Page.getResourceTree();
const mainFrameId = getResourceTreeResponse.result.frameTree.frame.id;
const isolatedWorldResponse = await dp.Page.createIsolatedWorld(
{frameId: mainFrameId, worldName: 'Test world', grantUniveralAccess: false});
const contextId = isolatedWorldResponse.result.executionContextId;
testRunner.log('Got execution context id');
await dp.Network.enable();
await dp.Runtime.evaluate({
contextId: contextId,
expression: `
fetch('/inspector-protocol/resources/test-page.html')
`});
const responseReceived = await dp.Network.onceResponseReceived();
testRunner.log('Response received');
testRunner.log(' url: ' + responseReceived.params.response.url);
testRunner.log(' type: ' + responseReceived.params.type);
testRunner.completeTest();
})
......@@ -1173,13 +1173,12 @@ protocol::Response InspectorPageAgent::createIsolatedWorld(
if (!world)
return Response::Error("Could not create isolated world");
if (grant_universal_access.fromMaybe(false)) {
scoped_refptr<SecurityOrigin> security_origin =
frame->GetSecurityContext()->GetSecurityOrigin()->IsolatedCopy();
scoped_refptr<SecurityOrigin> security_origin =
frame->GetSecurityContext()->GetSecurityOrigin()->IsolatedCopy();
if (grant_universal_access.fromMaybe(false))
security_origin->GrantUniversalAccess();
DOMWrapperWorld::SetIsolatedWorldSecurityOrigin(world->GetWorldId(),
security_origin);
}
DOMWrapperWorld::SetIsolatedWorldSecurityOrigin(world->GetWorldId(),
security_origin);
LocalWindowProxy* isolated_world_window_proxy =
frame->GetScriptController().WindowProxy(*world);
......
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