зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1555488 - Part 1: Clear WindowProxy cache when flipping processes, r=peterv,mccr8
This is sorta-part of the work for bug 1510760. Currently if you do a process switch, the window proxy state is completely borked, and a lot of stuff doesn't work. This patch aims to make it so that, while not transplanted correctly, methods generally don't return the wrong WindowProxy object anymore after a process swap. Differential Revision: https://phabricator.services.mozilla.com/D33082 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
ef32ea9269
Коммит
39aaf12dd5
|
@ -311,6 +311,26 @@ void BrowsingContext::Detach(bool aFromIPC) {
|
|||
}
|
||||
}
|
||||
|
||||
void BrowsingContext::PrepareForProcessChange() {
|
||||
MOZ_LOG(GetLog(), LogLevel::Debug,
|
||||
("%s: Preparing 0x%08" PRIx64 " for a process change",
|
||||
XRE_IsParentProcess() ? "Parent" : "Child", Id()));
|
||||
|
||||
MOZ_ASSERT(mIsInProcess, "Must currently be an in-process frame");
|
||||
MOZ_ASSERT(!mClosed, "We're already closed?");
|
||||
|
||||
mIsInProcess = false;
|
||||
|
||||
// XXX: We should transplant our WindowProxy into a Cross-Process WindowProxy
|
||||
// if mWindowProxy is non-nullptr. (bug 1510760)
|
||||
mWindowProxy = nullptr;
|
||||
|
||||
// NOTE: For now, clear our nsDocShell reference, as we're primarily in a
|
||||
// different process now. This may need to change in the future with
|
||||
// Cross-Process BFCache.
|
||||
mDocShell = nullptr;
|
||||
}
|
||||
|
||||
void BrowsingContext::CacheChildren(bool aFromIPC) {
|
||||
MOZ_LOG(GetLog(), LogLevel::Debug,
|
||||
("%s: Caching children of 0x%08" PRIx64 "",
|
||||
|
|
|
@ -145,6 +145,9 @@ class BrowsingContext : public nsWrapperCache, public BrowsingContextBase {
|
|||
// child and the parent process.
|
||||
void Detach(bool aFromIPC = false);
|
||||
|
||||
// Prepare this BrowsingContext to leave the current process.
|
||||
void PrepareForProcessChange();
|
||||
|
||||
// Remove all children from the current BrowsingContext and cache
|
||||
// them to allow them to be attached again.
|
||||
void CacheChildren(bool aFromIPC = false);
|
||||
|
|
|
@ -5079,9 +5079,11 @@ nsDocShell::Destroy() {
|
|||
mSessionHistory = nullptr;
|
||||
}
|
||||
|
||||
// This will be skipped in cases where we want to preserve the browsing
|
||||
// context between loads.
|
||||
if (!mSkipBrowsingContextDetachOnDestroy) {
|
||||
// Either `Detach` our BrowsingContext if this window is closing, or prepare
|
||||
// the BrowsingContext for the switch to continue.
|
||||
if (mSkipBrowsingContextDetachOnDestroy) {
|
||||
mBrowsingContext->PrepareForProcessChange();
|
||||
} else {
|
||||
mBrowsingContext->Detach();
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче