Bug 1625513 - Part 1: Perform onMayChangeProcess handling within DocumentLoadListener, r=mattwoodrow,pbone,droeh,necko-reviewers,valentin

When I first added this method last year, I added it in JS, handled from within
SessionStore.jsm, as that was the easiest place to do it. Now that
DocumentLoadListener exists, it makes more sense to handle this logic directly
from within that code.

Many parts of the process switch are still handled by frontend JS, such as
selecting remote types, and performing toplevel process switches.

Differential Revision: https://phabricator.services.mozilla.com/D68594
This commit is contained in:
Nika Layzell
2020-04-21 22:33:00 +00:00
parent 5b5e39a217
commit 005f7d6520
12 changed files with 302 additions and 374 deletions

View File

@@ -507,25 +507,6 @@ CanonicalBrowsingContext::ChangeFrameRemoteness(const nsAString& aRemoteType,
return promise.forget();
}
already_AddRefed<Promise> CanonicalBrowsingContext::ChangeFrameRemoteness(
const nsAString& aRemoteType, uint64_t aPendingSwitchId, ErrorResult& aRv) {
nsIGlobalObject* global = xpc::NativeGlobal(xpc::PrivilegedJunkScope());
RefPtr<Promise> promise = Promise::Create(global, aRv);
if (aRv.Failed()) {
return nullptr;
}
ChangeFrameRemoteness(aRemoteType, aPendingSwitchId)
->Then(
GetMainThreadSerialEventTarget(), __func__,
[promise](BrowserParent* aBrowserParent) {
promise->MaybeResolve(aBrowserParent->Manager()->ChildID());
},
[promise](nsresult aRv) { promise->MaybeReject(aRv); });
return promise.forget();
}
MediaController* CanonicalBrowsingContext::GetMediaController() {
// We would only create one media controller per tab, so accessing the
// controller via the top-level browsing context.