mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-01 00:32:11 +00:00
Bug 1604836 - ServiceWorkerGlobalScope.skipWaiting should use DOMMozPromiseRequestHolder r=asuth
Differential Revision: https://phabricator.services.mozilla.com/D57875 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
a8028a50b1
commit
a629fffc9a
@ -14,6 +14,7 @@
|
||||
#include "mozilla/dom/ClientState.h"
|
||||
#include "mozilla/dom/Console.h"
|
||||
#include "mozilla/dom/CSPEvalChecker.h"
|
||||
#include "mozilla/dom/DOMMozPromiseRequestHolder.h"
|
||||
#include "mozilla/dom/DebuggerNotification.h"
|
||||
#include "mozilla/dom/DedicatedWorkerGlobalScopeBinding.h"
|
||||
#include "mozilla/dom/Fetch.h"
|
||||
@ -876,16 +877,17 @@ already_AddRefed<Promise> ServiceWorkerGlobalScope::SkipWaiting(
|
||||
}
|
||||
|
||||
if (ServiceWorkerParentInterceptEnabled()) {
|
||||
mWorkerPrivate->SetServiceWorkerSkipWaitingFlag()->Then(
|
||||
GetCurrentThreadSerialEventTarget(), __func__,
|
||||
[promise](bool aOk) {
|
||||
Unused << NS_WARN_IF(!aOk);
|
||||
promise->MaybeResolveWithUndefined();
|
||||
},
|
||||
[promise](nsresult aRv) {
|
||||
MOZ_ASSERT(NS_FAILED(aRv));
|
||||
promise->MaybeResolveWithUndefined();
|
||||
});
|
||||
using MozPromiseType = decltype(
|
||||
mWorkerPrivate->SetServiceWorkerSkipWaitingFlag())::element_type;
|
||||
auto holder = MakeRefPtr<DOMMozPromiseRequestHolder<MozPromiseType>>(this);
|
||||
|
||||
mWorkerPrivate->SetServiceWorkerSkipWaitingFlag()
|
||||
->Then(GetCurrentThreadSerialEventTarget(), __func__,
|
||||
[holder, promise](const MozPromiseType::ResolveOrRejectValue&) {
|
||||
holder->Complete();
|
||||
promise->MaybeResolveWithUndefined();
|
||||
})
|
||||
->Track(*holder);
|
||||
|
||||
return promise.forget();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user