mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
Get webContents from guestId
This commit is contained in:
@@ -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', '*')
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user