fix: set setter of window.location
This commit is contained in:
parent
e80e3a53e9
commit
fc4e10b6c0
2 changed files with 12 additions and 2 deletions
|
@ -103,7 +103,17 @@ function LocationProxy (ipcRenderer, guestId) {
|
||||||
|
|
||||||
function BrowserWindowProxy (ipcRenderer, guestId) {
|
function BrowserWindowProxy (ipcRenderer, guestId) {
|
||||||
this.closed = false
|
this.closed = false
|
||||||
this.location = new LocationProxy(ipcRenderer, guestId)
|
|
||||||
|
const location = new LocationProxy(ipcRenderer, guestId)
|
||||||
|
defineProperty(this, 'location', {
|
||||||
|
get: function () {
|
||||||
|
return location
|
||||||
|
},
|
||||||
|
set: function (url) {
|
||||||
|
url = resolveURL(url)
|
||||||
|
return ipcRenderer.sendSync('ELECTRON_GUEST_WINDOW_MANAGER_WEB_CONTENTS_METHOD_SYNC', guestId, 'loadURL', url)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
ipcRenderer.once(`ELECTRON_GUEST_WINDOW_MANAGER_WINDOW_CLOSED_${guestId}`, () => {
|
ipcRenderer.once(`ELECTRON_GUEST_WINDOW_MANAGER_WINDOW_CLOSED_${guestId}`, () => {
|
||||||
removeProxy(guestId)
|
removeProxy(guestId)
|
||||||
|
|
|
@ -515,7 +515,7 @@ describe('chromium feature', () => {
|
||||||
}
|
}
|
||||||
app.once('browser-window-created', (event, window) => {
|
app.once('browser-window-created', (event, window) => {
|
||||||
window.webContents.once('did-finish-load', () => {
|
window.webContents.once('did-finish-load', () => {
|
||||||
assert.strictEqual(b.location, targetURL)
|
assert.strictEqual(b.location.href, targetURL)
|
||||||
b.close()
|
b.close()
|
||||||
done()
|
done()
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue