2015-05-03 12:32:37 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2014-10-27 04:03:00 -07:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
|
|
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
2015-02-20 07:16:17 -08:00
|
|
|
#include "mozilla/dom/Promise.h"
|
2015-04-07 06:25:08 -07:00
|
|
|
#include "mozilla/dom/PromiseWorkerProxy.h"
|
2015-02-20 07:16:17 -08:00
|
|
|
|
2014-10-27 04:03:00 -07:00
|
|
|
#include "ServiceWorkerClient.h"
|
|
|
|
#include "ServiceWorkerClients.h"
|
|
|
|
#include "ServiceWorkerManager.h"
|
2015-03-06 05:04:49 -08:00
|
|
|
#include "ServiceWorkerWindowClient.h"
|
2014-10-27 04:03:00 -07:00
|
|
|
|
|
|
|
#include "WorkerPrivate.h"
|
|
|
|
#include "WorkerRunnable.h"
|
|
|
|
#include "WorkerScope.h"
|
|
|
|
|
|
|
|
using namespace mozilla;
|
|
|
|
using namespace mozilla::dom;
|
|
|
|
using namespace mozilla::dom::workers;
|
|
|
|
|
|
|
|
NS_IMPL_CYCLE_COLLECTING_ADDREF(ServiceWorkerClients)
|
|
|
|
NS_IMPL_CYCLE_COLLECTING_RELEASE(ServiceWorkerClients)
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(ServiceWorkerClients, mWorkerScope)
|
|
|
|
|
|
|
|
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(ServiceWorkerClients)
|
|
|
|
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
|
|
|
|
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
|
|
|
NS_INTERFACE_MAP_END
|
|
|
|
|
|
|
|
ServiceWorkerClients::ServiceWorkerClients(ServiceWorkerGlobalScope* aWorkerScope)
|
|
|
|
: mWorkerScope(aWorkerScope)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(mWorkerScope);
|
|
|
|
}
|
|
|
|
|
|
|
|
JSObject*
|
Bug 1117172 part 3. Change the wrappercached WrapObject methods to allow passing in aGivenProto. r=peterv
The only manual changes here are to BindingUtils.h, BindingUtils.cpp,
Codegen.py, Element.cpp, IDBFileRequest.cpp, IDBObjectStore.cpp,
dom/workers/Navigator.cpp, WorkerPrivate.cpp, DeviceStorageRequestChild.cpp,
Notification.cpp, nsGlobalWindow.cpp, MessagePort.cpp, nsJSEnvironment.cpp,
Sandbox.cpp, XPCConvert.cpp, ExportHelpers.cpp, and DataStoreService.cpp. The
rest of this diff was generated by running the following commands:
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObject\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(Binding(?:_workers)?::Wrap\((?:aCx|cx|aContext|aCtx|js), [^,)]+)\)/\1, aGivenProto)/g'
2015-03-19 07:13:33 -07:00
|
|
|
ServiceWorkerClients::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
|
2014-10-27 04:03:00 -07:00
|
|
|
{
|
Bug 1117172 part 3. Change the wrappercached WrapObject methods to allow passing in aGivenProto. r=peterv
The only manual changes here are to BindingUtils.h, BindingUtils.cpp,
Codegen.py, Element.cpp, IDBFileRequest.cpp, IDBObjectStore.cpp,
dom/workers/Navigator.cpp, WorkerPrivate.cpp, DeviceStorageRequestChild.cpp,
Notification.cpp, nsGlobalWindow.cpp, MessagePort.cpp, nsJSEnvironment.cpp,
Sandbox.cpp, XPCConvert.cpp, ExportHelpers.cpp, and DataStoreService.cpp. The
rest of this diff was generated by running the following commands:
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObject\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(Binding(?:_workers)?::Wrap\((?:aCx|cx|aContext|aCtx|js), [^,)]+)\)/\1, aGivenProto)/g'
2015-03-19 07:13:33 -07:00
|
|
|
return ClientsBinding::Wrap(aCx, this, aGivenProto);
|
2014-10-27 04:03:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
|
2015-03-21 09:28:04 -07:00
|
|
|
class ResolvePromiseWorkerRunnable final : public WorkerRunnable
|
2014-10-27 04:03:00 -07:00
|
|
|
{
|
2015-04-07 06:25:08 -07:00
|
|
|
nsRefPtr<PromiseWorkerProxy> mPromiseProxy;
|
2015-03-06 05:04:49 -08:00
|
|
|
nsTArray<ServiceWorkerClientInfo> mValue;
|
2014-10-27 04:03:00 -07:00
|
|
|
|
|
|
|
public:
|
|
|
|
ResolvePromiseWorkerRunnable(WorkerPrivate* aWorkerPrivate,
|
2015-04-07 06:25:08 -07:00
|
|
|
PromiseWorkerProxy* aPromiseProxy,
|
2015-03-06 05:04:49 -08:00
|
|
|
nsTArray<ServiceWorkerClientInfo>& aValue)
|
2014-10-27 04:03:00 -07:00
|
|
|
: WorkerRunnable(aWorkerPrivate, WorkerThreadModifyBusyCount),
|
2015-04-07 06:25:08 -07:00
|
|
|
mPromiseProxy(aPromiseProxy)
|
2014-10-27 04:03:00 -07:00
|
|
|
{
|
|
|
|
AssertIsOnMainThread();
|
2015-03-06 05:04:49 -08:00
|
|
|
mValue.SwapElements(aValue);
|
2014-10-27 04:03:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(aWorkerPrivate);
|
|
|
|
aWorkerPrivate->AssertIsOnWorkerThread();
|
|
|
|
|
2015-04-07 06:25:08 -07:00
|
|
|
Promise* promise = mPromiseProxy->GetWorkerPromise();
|
2014-10-27 04:03:00 -07:00
|
|
|
MOZ_ASSERT(promise);
|
|
|
|
|
|
|
|
nsTArray<nsRefPtr<ServiceWorkerClient>> ret;
|
2015-03-06 05:04:49 -08:00
|
|
|
for (size_t i = 0; i < mValue.Length(); i++) {
|
2014-10-27 04:03:00 -07:00
|
|
|
ret.AppendElement(nsRefPtr<ServiceWorkerClient>(
|
2015-03-06 05:04:49 -08:00
|
|
|
new ServiceWorkerWindowClient(promise->GetParentObject(),
|
|
|
|
mValue.ElementAt(i))));
|
2014-10-27 04:03:00 -07:00
|
|
|
}
|
|
|
|
promise->MaybeResolve(ret);
|
|
|
|
|
|
|
|
// release the reference on the worker thread.
|
2015-04-07 06:25:08 -07:00
|
|
|
mPromiseProxy->CleanUp(aCx);
|
2014-10-27 04:03:00 -07:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2015-03-21 09:28:04 -07:00
|
|
|
class MatchAllRunnable final : public nsRunnable
|
2014-10-27 04:03:00 -07:00
|
|
|
{
|
|
|
|
WorkerPrivate* mWorkerPrivate;
|
2015-04-07 06:25:08 -07:00
|
|
|
nsRefPtr<PromiseWorkerProxy> mPromiseProxy;
|
2014-10-28 02:29:00 -07:00
|
|
|
nsCString mScope;
|
2014-10-27 04:03:00 -07:00
|
|
|
public:
|
2015-02-20 07:16:17 -08:00
|
|
|
MatchAllRunnable(WorkerPrivate* aWorkerPrivate,
|
2015-04-07 06:25:08 -07:00
|
|
|
PromiseWorkerProxy* aPromiseProxy,
|
2015-02-20 07:16:17 -08:00
|
|
|
const nsCString& aScope)
|
2014-10-27 04:03:00 -07:00
|
|
|
: mWorkerPrivate(aWorkerPrivate),
|
2015-04-07 06:25:08 -07:00
|
|
|
mPromiseProxy(aPromiseProxy),
|
2014-10-27 04:03:00 -07:00
|
|
|
mScope(aScope)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(aWorkerPrivate);
|
|
|
|
aWorkerPrivate->AssertIsOnWorkerThread();
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHOD
|
2015-03-21 09:28:04 -07:00
|
|
|
Run() override
|
2014-10-27 04:03:00 -07:00
|
|
|
{
|
|
|
|
AssertIsOnMainThread();
|
|
|
|
|
2015-04-07 06:25:08 -07:00
|
|
|
MutexAutoLock lock(mPromiseProxy->GetCleanUpLock());
|
|
|
|
if (mPromiseProxy->IsClean()) {
|
2014-10-28 02:29:00 -07:00
|
|
|
// Don't resolve the promise if it was already released.
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2014-10-27 04:03:00 -07:00
|
|
|
nsRefPtr<ServiceWorkerManager> swm = ServiceWorkerManager::GetInstance();
|
2015-03-06 05:04:49 -08:00
|
|
|
nsTArray<ServiceWorkerClientInfo> result;
|
2014-10-27 04:03:00 -07:00
|
|
|
|
2015-06-03 01:43:43 -07:00
|
|
|
swm->GetAllClients(mWorkerPrivate->GetPrincipal(), mScope, result);
|
2014-10-27 04:03:00 -07:00
|
|
|
nsRefPtr<ResolvePromiseWorkerRunnable> r =
|
2015-04-07 06:25:08 -07:00
|
|
|
new ResolvePromiseWorkerRunnable(mWorkerPrivate, mPromiseProxy, result);
|
2014-10-27 04:03:00 -07:00
|
|
|
|
|
|
|
AutoSafeJSContext cx;
|
2014-10-30 08:13:00 -07:00
|
|
|
if (r->Dispatch(cx)) {
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Dispatch to worker thread failed because the worker is shutting down.
|
|
|
|
// Use a control runnable to release the runnable on the worker thread.
|
2015-04-07 06:25:08 -07:00
|
|
|
nsRefPtr<PromiseWorkerProxyControlRunnable> releaseRunnable =
|
|
|
|
new PromiseWorkerProxyControlRunnable(mWorkerPrivate, mPromiseProxy);
|
2014-10-30 08:13:00 -07:00
|
|
|
|
|
|
|
if (!releaseRunnable->Dispatch(cx)) {
|
2015-04-07 06:25:08 -07:00
|
|
|
NS_RUNTIMEABORT("Failed to dispatch MatchAll promise control runnable.");
|
2014-10-30 08:13:00 -07:00
|
|
|
}
|
|
|
|
|
2014-10-27 04:03:00 -07:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2015-05-14 12:41:42 -07:00
|
|
|
class ResolveClaimRunnable final : public WorkerRunnable
|
|
|
|
{
|
|
|
|
nsRefPtr<PromiseWorkerProxy> mPromiseProxy;
|
|
|
|
nsresult mResult;
|
|
|
|
|
|
|
|
public:
|
|
|
|
ResolveClaimRunnable(WorkerPrivate* aWorkerPrivate,
|
|
|
|
PromiseWorkerProxy* aPromiseProxy,
|
|
|
|
nsresult aResult)
|
|
|
|
: WorkerRunnable(aWorkerPrivate, WorkerThreadModifyBusyCount)
|
|
|
|
, mPromiseProxy(aPromiseProxy)
|
|
|
|
, mResult(aResult)
|
|
|
|
{
|
|
|
|
AssertIsOnMainThread();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate) override
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(aWorkerPrivate);
|
|
|
|
aWorkerPrivate->AssertIsOnWorkerThread();
|
|
|
|
|
|
|
|
Promise* promise = mPromiseProxy->GetWorkerPromise();
|
|
|
|
MOZ_ASSERT(promise);
|
|
|
|
|
|
|
|
if (NS_SUCCEEDED(mResult)) {
|
|
|
|
promise->MaybeResolve(JS::UndefinedHandleValue);
|
|
|
|
} else {
|
|
|
|
promise->MaybeReject(NS_ERROR_DOM_INVALID_STATE_ERR);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Release the reference on the worker thread.
|
|
|
|
mPromiseProxy->CleanUp(aCx);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
class ClaimRunnable final : public nsRunnable
|
|
|
|
{
|
|
|
|
nsRefPtr<PromiseWorkerProxy> mPromiseProxy;
|
|
|
|
nsCString mScope;
|
|
|
|
// We grab the ID so we don't have to hold a lock the entire time the claim
|
|
|
|
// operation is happening on the main thread.
|
|
|
|
uint64_t mServiceWorkerID;
|
|
|
|
|
|
|
|
public:
|
|
|
|
ClaimRunnable(PromiseWorkerProxy* aPromiseProxy, const nsCString& aScope)
|
|
|
|
: mPromiseProxy(aPromiseProxy)
|
|
|
|
, mScope(aScope)
|
|
|
|
, mServiceWorkerID(aPromiseProxy->GetWorkerPrivate()->ServiceWorkerID())
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(aPromiseProxy);
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHOD
|
|
|
|
Run() override
|
|
|
|
{
|
|
|
|
MutexAutoLock lock(mPromiseProxy->GetCleanUpLock());
|
|
|
|
if (mPromiseProxy->IsClean()) {
|
|
|
|
// Don't resolve the promise if it was already released.
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
WorkerPrivate* workerPrivate = mPromiseProxy->GetWorkerPrivate();
|
|
|
|
MOZ_ASSERT(workerPrivate);
|
|
|
|
|
2015-06-03 01:43:43 -07:00
|
|
|
nsRefPtr<ServiceWorkerManager> swm = ServiceWorkerManager::GetInstance();
|
|
|
|
MOZ_ASSERT(swm);
|
|
|
|
|
|
|
|
nsresult rv = swm->ClaimClients(workerPrivate->GetPrincipal(),
|
|
|
|
mScope, mServiceWorkerID);
|
|
|
|
|
2015-05-14 12:41:42 -07:00
|
|
|
nsRefPtr<ResolveClaimRunnable> r =
|
|
|
|
new ResolveClaimRunnable(workerPrivate, mPromiseProxy, rv);
|
|
|
|
|
|
|
|
AutoJSAPI jsapi;
|
|
|
|
jsapi.Init();
|
|
|
|
JSContext* cx = jsapi.cx();
|
|
|
|
if (r->Dispatch(cx)) {
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Dispatch to worker thread failed because the worker is shutting down.
|
|
|
|
// Use a control runnable to release the runnable on the worker thread.
|
|
|
|
nsRefPtr<PromiseWorkerProxyControlRunnable> releaseRunnable =
|
|
|
|
new PromiseWorkerProxyControlRunnable(workerPrivate, mPromiseProxy);
|
|
|
|
|
|
|
|
if (!releaseRunnable->Dispatch(cx)) {
|
|
|
|
NS_RUNTIMEABORT("Failed to dispatch Claim control runnable.");
|
|
|
|
}
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-10-27 04:03:00 -07:00
|
|
|
} // anonymous namespace
|
|
|
|
|
|
|
|
already_AddRefed<Promise>
|
2015-02-20 07:16:17 -08:00
|
|
|
ServiceWorkerClients::MatchAll(const ClientQueryOptions& aOptions,
|
|
|
|
ErrorResult& aRv)
|
2014-10-27 04:03:00 -07:00
|
|
|
{
|
|
|
|
WorkerPrivate* workerPrivate = GetCurrentThreadWorkerPrivate();
|
|
|
|
MOZ_ASSERT(workerPrivate);
|
|
|
|
workerPrivate->AssertIsOnWorkerThread();
|
|
|
|
|
2015-02-12 15:39:26 -08:00
|
|
|
nsString scope;
|
2014-10-27 04:03:00 -07:00
|
|
|
mWorkerScope->GetScope(scope);
|
|
|
|
|
2015-02-20 07:16:17 -08:00
|
|
|
if (aOptions.mIncludeUncontrolled || aOptions.mType != ClientType::Window) {
|
|
|
|
aRv.Throw(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2014-10-27 04:03:00 -07:00
|
|
|
nsRefPtr<Promise> promise = Promise::Create(mWorkerScope, aRv);
|
|
|
|
if (NS_WARN_IF(aRv.Failed())) {
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2015-04-07 06:25:08 -07:00
|
|
|
nsRefPtr<PromiseWorkerProxy> promiseProxy =
|
|
|
|
PromiseWorkerProxy::Create(workerPrivate, promise);
|
|
|
|
if (!promiseProxy->GetWorkerPromise()) {
|
2014-10-28 02:29:00 -07:00
|
|
|
// Don't dispatch if adding the worker feature failed.
|
|
|
|
return promise.forget();
|
|
|
|
}
|
|
|
|
|
2015-02-20 07:16:17 -08:00
|
|
|
nsRefPtr<MatchAllRunnable> r =
|
|
|
|
new MatchAllRunnable(workerPrivate,
|
2015-04-07 06:25:08 -07:00
|
|
|
promiseProxy,
|
2015-02-20 07:16:17 -08:00
|
|
|
NS_ConvertUTF16toUTF8(scope));
|
2014-10-27 04:03:00 -07:00
|
|
|
nsresult rv = NS_DispatchToMainThread(r);
|
|
|
|
|
|
|
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
|
|
|
promise->MaybeReject(NS_ERROR_NOT_AVAILABLE);
|
|
|
|
}
|
|
|
|
|
|
|
|
return promise.forget();
|
|
|
|
}
|
2015-03-06 05:04:49 -08:00
|
|
|
|
|
|
|
already_AddRefed<Promise>
|
|
|
|
ServiceWorkerClients::OpenWindow(const nsAString& aUrl)
|
|
|
|
{
|
|
|
|
ErrorResult result;
|
|
|
|
nsRefPtr<Promise> promise = Promise::Create(mWorkerScope, result);
|
|
|
|
if (NS_WARN_IF(result.Failed())) {
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
promise->MaybeReject(NS_ERROR_NOT_AVAILABLE);
|
|
|
|
return promise.forget();
|
|
|
|
}
|
|
|
|
|
|
|
|
already_AddRefed<Promise>
|
2015-05-14 12:41:42 -07:00
|
|
|
ServiceWorkerClients::Claim(ErrorResult& aRv)
|
2015-03-06 05:04:49 -08:00
|
|
|
{
|
2015-05-14 12:41:42 -07:00
|
|
|
WorkerPrivate* workerPrivate = GetCurrentThreadWorkerPrivate();
|
|
|
|
MOZ_ASSERT(workerPrivate);
|
|
|
|
|
|
|
|
nsRefPtr<Promise> promise = Promise::Create(mWorkerScope, aRv);
|
|
|
|
if (NS_WARN_IF(aRv.Failed())) {
|
2015-03-06 05:04:49 -08:00
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2015-05-14 12:41:42 -07:00
|
|
|
nsRefPtr<PromiseWorkerProxy> promiseProxy =
|
|
|
|
PromiseWorkerProxy::Create(workerPrivate, promise);
|
|
|
|
if (!promiseProxy->GetWorkerPromise()) {
|
|
|
|
// Don't dispatch if adding the worker feature failed.
|
|
|
|
return promise.forget();
|
|
|
|
}
|
|
|
|
|
|
|
|
nsString scope;
|
|
|
|
mWorkerScope->GetScope(scope);
|
|
|
|
|
|
|
|
nsRefPtr<ClaimRunnable> runnable =
|
|
|
|
new ClaimRunnable(promiseProxy, NS_ConvertUTF16toUTF8(scope));
|
|
|
|
|
|
|
|
aRv = NS_DispatchToMainThread(runnable);
|
|
|
|
if (NS_WARN_IF(aRv.Failed())) {
|
|
|
|
promise->MaybeReject(NS_ERROR_DOM_ABORT_ERR);
|
|
|
|
}
|
|
|
|
|
2015-03-06 05:04:49 -08:00
|
|
|
return promise.forget();
|
|
|
|
}
|