Get webContents from guestId
This commit is contained in:
parent
c8180ab301
commit
39180e6539
1 changed files with 5 additions and 6 deletions
|
@ -5,8 +5,7 @@ const ws = require('ws')
|
|||
const url = require('url')
|
||||
const remote = require('electron').remote
|
||||
|
||||
const BrowserWindow = remote.require('electron').BrowserWindow
|
||||
const session = remote.require('electron').session
|
||||
const {BrowserWindow, session, webContents} = remote
|
||||
|
||||
const isCI = remote.getGlobal('isCi')
|
||||
|
||||
|
@ -235,7 +234,7 @@ describe('chromium feature', function () {
|
|||
else
|
||||
targetURL = 'file://' + fixtures + '/pages/base-page.html'
|
||||
b = window.open(targetURL)
|
||||
BrowserWindow.fromId(b.guestId).webContents.once('did-finish-load', function () {
|
||||
webContents.fromId(b.guestId).once('did-finish-load', function () {
|
||||
assert.equal(b.location, targetURL)
|
||||
b.close()
|
||||
done()
|
||||
|
@ -246,10 +245,10 @@ describe('chromium feature', function () {
|
|||
// Load a page that definitely won't redirect
|
||||
var b
|
||||
b = window.open('about:blank')
|
||||
BrowserWindow.fromId(b.guestId).webContents.once('did-finish-load', function () {
|
||||
webContents.fromId(b.guestId).once('did-finish-load', function () {
|
||||
// When it loads, redirect
|
||||
b.location = 'file://' + fixtures + '/pages/base-page.html'
|
||||
BrowserWindow.fromId(b.guestId).webContents.once('did-finish-load', function () {
|
||||
webContents.fromId(b.guestId).once('did-finish-load', function () {
|
||||
// After our second redirect, cleanup and callback
|
||||
b.close()
|
||||
done()
|
||||
|
@ -308,7 +307,7 @@ describe('chromium feature', function () {
|
|||
}
|
||||
window.addEventListener('message', listener)
|
||||
b = window.open('file://' + fixtures + '/pages/window-open-postMessage.html', '', 'show=no')
|
||||
BrowserWindow.fromId(b.guestId).webContents.once('did-finish-load', function () {
|
||||
webContents.fromId(b.guestId).once('did-finish-load', function () {
|
||||
b.postMessage('testing', '*')
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Add table
Reference in a new issue