refactor: address TODO for WebContents type parsing (#18158)
This commit is contained in:
parent
7e2cbf528e
commit
89105e7e57
6 changed files with 10 additions and 19 deletions
|
@ -93,7 +93,7 @@ const startBackgroundPages = function (manifest) {
|
|||
|
||||
const contents = webContents.create({
|
||||
partition: 'persist:__chrome_extension',
|
||||
isBackgroundPage: true,
|
||||
type: 'backgroundPage',
|
||||
sandbox: true,
|
||||
enableRemoteModule: false
|
||||
})
|
||||
|
|
|
@ -59,7 +59,7 @@ const createGuest = function (embedder, params) {
|
|||
}
|
||||
|
||||
const guest = webContents.create({
|
||||
isGuest: true,
|
||||
type: 'webview',
|
||||
partition: params.partition,
|
||||
embedder: embedder
|
||||
})
|
||||
|
|
|
@ -28,7 +28,7 @@ const mergeOptions = function (child, parent, visited) {
|
|||
|
||||
visited.add(parent)
|
||||
for (const key in parent) {
|
||||
if (key === 'isBrowserView') continue
|
||||
if (key === 'type') continue
|
||||
if (!hasProp.call(parent, key)) continue
|
||||
if (key in child && key !== 'webPreferences') continue
|
||||
|
||||
|
@ -244,7 +244,7 @@ ipcMainInternal.on('ELECTRON_GUEST_WINDOW_MANAGER_INTERNAL_WINDOW_OPEN', functio
|
|||
options = mergeBrowserWindowOptions(event.sender, options)
|
||||
event.sender.emit('new-window', event, url, frameName, disposition, options, additionalFeatures, referrer)
|
||||
const { newGuest } = event
|
||||
if ((event.sender.isGuest() && !event.sender.allowPopups) || event.defaultPrevented) {
|
||||
if ((event.sender.getType() === 'webview' && !event.sender.allowPopups) || event.defaultPrevented) {
|
||||
if (newGuest != null) {
|
||||
if (options.webContents === newGuest.webContents) {
|
||||
// the webContents is not changed, so set defaultPrevented to false to
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue