fix: send ELECTRON_BROWSER_CONTEXT_RELEASE asynchronously (#20632)

* fix: send ELECTRON_BROWSER_CONTEXT_RELEASE asynchronously

* test: remote references should be able to be cleared for all cases
This commit is contained in:
Milan Burda 2019-10-23 06:44:21 +02:00 committed by Cheng Zhao
parent 2abea22b4b
commit ba8f80267c
5 changed files with 43 additions and 5 deletions

View file

@ -127,6 +127,10 @@ class ObjectsRegistry {
this.clear(webContents, contextId)
}
}
// Note that the "render-view-deleted" event may not be emitted on time when
// the renderer process get destroyed because of navigation, we rely on the
// renderer process to send "ELECTRON_BROWSER_CONTEXT_RELEASE" message to
// guard this situation.
webContents.on('render-view-deleted' as any, listener)
}
}