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 url = require('url')
|
||||||
const remote = require('electron').remote
|
const remote = require('electron').remote
|
||||||
|
|
||||||
const BrowserWindow = remote.require('electron').BrowserWindow
|
const {BrowserWindow, session, webContents} = remote
|
||||||
const session = remote.require('electron').session
|
|
||||||
|
|
||||||
const isCI = remote.getGlobal('isCi')
|
const isCI = remote.getGlobal('isCi')
|
||||||
|
|
||||||
|
@ -235,7 +234,7 @@ describe('chromium feature', function () {
|
||||||
else
|
else
|
||||||
targetURL = 'file://' + fixtures + '/pages/base-page.html'
|
targetURL = 'file://' + fixtures + '/pages/base-page.html'
|
||||||
b = window.open(targetURL)
|
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)
|
assert.equal(b.location, targetURL)
|
||||||
b.close()
|
b.close()
|
||||||
done()
|
done()
|
||||||
|
@ -246,10 +245,10 @@ describe('chromium feature', function () {
|
||||||
// Load a page that definitely won't redirect
|
// Load a page that definitely won't redirect
|
||||||
var b
|
var b
|
||||||
b = window.open('about:blank')
|
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
|
// When it loads, redirect
|
||||||
b.location = 'file://' + fixtures + '/pages/base-page.html'
|
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
|
// After our second redirect, cleanup and callback
|
||||||
b.close()
|
b.close()
|
||||||
done()
|
done()
|
||||||
|
@ -308,7 +307,7 @@ describe('chromium feature', function () {
|
||||||
}
|
}
|
||||||
window.addEventListener('message', listener)
|
window.addEventListener('message', listener)
|
||||||
b = window.open('file://' + fixtures + '/pages/window-open-postMessage.html', '', 'show=no')
|
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', '*')
|
b.postMessage('testing', '*')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue