fix: set setter of window.location

This commit is contained in:
Cheng Zhao 2018-12-04 16:22:03 +09:00
parent e80e3a53e9
commit fc4e10b6c0
2 changed files with 12 additions and 2 deletions

View file

@ -103,7 +103,17 @@ function LocationProxy (ipcRenderer, guestId) {
function BrowserWindowProxy (ipcRenderer, guestId) {
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}`, () => {
removeProxy(guestId)