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

Tab is destroyed if switched during first attach #13798

Closed
petemill opened this issue Apr 11, 2018 · 4 comments
Closed

Tab is destroyed if switched during first attach #13798

petemill opened this issue Apr 11, 2018 · 4 comments
Labels
0.22.x-single-webview Issue first seen on single-webview build against v0.22.x branch QA/no-qa-needed regression release-notes/exclude

Comments

@petemill
Copy link
Member

First attach of a tab seems to cause the WebContents to attach, then detach, then attach again very quickly. If the active tab is switched during the 'detach' phase, then the WebContents will not be properly detached and will be destroyed when the new Tab is attached. This is because the WebContents does not report as attached, even though it is about to automatically attach again.

@bridiver do you know if muon is to blame for the attach -> detach -> attach initial repeat, or somewhere deep in Chromium? It complicates things when there is no trustworthy event or property for whether it is attached or detached, or even attaching or detaching, since when we receive did-attach, we have no way of knowing if the WebContents will emit did-detach and did-attach very quickly again ...and we do not want to attach another guest to the view if the WebContents is reporting it is not attached but is actually about to attach again (automatically).

I encountered this by pinning a tab, and then opening a new window (which at the moment causes active tab to switch very quickly from the new non-pinned tab to the new pinned tab). It usually repeats once within 10 new windows, as it's a timing issue.

@petemill petemill added regression 0.22.x-single-webview Issue first seen on single-webview build against v0.22.x branch labels Apr 11, 2018
@petemill petemill added this to the 0.22.x Release 3 (Beta channel) milestone Apr 11, 2018
@petemill
Copy link
Member Author

petemill commented Apr 11, 2018

This could be worked around by instead of working out whether we need to detach and attach to another WebContents after did-attach, we wait for render-view-ready. Unfortunately, whilst this works well for subsequent attaches for a Tab, the first attach only fires render-view-ready if we "bump" the webview by hiding and showing it. This in itself would be good to fix inside muon before launch because of the apparent flimsiness of our display workarounds.

Here's what's going on when a tab is setActive, and has it's guestInstanceId passed to a webview's .attachGuest for the first time:

tabs.setActive: 84
Tab [84] event 'set-active'
tab [84 via process] chrome-tabs-updated { active: true, highlighted: true, selected: true }
Tab [84] event 'will-attach'
Tab [84] event 'did-attach'
tab [84 via process] chrome-tabs-updated { height: 972, width: 1451 }
Tab [84] event 'preferred-size-changed'
Tab [84] event 'ipc-message-host'
Tab [84] event 'preferred-size-changed'
Tab [84] event 'did-detach'
Tab [84] event 'will-attach'
Tab [84] event 'did-attach'
Tab [84] event 'render-view-ready'
Tab [84] event 'guest-ready'

@petemill
Copy link
Member Author

The attach -> detach -> attach is actually caused by our code hiding and showing the <webview> for the webview's first attach in order to force it to paint.

petemill added a commit that referenced this issue Apr 11, 2018
Fix #13798 since "display: none" and then "display: ''" of a webview will cause the guest to (asynchronously) detach and attach again, and by that time we had attached another guest, which causes the original tab to be destroyed since we are attaching a guest to a webview which already has a guest.
Luckily, it doesn't look like this workaround is needed in order to paint the first attachGuest of a webview anymore.
petemill added a commit that referenced this issue Apr 11, 2018
Fix #13798 since "display: none" and then "display: ''" of a webview will cause the guest to (asynchronously) detach and attach again, and by that time we had attached another guest, which causes the original tab to be destroyed since we are attaching a guest to a webview which already has a guest.
Luckily, it doesn't look like this workaround is needed in order to paint the first attachGuest of a webview anymore.
petemill added a commit that referenced this issue Apr 11, 2018
Fix #13798 since "display: none" and then "display: ''" of a webview will cause the guest to (asynchronously) detach and attach again, and by that time we had attached another guest, which causes the original tab to be destroyed since we are attaching a guest to a webview which already has a guest.
Luckily, it doesn't look like this workaround is needed in order to paint the first attachGuest of a webview anymore.
petemill added a commit that referenced this issue Apr 11, 2018
Fix #13798 since "display: none" and then "display: ''" of a webview will cause the guest to (asynchronously) detach and attach again, and by that time we had attached another guest, which causes the original tab to be destroyed since we are attaching a guest to a webview which already has a guest.
Luckily, it doesn't look like this workaround is needed in order to paint the first attachGuest of a webview anymore.
@petemill
Copy link
Member Author

Should be fixed in 0.22.109

petemill added a commit that referenced this issue Apr 30, 2018
Fix #13798 since "display: none" and then "display: ''" of a webview will cause the guest to (asynchronously) detach and attach again, and by that time we had attached another guest, which causes the original tab to be destroyed since we are attaching a guest to a webview which already has a guest.
Luckily, it doesn't look like this workaround is needed in order to paint the first attachGuest of a webview anymore.
petemill added a commit that referenced this issue Apr 30, 2018
Fix #13798 since "display: none" and then "display: ''" of a webview will cause the guest to (asynchronously) detach and attach again, and by that time we had attached another guest, which causes the original tab to be destroyed since we are attaching a guest to a webview which already has a guest.
Luckily, it doesn't look like this workaround is needed in order to paint the first attachGuest of a webview anymore.
petemill added a commit that referenced this issue May 1, 2018
Fix #13798 since "display: none" and then "display: ''" of a webview will cause the guest to (asynchronously) detach and attach again, and by that time we had attached another guest, which causes the original tab to be destroyed since we are attaching a guest to a webview which already has a guest.
Luckily, it doesn't look like this workaround is needed in order to paint the first attachGuest of a webview anymore.
petemill added a commit that referenced this issue May 2, 2018
Fix #13798 since "display: none" and then "display: ''" of a webview will cause the guest to (asynchronously) detach and attach again, and by that time we had attached another guest, which causes the original tab to be destroyed since we are attaching a guest to a webview which already has a guest.
Luckily, it doesn't look like this workaround is needed in order to paint the first attachGuest of a webview anymore.
petemill added a commit that referenced this issue May 3, 2018
Fix #13798 since "display: none" and then "display: ''" of a webview will cause the guest to (asynchronously) detach and attach again, and by that time we had attached another guest, which causes the original tab to be destroyed since we are attaching a guest to a webview which already has a guest.
Luckily, it doesn't look like this workaround is needed in order to paint the first attachGuest of a webview anymore.
petemill added a commit that referenced this issue May 7, 2018
Fix #13798 since "display: none" and then "display: ''" of a webview will cause the guest to (asynchronously) detach and attach again, and by that time we had attached another guest, which causes the original tab to be destroyed since we are attaching a guest to a webview which already has a guest.
Luckily, it doesn't look like this workaround is needed in order to paint the first attachGuest of a webview anymore.
petemill added a commit that referenced this issue May 8, 2018
Fix #13798 since "display: none" and then "display: ''" of a webview will cause the guest to (asynchronously) detach and attach again, and by that time we had attached another guest, which causes the original tab to be destroyed since we are attaching a guest to a webview which already has a guest.
Luckily, it doesn't look like this workaround is needed in order to paint the first attachGuest of a webview anymore.
petemill added a commit that referenced this issue May 8, 2018
Fix #13798 since "display: none" and then "display: ''" of a webview will cause the guest to (asynchronously) detach and attach again, and by that time we had attached another guest, which causes the original tab to be destroyed since we are attaching a guest to a webview which already has a guest.
Luckily, it doesn't look like this workaround is needed in order to paint the first attachGuest of a webview anymore.
petemill added a commit that referenced this issue May 9, 2018
Fix #13798 since "display: none" and then "display: ''" of a webview will cause the guest to (asynchronously) detach and attach again, and by that time we had attached another guest, which causes the original tab to be destroyed since we are attaching a guest to a webview which already has a guest.
Luckily, it doesn't look like this workaround is needed in order to paint the first attachGuest of a webview anymore.
petemill added a commit that referenced this issue May 10, 2018
Fix #13798 since "display: none" and then "display: ''" of a webview will cause the guest to (asynchronously) detach and attach again, and by that time we had attached another guest, which causes the original tab to be destroyed since we are attaching a guest to a webview which already has a guest.
Luckily, it doesn't look like this workaround is needed in order to paint the first attachGuest of a webview anymore.
petemill added a commit that referenced this issue May 10, 2018
Fix #13798 since "display: none" and then "display: ''" of a webview will cause the guest to (asynchronously) detach and attach again, and by that time we had attached another guest, which causes the original tab to be destroyed since we are attaching a guest to a webview which already has a guest.
Luckily, it doesn't look like this workaround is needed in order to paint the first attachGuest of a webview anymore.
petemill added a commit that referenced this issue May 10, 2018
Fix #13798 since "display: none" and then "display: ''" of a webview will cause the guest to (asynchronously) detach and attach again, and by that time we had attached another guest, which causes the original tab to be destroyed since we are attaching a guest to a webview which already has a guest.
Luckily, it doesn't look like this workaround is needed in order to paint the first attachGuest of a webview anymore.
petemill added a commit that referenced this issue May 11, 2018
…emove other rendering workarounds

Fix #13798 since "display: none" and then "display: ''" of a webview will cause the guest to (asynchronously) detach and attach again, and by that time we had attached another guest, which causes the original tab to be destroyed since we are attaching a guest to a webview which already has a guest.
Luckily, it doesn't look like this workaround is needed in order to paint the first attachGuest of a webview anymore.

Remove all composition workarounds from c65 as they are no longer needed for c66
petemill added a commit that referenced this issue May 11, 2018
…emove other rendering workarounds

Fix #13798 since "display: none" and then "display: ''" of a webview will cause the guest to (asynchronously) detach and attach again, and by that time we had attached another guest, which causes the original tab to be destroyed since we are attaching a guest to a webview which already has a guest.
Luckily, it doesn't look like this workaround is needed in order to paint the first attachGuest of a webview anymore.

Remove all composition workarounds from c65 as they are no longer needed for c66
petemill added a commit that referenced this issue May 11, 2018
…emove other rendering workarounds

Fix #13798 since "display: none" and then "display: ''" of a webview will cause the guest to (asynchronously) detach and attach again, and by that time we had attached another guest, which causes the original tab to be destroyed since we are attaching a guest to a webview which already has a guest.
Luckily, it doesn't look like this workaround is needed in order to paint the first attachGuest of a webview anymore.

Remove all composition workarounds from c65 as they are no longer needed for c66
@petemill
Copy link
Member Author

This is definitely fixed, since I removed the code that was hiding and showing the webview after C66 (as it was no longer required in order to force the tab to display without just being blank) - since the code is removed, it won't cause the issue. But the STR was to ctrl-tab through tabs very quickly at startup (with a profile that has a few tabs in it), and some of them would be removed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
0.22.x-single-webview Issue first seen on single-webview build against v0.22.x branch QA/no-qa-needed regression release-notes/exclude
Projects
None yet
Development

No branches or pull requests

3 participants