Bug 1701303 - Move counting of private browsing contexts to parent process. r=smaug,johannh
Move the counting of private browsing contexts to the parent process. Also change to only consider non-chrome browsing contexts when counting private contexts. The latter is possible due to bug 1528115, because we no longer need to support hidden private windows. With counting in the parent process we can make sure that when we're changing remoteness on a private browsing context the private browsing context count never drops to zero. This fixes an issue with Fission, where we remoteness changes could transiently have a zero private browsing context count, that would be mistaken for the last private browsing context going away. Changing to only count non-chrome browsing contexts makes us only fire 'last-pb-context-exited' once, and since we count them in the parent there is no missing information about contexts that makes us wait for a content process about telling us about insertion or removal of browsing contexts. Differential Revision: https://phabricator.services.mozilla.com/D118182
This commit is contained in:
@@ -799,6 +799,10 @@ void BrowsingContext::Attach(bool aFromIPC, ContentParent* aOriginProcess) {
|
||||
obs->NotifyWhenScriptSafe(ToSupports(this), "browsing-context-attached",
|
||||
nullptr);
|
||||
}
|
||||
|
||||
if (XRE_IsParentProcess()) {
|
||||
Canonical()->CanonicalAttach();
|
||||
}
|
||||
}
|
||||
|
||||
void BrowsingContext::Detach(bool aFromIPC) {
|
||||
@@ -1588,6 +1592,10 @@ NS_IMETHODIMP BrowsingContext::SetPrivateBrowsing(bool aPrivateBrowsing) {
|
||||
if (IsContent()) {
|
||||
mOriginAttributes.SyncAttributesWithPrivateBrowsing(aPrivateBrowsing);
|
||||
}
|
||||
|
||||
if (XRE_IsParentProcess()) {
|
||||
Canonical()->AdjustPrivateBrowsingCount(aPrivateBrowsing);
|
||||
}
|
||||
}
|
||||
AssertOriginAttributesMatchPrivateBrowsing();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user