fix: make webContents.id work even after destroy (#27038)
This commit is contained in:
parent
8cbcb04e84
commit
da3d21e5e3
1 changed files with 7 additions and 0 deletions
|
@ -503,6 +503,13 @@ WebContents.prototype._init = function () {
|
|||
this.goToOffset = navigationController.goToOffset.bind(navigationController);
|
||||
this.getActiveIndex = navigationController.getActiveIndex.bind(navigationController);
|
||||
this.length = navigationController.length.bind(navigationController);
|
||||
// Read off the ID at construction time, so that it's accessible even after
|
||||
// the underlying C++ WebContents is destroyed.
|
||||
const id = this.id;
|
||||
Object.defineProperty(this, 'id', {
|
||||
value: id,
|
||||
writable: false
|
||||
});
|
||||
|
||||
this._windowOpenHandler = null;
|
||||
|
||||
|
|
Loading…
Reference in a new issue