зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1419771 - Introduce DOMPreferences, a thread-safe access to preferences for DOM - part 10 - ServiceWorker Client OpenWindow enabled, r=asuth
This commit is contained in:
Родитель
6449cfcb08
Коммит
41df4c1f5b
|
@ -44,6 +44,7 @@ PREF(NotificationEnabledInServiceWorkers, "dom.webnotifications.serviceworker.en
|
|||
PREF(NotificationRIEnabled, "dom.webnotifications.requireinteraction.enabled")
|
||||
PREF(ServiceWorkersEnabled, "dom.serviceWorkers.enabled")
|
||||
PREF(ServiceWorkersTestingEnabled, "dom.serviceWorkers.testing.enabled")
|
||||
PREF(OpenWindowEnabled, "dom.serviceWorkers.openWindow.enabled")
|
||||
|
||||
#undef PREF
|
||||
|
||||
|
@ -59,6 +60,7 @@ PREF_WEBIDL(DOMCachesEnabled)
|
|||
PREF_WEBIDL(NotificationEnabledInServiceWorkers)
|
||||
PREF_WEBIDL(NotificationRIEnabled)
|
||||
PREF_WEBIDL(ServiceWorkersEnabled)
|
||||
PREF_WEBIDL(OpenWindowEnabled)
|
||||
|
||||
#undef PREF_WEBIDL
|
||||
|
||||
|
|
|
@ -51,6 +51,10 @@ public:
|
|||
|
||||
// Returns true if the dom.serviceWorkers.testing.enabled pref is set.
|
||||
static bool ServiceWorkersTestingEnabled();
|
||||
|
||||
// Returns true if the dom.serviceWorkers.openWindow.enabled pref is set.
|
||||
static bool OpenWindowEnabled();
|
||||
static bool OpenWindowEnabled(JSContext* aCx, JSObject* aObj);
|
||||
};
|
||||
|
||||
} // dom namespace
|
||||
|
|
|
@ -16,7 +16,7 @@ interface Clients {
|
|||
[NewObject]
|
||||
Promise<sequence<Client>> matchAll(optional ClientQueryOptions options);
|
||||
[NewObject,
|
||||
Func="mozilla::dom::ServiceWorkerGlobalScope::OpenWindowEnabled"]
|
||||
Func="mozilla::dom::DOMPreferences::OpenWindowEnabled"]
|
||||
Promise<WindowClient?> openWindow(USVString url);
|
||||
[NewObject]
|
||||
Promise<void> claim();
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include "mozilla/ErrorResult.h"
|
||||
#include "mozilla/dom/BindingDeclarations.h"
|
||||
#include "mozilla/dom/ClientBinding.h"
|
||||
#include "mozilla/dom/DOMPreferences.h"
|
||||
|
||||
class nsIDocument;
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
|
||||
#include "mozilla/dom/WorkerScope.h"
|
||||
#include "mozilla/dom/BindingDeclarations.h"
|
||||
#include "mozilla/dom/DOMPreferences.h"
|
||||
#include "mozilla/dom/ClientsBinding.h"
|
||||
#include "mozilla/ErrorResult.h"
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
// * First argument is the name of the pref.
|
||||
// * The name of the function that updates the new value of a pref.
|
||||
|
||||
WORKER_SIMPLE_PREF("dom.serviceWorkers.openWindow.enabled", OpenWindowEnabled, OPEN_WINDOW_ENABLED)
|
||||
WORKER_SIMPLE_PREF("dom.storageManager.enabled", StorageManagerEnabled, STORAGEMANAGER_ENABLED)
|
||||
WORKER_SIMPLE_PREF("dom.promise_rejection_events.enabled", PromiseRejectionEventsEnabled, PROMISE_REJECTION_EVENTS_ENABLED)
|
||||
WORKER_SIMPLE_PREF("dom.push.enabled", PushEnabled, PUSH_ENABLED)
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include "mozilla/EventListenerManager.h"
|
||||
#include "mozilla/dom/BindingDeclarations.h"
|
||||
#include "mozilla/dom/Console.h"
|
||||
#include "mozilla/dom/DOMPreferences.h"
|
||||
#include "mozilla/dom/DedicatedWorkerGlobalScopeBinding.h"
|
||||
#include "mozilla/dom/DOMPreferences.h"
|
||||
#include "mozilla/dom/Fetch.h"
|
||||
|
@ -849,15 +850,6 @@ ServiceWorkerGlobalScope::SkipWaiting(ErrorResult& aRv)
|
|||
return promise.forget();
|
||||
}
|
||||
|
||||
bool
|
||||
ServiceWorkerGlobalScope::OpenWindowEnabled(JSContext* aCx, JSObject* aObj)
|
||||
{
|
||||
WorkerPrivate* worker = GetCurrentThreadWorkerPrivate();
|
||||
MOZ_ASSERT(worker);
|
||||
worker->AssertIsOnWorkerThread();
|
||||
return worker->OpenWindowEnabled();
|
||||
}
|
||||
|
||||
WorkerDebuggerGlobalScope::WorkerDebuggerGlobalScope(
|
||||
WorkerPrivate* aWorkerPrivate)
|
||||
: mWorkerPrivate(aWorkerPrivate)
|
||||
|
|
|
@ -300,9 +300,6 @@ public:
|
|||
WrapGlobalObject(JSContext* aCx,
|
||||
JS::MutableHandle<JSObject*> aReflector) override;
|
||||
|
||||
static bool
|
||||
OpenWindowEnabled(JSContext* aCx, JSObject* aObj);
|
||||
|
||||
void
|
||||
GetScope(nsString& aScope) const
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче