Skip to content
This repository has been archived by the owner on Jan 4, 2019. It is now read-only.

<webview> / GuestView receives duplicate events for guest on re-attachment #515

Open
petemill opened this issue Mar 1, 2018 · 2 comments
Assignees
Labels
PR/work-in-progress ⚒ single-webview Supporting the single-webview project

Comments

@petemill
Copy link
Member

petemill commented Mar 1, 2018

STR:

Attach a guest to a window WebContents via a . (<webview>.attachGuest(x))
Detach (<webview>.detachGuest())
Repeat
Every event that is fired (e.g. 'update-target-url', 'load-start', 'guest-ready', 'will-destroy', etc) will fire as many times as the contents has been attached.

Cause

This is due to guest-view-manager.js attaching new listeners to those events every time a guest is attached to an embedder. Those listener handlers then fire IPC message to the window embedder, which forwards to the guest view (via guest-view-internal.js).

Fix

Part of the single-webview2 branch, contained in 2fbabc6

@petemill petemill added the single-webview Supporting the single-webview project label Mar 1, 2018
@petemill petemill self-assigned this Mar 1, 2018
petemill added a commit that referenced this issue Mar 1, 2018
@petemill
Copy link
Member Author

petemill commented Mar 1, 2018

Perhaps this is useful electron/electron@313b2fa

petemill added a commit that referenced this issue Mar 2, 2018
…ebview. Each time a webContents gets a new embedder, it will register with it.

Introduce 'set-window-id' and 'guest-created' WebContents events.

Fix #515
@petemill
Copy link
Member Author

petemill commented Mar 2, 2018

I created a potential fix in 2fbabc6 that introduces a new event set-window. At first, I saw that without attaching we get process add-new-contents event - the first event with a valid windowId, but we want to get an event every time the window changes, so we can change which embedder we're forwarding the events to. This seems to work.

petemill added a commit that referenced this issue Mar 2, 2018
…ebview. Each time a webContents gets a new embedder, it will register with it.

Introduce 'set-window-id' and 'guest-created' WebContents events.

Fix #515
petemill added a commit that referenced this issue Mar 2, 2018
…ebview. Each time a webContents gets a new embedder contents (window), it will register with it.

Introduce 'set-window' and 'guest-created' WebContents events.

Fix #515
petemill added a commit that referenced this issue Mar 2, 2018
…ebview. Each time a webContents gets a new embedder contents (window), it will register with it.

Introduce 'set-window' and 'guest-created' WebContents events.

Fix #515
petemill added a commit that referenced this issue Mar 2, 2018
…ebview. Each time a webContents gets a new embedder contents (window), it will register with it.

Introduce 'set-window' and 'guest-created' WebContents events.

Fix #515
bridiver pushed a commit that referenced this issue Mar 6, 2018
…ebview. Each time a webContents gets a new embedder contents (window), it will register with it.

Introduce 'set-window' and 'guest-created' WebContents events.

Fix #515
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
PR/work-in-progress ⚒ single-webview Supporting the single-webview project
Projects
None yet
Development

No branches or pull requests

1 participant