Skip to content
This repository has been archived by the owner on Aug 4, 2022. It is now read-only.

Commit

Permalink
Backed out 2 changesets (bug 1605072) for causing reftest failures in…
Browse files Browse the repository at this point in the history
… layout/reftests/selection/splitText-normalize-ref.html CLOSED TREE

Backed out changeset 973f1e5baebf (bug 1605072)
Backed out changeset 038b50303733 (bug 1605072)
  • Loading branch information
shindli committed Feb 17, 2020
1 parent 5003d48 commit d44efa4
Show file tree
Hide file tree
Showing 5 changed files with 268 additions and 252 deletions.
31 changes: 23 additions & 8 deletions docshell/base/CanonicalBrowsingContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,26 @@ void CanonicalBrowsingContext::LoadURI(const nsAString& aURI,
LoadURI(nullptr, loadState, true);
}

namespace {

using NewOrUsedPromise = MozPromise<RefPtr<ContentParent>, 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<NewOrUsedPromise> GetNewOrUsedBrowserProcessAsync(
const nsAString& aRemoteType) {
RefPtr<ContentParent> 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) {
Expand Down Expand Up @@ -463,19 +483,14 @@ CanonicalBrowsingContext::ChangeFrameRemoteness(const nsAString& aRemoteType,
new PendingRemotenessChange(this, promise, aPendingSwitchId);
mPendingRemotenessChange = change;

ContentParent::GetNewOrUsedBrowserProcessAsync(
/* aFrameElement = */ nullptr,
/* aRemoteType = */ aRemoteType,
/* aPriority = */ hal::PROCESS_PRIORITY_FOREGROUND,
/* aOpener = */ nullptr,
/* aPreferUsed = */ false)
GetNewOrUsedBrowserProcessAsync(aRemoteType)
->Then(
GetMainThreadSerialEventTarget(), __func__,
[change](ContentParent* aContentParent) {
change->Complete(aContentParent);
},
[change](LaunchError aError) { change->Cancel(NS_ERROR_FAILURE); });
return promise.forget();
[change](nsresult aRv) { change->Cancel(aRv); });
return promise;
}

already_AddRefed<Promise> CanonicalBrowsingContext::ChangeFrameRemoteness(
Expand Down
Loading

0 comments on commit d44efa4

Please sign in to comment.