Merge pull request #5972 from electron/non-writeable-guest-id
Make guestId on BrowserWindowProxy non-writeable
This commit is contained in:
commit
4373dc1eac
2 changed files with 13 additions and 1 deletions
|
@ -25,7 +25,13 @@ var BrowserWindowProxy = (function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
function BrowserWindowProxy (guestId1) {
|
function BrowserWindowProxy (guestId1) {
|
||||||
this.guestId = guestId1
|
Object.defineProperty(this, 'guestId', {
|
||||||
|
configurable: false,
|
||||||
|
enumerable: true,
|
||||||
|
writeable: false,
|
||||||
|
value: guestId1
|
||||||
|
})
|
||||||
|
|
||||||
this.closed = false
|
this.closed = false
|
||||||
ipcRenderer.once('ELECTRON_GUEST_WINDOW_MANAGER_WINDOW_CLOSED_' + this.guestId, () => {
|
ipcRenderer.once('ELECTRON_GUEST_WINDOW_MANAGER_WINDOW_CLOSED_' + this.guestId, () => {
|
||||||
BrowserWindowProxy.remove(this.guestId)
|
BrowserWindowProxy.remove(this.guestId)
|
||||||
|
|
|
@ -164,6 +164,12 @@ describe('chromium feature', function () {
|
||||||
var b = window.open('about:blank', '', 'show=no')
|
var b = window.open('about:blank', '', 'show=no')
|
||||||
assert.equal(b.closed, false)
|
assert.equal(b.closed, false)
|
||||||
assert.equal(b.constructor.name, 'BrowserWindowProxy')
|
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()
|
b.close()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue