|
@@ -158,12 +158,12 @@ describe('BrowserWindow module', () => {
|
|
|
assert.equal(String(content), 'unload')
|
|
|
done()
|
|
|
})
|
|
|
- w.loadURL('file://' + path.join(fixtures, 'api', 'unload.html'))
|
|
|
+ w.loadFile(path.join(fixtures, 'api', 'unload.html'))
|
|
|
})
|
|
|
it('should emit beforeunload handler', (done) => {
|
|
|
w.once('onbeforeunload', () => { done() })
|
|
|
w.webContents.on('did-finish-load', () => { w.close() })
|
|
|
- w.loadURL(`file://${path.join(fixtures, 'api', 'beforeunload-false.html')}`)
|
|
|
+ w.loadFile(path.join(fixtures, 'api', 'beforeunload-false.html'))
|
|
|
})
|
|
|
it('should not crash when invoked synchronously inside navigation observer', (done) => {
|
|
|
const events = [
|
|
@@ -205,11 +205,11 @@ describe('BrowserWindow module', () => {
|
|
|
assert.equal(String(content), 'close')
|
|
|
done()
|
|
|
})
|
|
|
- w.loadURL(`file://${path.join(fixtures, 'api', 'close.html')}`)
|
|
|
+ w.loadFile(path.join(fixtures, 'api', 'close.html'))
|
|
|
})
|
|
|
it('should emit beforeunload handler', (done) => {
|
|
|
w.once('onbeforeunload', () => { done() })
|
|
|
- w.loadURL(`file://${path.join(fixtures, 'api', 'close-beforeunload-false.html')}`)
|
|
|
+ w.loadFile(path.join(fixtures, 'api', 'close-beforeunload-false.html'))
|
|
|
})
|
|
|
})
|
|
|
|
|
@@ -255,7 +255,7 @@ describe('BrowserWindow module', () => {
|
|
|
assert.equal(isMainFrame, false)
|
|
|
done()
|
|
|
})
|
|
|
- w.loadURL(`file://${path.join(fixtures, 'api', 'did-fail-load-iframe.html')}`)
|
|
|
+ w.loadFile(path.join(fixtures, 'api', 'did-fail-load-iframe.html'))
|
|
|
})
|
|
|
it('does not crash in did-fail-provisional-load handler', (done) => {
|
|
|
w.webContents.once('did-fail-provisional-load', () => {
|
|
@@ -334,7 +334,7 @@ describe('BrowserWindow module', () => {
|
|
|
it('allows the window to be closed from the event listener', (done) => {
|
|
|
ipcRenderer.send('close-on-will-navigate', w.id)
|
|
|
ipcRenderer.once('closed-on-will-navigate', () => { done() })
|
|
|
- w.loadURL(`file://${fixtures}/pages/will-navigate.html`)
|
|
|
+ w.loadFile(path.join(fixtures, 'pages', 'will-navigate.html'))
|
|
|
})
|
|
|
})
|
|
|
|
|
@@ -1202,7 +1202,7 @@ describe('BrowserWindow module', () => {
|
|
|
preload: preload
|
|
|
}
|
|
|
})
|
|
|
- w.loadURL(`file://${path.join(fixtures, 'api', 'preload.html')}`)
|
|
|
+ w.loadFile(path.join(fixtures, 'api', 'preload.html'))
|
|
|
})
|
|
|
it('can successfully delete the Buffer global', (done) => {
|
|
|
const preload = path.join(fixtures, 'module', 'delete-buffer.js')
|
|
@@ -1217,7 +1217,7 @@ describe('BrowserWindow module', () => {
|
|
|
preload: preload
|
|
|
}
|
|
|
})
|
|
|
- w.loadURL(`file://${path.join(fixtures, 'api', 'preload.html')}`)
|
|
|
+ w.loadFile(path.join(fixtures, 'api', 'preload.html'))
|
|
|
})
|
|
|
})
|
|
|
|
|
@@ -1254,7 +1254,7 @@ describe('BrowserWindow module', () => {
|
|
|
preload: path.join(fixtures, 'module', 'set-global-preload-3.js')
|
|
|
}
|
|
|
})
|
|
|
- w.loadURL('file://' + path.join(fixtures, 'api', 'preloads.html'))
|
|
|
+ w.loadFile(path.join(fixtures, 'api', 'preloads.html'))
|
|
|
})
|
|
|
})
|
|
|
|
|
@@ -1273,7 +1273,7 @@ describe('BrowserWindow module', () => {
|
|
|
additionalArguments: ['--my-magic-arg']
|
|
|
}
|
|
|
})
|
|
|
- w.loadURL(`file://${path.join(fixtures, 'api', 'blank.html')}`)
|
|
|
+ w.loadFile(path.join(fixtures, 'api', 'blank.html'))
|
|
|
})
|
|
|
|
|
|
it('adds extra value args to process.argv in the renderer process', (done) => {
|
|
@@ -1290,7 +1290,7 @@ describe('BrowserWindow module', () => {
|
|
|
additionalArguments: ['--my-magic-arg=foo']
|
|
|
}
|
|
|
})
|
|
|
- w.loadURL(`file://${path.join(fixtures, 'api', 'blank.html')}`)
|
|
|
+ w.loadFile(path.join(fixtures, 'api', 'blank.html'))
|
|
|
})
|
|
|
})
|
|
|
|
|
@@ -1310,7 +1310,7 @@ describe('BrowserWindow module', () => {
|
|
|
nodeIntegration: false
|
|
|
}
|
|
|
})
|
|
|
- w.loadURL(`file://${path.join(fixtures, 'api', 'blank.html')}`)
|
|
|
+ w.loadFile(path.join(fixtures, 'api', 'blank.html'))
|
|
|
})
|
|
|
})
|
|
|
|
|
@@ -1362,7 +1362,7 @@ describe('BrowserWindow module', () => {
|
|
|
preload: preload
|
|
|
}
|
|
|
})
|
|
|
- w.loadURL('file://' + path.join(fixtures, 'api', 'preload.html'))
|
|
|
+ w.loadFile(path.join(fixtures, 'api', 'preload.html'))
|
|
|
})
|
|
|
|
|
|
it('exposes ipcRenderer to preload script (path has special chars)', function (done) {
|
|
@@ -1379,7 +1379,7 @@ describe('BrowserWindow module', () => {
|
|
|
preload: preloadSpecialChars
|
|
|
}
|
|
|
})
|
|
|
- w.loadURL('file://' + path.join(fixtures, 'api', 'preload.html'))
|
|
|
+ w.loadFile(path.join(fixtures, 'api', 'preload.html'))
|
|
|
})
|
|
|
|
|
|
it('exposes "exit" event to preload script', function (done) {
|
|
@@ -1487,7 +1487,7 @@ describe('BrowserWindow module', () => {
|
|
|
assert.equal(args.includes('--enable-sandbox'), true)
|
|
|
done()
|
|
|
})
|
|
|
- w.loadURL(`file://${path.join(fixtures, 'api', 'new-window.html')}`)
|
|
|
+ w.loadFile(path.join(fixtures, 'api', 'new-window.html'))
|
|
|
})
|
|
|
|
|
|
it('should open windows with the options configured via new-window event listeners', (done) => {
|
|
@@ -1506,7 +1506,7 @@ describe('BrowserWindow module', () => {
|
|
|
assert.equal(webPreferences.foo, 'bar')
|
|
|
done()
|
|
|
})
|
|
|
- w.loadURL(`file://${path.join(fixtures, 'api', 'new-window.html')}`)
|
|
|
+ w.loadFile(path.join(fixtures, 'api', 'new-window.html'))
|
|
|
})
|
|
|
|
|
|
it('should set ipc event sender correctly', (done) => {
|
|
@@ -1630,7 +1630,7 @@ describe('BrowserWindow module', () => {
|
|
|
done()
|
|
|
}, 100)
|
|
|
})
|
|
|
- w.loadURL('file://' + path.join(fixtures, 'pages', 'window-open.html'))
|
|
|
+ w.loadFile(path.join(fixtures, 'pages', 'window-open.html'))
|
|
|
})
|
|
|
|
|
|
it('releases memory after popup is closed', (done) => {
|
|
@@ -1747,7 +1747,7 @@ describe('BrowserWindow module', () => {
|
|
|
preload: preload
|
|
|
}
|
|
|
})
|
|
|
- w.loadURL('file://' + path.join(fixtures, 'api', 'preload.html'))
|
|
|
+ w.loadFile(path.join(fixtures, 'api', 'preload.html'))
|
|
|
})
|
|
|
|
|
|
it('webview in sandbox renderer', async () => {
|
|
@@ -1760,7 +1760,7 @@ describe('BrowserWindow module', () => {
|
|
|
webviewTag: true
|
|
|
}
|
|
|
})
|
|
|
- w.loadURL(`file://${fixtures}/pages/webview-did-attach-event.html`)
|
|
|
+ w.loadFile(path.join(fixtures, 'pages', 'webview-did-attach-event.html'))
|
|
|
|
|
|
const [, webContents] = await emittedOnce(w.webContents, 'did-attach-webview')
|
|
|
const [, id] = await emittedOnce(ipcMain, 'webview-dom-ready')
|
|
@@ -1784,28 +1784,28 @@ describe('BrowserWindow module', () => {
|
|
|
assert.equal(content, 'Hello')
|
|
|
done()
|
|
|
})
|
|
|
- w.loadURL(`file://${path.join(fixtures, 'api', 'native-window-open-blank.html')}`)
|
|
|
+ w.loadFile(path.join(fixtures, 'api', 'native-window-open-blank.html'))
|
|
|
})
|
|
|
it('opens window of same domain with cross-scripting enabled', (done) => {
|
|
|
ipcMain.once('answer', (event, content) => {
|
|
|
assert.equal(content, 'Hello')
|
|
|
done()
|
|
|
})
|
|
|
- w.loadURL(`file://${path.join(fixtures, 'api', 'native-window-open-file.html')}`)
|
|
|
+ w.loadFile(path.join(fixtures, 'api', 'native-window-open-file.html'))
|
|
|
})
|
|
|
it('blocks accessing cross-origin frames', (done) => {
|
|
|
ipcMain.once('answer', (event, content) => {
|
|
|
assert.equal(content, 'Blocked a frame with origin "file://" from accessing a cross-origin frame.')
|
|
|
done()
|
|
|
})
|
|
|
- w.loadURL(`file://${path.join(fixtures, 'api', 'native-window-open-cross-origin.html')}`)
|
|
|
+ w.loadFile(path.join(fixtures, 'api', 'native-window-open-cross-origin.html'))
|
|
|
})
|
|
|
it('opens window from <iframe> tags', (done) => {
|
|
|
ipcMain.once('answer', (event, content) => {
|
|
|
assert.equal(content, 'Hello')
|
|
|
done()
|
|
|
})
|
|
|
- w.loadURL(`file://${path.join(fixtures, 'api', 'native-window-open-iframe.html')}`)
|
|
|
+ w.loadFile(path.join(fixtures, 'api', 'native-window-open-iframe.html'))
|
|
|
});
|
|
|
(nativeModulesEnabled ? it : it.skip)('loads native addons correctly after reload', (done) => {
|
|
|
ipcMain.once('answer', (event, content) => {
|
|
@@ -1816,7 +1816,7 @@ describe('BrowserWindow module', () => {
|
|
|
})
|
|
|
w.reload()
|
|
|
})
|
|
|
- w.loadURL(`file://${path.join(fixtures, 'api', 'native-window-open-native-addon.html')}`)
|
|
|
+ w.loadFile(path.join(fixtures, 'api', 'native-window-open-native-addon.html'))
|
|
|
})
|
|
|
it('should inherit the nativeWindowOpen setting in opened windows', (done) => {
|
|
|
w.destroy()
|
|
@@ -1833,7 +1833,7 @@ describe('BrowserWindow module', () => {
|
|
|
assert.equal(args.includes('--native-window-open'), true)
|
|
|
done()
|
|
|
})
|
|
|
- w.loadURL(`file://${path.join(fixtures, 'api', 'new-window.html')}`)
|
|
|
+ w.loadFile(path.join(fixtures, 'api', 'new-window.html'))
|
|
|
})
|
|
|
it('should open windows with the options configured via new-window event listeners', (done) => {
|
|
|
w.destroy()
|
|
@@ -1851,7 +1851,7 @@ describe('BrowserWindow module', () => {
|
|
|
assert.equal(webPreferences.foo, 'bar')
|
|
|
done()
|
|
|
})
|
|
|
- w.loadURL(`file://${path.join(fixtures, 'api', 'new-window.html')}`)
|
|
|
+ w.loadFile(path.join(fixtures, 'api', 'new-window.html'))
|
|
|
})
|
|
|
it('retains the original web preferences when window.location is changed to a new origin', async () => {
|
|
|
await serveFileFromProtocol('foo', path.join(fixtures, 'api', 'window-open-location-change.html'))
|
|
@@ -1874,7 +1874,7 @@ describe('BrowserWindow module', () => {
|
|
|
assert.equal(typeofProcess, 'undefined')
|
|
|
resolve()
|
|
|
})
|
|
|
- w.loadURL(`file://${path.join(fixtures, 'api', 'window-open-location-open.html')}`)
|
|
|
+ w.loadFile(path.join(fixtures, 'api', 'window-open-location-open.html'))
|
|
|
})
|
|
|
})
|
|
|
})
|
|
@@ -1898,22 +1898,22 @@ describe('BrowserWindow module', () => {
|
|
|
assert.equal(content, 'Hello')
|
|
|
done()
|
|
|
})
|
|
|
- w.loadURL(`file://${path.join(fixtures, 'api', 'native-window-open-isolated.html')}`)
|
|
|
+ w.loadFile(path.join(fixtures, 'api', 'native-window-open-isolated.html'))
|
|
|
})
|
|
|
})
|
|
|
|
|
|
describe('beforeunload handler', () => {
|
|
|
it('returning undefined would not prevent close', (done) => {
|
|
|
w.once('closed', () => { done() })
|
|
|
- w.loadURL('file://' + path.join(fixtures, 'api', 'close-beforeunload-undefined.html'))
|
|
|
+ w.loadFile(path.join(fixtures, 'api', 'close-beforeunload-undefined.html'))
|
|
|
})
|
|
|
it('returning false would prevent close', (done) => {
|
|
|
w.once('onbeforeunload', () => { done() })
|
|
|
- w.loadURL(`file://${path.join(fixtures, 'api', 'close-beforeunload-false.html')}`)
|
|
|
+ w.loadFile(path.join(fixtures, 'api', 'close-beforeunload-false.html'))
|
|
|
})
|
|
|
it('returning empty string would prevent close', (done) => {
|
|
|
w.once('onbeforeunload', () => { done() })
|
|
|
- w.loadURL(`file://${path.join(fixtures, 'api', 'close-beforeunload-empty-string.html')}`)
|
|
|
+ w.loadFile(path.join(fixtures, 'api', 'close-beforeunload-empty-string.html'))
|
|
|
})
|
|
|
it('emits for each close attempt', (done) => {
|
|
|
let beforeUnloadCount = 0
|
|
@@ -1926,7 +1926,7 @@ describe('BrowserWindow module', () => {
|
|
|
}
|
|
|
})
|
|
|
w.webContents.once('did-finish-load', () => { w.close() })
|
|
|
- w.loadURL(`file://${path.join(fixtures, 'api', 'beforeunload-false-prevent3.html')}`)
|
|
|
+ w.loadFile(path.join(fixtures, 'api', 'beforeunload-false-prevent3.html'))
|
|
|
})
|
|
|
it('emits for each reload attempt', (done) => {
|
|
|
let beforeUnloadCount = 0
|
|
@@ -1944,7 +1944,7 @@ describe('BrowserWindow module', () => {
|
|
|
})
|
|
|
w.reload()
|
|
|
})
|
|
|
- w.loadURL(`file://${path.join(fixtures, 'api', 'beforeunload-false-prevent3.html')}`)
|
|
|
+ w.loadFile(path.join(fixtures, 'api', 'beforeunload-false-prevent3.html'))
|
|
|
})
|
|
|
it('emits for each navigation attempt', (done) => {
|
|
|
let beforeUnloadCount = 0
|
|
@@ -1962,7 +1962,7 @@ describe('BrowserWindow module', () => {
|
|
|
})
|
|
|
w.loadURL('about:blank')
|
|
|
})
|
|
|
- w.loadURL(`file://${path.join(fixtures, 'api', 'beforeunload-false-prevent3.html')}`)
|
|
|
+ w.loadFile(path.join(fixtures, 'api', 'beforeunload-false-prevent3.html'))
|
|
|
})
|
|
|
})
|
|
|
|
|
@@ -2004,7 +2004,7 @@ describe('BrowserWindow module', () => {
|
|
|
done()
|
|
|
})
|
|
|
|
|
|
- w.loadURL(`file://${path.join(fixtures, 'pages', 'visibilitychange.html')}`)
|
|
|
+ w.loadFile(path.join(fixtures, 'pages', 'visibilitychange.html'))
|
|
|
})
|
|
|
it('visibilityState changes when window is hidden', (done) => {
|
|
|
w = new BrowserWindow({width: 100, height: 100})
|
|
@@ -2022,7 +2022,7 @@ describe('BrowserWindow module', () => {
|
|
|
w.hide()
|
|
|
})
|
|
|
|
|
|
- w.loadURL(`file://${path.join(fixtures, 'pages', 'visibilitychange.html')}`)
|
|
|
+ w.loadFile(path.join(fixtures, 'pages', 'visibilitychange.html'))
|
|
|
})
|
|
|
it('visibilityState changes when window is shown', (done) => {
|
|
|
w = new BrowserWindow({width: 100, height: 100})
|
|
@@ -2039,7 +2039,7 @@ describe('BrowserWindow module', () => {
|
|
|
w.show()
|
|
|
})
|
|
|
|
|
|
- w.loadURL(`file://${path.join(fixtures, 'pages', 'visibilitychange.html')}`)
|
|
|
+ w.loadFile(path.join(fixtures, 'pages', 'visibilitychange.html'))
|
|
|
})
|
|
|
it('visibilityState changes when window is shown inactive', function (done) {
|
|
|
if (isCI && process.platform === 'win32') {
|
|
@@ -2065,7 +2065,7 @@ describe('BrowserWindow module', () => {
|
|
|
w.showInactive()
|
|
|
})
|
|
|
|
|
|
- w.loadURL(`file://${path.join(fixtures, 'pages', 'visibilitychange.html')}`)
|
|
|
+ w.loadFile(path.join(fixtures, 'pages', 'visibilitychange.html'))
|
|
|
})
|
|
|
it('visibilityState changes when window is minimized', function (done) {
|
|
|
if (isCI && process.platform === 'linux') {
|
|
@@ -2092,7 +2092,7 @@ describe('BrowserWindow module', () => {
|
|
|
w.minimize()
|
|
|
})
|
|
|
|
|
|
- w.loadURL(`file://${path.join(fixtures, 'pages', 'visibilitychange.html')}`)
|
|
|
+ w.loadFile(path.join(fixtures, 'pages', 'visibilitychange.html'))
|
|
|
})
|
|
|
it('visibilityState remains visible if backgroundThrottling is disabled', (done) => {
|
|
|
w = new BrowserWindow({
|
|
@@ -2124,7 +2124,7 @@ describe('BrowserWindow module', () => {
|
|
|
})
|
|
|
w.show()
|
|
|
|
|
|
- w.loadURL(`file://${path.join(fixtures, 'pages', 'visibilitychange.html')}`)
|
|
|
+ w.loadFile(path.join(fixtures, 'pages', 'visibilitychange.html'))
|
|
|
})
|
|
|
})
|
|
|
|
|
@@ -2143,7 +2143,7 @@ describe('BrowserWindow module', () => {
|
|
|
assert.equal(additionalFeatures[0], 'this-is-not-a-standard-feature')
|
|
|
done()
|
|
|
})
|
|
|
- w.loadURL(`file://${fixtures}/pages/window-open.html`)
|
|
|
+ w.loadFile(path.join(fixtures, 'pages', 'window-open.html'))
|
|
|
})
|
|
|
it('emits when window.open is called with no webPreferences', (done) => {
|
|
|
w.destroy()
|
|
@@ -2155,8 +2155,9 @@ describe('BrowserWindow module', () => {
|
|
|
assert.equal(additionalFeatures[0], 'this-is-not-a-standard-feature')
|
|
|
done()
|
|
|
})
|
|
|
- w.loadURL(`file://${fixtures}/pages/window-open.html`)
|
|
|
+ w.loadFile(path.join(fixtures, 'pages', 'window-open.html'))
|
|
|
})
|
|
|
+
|
|
|
it('emits when link with target is called', (done) => {
|
|
|
w.webContents.once('new-window', (e, url, frameName) => {
|
|
|
e.preventDefault()
|
|
@@ -2164,7 +2165,7 @@ describe('BrowserWindow module', () => {
|
|
|
assert.equal(frameName, 'target')
|
|
|
done()
|
|
|
})
|
|
|
- w.loadURL(`file://${fixtures}/pages/target-name.html`)
|
|
|
+ w.loadFile(path.join(fixtures, 'pages', 'target-name.html'))
|
|
|
})
|
|
|
})
|
|
|
|
|
@@ -2264,7 +2265,7 @@ describe('BrowserWindow module', () => {
|
|
|
|
|
|
it('subscribes to frame updates', (done) => {
|
|
|
let called = false
|
|
|
- w.loadURL(`file://${fixtures}/api/frame-subscriber.html`)
|
|
|
+ w.loadFile(path.join(fixtures, 'api', 'frame-subscriber.html'))
|
|
|
w.webContents.on('dom-ready', () => {
|
|
|
w.webContents.beginFrameSubscription(function (data) {
|
|
|
// This callback might be called twice.
|
|
@@ -2279,7 +2280,7 @@ describe('BrowserWindow module', () => {
|
|
|
})
|
|
|
it('subscribes to frame updates (only dirty rectangle)', (done) => {
|
|
|
let called = false
|
|
|
- w.loadURL(`file://${fixtures}/api/frame-subscriber.html`)
|
|
|
+ w.loadFile(path.join(fixtures, 'api', 'frame-subscriber.html'))
|
|
|
w.webContents.on('dom-ready', () => {
|
|
|
w.webContents.beginFrameSubscription(true, (data) => {
|
|
|
// This callback might be called twice.
|
|
@@ -2293,7 +2294,7 @@ describe('BrowserWindow module', () => {
|
|
|
})
|
|
|
})
|
|
|
it('throws error when subscriber is not well defined', (done) => {
|
|
|
- w.loadURL(`file://${fixtures}'/api/frame-subscriber.html`)
|
|
|
+ w.loadFile(path.join(fixtures, 'api', 'frame-subscriber.html'))
|
|
|
try {
|
|
|
w.webContents.beginFrameSubscription(true, true)
|
|
|
} catch (e) {
|
|
@@ -2330,7 +2331,7 @@ describe('BrowserWindow module', () => {
|
|
|
done()
|
|
|
})
|
|
|
})
|
|
|
- w.loadURL('file://' + fixtures + '/pages/save_page/index.html')
|
|
|
+ w.loadFile(path.join(fixtures, 'pages', 'save_page', 'index.html'))
|
|
|
})
|
|
|
})
|
|
|
|
|
@@ -3276,29 +3277,29 @@ describe('BrowserWindow module', () => {
|
|
|
})
|
|
|
|
|
|
it('separates the page context from the Electron/preload context', async () => {
|
|
|
- iw.loadURL(`file://${fixtures}/api/isolated.html`)
|
|
|
+ iw.loadFile(path.join(fixtures, 'api', 'isolated.html'))
|
|
|
const [, data] = await emittedOnce(ipcMain, 'isolated-world')
|
|
|
assert.deepEqual(data, expectedContextData)
|
|
|
})
|
|
|
it('recreates the contexts on reload', async () => {
|
|
|
- iw.loadURL(`file://${fixtures}/api/isolated.html`)
|
|
|
+ iw.loadFile(path.join(fixtures, 'api', 'isolated.html'))
|
|
|
await emittedOnce(iw.webContents, 'did-finish-load')
|
|
|
iw.webContents.reload()
|
|
|
const [, data] = await emittedOnce(ipcMain, 'isolated-world')
|
|
|
assert.deepEqual(data, expectedContextData)
|
|
|
})
|
|
|
it('enables context isolation on child windows', async () => {
|
|
|
- iw.loadURL(`file://${fixtures}/pages/window-open.html`)
|
|
|
+ iw.loadFile(path.join(fixtures, 'pages', 'window-open.html'))
|
|
|
const [, window] = await emittedOnce(app, 'browser-window-created')
|
|
|
assert.ok(window.webContents.getLastWebPreferences().contextIsolation)
|
|
|
})
|
|
|
it('separates the page context from the Electron/preload context with sandbox on', async () => {
|
|
|
- ws.loadURL(`file://${fixtures}/api/isolated.html`)
|
|
|
+ ws.loadFile(path.join(fixtures, 'api', 'isolated.html'))
|
|
|
const [, data] = await emittedOnce(ipcMain, 'isolated-world')
|
|
|
assert.deepEqual(data, expectedContextData)
|
|
|
})
|
|
|
it('recreates the contexts on reload with sandbox on', async () => {
|
|
|
- ws.loadURL(`file://${fixtures}/api/isolated.html`)
|
|
|
+ ws.loadFile(path.join(fixtures, 'api', 'isolated.html'))
|
|
|
await emittedOnce(ws.webContents, 'did-finish-load')
|
|
|
ws.webContents.reload()
|
|
|
const [, data] = await emittedOnce(ipcMain, 'isolated-world')
|
|
@@ -3358,12 +3359,12 @@ describe('BrowserWindow module', () => {
|
|
|
assertWithinDelta(size.height, 100, 2, 'height')
|
|
|
done()
|
|
|
})
|
|
|
- w.loadURL('file://' + fixtures + '/api/offscreen-rendering.html')
|
|
|
+ w.loadFile(path.join(fixtures, 'api', 'offscreen-rendering.html'))
|
|
|
})
|
|
|
|
|
|
describe('window.webContents.isOffscreen()', () => {
|
|
|
it('is true for offscreen type', () => {
|
|
|
- w.loadURL('file://' + fixtures + '/api/offscreen-rendering.html')
|
|
|
+ w.loadFile(path.join(fixtures, 'api', 'offscreen-rendering.html'))
|
|
|
assert.equal(w.webContents.isOffscreen(), true)
|
|
|
})
|
|
|
|
|
@@ -3380,7 +3381,7 @@ describe('BrowserWindow module', () => {
|
|
|
assert.equal(w.webContents.isPainting(), true)
|
|
|
done()
|
|
|
})
|
|
|
- w.loadURL('file://' + fixtures + '/api/offscreen-rendering.html')
|
|
|
+ w.loadFile(path.join(fixtures, 'api', 'offscreen-rendering.html'))
|
|
|
})
|
|
|
})
|
|
|
|
|
@@ -3391,7 +3392,7 @@ describe('BrowserWindow module', () => {
|
|
|
assert.equal(w.webContents.isPainting(), false)
|
|
|
done()
|
|
|
})
|
|
|
- w.loadURL('file://' + fixtures + '/api/offscreen-rendering.html')
|
|
|
+ w.loadFile(path.join(fixtures, 'api', 'offscreen-rendering.html'))
|
|
|
})
|
|
|
})
|
|
|
|
|
@@ -3405,7 +3406,7 @@ describe('BrowserWindow module', () => {
|
|
|
done()
|
|
|
})
|
|
|
})
|
|
|
- w.loadURL('file://' + fixtures + '/api/offscreen-rendering.html')
|
|
|
+ w.loadFile(path.join(fixtures, 'api', 'offscreen-rendering.html'))
|
|
|
})
|
|
|
})
|
|
|
|
|
@@ -3415,7 +3416,7 @@ describe('BrowserWindow module', () => {
|
|
|
assert.equal(w.webContents.getFrameRate(), 60)
|
|
|
done()
|
|
|
})
|
|
|
- w.loadURL('file://' + fixtures + '/api/offscreen-rendering.html')
|
|
|
+ w.loadFile(path.join(fixtures, 'api', 'offscreen-rendering.html'))
|
|
|
})
|
|
|
})
|
|
|
|
|
@@ -3428,7 +3429,7 @@ describe('BrowserWindow module', () => {
|
|
|
done()
|
|
|
})
|
|
|
})
|
|
|
- w.loadURL('file://' + fixtures + '/api/offscreen-rendering.html')
|
|
|
+ w.loadFile(path.join(fixtures, 'api', 'offscreen-rendering.html'))
|
|
|
})
|
|
|
})
|
|
|
})
|