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

This commit is contained in:
Andrea Marchesini 2017-12-13 14:02:44 -06:00
Родитель bd8d59c237
Коммит 9447a08bbc
4 изменённых файлов: 5 добавлений и 2 удалений

Просмотреть файл

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

Просмотреть файл

@ -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

2
dom/cache/CacheStorage.cpp поставляемый
Просмотреть файл

@ -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 = DOMPreferences::DOMCachesTestingEnabled() ||
aWorkerPrivate->ServiceWorkersTestingEnabled() ||
aWorkerPrivate->ServiceWorkersTestingInWindow() ||
aWorkerPrivate->IsServiceWorker();

Просмотреть файл

@ -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)