Backed out 7 changesets (bug 1942424) for causing frequent crashes. a=backout
[gecko.git] / toolkit / components / antitracking / bouncetrackingprotection / PromiseNativeWrapper.cpp
blob50d79591ecc4d4450f50bd60c90104f475e5e332
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #include "PromiseNativeWrapper.h"
7 namespace mozilla {
9 NS_IMPL_ISUPPORTS0(PromiseNativeWrapper);
11 RefPtr<GenericNonExclusivePromise>
12 PromiseNativeWrapper::ConvertJSPromiseToMozPromise(
13 const RefPtr<dom::Promise>& jsPromise) {
14 MozPromiseHolder<GenericNonExclusivePromise> holder;
15 RefPtr<GenericNonExclusivePromise> mozPromise = holder.Ensure(__func__);
17 // The handler will resolve mozPromise once jsPromise resolves.
18 RefPtr<PromiseNativeWrapper> handler =
19 new PromiseNativeWrapper(std::move(holder));
20 jsPromise->AppendNativeHandler(handler);
22 return mozPromise.forget();
25 } // namespace mozilla