Bug 1419771 - Introduce DOMPrefs, a thread-safe access to preferences for DOM - part 4 - DOM Cache testing enabled, r=asuth

This commit is contained in:
Andrea Marchesini 2018-01-08 14:05:04 +01:00
parent b0c234924a
commit 615e4c18e4
4 changed files with 5 additions and 2 deletions

View File

@ -36,6 +36,7 @@ DOMPrefs::DumpEnabled()
PREF(ImageBitmapExtensionsEnabled, "canvas.imagebitmap_extensions.enabled")
PREF(DOMCachesEnabled, "dom.caches.enabled")
PREF(DOMCachesTestingEnabled, "dom.caches.testing.enabled")
#undef PREF

View File

@ -23,6 +23,9 @@ public:
// Returns true if the dom.caches.enabled pref is set.
static bool DOMCachesEnabled();
static bool DOMCachesEnabled(JSContext* aCx, JSObject* aObj);
// Returns true if the dom.caches.testing.enabled pref is set.
static bool DOMCachesTestingEnabled();
};
} // dom namespace

View File

@ -219,7 +219,7 @@ CacheStorage::CreateOnWorker(Namespace aNamespace, nsIGlobalObject* aGlobal,
// origin checks. The ServiceWorker has its own trusted origin checks
// that are better than ours. In addition, we don't have information
// about the window any more, so we can't do our own checks.
bool testingEnabled = aWorkerPrivate->DOMCachesTestingEnabled() ||
bool testingEnabled = DOMPrefs::DOMCachesTestingEnabled() ||
aWorkerPrivate->ServiceWorkersTestingEnabled() ||
aWorkerPrivate->ServiceWorkersTestingInWindow() ||
aWorkerPrivate->IsServiceWorker();

View File

@ -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.caches.testing.enabled", DOMCachesTestingEnabled, DOM_CACHES_TESTING)
WORKER_SIMPLE_PREF("dom.performance.enable_user_timing_logging", PerformanceLoggingEnabled, PERFORMANCE_LOGGING_ENABLED)
WORKER_SIMPLE_PREF("dom.webnotifications.enabled", DOMWorkerNotificationEnabled, DOM_WORKERNOTIFICATION)
WORKER_SIMPLE_PREF("dom.webnotifications.serviceworker.enabled", DOMServiceWorkerNotificationEnabled, DOM_SERVICEWORKERNOTIFICATION)