mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 11:55:49 +00:00
Bug 1419771 - Introduce DOMPrefs, a thread-safe access to preferences for DOM - part 11 - Promise Rejection Event enabled, r=asuth
This commit is contained in:
parent
01fd1fc62e
commit
c05772d855
@ -44,6 +44,7 @@ PREF(NotificationRIEnabled, "dom.webnotifications.requireinteraction.enabled")
|
||||
PREF(ServiceWorkersEnabled, "dom.serviceWorkers.enabled")
|
||||
PREF(ServiceWorkersTestingEnabled, "dom.serviceWorkers.testing.enabled")
|
||||
PREF(StorageManagerEnabled, "dom.storageManager.enabled")
|
||||
PREF(PromiseRejectionEventsEnabled, "dom.promise_rejection_events.enabled")
|
||||
|
||||
#undef PREF
|
||||
|
||||
@ -60,6 +61,7 @@ PREF_WEBIDL(NotificationEnabledInServiceWorkers)
|
||||
PREF_WEBIDL(NotificationRIEnabled)
|
||||
PREF_WEBIDL(ServiceWorkersEnabled)
|
||||
PREF_WEBIDL(StorageManagerEnabled)
|
||||
PREF_WEBIDL(PromiseRejectionEventsEnabled)
|
||||
|
||||
#undef PREF_WEBIDL
|
||||
|
||||
|
@ -55,6 +55,10 @@ public:
|
||||
// Returns true if the dom.storageManager.enabled pref is set.
|
||||
static bool StorageManagerEnabled();
|
||||
static bool StorageManagerEnabled(JSContext* aCx, JSObject* aObj);
|
||||
|
||||
// Returns true if the dom.promise_rejection_events.enabled pref is set.
|
||||
static bool PromiseRejectionEventsEnabled();
|
||||
static bool PromiseRejectionEventsEnabled(JSContext* aCx, JSObject* aObj);
|
||||
};
|
||||
|
||||
} // dom namespace
|
||||
|
@ -8885,25 +8885,6 @@ nsContentUtils::GetReferrerPolicyFromHeader(const nsAString& aHeader)
|
||||
return referrerPolicy;
|
||||
}
|
||||
|
||||
// static
|
||||
bool
|
||||
nsContentUtils::PromiseRejectionEventsEnabled(JSContext* aCx, JSObject* aObj)
|
||||
{
|
||||
if (NS_IsMainThread()) {
|
||||
return Preferences::GetBool("dom.promise_rejection_events.enabled", false);
|
||||
}
|
||||
|
||||
using namespace workers;
|
||||
|
||||
// Otherwise, check the pref via the WorkerPrivate
|
||||
WorkerPrivate* workerPrivate = GetWorkerPrivateFromContext(aCx);
|
||||
if (!workerPrivate) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return workerPrivate->PromiseRejectionEventsEnabled();
|
||||
}
|
||||
|
||||
// static
|
||||
bool
|
||||
nsContentUtils::PushEnabled(JSContext* aCx, JSObject* aObj)
|
||||
|
@ -2911,8 +2911,6 @@ public:
|
||||
*/
|
||||
static mozilla::net::ReferrerPolicy GetReferrerPolicyFromHeader(const nsAString& aHeader);
|
||||
|
||||
static bool PromiseRejectionEventsEnabled(JSContext* aCx, JSObject* aObj);
|
||||
|
||||
static bool PushEnabled(JSContext* aCx, JSObject* aObj);
|
||||
|
||||
static bool StreamsEnabled(JSContext* aCx, JSObject* aObj);
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
[Constructor(DOMString type, PromiseRejectionEventInit eventInitDict),
|
||||
Exposed=(Window,Worker),
|
||||
Func="nsContentUtils::PromiseRejectionEventsEnabled"]
|
||||
Func="mozilla::dom::DOMPrefs::PromiseRejectionEventsEnabled"]
|
||||
interface PromiseRejectionEvent : Event
|
||||
{
|
||||
[BinaryName="rejectedPromise"]
|
||||
|
@ -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.promise_rejection_events.enabled", PromiseRejectionEventsEnabled, PROMISE_REJECTION_EVENTS_ENABLED)
|
||||
WORKER_SIMPLE_PREF("dom.push.enabled", PushEnabled, PUSH_ENABLED)
|
||||
WORKER_SIMPLE_PREF("dom.streams.enabled", StreamsEnabled, STREAMS_ENABLED)
|
||||
WORKER_SIMPLE_PREF("dom.requestcontext.enabled", RequestContextEnabled, REQUESTCONTEXT_ENABLED)
|
||||
|
Loading…
Reference in New Issue
Block a user