Fire Runtime.executionContextDestroyed when the tab closes
Categories
(Remote Protocol :: CDP, enhancement, P3)
Tracking
(Not tracked)
People
(Reporter: ochameau, Unassigned)
References
Details
(Whiteboard: [puppeteer-beta2-mvp])
Attachments
(1 obsolete file)
The existing code out of bug 1543098 do try to send this event.
But unfortunately, this ContentProcessSession is being shutdown too early.
ContentProcessSession unregister the message manager here:
https://searchfox.org/mozilla-central/rev/75294521381b331f821aad3d6b60636844080ee2/remote/sessions/ContentProcessSession.jsm#24-27
When the parent process TabSession request to do so from here:
https://searchfox.org/mozilla-central/rev/75294521381b331f821aad3d6b60636844080ee2/remote/sessions/TabSession.jsm#45-47
Which is ultimately call from a TabClose event via Target and Session:
https://searchfox.org/mozilla-central/source/remote/RemoteAgent.jsm#51-53
The TabClose event actually fires early when we just start destroying the tab.
The code from bug 1543098 is still having time to try to emit the executionContextDestroyed event, but as the message manager listeners are unregistered, the packet isn't forwarded.
So may be we could find another event to destroy the target, sligthly more late than TabClose? Otherwise, it means that the parent process code should ensure firing this event.
Reporter | ||
Updated•6 years ago
|
Reporter | ||
Comment 1•6 years ago
|
||
Comment 2•6 years ago
|
||
(In reply to Alexandre Poirot [:ochameau] from comment #0)
So may be we could find another event to destroy the target,
sligthly more late than TabClose? Otherwise, it means that the
parent process code should ensure firing this event.
Perhaps we could listen for the content browser’s message manager
disconnecting?
I can’t remember off the top of my head if that fires before or
after TabClose
.
nika: Is there any new event in the platform code that fires when a
browsing context is discarded?
Comment 3•6 years ago
|
||
(In reply to Andreas Tolfsen ⦗:ato⦘ from comment #2)
(In reply to Alexandre Poirot [:ochameau] from comment #0)
So may be we could find another event to destroy the target,
sligthly more late than TabClose? Otherwise, it means that the
parent process code should ensure firing this event.Perhaps we could listen for the content browser’s message manager
disconnecting?I can’t remember off the top of my head if that fires before or
afterTabClose
.nika: Is there any new event in the platform code that fires when a
browsing context is discarded?
We don't currently fire an observer notification when a BrowsingContext is fully destroyed IIRC. You should be able to listen to ipc:browser-destroyed
to detect when the BrowserParent object is destroyed.
With process switches, however, this will be fired during process changes as well.
Reporter | ||
Updated•6 years ago
|
Reporter | ||
Updated•6 years ago
|
Comment 4•5 years ago
|
||
Looks like we forgot to prioritize it. While this event shows high usage, in combination with closing a tab, it might be not that important. Adding it as a reserved bug but keeping it as P3 for now.
Updated•5 years ago
|
Assignee | ||
Updated•4 years ago
|
Updated•2 years ago
|
Comment 5•11 months ago
|
||
This is a feature that already exists in WebDriver BiDi and we are not going to add it to CDP.
Description
•