-
Notifications
You must be signed in to change notification settings - Fork 15k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: simplify main world setup of contextIsolation (#16065)
- Loading branch information
Cheng Zhao
committed
Dec 14, 2018
1 parent
b2913e5
commit 80ef116
Showing
7 changed files
with
34 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,11 @@ | ||
'use strict' | ||
|
||
/* global binding */ | ||
/* global nodeProcess, isolatedWorld */ | ||
|
||
const { send, sendSync } = binding | ||
// Note: Don't use "process", as it will be replaced by browserify's one. | ||
const v8Util = nodeProcess.atomBinding('v8_util') | ||
|
||
const ipcRenderer = { | ||
send (...args) { | ||
return send('ipc-internal-message', args) | ||
}, | ||
const isolatedWorldArgs = v8Util.getHiddenValue(isolatedWorld, 'isolated-world-args') | ||
const { ipcRenderer, guestInstanceId, hiddenPage, openerId, usesNativeWindowOpen } = isolatedWorldArgs | ||
|
||
sendSync (...args) { | ||
return sendSync('ipc-internal-message-sync', args)[0] | ||
}, | ||
|
||
// No-ops since events aren't received | ||
on () {}, | ||
once () {} | ||
} | ||
|
||
let { guestInstanceId, hiddenPage, openerId, nativeWindowOpen } = binding | ||
if (guestInstanceId != null) guestInstanceId = parseInt(guestInstanceId) | ||
if (openerId != null) openerId = parseInt(openerId) | ||
|
||
require('@electron/internal/renderer/window-setup')(ipcRenderer, guestInstanceId, openerId, hiddenPage, nativeWindowOpen) | ||
require('@electron/internal/renderer/window-setup')(ipcRenderer, guestInstanceId, openerId, hiddenPage, usesNativeWindowOpen) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters