From 2f93735909af3f451c42d35fe7dde09bc1d30ccb Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 9 Jun 2016 13:41:42 -0700 Subject: [PATCH 1/2] Make BrowserWindowProxy guestId non-writeable --- lib/renderer/override.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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) From 2f88bec17742c47c6e0522ab775d7bf2c0cf0c8f Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 9 Jun 2016 13:45:05 -0700 Subject: [PATCH 2/2] Add guestId non-writeable assertions --- spec/chromium-spec.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/spec/chromium-spec.js b/spec/chromium-spec.js index cd046ab29abf..7a8c25b7b376 100644 --- a/spec/chromium-spec.js +++ b/spec/chromium-spec.js @@ -165,6 +165,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() })