diff --git a/docshell/base/CanonicalBrowsingContext.cpp b/docshell/base/CanonicalBrowsingContext.cpp index dc554245c2aa..1c987f18b2be 100644 --- a/docshell/base/CanonicalBrowsingContext.cpp +++ b/docshell/base/CanonicalBrowsingContext.cpp @@ -274,26 +274,6 @@ void CanonicalBrowsingContext::LoadURI(const nsAString& aURI, LoadURI(nullptr, loadState, true); } -namespace { - -using NewOrUsedPromise = MozPromise, nsresult, false>; - -// NOTE: This method is currently a dummy, and always actually spawns sync. It -// mostly exists so I can test out the async API right now. -RefPtr GetNewOrUsedBrowserProcessAsync( - const nsAString& aRemoteType) { - RefPtr contentParent = - ContentParent::GetNewOrUsedBrowserProcess( - nullptr, aRemoteType, hal::PROCESS_PRIORITY_FOREGROUND, nullptr, - false); - if (!contentParent) { - return NewOrUsedPromise::CreateAndReject(NS_ERROR_FAILURE, __func__); - } - return NewOrUsedPromise::CreateAndResolve(contentParent, __func__); -} - -} // anonymous namespace - void CanonicalBrowsingContext::PendingRemotenessChange::Complete( ContentParent* aContentParent) { if (!mPromise) { @@ -511,13 +491,18 @@ CanonicalBrowsingContext::ChangeFrameRemoteness(const nsAString& aRemoteType, new PendingRemotenessChange(this, promise, aPendingSwitchId); mPendingRemotenessChange = change; - GetNewOrUsedBrowserProcessAsync(aRemoteType) + ContentParent::GetNewOrUsedBrowserProcessAsync( + /* aFrameElement = */ nullptr, + /* aRemoteType = */ aRemoteType, + /* aPriority = */ hal::PROCESS_PRIORITY_FOREGROUND, + /* aOpener = */ nullptr, + /* aPreferUsed = */ false) ->Then( GetMainThreadSerialEventTarget(), __func__, [change](ContentParent* aContentParent) { change->Complete(aContentParent); }, - [change](nsresult aRv) { change->Cancel(aRv); }); + [change](LaunchError aError) { change->Cancel(NS_ERROR_FAILURE); }); return promise.forget(); }