Set isolated world security origin
This commit is contained in:
parent
7f6283352f
commit
7fb77ee1cb
2 changed files with 9 additions and 3 deletions
|
@ -86,14 +86,21 @@ class AtomRenderFrameObserver : public content::RenderFrameObserver {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CreateIsolatedWorldContext() {
|
void CreateIsolatedWorldContext() {
|
||||||
|
auto frame = render_frame_->GetWebFrame();
|
||||||
|
|
||||||
// This maps to the name shown in the context combo box in the Console tab
|
// This maps to the name shown in the context combo box in the Console tab
|
||||||
// of the dev tools.
|
// of the dev tools.
|
||||||
render_frame_->GetWebFrame()->setIsolatedWorldHumanReadableName(
|
frame->setIsolatedWorldHumanReadableName(
|
||||||
World::ISOLATED_WORLD,
|
World::ISOLATED_WORLD,
|
||||||
blink::WebString::fromUTF8("Electron Isolated Context"));
|
blink::WebString::fromUTF8("Electron Isolated Context"));
|
||||||
|
|
||||||
|
// Setup document's origin policy in isolated world
|
||||||
|
frame->setIsolatedWorldSecurityOrigin(
|
||||||
|
World::ISOLATED_WORLD, frame->document().getSecurityOrigin());
|
||||||
|
|
||||||
|
// Create initial script context in isolated world
|
||||||
blink::WebScriptSource source("void 0");
|
blink::WebScriptSource source("void 0");
|
||||||
render_frame_->GetWebFrame()->executeScriptInIsolatedWorld(
|
frame->executeScriptInIsolatedWorld(
|
||||||
World::ISOLATED_WORLD, &source, 1, ExtensionGroup::MAIN_GROUP);
|
World::ISOLATED_WORLD, &source, 1, ExtensionGroup::MAIN_GROUP);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
1
spec/fixtures/api/isolated-preload.js
vendored
1
spec/fixtures/api/isolated-preload.js
vendored
|
@ -9,7 +9,6 @@ window.foo = 3
|
||||||
|
|
||||||
webFrame.executeJavaScript('window.preloadExecuteJavaScriptProperty = 1234;')
|
webFrame.executeJavaScript('window.preloadExecuteJavaScriptProperty = 1234;')
|
||||||
|
|
||||||
|
|
||||||
window.addEventListener('message', (event) => {
|
window.addEventListener('message', (event) => {
|
||||||
ipcRenderer.send('isolated-world', {
|
ipcRenderer.send('isolated-world', {
|
||||||
preloadContext: {
|
preloadContext: {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue