diff --git a/lib/renderer/override.js b/lib/renderer/override.js index 5667e5e16f55..ced2318e7188 100644 --- a/lib/renderer/override.js +++ b/lib/renderer/override.js @@ -25,7 +25,13 @@ var BrowserWindowProxy = (function () { } function BrowserWindowProxy (guestId1) { - this.guestId = guestId1 + Object.defineProperty(this, 'guestId', { + configurable: false, + enumerable: true, + writeable: false, + value: guestId1 + }) + this.closed = false ipcRenderer.once('ELECTRON_GUEST_WINDOW_MANAGER_WINDOW_CLOSED_' + this.guestId, () => { BrowserWindowProxy.remove(this.guestId) diff --git a/spec/chromium-spec.js b/spec/chromium-spec.js index 939570d6abce..68836fb927ed 100644 --- a/spec/chromium-spec.js +++ b/spec/chromium-spec.js @@ -164,6 +164,12 @@ describe('chromium feature', function () { var b = window.open('about:blank', '', 'show=no') assert.equal(b.closed, false) assert.equal(b.constructor.name, 'BrowserWindowProxy') + + // Check that guestId is not writeable + assert(b.guestId) + b.guestId = 'anotherValue' + assert.notEqual(b.guestId, 'anoterValue') + b.close() })