Keep track of all BrowsingContext objects in a BrowsingContextGroup
Categories
(Core :: DOM: Core & HTML, defect, P2)
Tracking
()
Tracking | Status | |
---|---|---|
firefox67 | --- | fixed |
People
(Reporter: nika, Assigned: farre)
References
Details
Attachments
(2 files)
47 bytes,
text/x-phabricator-request
|
Details | Review | |
3.16 KB,
patch
|
Details | Diff | Splinter Review |
Reporter | ||
Comment 1•6 years ago
|
||
Assignee | ||
Comment 2•6 years ago
|
||
Generally I'm all in favour of this patch with the exception of BrowsingContextGroup::mContexts, which I don't understand. Why do we need to keep track of all BrowsingContext in BrowsingContextGroup more than we already do?
Checking if a BrowsingContext is a member of a particular BrowsingContextGroup doesn't need a hash table, but can just be:
bool BrowsingContextGroup::Contains(BrowsingContext* aBC) { return this == aBC->Group(); }
Updated•6 years ago
|
Updated•6 years ago
|
Assignee | ||
Comment 3•6 years ago
|
||
Try says that I need to put some more work into this: https://treeherder.mozilla.org/#/jobs?repo=try&revision=6dde50aa544826a1bd832353e26fafa0a6c53f2e&selectedJob=223735159
Also, there are reasons for mContext. Will be used for validation in BC syncing.
Comment hidden (typo) |
Reporter | ||
Comment 5•6 years ago
|
||
:neha asked me to look into a fix for the leaking issue. This patch seems to work OK locally for fixing it.
I think the root of the problem is that there was a cycle keeping nsDocShell alive after it had been destroyed. This patch changes the code to null out the BrowsingContext -> nsDocShell reference when the nsDocShell is destroyed.
There were a few other needed changes to prevent the cycle collector from destroying the BrowsingContextGroup object too early which should ideally be unnecessary after the syncing work is done, and the ContentParent is keeping the BrowsingContextGroup alive for us.
try: https://treeherder.mozilla.org/#/jobs?repo=try&revision=8a1fb6c3211843bcda8dd241920419d47eef1218
Assignee | ||
Comment 6•6 years ago
|
||
So just that I understand, there was a cycle keeping nsDocShell alive, right? As in the direct cycle created by BrowsingContext::mDocShell and nsDocShell::mBrowsingContext isn't that cycle? Because there are some subtle ownership changes here. The list of root browsing contexts used to be the thing keeping browsing contexts alive in the content parent, but now I guess that that is done by WindowGlobalParent instead, because the static list of BCG that replaces the static list of root BC only keep pointers.
Reporter | ||
Comment 7•6 years ago
|
||
(In reply to Andreas Farre [:farre] from comment #6)
So just that I understand, there was a cycle keeping nsDocShell alive, right? As in the direct cycle created by BrowsingContext::mDocShell and nsDocShell::mBrowsingContext isn't that cycle? Because there are some subtle ownership changes here. The list of root browsing contexts used to be the thing keeping browsing contexts alive in the content parent, but now I guess that that is done by WindowGlobalParent instead, because the static list of BCG that replaces the static list of root BC only keep pointers.
Yeah, the ownership keeping things alive isn't great right now. What's keeping it alive in the content parent right now is the hacky part which doesn't traverse one CC edge, which isn't great... You might want to clean that up.
The mDocShell <-> mBrowsingContext cycle was kinda keeping nsDocShell alive. nsDocShell used to not be cycle collected at all, and has some super weird lifetime semantics because of it. In the past, I tried to make the nsDocShell <-> nsGlobalWindowOuter relationship not be cleared by nsDocShell::Destroy, but it caused massive leaks like this one. I'm guessing that the issue here is probably similar -- there are some edges which I couldn't find which are keeping the whole tree alive, and are being kept alive themselves from the nsDocShell, but aren't being traversed.
Reporter | ||
Updated•6 years ago
|
Comment 9•6 years ago
|
||
bugherder |
Updated•6 years ago
|
Description
•