Revert: electron/electron#14487 (#19011)
This commit is contained in:
parent
75a020e0ac
commit
e26f366405
6 changed files with 3 additions and 67 deletions
|
@ -66,19 +66,6 @@ const createGuest = function (embedder, params) {
|
|||
}
|
||||
|
||||
// Clear the guest from map when it is destroyed.
|
||||
//
|
||||
// The guest WebContents is usually destroyed in 2 cases:
|
||||
// 1. The embedder frame is closed (reloaded or destroyed), and it
|
||||
// automatically closes the guest frame.
|
||||
// 2. The guest frame is detached dynamically via JS, and it is manually
|
||||
// destroyed when the renderer sends the GUEST_VIEW_MANAGER_DESTROY_GUEST
|
||||
// message.
|
||||
// The second case relies on the libcc patch:
|
||||
// https://github.com/electron/libchromiumcontent/pull/676
|
||||
// The patch was introduced to work around a bug in Chromium:
|
||||
// https://github.com/electron/electron/issues/14211
|
||||
// We should revisit the bug to see if we can remove our libcc patch, the
|
||||
// patch was introduced in Chrome 66.
|
||||
guest.once('destroyed', () => {
|
||||
if (guestInstanceId in guestInstances) {
|
||||
detachGuest(embedder, guestInstanceId)
|
||||
|
@ -340,15 +327,6 @@ handleMessage('ELECTRON_GUEST_VIEW_MANAGER_CREATE_GUEST', function (event, param
|
|||
return createGuest(event.sender, params)
|
||||
})
|
||||
|
||||
handleMessage('ELECTRON_GUEST_VIEW_MANAGER_DESTROY_GUEST', function (event, guestInstanceId) {
|
||||
try {
|
||||
const guest = getGuestForWebContents(guestInstanceId, event.sender)
|
||||
guest.detachFromOuterFrame()
|
||||
} catch (error) {
|
||||
console.error(`Guest destroy failed: ${error}`)
|
||||
}
|
||||
})
|
||||
|
||||
handleMessage('ELECTRON_GUEST_VIEW_MANAGER_ATTACH_GUEST', function (event, embedderFrameId, elementInstanceId, guestInstanceId, params) {
|
||||
try {
|
||||
attachGuest(event, embedderFrameId, elementInstanceId, guestInstanceId, params)
|
||||
|
|
|
@ -100,10 +100,6 @@ export function createGuestSync (params: Record<string, any>): number {
|
|||
return invokeSync('ELECTRON_GUEST_VIEW_MANAGER_CREATE_GUEST', params)
|
||||
}
|
||||
|
||||
export function destroyGuest (guestInstanceId: number): void {
|
||||
invoke('ELECTRON_GUEST_VIEW_MANAGER_DESTROY_GUEST', guestInstanceId)
|
||||
}
|
||||
|
||||
export function attachGuest (
|
||||
elementInstanceId: number, guestInstanceId: number, params: Record<string, any>, contentWindow: Window
|
||||
) {
|
||||
|
@ -118,6 +114,5 @@ export const guestViewInternalModule = {
|
|||
deregisterEvents,
|
||||
createGuest,
|
||||
createGuestSync,
|
||||
destroyGuest,
|
||||
attachGuest
|
||||
}
|
||||
|
|
|
@ -69,7 +69,6 @@ export class WebViewImpl {
|
|||
// heard back from createGuest yet. We will not reset the flag in this case so
|
||||
// that we don't end up allocating a second guest.
|
||||
if (this.guestInstanceId) {
|
||||
guestViewInternal.destroyGuest(this.guestInstanceId)
|
||||
this.guestInstanceId = void 0
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue