mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 21:01:08 +00:00
Backed out 23 changesets (bug 1419771) for frequently failing service workers related devtools tests, e.g. devtools/client/aboutdebugging/test/browser_service_workers_push.js. r=backout on a CLOSED TREE
Backed out changeset 2242edc902a5 (bug 1419771) Backed out changeset 9cc3c29a9e36 (bug 1419771) Backed out changeset c39ee002c825 (bug 1419771) Backed out changeset caf7428013f2 (bug 1419771) Backed out changeset c03970363433 (bug 1419771) Backed out changeset 7f9de012861e (bug 1419771) Backed out changeset ed146ac42a7f (bug 1419771) Backed out changeset a8154698f782 (bug 1419771) Backed out changeset 8a54c1c8d45d (bug 1419771) Backed out changeset e32cd55b4c96 (bug 1419771) Backed out changeset b7f342f436ef (bug 1419771) Backed out changeset 60464b3e468f (bug 1419771) Backed out changeset 108806f14ad8 (bug 1419771) Backed out changeset 65998b0740f3 (bug 1419771) Backed out changeset 0d23880842d8 (bug 1419771) Backed out changeset 862aeaa2fefd (bug 1419771) Backed out changeset cbc192478bf5 (bug 1419771) Backed out changeset c58ef2a91bad (bug 1419771) Backed out changeset 2b0a4bfd654f (bug 1419771) Backed out changeset f182eba574f9 (bug 1419771) Backed out changeset d9999a624097 (bug 1419771) Backed out changeset 4050a1b8db2b (bug 1419771) Backed out changeset a1a68e6500d9 (bug 1419771)
This commit is contained in:
parent
044c09018c
commit
5c4663243d
@ -1,82 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||
/* 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/. */
|
||||
|
||||
#include "DOMPreferences.h"
|
||||
#include "mozilla/Atomics.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
void
|
||||
DOMPreferences::Initialize()
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
// Let's cache all the values on the main-thread.
|
||||
#if !(defined(DEBUG) || defined(MOZ_ENABLE_JS_DUMP))
|
||||
DOMPreferences::DumpEnabled();
|
||||
#endif
|
||||
|
||||
#define DOM_PREF(name, pref) DOMPreferences::name();
|
||||
#include "DOMPreferencesInternal.h"
|
||||
#undef DOM_PREF
|
||||
}
|
||||
|
||||
#define DOM_PREF(name, pref) \
|
||||
/* static */ bool \
|
||||
DOMPreferences::name() \
|
||||
{ \
|
||||
static bool initialized = false; \
|
||||
static Atomic<bool> cachedValue; \
|
||||
if (!initialized) { \
|
||||
initialized = true; \
|
||||
Preferences::AddAtomicBoolVarCache(&cachedValue, \
|
||||
pref, false); \
|
||||
} \
|
||||
return cachedValue; \
|
||||
}
|
||||
|
||||
#if !(defined(DEBUG) || defined(MOZ_ENABLE_JS_DUMP))
|
||||
DOM_PREF(DumpEnabled, "browser.dom.window.dump.enabled")
|
||||
#else
|
||||
/* static */ bool
|
||||
DOMPreferences::DumpEnabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
#include "DOMPreferencesInternal.h"
|
||||
#undef DOM_PREF
|
||||
|
||||
#define DOM_PREF_WEBIDL(name) \
|
||||
/* static */ bool \
|
||||
DOMPreferences::name(JSContext* aCx, JSObject* aObj) \
|
||||
{ \
|
||||
return DOMPreferences::name(); \
|
||||
}
|
||||
|
||||
DOM_PREF_WEBIDL(ImageBitmapExtensionsEnabled)
|
||||
DOM_PREF_WEBIDL(DOMCachesEnabled)
|
||||
DOM_PREF_WEBIDL(NotificationEnabledInServiceWorkers)
|
||||
DOM_PREF_WEBIDL(NotificationRIEnabled)
|
||||
DOM_PREF_WEBIDL(ServiceWorkersEnabled)
|
||||
DOM_PREF_WEBIDL(OpenWindowEnabled)
|
||||
DOM_PREF_WEBIDL(StorageManagerEnabled)
|
||||
DOM_PREF_WEBIDL(PromiseRejectionEventsEnabled)
|
||||
DOM_PREF_WEBIDL(PushEnabled)
|
||||
DOM_PREF_WEBIDL(StreamsEnabled)
|
||||
DOM_PREF_WEBIDL(RequestContextEnabled)
|
||||
DOM_PREF_WEBIDL(OffscreenCanvasEnabled)
|
||||
DOM_PREF_WEBIDL(WebkitBlinkDirectoryPickerEnabled)
|
||||
DOM_PREF_WEBIDL(NetworkInformationEnabled)
|
||||
DOM_PREF_WEBIDL(FetchObserverEnabled)
|
||||
|
||||
#undef DOM_PREF_WEBIDL
|
||||
|
||||
} // dom namespace
|
||||
} // mozilla namespace
|
@ -1,137 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||
/* 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/. */
|
||||
|
||||
#ifndef mozilla_dom_DOMPreferences_h
|
||||
#define mozilla_dom_DOMPreferences_h
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
|
||||
/* DOMPreferences provides consolidated, consistent access to preferences for
|
||||
* DOM APIs that may be invoked on Worker threads as well as the main thread.
|
||||
* Previously this was handled through a combination of per-API boilerplate
|
||||
* helper functions that would determine what thread they were on and defer to
|
||||
* the WorkerPrefs mechanism if they weren't the main thread.
|
||||
*
|
||||
* These methods can safely be invoked on any thread.
|
||||
*
|
||||
* Add preferences to this file when they need to be checked from both the main
|
||||
* thread and worker threads or when adding a new DOM API that is preference
|
||||
* controlled.
|
||||
*
|
||||
* ## How to add a new preference
|
||||
*
|
||||
* For preferences to be checked from code:
|
||||
* - Add a `FooEnabled();` prototype to DOMPreferences.h preceded by a comment.
|
||||
* The prototypes could be implemented as macro-expansions automatically, but
|
||||
* the macros can confuse code analysis tools (that are less clever than
|
||||
* searchfox).
|
||||
* - Add a `DOM_PREF(FooEnabled, "the.pref.name")` line to
|
||||
* DOMPreferencesInternal.h.
|
||||
*
|
||||
* For preferences to also be checked from WebIDL "Func" decorator checks:
|
||||
* - Add a `FooEnabled(JSContext* aCx, JSObject* aObj);` prototype to
|
||||
* DOMPreferences.h.
|
||||
* - Add a `DOM_PREF_WEBIDL(FooEnabled)` line to DOMPreferences.cpp.
|
||||
*/
|
||||
class DOMPreferences final
|
||||
{
|
||||
public:
|
||||
// This must be called on the main-thread in order to initialize the caching
|
||||
// of pref values on the correct thread. You should not use this method.
|
||||
static void Initialize();
|
||||
|
||||
// Returns true if the browser.dom.window.dump.enabled pref is set.
|
||||
static bool DumpEnabled();
|
||||
|
||||
// Returns true if the canvas.imagebitmap_extensions.enabled pref is set.
|
||||
static bool ImageBitmapExtensionsEnabled();
|
||||
static bool ImageBitmapExtensionsEnabled(JSContext* aCx, JSObject* aObj);
|
||||
|
||||
// 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();
|
||||
|
||||
// Returns true if the dom.performance.enable_user_timing_logging pref is set.
|
||||
static bool PerformanceLoggingEnabled();
|
||||
|
||||
// Returns true if the dom.webnotifications.enabled pref is set.
|
||||
// Note that you should use NotificationEnabledInServiceWorkers if you need to
|
||||
// enable Notification API for ServiceWorkers
|
||||
static bool NotificationEnabled();
|
||||
|
||||
// Returns true if the dom.webnotifications.serviceworker.enabled pref is set.
|
||||
static bool NotificationEnabledInServiceWorkers();
|
||||
static bool NotificationEnabledInServiceWorkers(JSContext* aCx,
|
||||
JSObject* aObj);
|
||||
|
||||
// Returns true if the dom.webnotifications.requireinteraction.enabled pref is
|
||||
// set.
|
||||
static bool NotificationRIEnabled();
|
||||
static bool NotificationRIEnabled(JSContext* aCx, JSObject* aObj);
|
||||
|
||||
// Returns true if the dom.serviceWorkers.enabled pref is set.
|
||||
static bool ServiceWorkersEnabled();
|
||||
static bool ServiceWorkersEnabled(JSContext* aCx, JSObject* aObj);
|
||||
|
||||
// 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);
|
||||
|
||||
// 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);
|
||||
|
||||
// Returns true if the dom.push.enabled pref is set.
|
||||
static bool PushEnabled();
|
||||
static bool PushEnabled(JSContext* aCx, JSObject* aObj);
|
||||
|
||||
// Returns true if the dom.streams.enabled pref is set.
|
||||
static bool StreamsEnabled();
|
||||
static bool StreamsEnabled(JSContext* aCx, JSObject* aObj);
|
||||
|
||||
// Returns true if the dom.requestcontext.enabled pref is set.
|
||||
static bool RequestContextEnabled();
|
||||
static bool RequestContextEnabled(JSContext* aCx, JSObject* aObj);
|
||||
|
||||
// Returns true if the gfx.offscreencanvas.enabled pref is set.
|
||||
static bool OffscreenCanvasEnabled();
|
||||
static bool OffscreenCanvasEnabled(JSContext* aCx, JSObject* aObj);
|
||||
|
||||
// Returns true if the dom.webkitBlink.dirPicker.enabled pref is set.
|
||||
static bool WebkitBlinkDirectoryPickerEnabled();
|
||||
static bool WebkitBlinkDirectoryPickerEnabled(JSContext* aCx, JSObject* aObj);
|
||||
|
||||
// Returns true if the dom.netinfo.enabled pref is set.
|
||||
static bool NetworkInformationEnabled();
|
||||
static bool NetworkInformationEnabled(JSContext* aCx, JSObject* aObj);
|
||||
|
||||
// Returns true if the dom.fetchObserver.enabled pref is set.
|
||||
static bool FetchObserverEnabled();
|
||||
static bool FetchObserverEnabled(JSContext* aCx, JSObject* aObj);
|
||||
|
||||
// Returns true if the privacy.resistFingerprinting pref is set.
|
||||
static bool ResistFingerprintingEnabled();
|
||||
|
||||
// Returns true if the devtools.enabled pref is set.
|
||||
static bool DevToolsEnabled();
|
||||
};
|
||||
|
||||
} // dom namespace
|
||||
} // mozilla namespace
|
||||
|
||||
#endif // mozilla_dom_DOMPreferences_h
|
@ -1,27 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||
/* 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/. */
|
||||
|
||||
DOM_PREF(ImageBitmapExtensionsEnabled, "canvas.imagebitmap_extensions.enabled")
|
||||
DOM_PREF(DOMCachesEnabled, "dom.caches.enabled")
|
||||
DOM_PREF(DOMCachesTestingEnabled, "dom.caches.testing.enabled")
|
||||
DOM_PREF(PerformanceLoggingEnabled, "dom.performance.enable_user_timing_logging")
|
||||
DOM_PREF(NotificationEnabled, "dom.webnotifications.enabled")
|
||||
DOM_PREF(NotificationEnabledInServiceWorkers, "dom.webnotifications.serviceworker.enabled")
|
||||
DOM_PREF(NotificationRIEnabled, "dom.webnotifications.requireinteraction.enabled")
|
||||
DOM_PREF(ServiceWorkersEnabled, "dom.serviceWorkers.enabled")
|
||||
DOM_PREF(ServiceWorkersTestingEnabled, "dom.serviceWorkers.testing.enabled")
|
||||
DOM_PREF(OpenWindowEnabled, "dom.serviceWorkers.openWindow.enabled")
|
||||
DOM_PREF(StorageManagerEnabled, "dom.storageManager.enabled")
|
||||
DOM_PREF(PromiseRejectionEventsEnabled, "dom.promise_rejection_events.enabled")
|
||||
DOM_PREF(PushEnabled, "dom.push.enabled")
|
||||
DOM_PREF(StreamsEnabled, "dom.streams.enabled")
|
||||
DOM_PREF(RequestContextEnabled, "dom.requestcontext.enabled")
|
||||
DOM_PREF(OffscreenCanvasEnabled, "gfx.offscreencanvas.enabled")
|
||||
DOM_PREF(WebkitBlinkDirectoryPickerEnabled, "dom.webkitBlink.dirPicker.enabled")
|
||||
DOM_PREF(NetworkInformationEnabled, "dom.netinfo.enabled")
|
||||
DOM_PREF(FetchObserverEnabled, "dom.fetchObserver.enabled")
|
||||
DOM_PREF(ResistFingerprintingEnabled, "privacy.resistFingerprinting")
|
||||
DOM_PREF(DevToolsEnabled, "devtools.enabled")
|
@ -6,7 +6,6 @@
|
||||
|
||||
#include "FuzzingFunctions.h"
|
||||
|
||||
#include "mozilla/ErrorResult.h"
|
||||
#include "nsJSEnvironment.h"
|
||||
#include "js/GCAPI.h"
|
||||
#include "nsIAccessibilityService.h"
|
||||
|
@ -8,9 +8,6 @@
|
||||
#define mozilla_dom_FuzzingFunctions
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class ErrorResult;
|
||||
|
||||
namespace dom {
|
||||
|
||||
class GlobalObject;
|
||||
|
@ -10,10 +10,6 @@
|
||||
#include "mozIMozIntl.h"
|
||||
#include "nsContentUtils.h"
|
||||
|
||||
#ifdef XP_WIN
|
||||
#undef GetLocaleInfo
|
||||
#endif
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
|
@ -10,10 +10,6 @@
|
||||
#include "nsWrapperCache.h"
|
||||
#include "xpcprivate.h"
|
||||
|
||||
#ifdef XP_WIN
|
||||
#undef GetLocaleInfo
|
||||
#endif
|
||||
|
||||
class nsPIDOMWindowInner;
|
||||
|
||||
namespace mozilla {
|
||||
|
@ -171,7 +171,6 @@ EXPORTS.mozilla.dom += [
|
||||
'DOMMatrix.h',
|
||||
'DOMParser.h',
|
||||
'DOMPoint.h',
|
||||
'DOMPreferences.h',
|
||||
'DOMQuad.h',
|
||||
'DOMRect.h',
|
||||
'DOMRequest.h',
|
||||
@ -249,7 +248,6 @@ UNIFIED_SOURCES += [
|
||||
'DOMMatrix.cpp',
|
||||
'DOMParser.cpp',
|
||||
'DOMPoint.cpp',
|
||||
'DOMPreferences.cpp',
|
||||
'DOMQuad.cpp',
|
||||
'DOMRect.cpp',
|
||||
'DOMRequest.cpp',
|
||||
|
@ -294,9 +294,11 @@ bool nsContentUtils::sIsFrameTimingPrefEnabled = false;
|
||||
bool nsContentUtils::sIsPerformanceTimingEnabled = false;
|
||||
bool nsContentUtils::sIsResourceTimingEnabled = false;
|
||||
bool nsContentUtils::sIsPerformanceNavigationTimingEnabled = false;
|
||||
bool nsContentUtils::sIsUserTimingLoggingEnabled = false;
|
||||
bool nsContentUtils::sIsFormAutofillAutocompleteEnabled = false;
|
||||
bool nsContentUtils::sIsWebComponentsEnabled = false;
|
||||
bool nsContentUtils::sIsCustomElementsEnabled = false;
|
||||
bool nsContentUtils::sDevToolsEnabled = false;
|
||||
bool nsContentUtils::sSendPerformanceTimingNotifications = false;
|
||||
bool nsContentUtils::sUseActivityCursor = false;
|
||||
bool nsContentUtils::sAnimationsAPICoreEnabled = false;
|
||||
@ -334,6 +336,10 @@ nsIParser* nsContentUtils::sXMLFragmentParser = nullptr;
|
||||
nsIFragmentContentSink* nsContentUtils::sXMLFragmentSink = nullptr;
|
||||
bool nsContentUtils::sFragmentParsingActive = false;
|
||||
|
||||
#if !(defined(DEBUG) || defined(MOZ_ENABLE_JS_DUMP))
|
||||
bool nsContentUtils::sDOMWindowDumpEnabled;
|
||||
#endif
|
||||
|
||||
bool nsContentUtils::sDoNotTrackEnabled = false;
|
||||
|
||||
mozilla::LazyLogModule nsContentUtils::sDOMDumpLog("Dump");
|
||||
@ -651,6 +657,9 @@ nsContentUtils::Init()
|
||||
Preferences::AddBoolVarCache(&sIsPerformanceNavigationTimingEnabled,
|
||||
"dom.enable_performance_navigation_timing", true);
|
||||
|
||||
Preferences::AddBoolVarCache(&sIsUserTimingLoggingEnabled,
|
||||
"dom.performance.enable_user_timing_logging", false);
|
||||
|
||||
Preferences::AddBoolVarCache(&sIsFrameTimingPrefEnabled,
|
||||
"dom.enable_frame_timing", false);
|
||||
|
||||
@ -663,6 +672,9 @@ nsContentUtils::Init()
|
||||
Preferences::AddBoolVarCache(&sIsCustomElementsEnabled,
|
||||
"dom.webcomponents.customelements.enabled", false);
|
||||
|
||||
Preferences::AddBoolVarCache(&sDevToolsEnabled,
|
||||
"devtools.enabled");
|
||||
|
||||
Preferences::AddIntVarCache(&sPrivacyMaxInnerWidth,
|
||||
"privacy.window.maxInnerWidth",
|
||||
1000);
|
||||
@ -686,6 +698,11 @@ nsContentUtils::Init()
|
||||
"network.cookie.cookieBehavior",
|
||||
nsICookieService::BEHAVIOR_ACCEPT);
|
||||
|
||||
#if !(defined(DEBUG) || defined(MOZ_ENABLE_JS_DUMP))
|
||||
Preferences::AddBoolVarCache(&sDOMWindowDumpEnabled,
|
||||
"browser.dom.window.dump.enabled");
|
||||
#endif
|
||||
|
||||
Preferences::AddBoolVarCache(&sDoNotTrackEnabled,
|
||||
"privacy.donottrackheader.enabled", false);
|
||||
|
||||
@ -2373,7 +2390,17 @@ nsContentUtils::IsCallerChrome()
|
||||
bool
|
||||
nsContentUtils::ShouldResistFingerprinting()
|
||||
{
|
||||
return DOMPreferences::ResistFingerprintingEnabled();
|
||||
if (NS_IsMainThread()) {
|
||||
return nsRFPService::IsResistFingerprintingEnabled();
|
||||
}
|
||||
|
||||
workers::WorkerPrivate* workerPrivate = workers::GetCurrentThreadWorkerPrivate();
|
||||
if (NS_WARN_IF(!workerPrivate)) {
|
||||
return false;
|
||||
}
|
||||
workerPrivate->AssertIsOnWorkerThread();
|
||||
|
||||
return workerPrivate->ResistFingerprintingEnabled();
|
||||
}
|
||||
|
||||
bool
|
||||
@ -7586,6 +7613,19 @@ nsContentUtils::IsAllowedNonCorsContentType(const nsACString& aHeaderValue)
|
||||
contentType.LowerCaseEqualsLiteral("multipart/form-data");
|
||||
}
|
||||
|
||||
bool
|
||||
nsContentUtils::DOMWindowDumpEnabled()
|
||||
{
|
||||
#if !(defined(DEBUG) || defined(MOZ_ENABLE_JS_DUMP))
|
||||
// In optimized builds we check a pref that controls if we should
|
||||
// enable output from dump() or not, in debug builds it's always
|
||||
// enabled.
|
||||
return nsContentUtils::sDOMWindowDumpEnabled;
|
||||
#else
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool
|
||||
nsContentUtils::DoNotTrackEnabled()
|
||||
{
|
||||
@ -8898,6 +8938,63 @@ 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)
|
||||
{
|
||||
if (NS_IsMainThread()) {
|
||||
return Preferences::GetBool("dom.push.enabled", false);
|
||||
}
|
||||
|
||||
using namespace workers;
|
||||
|
||||
// Otherwise, check the pref via the WorkerPrivate
|
||||
WorkerPrivate* workerPrivate = GetWorkerPrivateFromContext(aCx);
|
||||
if (!workerPrivate) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return workerPrivate->PushEnabled();
|
||||
}
|
||||
|
||||
// static
|
||||
bool
|
||||
nsContentUtils::StreamsEnabled(JSContext* aCx, JSObject* aObj)
|
||||
{
|
||||
if (NS_IsMainThread()) {
|
||||
return Preferences::GetBool("dom.streams.enabled", false);
|
||||
}
|
||||
|
||||
using namespace workers;
|
||||
|
||||
// Otherwise, check the pref via the WorkerPrivate
|
||||
WorkerPrivate* workerPrivate = GetWorkerPrivateFromContext(aCx);
|
||||
if (!workerPrivate) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return workerPrivate->StreamsEnabled();
|
||||
}
|
||||
|
||||
// static
|
||||
bool
|
||||
nsContentUtils::IsNonSubresourceRequest(nsIChannel* aChannel)
|
||||
@ -11015,6 +11112,21 @@ nsContentUtils::ExtractErrorValues(JSContext* aCx,
|
||||
|
||||
#undef EXTRACT_EXN_VALUES
|
||||
|
||||
/* static */ bool
|
||||
nsContentUtils::DevToolsEnabled(JSContext* aCx)
|
||||
{
|
||||
if (NS_IsMainThread()) {
|
||||
return sDevToolsEnabled;
|
||||
}
|
||||
|
||||
workers::WorkerPrivate* workerPrivate = workers::GetWorkerPrivateFromContext(aCx);
|
||||
if (!workerPrivate) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return workerPrivate->DevToolsEnabled();
|
||||
}
|
||||
|
||||
/* static */ bool
|
||||
nsContentUtils::ContentIsLink(nsIContent* aContent)
|
||||
{
|
||||
|
@ -2276,6 +2276,14 @@ public:
|
||||
return sIsPerformanceTimingEnabled;
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns true if user timing API should print to console.
|
||||
*/
|
||||
static bool IsUserTimingLoggingEnabled()
|
||||
{
|
||||
return sIsUserTimingLoggingEnabled;
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns true if the performance timing APIs are enabled.
|
||||
*/
|
||||
@ -2682,6 +2690,11 @@ public:
|
||||
*/
|
||||
static mozilla::HTMLEditor* GetHTMLEditor(nsPresContext* aPresContext);
|
||||
|
||||
/**
|
||||
* Returns true if the browser.dom.window.dump.enabled pref is set.
|
||||
*/
|
||||
static bool DOMWindowDumpEnabled();
|
||||
|
||||
/**
|
||||
* Returns true if the privacy.donottrackheader.enabled pref is set.
|
||||
*/
|
||||
@ -2918,6 +2931,12 @@ 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);
|
||||
|
||||
static bool IsNonSubresourceRequest(nsIChannel* aChannel);
|
||||
|
||||
static uint32_t CookiesBehavior()
|
||||
@ -3399,10 +3418,12 @@ private:
|
||||
static bool sIsPerformanceTimingEnabled;
|
||||
static bool sIsResourceTimingEnabled;
|
||||
static bool sIsPerformanceNavigationTimingEnabled;
|
||||
static bool sIsUserTimingLoggingEnabled;
|
||||
static bool sIsFrameTimingPrefEnabled;
|
||||
static bool sIsFormAutofillAutocompleteEnabled;
|
||||
static bool sIsWebComponentsEnabled;
|
||||
static bool sIsCustomElementsEnabled;
|
||||
static bool sDevToolsEnabled;
|
||||
static bool sSendPerformanceTimingNotifications;
|
||||
static bool sUseActivityCursor;
|
||||
static bool sAnimationsAPICoreEnabled;
|
||||
@ -3451,6 +3472,9 @@ private:
|
||||
// bytecode out of the nsCacheInfoChannel.
|
||||
static nsCString* sJSBytecodeMimeType;
|
||||
|
||||
#if !(defined(DEBUG) || defined(MOZ_ENABLE_JS_DUMP))
|
||||
static bool sDOMWindowDumpEnabled;
|
||||
#endif
|
||||
static bool sDoNotTrackEnabled;
|
||||
static mozilla::LazyLogModule sDOMDumpLog;
|
||||
|
||||
|
@ -36,7 +36,6 @@
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/ScriptPreloader.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
#include "mozilla/dom/DOMPreferences.h"
|
||||
#include "mozilla/dom/File.h"
|
||||
#include "mozilla/dom/MessagePort.h"
|
||||
#include "mozilla/dom/ContentParent.h"
|
||||
@ -806,7 +805,7 @@ nsFrameMessageManager::ReleaseCachedProcesses()
|
||||
NS_IMETHODIMP
|
||||
nsFrameMessageManager::Dump(const nsAString& aStr)
|
||||
{
|
||||
if (!DOMPreferences::DumpEnabled()) {
|
||||
if (!nsContentUtils::DOMWindowDumpEnabled()) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,6 @@
|
||||
#include "nsHistory.h"
|
||||
#include "nsDOMNavigationTiming.h"
|
||||
#include "nsIDOMStorageManager.h"
|
||||
#include "mozilla/dom/DOMPreferences.h"
|
||||
#include "mozilla/dom/LocalStorage.h"
|
||||
#include "mozilla/dom/Storage.h"
|
||||
#include "mozilla/dom/IdleRequest.h"
|
||||
@ -3344,7 +3343,7 @@ nsGlobalWindowInner::GetFullScreen()
|
||||
void
|
||||
nsGlobalWindowInner::Dump(const nsAString& aStr)
|
||||
{
|
||||
if (!DOMPreferences::DumpEnabled()) {
|
||||
if (!nsContentUtils::DOMWindowDumpEnabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -7505,7 +7504,7 @@ nsGlobalWindowInner::CreateImageBitmap(JSContext* aCx,
|
||||
const Sequence<ChannelPixelLayout>& aLayout,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
if (!DOMPreferences::ImageBitmapExtensionsEnabled()) {
|
||||
if (!ImageBitmap::ExtensionsEnabled(aCx)) {
|
||||
aRv.Throw(NS_ERROR_TYPE_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -37,7 +37,6 @@
|
||||
#include "nsSize.h"
|
||||
#include "mozilla/FlushType.h"
|
||||
#include "prclist.h"
|
||||
#include "mozilla/dom/DOMPreferences.h"
|
||||
#include "mozilla/dom/BindingDeclarations.h"
|
||||
#include "mozilla/dom/StorageEvent.h"
|
||||
#include "mozilla/dom/StorageEventBinding.h"
|
||||
|
24
dom/cache/Cache.cpp
vendored
24
dom/cache/Cache.cpp
vendored
@ -17,7 +17,6 @@
|
||||
#include "mozilla/dom/cache/CacheChild.h"
|
||||
#include "mozilla/dom/cache/CacheWorkerHolder.h"
|
||||
#include "mozilla/dom/cache/ReadStream.h"
|
||||
#include "mozilla/dom/DOMPreferences.h"
|
||||
#include "mozilla/ErrorResult.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/Unused.h"
|
||||
@ -518,6 +517,29 @@ Cache::Keys(JSContext* aCx, const Optional<RequestOrUSVString>& aRequest,
|
||||
return ExecuteOp(args, aRv);
|
||||
}
|
||||
|
||||
// static
|
||||
bool
|
||||
Cache::PrefEnabled(JSContext* aCx, JSObject* aObj)
|
||||
{
|
||||
using mozilla::dom::workers::WorkerPrivate;
|
||||
using mozilla::dom::workers::GetWorkerPrivateFromContext;
|
||||
|
||||
// If we're on the main thread, then check the pref directly.
|
||||
if (NS_IsMainThread()) {
|
||||
bool enabled = false;
|
||||
Preferences::GetBool("dom.caches.enabled", &enabled);
|
||||
return enabled;
|
||||
}
|
||||
|
||||
// Otherwise check the pref via the work private helper
|
||||
WorkerPrivate* workerPrivate = GetWorkerPrivateFromContext(aCx);
|
||||
if (!workerPrivate) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return workerPrivate->DOMCachesEnabled();
|
||||
}
|
||||
|
||||
nsISupports*
|
||||
Cache::GetParentObject() const
|
||||
{
|
||||
|
2
dom/cache/Cache.h
vendored
2
dom/cache/Cache.h
vendored
@ -68,6 +68,8 @@ public:
|
||||
const CacheQueryOptions& aParams, ErrorResult& aRv);
|
||||
|
||||
// binding methods
|
||||
static bool PrefEnabled(JSContext* aCx, JSObject* aObj);
|
||||
|
||||
nsISupports* GetParentObject() const;
|
||||
virtual JSObject* WrapObject(JSContext* aContext, JS::Handle<JSObject*> aGivenProto) override;
|
||||
|
||||
|
16
dom/cache/CacheStorage.cpp
vendored
16
dom/cache/CacheStorage.cpp
vendored
@ -9,7 +9,6 @@
|
||||
#include "mozilla/Unused.h"
|
||||
#include "mozilla/dom/CacheBinding.h"
|
||||
#include "mozilla/dom/CacheStorageBinding.h"
|
||||
#include "mozilla/dom/DOMPreferences.h"
|
||||
#include "mozilla/dom/InternalRequest.h"
|
||||
#include "mozilla/dom/Promise.h"
|
||||
#include "mozilla/dom/Response.h"
|
||||
@ -161,8 +160,8 @@ CacheStorage::CreateOnMainThread(Namespace aNamespace, nsIGlobalObject* aGlobal,
|
||||
}
|
||||
|
||||
bool testingEnabled = aForceTrustedOrigin ||
|
||||
DOMPreferences::DOMCachesTestingEnabled() ||
|
||||
DOMPreferences::ServiceWorkersTestingEnabled();
|
||||
Preferences::GetBool("dom.caches.testing.enabled", false) ||
|
||||
Preferences::GetBool("dom.serviceWorkers.testing.enabled", false);
|
||||
|
||||
if (!IsTrusted(principalInfo, testingEnabled)) {
|
||||
NS_WARNING("CacheStorage not supported on untrusted origins.");
|
||||
@ -220,8 +219,8 @@ 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 = DOMPreferences::DOMCachesTestingEnabled() ||
|
||||
DOMPreferences::ServiceWorkersTestingEnabled() ||
|
||||
bool testingEnabled = aWorkerPrivate->DOMCachesTestingEnabled() ||
|
||||
aWorkerPrivate->ServiceWorkersTestingEnabled() ||
|
||||
aWorkerPrivate->ServiceWorkersTestingInWindow() ||
|
||||
aWorkerPrivate->IsServiceWorker();
|
||||
|
||||
@ -445,6 +444,13 @@ CacheStorage::Keys(ErrorResult& aRv)
|
||||
return promise.forget();
|
||||
}
|
||||
|
||||
// static
|
||||
bool
|
||||
CacheStorage::PrefEnabled(JSContext* aCx, JSObject* aObj)
|
||||
{
|
||||
return Cache::PrefEnabled(aCx, aObj);
|
||||
}
|
||||
|
||||
// static
|
||||
already_AddRefed<CacheStorage>
|
||||
CacheStorage::Constructor(const GlobalObject& aGlobal,
|
||||
|
2
dom/cache/CacheStorage.h
vendored
2
dom/cache/CacheStorage.h
vendored
@ -73,6 +73,8 @@ public:
|
||||
nsIPrincipal* aPrincipal, ErrorResult& aRv);
|
||||
|
||||
// binding methods
|
||||
static bool PrefEnabled(JSContext* aCx, JSObject* aObj);
|
||||
|
||||
nsISupports* GetParentObject() const;
|
||||
virtual JSObject* WrapObject(JSContext* aContext, JS::Handle<JSObject*> aGivenProto) override;
|
||||
|
||||
|
@ -6,7 +6,6 @@
|
||||
|
||||
#include "mozilla/dom/ImageBitmap.h"
|
||||
#include "mozilla/CheckedInt.h"
|
||||
#include "mozilla/dom/DOMPreferences.h"
|
||||
#include "mozilla/dom/ImageBitmapBinding.h"
|
||||
#include "mozilla/dom/Promise.h"
|
||||
#include "mozilla/dom/StructuredCloneTags.h"
|
||||
@ -1435,6 +1434,18 @@ ImageBitmap::WriteStructuredClone(JSStructuredCloneWriter* aWriter,
|
||||
return true;
|
||||
}
|
||||
|
||||
/*static*/ bool
|
||||
ImageBitmap::ExtensionsEnabled(JSContext* aCx, JSObject*)
|
||||
{
|
||||
if (NS_IsMainThread()) {
|
||||
return Preferences::GetBool("canvas.imagebitmap_extensions.enabled");
|
||||
} else {
|
||||
WorkerPrivate* workerPrivate = GetWorkerPrivateFromContext(aCx);
|
||||
MOZ_ASSERT(workerPrivate);
|
||||
return workerPrivate->ImageBitmapExtensionsEnabled();
|
||||
}
|
||||
}
|
||||
|
||||
// ImageBitmap extensions.
|
||||
ImageBitmapFormat
|
||||
ImageBitmap::FindOptimalFormat(const Optional<Sequence<ImageBitmapFormat>>& aPossibleFormats,
|
||||
|
@ -152,6 +152,12 @@ public:
|
||||
nsTArray<RefPtr<gfx::DataSourceSurface>>& aClonedSurfaces,
|
||||
ImageBitmap* aImageBitmap);
|
||||
|
||||
// Mozilla Extensions
|
||||
// aObj is an optional argument that isn't used by ExtensionsEnabled() and
|
||||
// only exists because the bindings layer insists on passing it to us. All
|
||||
// other consumers of this function should only call it passing one argument.
|
||||
static bool ExtensionsEnabled(JSContext* aCx, JSObject* aObj = nullptr);
|
||||
|
||||
friend CreateImageBitmapFromBlob;
|
||||
friend CreateImageBitmapFromBlobTask;
|
||||
friend CreateImageBitmapFromBlobWorkerTask;
|
||||
|
@ -6,7 +6,6 @@
|
||||
|
||||
#include "OffscreenCanvas.h"
|
||||
|
||||
#include "mozilla/dom/DOMPreferences.h"
|
||||
#include "mozilla/dom/OffscreenCanvasBinding.h"
|
||||
#include "mozilla/dom/WorkerPrivate.h"
|
||||
#include "mozilla/dom/WorkerScope.h"
|
||||
@ -333,6 +332,18 @@ OffscreenCanvas::CreateFromCloneData(nsIGlobalObject* aGlobal, OffscreenCanvasCl
|
||||
return wc.forget();
|
||||
}
|
||||
|
||||
/* static */ bool
|
||||
OffscreenCanvas::PrefEnabled(JSContext* aCx, JSObject* aObj)
|
||||
{
|
||||
if (NS_IsMainThread()) {
|
||||
return Preferences::GetBool("gfx.offscreencanvas.enabled");
|
||||
} else {
|
||||
WorkerPrivate* workerPrivate = GetWorkerPrivateFromContext(aCx);
|
||||
MOZ_ASSERT(workerPrivate);
|
||||
return workerPrivate->OffscreenCanvasEnabled();
|
||||
}
|
||||
}
|
||||
|
||||
/* static */ bool
|
||||
OffscreenCanvas::PrefEnabledOnWorkerThread(JSContext* aCx, JSObject* aObj)
|
||||
{
|
||||
@ -340,7 +351,7 @@ OffscreenCanvas::PrefEnabledOnWorkerThread(JSContext* aCx, JSObject* aObj)
|
||||
return true;
|
||||
}
|
||||
|
||||
return DOMPreferences::OffscreenCanvasEnabled(aCx, aObj);
|
||||
return PrefEnabled(aCx, aObj);
|
||||
}
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_INHERITED(OffscreenCanvas, DOMEventTargetHelper, mCurrentContext)
|
||||
|
@ -9,7 +9,6 @@
|
||||
|
||||
#include "gfxTypes.h"
|
||||
#include "mozilla/DOMEventTargetHelper.h"
|
||||
#include "mozilla/dom/DOMPreferences.h"
|
||||
#include "mozilla/layers/LayersTypes.h"
|
||||
#include "mozilla/RefPtr.h"
|
||||
#include "CanvasRenderingContextHelper.h"
|
||||
@ -131,6 +130,8 @@ public:
|
||||
static already_AddRefed<OffscreenCanvas>
|
||||
CreateFromCloneData(nsIGlobalObject* aGlobal, OffscreenCanvasCloneData* aData);
|
||||
|
||||
static bool PrefEnabled(JSContext* aCx, JSObject* aObj);
|
||||
|
||||
// Return true on main-thread, and return gfx.offscreencanvas.enabled
|
||||
// on worker thread.
|
||||
static bool PrefEnabledOnWorkerThread(JSContext* aCx, JSObject* aObj);
|
||||
|
@ -8,7 +8,6 @@
|
||||
#include "mozilla/dom/ConsoleBinding.h"
|
||||
|
||||
#include "mozilla/dom/BlobBinding.h"
|
||||
#include "mozilla/dom/DOMPreferences.h"
|
||||
#include "mozilla/dom/Exceptions.h"
|
||||
#include "mozilla/dom/File.h"
|
||||
#include "mozilla/dom/FunctionBinding.h"
|
||||
@ -1055,7 +1054,7 @@ Console::ProfileMethodInternal(JSContext* aCx, const nsAString& aAction,
|
||||
const Sequence<JS::Value>& aData)
|
||||
{
|
||||
// Make all Console API no-op if DevTools aren't enabled.
|
||||
if (!DOMPreferences::DevToolsEnabled()) {
|
||||
if (!nsContentUtils::DevToolsEnabled(aCx)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1208,7 +1207,7 @@ Console::MethodInternal(JSContext* aCx, MethodName aMethodName,
|
||||
const Sequence<JS::Value>& aData)
|
||||
{
|
||||
// Make all Console API no-op if DevTools aren't enabled.
|
||||
if (!DOMPreferences::DevToolsEnabled()) {
|
||||
if (!nsContentUtils::DevToolsEnabled(aCx)) {
|
||||
return;
|
||||
}
|
||||
AssertIsOnOwningThread();
|
||||
|
@ -26,6 +26,24 @@ NS_INTERFACE_MAP_END_INHERITING(DOMEventTargetHelper)
|
||||
NS_IMPL_ADDREF_INHERITED(FetchObserver, DOMEventTargetHelper)
|
||||
NS_IMPL_RELEASE_INHERITED(FetchObserver, DOMEventTargetHelper)
|
||||
|
||||
/* static */ bool
|
||||
FetchObserver::IsEnabled(JSContext* aCx, JSObject* aGlobal)
|
||||
{
|
||||
if (NS_IsMainThread()) {
|
||||
return Preferences::GetBool("dom.fetchObserver.enabled", false);
|
||||
}
|
||||
|
||||
using namespace workers;
|
||||
|
||||
// Otherwise, check the pref via the WorkerPrivate
|
||||
WorkerPrivate* workerPrivate = GetWorkerPrivateFromContext(aCx);
|
||||
if (!workerPrivate) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return workerPrivate->FetchObserverEnabled();
|
||||
}
|
||||
|
||||
FetchObserver::FetchObserver(nsIGlobalObject* aGlobal,
|
||||
AbortSignal* aSignal)
|
||||
: DOMEventTargetHelper(aGlobal)
|
||||
|
@ -21,6 +21,9 @@ public:
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(FetchObserver, DOMEventTargetHelper)
|
||||
|
||||
static bool
|
||||
IsEnabled(JSContext* aCx, JSObject* aGlobal);
|
||||
|
||||
FetchObserver(nsIGlobalObject* aGlobal, AbortSignal* aSignal);
|
||||
|
||||
JSObject*
|
||||
|
@ -77,6 +77,25 @@ Request::~Request()
|
||||
{
|
||||
}
|
||||
|
||||
// static
|
||||
bool
|
||||
Request::RequestContextEnabled(JSContext* aCx, JSObject* aObj)
|
||||
{
|
||||
if (NS_IsMainThread()) {
|
||||
return Preferences::GetBool("dom.requestcontext.enabled", false);
|
||||
}
|
||||
|
||||
using namespace workers;
|
||||
|
||||
// Otherwise, check the pref via the WorkerPrivate
|
||||
WorkerPrivate* workerPrivate = GetWorkerPrivateFromContext(aCx);
|
||||
if (!workerPrivate) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return workerPrivate->RequestContextEnabled();
|
||||
}
|
||||
|
||||
already_AddRefed<InternalRequest>
|
||||
Request::GetInternalRequest()
|
||||
{
|
||||
|
@ -35,6 +35,9 @@ public:
|
||||
Request(nsIGlobalObject* aOwner, InternalRequest* aRequest,
|
||||
AbortSignal* aSignal);
|
||||
|
||||
static bool
|
||||
RequestContextEnabled(JSContext* aCx, JSObject* aObj);
|
||||
|
||||
JSObject*
|
||||
WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override
|
||||
{
|
||||
|
@ -47,6 +47,24 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(Directory)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
/* static */ bool
|
||||
Directory::WebkitBlinkDirectoryPickerEnabled(JSContext* aCx, JSObject* aObj)
|
||||
{
|
||||
if (NS_IsMainThread()) {
|
||||
return Preferences::GetBool("dom.webkitBlink.dirPicker.enabled", false);
|
||||
}
|
||||
|
||||
// aCx can be null when this function is called by something else than WebIDL
|
||||
// binding code.
|
||||
workers::WorkerPrivate* workerPrivate =
|
||||
workers::GetCurrentThreadWorkerPrivate();
|
||||
if (!workerPrivate) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return workerPrivate->WebkitBlinkDirectoryPickerEnabled();
|
||||
}
|
||||
|
||||
/* static */ already_AddRefed<Directory>
|
||||
Directory::Constructor(const GlobalObject& aGlobal,
|
||||
const nsAString& aRealPath,
|
||||
|
@ -29,6 +29,9 @@ public:
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(Directory)
|
||||
|
||||
static bool
|
||||
WebkitBlinkDirectoryPickerEnabled(JSContext* aCx, JSObject* aObj);
|
||||
|
||||
static already_AddRefed<Directory>
|
||||
Constructor(const GlobalObject& aGlobal,
|
||||
const nsAString& aRealPath,
|
||||
|
@ -36,7 +36,6 @@
|
||||
#include "nsContentUtils.h"
|
||||
|
||||
#include "mozilla/dom/Directory.h"
|
||||
#include "mozilla/dom/DOMPreferences.h"
|
||||
#include "mozilla/dom/File.h"
|
||||
|
||||
namespace mozilla {
|
||||
@ -488,7 +487,7 @@ FSMultipartFormData::AddNameBlobOrNullPair(const nsAString& aName, Blob* aBlob)
|
||||
if (file) {
|
||||
nsAutoString relativePath;
|
||||
file->GetRelativePath(relativePath);
|
||||
if (DOMPreferences::WebkitBlinkDirectoryPickerEnabled() &&
|
||||
if (Directory::WebkitBlinkDirectoryPickerEnabled(nullptr, nullptr) &&
|
||||
!relativePath.IsEmpty()) {
|
||||
filename16 = relativePath;
|
||||
}
|
||||
@ -547,7 +546,7 @@ nsresult
|
||||
FSMultipartFormData::AddNameDirectoryPair(const nsAString& aName,
|
||||
Directory* aDirectory)
|
||||
{
|
||||
if (!DOMPreferences::WebkitBlinkDirectoryPickerEnabled()) {
|
||||
if (!Directory::WebkitBlinkDirectoryPickerEnabled(nullptr, nullptr)) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,6 @@
|
||||
#include "mozilla/DebugOnly.h"
|
||||
#include "mozilla/dom/Date.h"
|
||||
#include "mozilla/dom/Directory.h"
|
||||
#include "mozilla/dom/DOMPreferences.h"
|
||||
#include "mozilla/dom/HTMLFormSubmission.h"
|
||||
#include "mozilla/dom/FileSystemUtils.h"
|
||||
#include "mozilla/dom/GetFilesHelper.h"
|
||||
@ -686,7 +685,7 @@ HTMLInputElement::nsFilePickerShownCallback::Done(int16_t aResult)
|
||||
RefPtr<DispatchChangeEventCallback> dispatchChangeEventCallback =
|
||||
new DispatchChangeEventCallback(mInput);
|
||||
|
||||
if (DOMPreferences::WebkitBlinkDirectoryPickerEnabled() &&
|
||||
if (IsWebkitDirPickerEnabled() &&
|
||||
mInput->HasAttr(kNameSpaceID_None, nsGkAtoms::webkitdirectory)) {
|
||||
ErrorResult error;
|
||||
GetFilesHelper* helper = mInput->GetOrCreateGetFilesHelper(true, error);
|
||||
@ -2747,7 +2746,7 @@ HTMLInputElement::GetDisplayFileName(nsAString& aValue) const
|
||||
|
||||
if (mFileData->mFilesOrDirectories.IsEmpty()) {
|
||||
if ((IsDirPickerEnabled() && Allowdirs()) ||
|
||||
(DOMPreferences::WebkitBlinkDirectoryPickerEnabled() &&
|
||||
(IsWebkitDirPickerEnabled() &&
|
||||
HasAttr(kNameSpaceID_None, nsGkAtoms::webkitdirectory))) {
|
||||
nsContentUtils::GetLocalizedString(nsContentUtils::eFORMS_PROPERTIES,
|
||||
"NoDirSelected", value);
|
||||
@ -2840,7 +2839,7 @@ HTMLInputElement::MozSetDndFilesAndDirectories(const nsTArray<OwningFileOrDirect
|
||||
RefPtr<DispatchChangeEventCallback> dispatchChangeEventCallback =
|
||||
new DispatchChangeEventCallback(this);
|
||||
|
||||
if (DOMPreferences::WebkitBlinkDirectoryPickerEnabled() &&
|
||||
if (IsWebkitDirPickerEnabled() &&
|
||||
HasAttr(kNameSpaceID_None, nsGkAtoms::webkitdirectory)) {
|
||||
ErrorResult rv;
|
||||
GetFilesHelper* helper = GetOrCreateGetFilesHelper(true /* recursionFlag */,
|
||||
@ -2922,7 +2921,7 @@ HTMLInputElement::GetFiles()
|
||||
}
|
||||
|
||||
if (IsDirPickerEnabled() && Allowdirs() &&
|
||||
(!DOMPreferences::WebkitBlinkDirectoryPickerEnabled() ||
|
||||
(!IsWebkitDirPickerEnabled() ||
|
||||
!HasAttr(kNameSpaceID_None, nsGkAtoms::webkitdirectory))) {
|
||||
return nullptr;
|
||||
}
|
||||
@ -4173,7 +4172,7 @@ HTMLInputElement::MaybeInitPickers(EventChainPostVisitor& aVisitor)
|
||||
if (target &&
|
||||
target->FindFirstNonChromeOnlyAccessContent() == this &&
|
||||
((IsDirPickerEnabled() && Allowdirs()) ||
|
||||
(DOMPreferences::WebkitBlinkDirectoryPickerEnabled() &&
|
||||
(IsWebkitDirPickerEnabled() &&
|
||||
HasAttr(kNameSpaceID_None, nsGkAtoms::webkitdirectory)))) {
|
||||
type = FILE_PICKER_DIRECTORY;
|
||||
}
|
||||
@ -5634,6 +5633,21 @@ HTMLInputElement::IsDateTimeTypeSupported(uint8_t aDateTimeInputType)
|
||||
IsInputDateTimeOthersEnabled());
|
||||
}
|
||||
|
||||
/* static */ bool
|
||||
HTMLInputElement::IsWebkitDirPickerEnabled()
|
||||
{
|
||||
static bool sWebkitDirPickerEnabled = false;
|
||||
static bool sWebkitDirPickerPrefCached = false;
|
||||
if (!sWebkitDirPickerPrefCached) {
|
||||
sWebkitDirPickerPrefCached = true;
|
||||
Preferences::AddBoolVarCache(&sWebkitDirPickerEnabled,
|
||||
"dom.webkitBlink.dirPicker.enabled",
|
||||
false);
|
||||
}
|
||||
|
||||
return sWebkitDirPickerEnabled;
|
||||
}
|
||||
|
||||
/* static */ bool
|
||||
HTMLInputElement::IsWebkitFileSystemEnabled()
|
||||
{
|
||||
|
@ -1727,6 +1727,13 @@ private:
|
||||
static bool
|
||||
IsDateTimeTypeSupported(uint8_t aDateTimeInputType);
|
||||
|
||||
/**
|
||||
* Checks preference "dom.webkitBlink.dirPicker.enabled" to determine if
|
||||
* webkitdirectory should be supported.
|
||||
*/
|
||||
static bool
|
||||
IsWebkitDirPickerEnabled();
|
||||
|
||||
/**
|
||||
* Checks preference "dom.webkitBlink.filesystem.enabled" to determine if
|
||||
* webkitEntries should be supported.
|
||||
|
@ -5,7 +5,6 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "ImageDocument.h"
|
||||
#include "mozilla/dom/DOMPreferences.h"
|
||||
#include "mozilla/dom/ImageDocumentBinding.h"
|
||||
#include "mozilla/dom/HTMLImageElement.h"
|
||||
#include "nsRect.h"
|
||||
@ -50,7 +49,7 @@
|
||||
//XXX A hack needed for Firefox's site specific zoom.
|
||||
static bool IsSiteSpecific()
|
||||
{
|
||||
return !mozilla::dom::DOMPreferences::ResistFingerprintingEnabled() &&
|
||||
return !mozilla::Preferences::GetBool("privacy.resistFingerprinting", false) &&
|
||||
mozilla::Preferences::GetBool("browser.zoom.siteSpecific", false);
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,6 @@
|
||||
#include "mozilla/dom/PTabContext.h"
|
||||
#include "mozilla/dom/TabParent.h"
|
||||
#include "mozilla/dom/TabChild.h"
|
||||
#include "mozilla/dom/DOMPreferences.h"
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
|
||||
@ -247,7 +246,7 @@ MaybeInvalidTabContext::MaybeInvalidTabContext(const IPCTabContext& aParams)
|
||||
// It is meant as a temporary solution until service workers can
|
||||
// provide a TabChild equivalent. Don't allow this on b2g since
|
||||
// it might be used to escalate privileges.
|
||||
if (!DOMPreferences::ServiceWorkersEnabled()) {
|
||||
if (!Preferences::GetBool("dom.serviceWorkers.enabled", false)) {
|
||||
mInvalidReason = "ServiceWorkers should be enabled.";
|
||||
return;
|
||||
}
|
||||
|
@ -106,6 +106,18 @@ Connection::Update(ConnectionType aType, bool aIsWifi, uint32_t aDHCPGateway,
|
||||
}
|
||||
}
|
||||
|
||||
/* static */ bool
|
||||
Connection::IsEnabled(JSContext* aCx, JSObject* aObj)
|
||||
{
|
||||
if (NS_IsMainThread()) {
|
||||
return Preferences::GetBool("dom.netinfo.enabled");
|
||||
}
|
||||
|
||||
WorkerPrivate* workerPrivate = GetWorkerPrivateFromContext(aCx);
|
||||
MOZ_ASSERT(workerPrivate);
|
||||
return workerPrivate->NetworkInformationEnabled();
|
||||
}
|
||||
|
||||
/* static */ Connection*
|
||||
Connection::CreateForWindow(nsPIDOMWindowInner* aWindow)
|
||||
{
|
||||
|
@ -37,6 +37,8 @@ public:
|
||||
|
||||
NS_REALLY_FORWARD_NSIDOMEVENTTARGET(DOMEventTargetHelper)
|
||||
|
||||
static bool IsEnabled(JSContext* aCx, JSObject* aObj);
|
||||
|
||||
static Connection*
|
||||
CreateForWindow(nsPIDOMWindowInner* aWindow);
|
||||
|
||||
|
@ -19,7 +19,6 @@
|
||||
#include "mozilla/dom/AppNotificationServiceOptionsBinding.h"
|
||||
#include "mozilla/dom/BindingUtils.h"
|
||||
#include "mozilla/dom/ContentChild.h"
|
||||
#include "mozilla/dom/DOMPreferences.h"
|
||||
#include "mozilla/dom/NotificationEvent.h"
|
||||
#include "mozilla/dom/PermissionMessageUtils.h"
|
||||
#include "mozilla/dom/Promise.h"
|
||||
@ -894,22 +893,39 @@ NotificationTask::Run()
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
bool
|
||||
Notification::RequireInteractionEnabled(JSContext* aCx, JSObject* aOjb)
|
||||
{
|
||||
if (NS_IsMainThread()) {
|
||||
return Preferences::GetBool("dom.webnotifications.requireinteraction.enabled", false);
|
||||
}
|
||||
|
||||
WorkerPrivate* workerPrivate = GetWorkerPrivateFromContext(aCx);
|
||||
if (!workerPrivate) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return workerPrivate->DOMWorkerNotificationRIEnabled();
|
||||
}
|
||||
|
||||
// static
|
||||
bool
|
||||
Notification::PrefEnabled(JSContext* aCx, JSObject* aObj)
|
||||
{
|
||||
if (!NS_IsMainThread()) {
|
||||
WorkerPrivate* workerPrivate = GetWorkerPrivateFromContext(aCx);
|
||||
if (!workerPrivate) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (workerPrivate->IsServiceWorker()) {
|
||||
return DOMPreferences::NotificationEnabledInServiceWorkers();
|
||||
}
|
||||
if (NS_IsMainThread()) {
|
||||
return Preferences::GetBool("dom.webnotifications.enabled", false);
|
||||
}
|
||||
|
||||
return DOMPreferences::NotificationEnabled();
|
||||
WorkerPrivate* workerPrivate = GetWorkerPrivateFromContext(aCx);
|
||||
if (!workerPrivate) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (workerPrivate->IsServiceWorker()) {
|
||||
return workerPrivate->DOMServiceWorkerNotificationEnabled();
|
||||
}
|
||||
|
||||
return workerPrivate->DOMWorkerNotificationEnabled();
|
||||
}
|
||||
|
||||
// static
|
||||
@ -1724,7 +1740,7 @@ Notification::ShowInternal()
|
||||
bool inPrivateBrowsing = IsInPrivateBrowsing();
|
||||
|
||||
bool requireInteraction = mRequireInteraction;
|
||||
if (!DOMPreferences::NotificationRIEnabled()) {
|
||||
if (!Preferences::GetBool("dom.webnotifications.requireinteraction.enabled", false)) {
|
||||
requireInteraction = false;
|
||||
}
|
||||
|
||||
|
@ -152,6 +152,7 @@ public:
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(Notification, DOMEventTargetHelper)
|
||||
NS_DECL_NSIOBSERVER
|
||||
|
||||
static bool RequireInteractionEnabled(JSContext* aCx, JSObject* aObj);
|
||||
static bool PrefEnabled(JSContext* aCx, JSObject* aObj);
|
||||
// Returns if Notification.get() is allowed for the current global.
|
||||
static bool IsGetEnabled(JSContext* aCx, JSObject* aObj);
|
||||
|
@ -6,7 +6,6 @@
|
||||
|
||||
#include "PerformanceMainThread.h"
|
||||
#include "PerformanceNavigation.h"
|
||||
#include "mozilla/dom/DOMPreferences.h"
|
||||
#include "nsICacheInfoChannel.h"
|
||||
|
||||
namespace mozilla {
|
||||
@ -272,7 +271,7 @@ PerformanceMainThread::InsertUserEntry(PerformanceEntry* aEntry)
|
||||
nsAutoCString uri;
|
||||
uint64_t markCreationEpoch = 0;
|
||||
|
||||
if (DOMPreferences::PerformanceLoggingEnabled() ||
|
||||
if (nsContentUtils::IsUserTimingLoggingEnabled() ||
|
||||
nsContentUtils::SendPerformanceTimingNotifications()) {
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
nsCOMPtr<nsPIDOMWindowInner> owner = GetOwner();
|
||||
@ -286,7 +285,7 @@ PerformanceMainThread::InsertUserEntry(PerformanceEntry* aEntry)
|
||||
}
|
||||
markCreationEpoch = static_cast<uint64_t>(PR_Now() / PR_USEC_PER_MSEC);
|
||||
|
||||
if (DOMPreferences::PerformanceLoggingEnabled()) {
|
||||
if (nsContentUtils::IsUserTimingLoggingEnabled()) {
|
||||
Performance::LogEntry(aEntry, uri);
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,6 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "PerformanceWorker.h"
|
||||
#include "mozilla/dom/DOMPreferences.h"
|
||||
#include "WorkerPrivate.h"
|
||||
|
||||
namespace mozilla {
|
||||
@ -27,7 +26,7 @@ PerformanceWorker::~PerformanceWorker()
|
||||
void
|
||||
PerformanceWorker::InsertUserEntry(PerformanceEntry* aEntry)
|
||||
{
|
||||
if (DOMPreferences::PerformanceLoggingEnabled()) {
|
||||
if (mWorkerPrivate->PerformanceLoggingEnabled()) {
|
||||
nsAutoCString uri;
|
||||
nsCOMPtr<nsIURI> scriptURI = mWorkerPrivate->GetResolvedScriptURI();
|
||||
if (!scriptURI || NS_FAILED(scriptURI->GetHost(uri))) {
|
||||
|
@ -32,9 +32,9 @@
|
||||
#include "mozilla/ErrorResult.h"
|
||||
#include "mozilla/dom/BindingDeclarations.h"
|
||||
#include "mozilla/dom/TypedArray.h"
|
||||
#include "mozilla/dom/DOMPreferences.h"
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsContentUtils.h" // Required for nsContentUtils::PushEnabled
|
||||
#include "mozilla/RefPtr.h"
|
||||
|
||||
class nsIGlobalObject;
|
||||
|
@ -10,13 +10,13 @@
|
||||
#include "jsapi.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsWrapperCache.h"
|
||||
#include "nsContentUtils.h" // Required for nsContentUtils::PushEnabled
|
||||
|
||||
#include "mozilla/AlreadyAddRefed.h"
|
||||
#include "mozilla/ErrorResult.h"
|
||||
#include "mozilla/RefPtr.h"
|
||||
|
||||
#include "mozilla/dom/BindingDeclarations.h"
|
||||
#include "mozilla/dom/DOMPreferences.h"
|
||||
#include "mozilla/dom/PushSubscriptionBinding.h"
|
||||
#include "mozilla/dom/PushSubscriptionOptionsBinding.h"
|
||||
#include "mozilla/dom/TypedArray.h"
|
||||
|
@ -8,9 +8,9 @@
|
||||
#define mozilla_dom_PushSubscriptionOptions_h
|
||||
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "nsContentUtils.h" // Required for nsContentUtils::PushEnabled
|
||||
#include "nsTArray.h"
|
||||
#include "nsWrapperCache.h"
|
||||
#include "mozilla/dom/DOMPreferences.h"
|
||||
|
||||
class nsIGlobalObject;
|
||||
|
||||
|
@ -6,7 +6,6 @@
|
||||
|
||||
#include "StorageManager.h"
|
||||
|
||||
#include "mozilla/dom/DOMPreferences.h"
|
||||
#include "mozilla/dom/PromiseWorkerProxy.h"
|
||||
#include "mozilla/dom/quota/QuotaManagerService.h"
|
||||
#include "mozilla/dom/StorageManagerBinding.h"
|
||||
@ -866,6 +865,20 @@ StorageManager::Estimate(ErrorResult& aRv)
|
||||
aRv);
|
||||
}
|
||||
|
||||
// static
|
||||
bool
|
||||
StorageManager::PrefEnabled(JSContext* aCx, JSObject* aObj)
|
||||
{
|
||||
if (NS_IsMainThread()) {
|
||||
return Preferences::GetBool("dom.storageManager.enabled");
|
||||
}
|
||||
|
||||
WorkerPrivate* workerPrivate = GetWorkerPrivateFromContext(aCx);
|
||||
MOZ_ASSERT(workerPrivate);
|
||||
|
||||
return workerPrivate->StorageManagerEnabled();
|
||||
}
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(StorageManager, mOwner)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(StorageManager)
|
||||
|
@ -25,6 +25,10 @@ class StorageManager final
|
||||
nsCOMPtr<nsIGlobalObject> mOwner;
|
||||
|
||||
public:
|
||||
// Return dom.quota.storageManager.enabled on main/worker thread.
|
||||
static bool
|
||||
PrefEnabled(JSContext* aCx, JSObject* aObj);
|
||||
|
||||
explicit
|
||||
StorageManager(nsIGlobalObject* aGlobal);
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
// https://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html#cache
|
||||
|
||||
[Exposed=(Window,Worker),
|
||||
Func="mozilla::dom::DOMPreferences::DOMCachesEnabled"]
|
||||
Func="mozilla::dom::cache::Cache::PrefEnabled"]
|
||||
interface Cache {
|
||||
[NewObject]
|
||||
Promise<Response> match(RequestInfo request, optional CacheQueryOptions options);
|
||||
|
@ -14,7 +14,7 @@ interface Principal;
|
||||
|
||||
[Exposed=(Window,Worker),
|
||||
ChromeConstructor(CacheStorageNamespace namespace, Principal principal),
|
||||
Func="mozilla::dom::DOMPreferences::DOMCachesEnabled"]
|
||||
Func="mozilla::dom::cache::CacheStorage::PrefEnabled"]
|
||||
interface CacheStorage {
|
||||
[NewObject]
|
||||
Promise<Response> match(RequestInfo request, optional CacheQueryOptions options);
|
||||
|
@ -16,7 +16,7 @@ interface Clients {
|
||||
[NewObject]
|
||||
Promise<sequence<Client>> matchAll(optional ClientQueryOptions options);
|
||||
[NewObject,
|
||||
Func="mozilla::dom::DOMPreferences::OpenWindowEnabled"]
|
||||
Func="mozilla::dom::ServiceWorkerGlobalScope::OpenWindowEnabled"]
|
||||
Promise<WindowClient?> openWindow(USVString url);
|
||||
[NewObject]
|
||||
Promise<void> claim();
|
||||
|
@ -16,7 +16,7 @@ enum FetchState {
|
||||
};
|
||||
|
||||
[Exposed=(Window,Worker),
|
||||
Func="mozilla::dom::DOMPreferences::FetchObserverEnabled"]
|
||||
Func="FetchObserver::IsEnabled"]
|
||||
interface FetchObserver : EventTarget {
|
||||
readonly attribute FetchState state;
|
||||
|
||||
|
@ -34,7 +34,7 @@ partial interface File {
|
||||
[GetterThrows, Deprecated="FileLastModifiedDate"]
|
||||
readonly attribute Date lastModifiedDate;
|
||||
|
||||
[BinaryName="relativePath", Func="mozilla::dom::DOMPreferences::WebkitBlinkDirectoryPickerEnabled"]
|
||||
[BinaryName="relativePath", Func="mozilla::dom::Directory::WebkitBlinkDirectoryPickerEnabled"]
|
||||
readonly attribute USVString webkitRelativePath;
|
||||
|
||||
[GetterThrows, ChromeOnly, NeedsCallerType]
|
||||
|
@ -403,10 +403,10 @@ dictionary ChannelPixelLayout {
|
||||
typedef sequence<ChannelPixelLayout> ImagePixelLayout;
|
||||
|
||||
partial interface ImageBitmap {
|
||||
[Throws, Func="mozilla::dom::DOMPreferences::ImageBitmapExtensionsEnabled"]
|
||||
[Throws, Func="mozilla::dom::ImageBitmap::ExtensionsEnabled"]
|
||||
ImageBitmapFormat findOptimalFormat (optional sequence<ImageBitmapFormat> aPossibleFormats);
|
||||
[Throws, Func="mozilla::dom::DOMPreferences::ImageBitmapExtensionsEnabled"]
|
||||
[Throws, Func="mozilla::dom::ImageBitmap::ExtensionsEnabled"]
|
||||
long mappedDataLength (ImageBitmapFormat aFormat);
|
||||
[Throws, Func="mozilla::dom::DOMPreferences::ImageBitmapExtensionsEnabled"]
|
||||
[Throws, Func="mozilla::dom::ImageBitmap::ExtensionsEnabled"]
|
||||
Promise<ImagePixelLayout> mapDataInto (ImageBitmapFormat aFormat, BufferSource aBuffer, long aOffset);
|
||||
};
|
||||
|
@ -89,7 +89,7 @@ interface NavigatorContentUtils {
|
||||
|
||||
[SecureContext, NoInterfaceObject, Exposed=(Window,Worker)]
|
||||
interface NavigatorStorage {
|
||||
[Func="mozilla::dom::DOMPreferences::StorageManagerEnabled"]
|
||||
[Func="mozilla::dom::StorageManager::PrefEnabled"]
|
||||
readonly attribute StorageManager storage;
|
||||
};
|
||||
|
||||
|
@ -18,7 +18,7 @@ enum ConnectionType {
|
||||
"unknown"
|
||||
};
|
||||
|
||||
[Func="mozilla::dom::DOMPreferences::NetworkInformationEnabled",
|
||||
[Func="mozilla::dom::network::Connection::IsEnabled",
|
||||
Exposed=(Window,Worker)]
|
||||
interface NetworkInformation : EventTarget {
|
||||
readonly attribute ConnectionType type;
|
||||
|
@ -51,7 +51,7 @@ interface Notification : EventTarget {
|
||||
[Pure]
|
||||
readonly attribute DOMString? icon;
|
||||
|
||||
[Constant, Func="mozilla::dom::DOMPreferences::NotificationRIEnabled"]
|
||||
[Constant, Func="mozilla::dom::Notification::RequireInteractionEnabled"]
|
||||
readonly attribute boolean requireInteraction;
|
||||
|
||||
[Constant]
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
[Constructor(unsigned long width, unsigned long height),
|
||||
Exposed=(Window,Worker),
|
||||
Func="mozilla::dom::DOMPreferences::OffscreenCanvasEnabled"]
|
||||
Func="mozilla::dom::OffscreenCanvas::PrefEnabled"]
|
||||
interface OffscreenCanvas : EventTarget {
|
||||
[Pure, SetterThrows]
|
||||
attribute unsigned long width;
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
[Constructor(DOMString type, PromiseRejectionEventInit eventInitDict),
|
||||
Exposed=(Window,Worker),
|
||||
Func="mozilla::dom::DOMPreferences::PromiseRejectionEventsEnabled"]
|
||||
Func="nsContentUtils::PromiseRejectionEventsEnabled"]
|
||||
interface PromiseRejectionEvent : Event
|
||||
{
|
||||
[BinaryName="rejectedPromise"]
|
||||
|
@ -8,7 +8,7 @@
|
||||
*/
|
||||
|
||||
[Constructor(DOMString type, optional PushEventInit eventInitDict),
|
||||
Func="mozilla::dom::DOMPreferences::PushEnabled",
|
||||
Func="nsContentUtils::PushEnabled",
|
||||
Exposed=ServiceWorker]
|
||||
interface PushEvent : ExtendableEvent {
|
||||
readonly attribute PushMessageData? data;
|
||||
|
@ -22,7 +22,7 @@ interface PushManagerImpl {
|
||||
Promise<PushPermissionState> permissionState(optional PushSubscriptionOptionsInit options);
|
||||
};
|
||||
|
||||
[Exposed=(Window,Worker), Func="mozilla::dom::DOMPreferences::PushEnabled",
|
||||
[Exposed=(Window,Worker), Func="nsContentUtils::PushEnabled",
|
||||
ChromeConstructor(DOMString scope)]
|
||||
interface PushManager {
|
||||
[Throws, UseCounter]
|
||||
|
@ -7,7 +7,7 @@
|
||||
* https://w3c.github.io/push-api/
|
||||
*/
|
||||
|
||||
[Func="mozilla::dom::DOMPreferences::PushEnabled",
|
||||
[Func="nsContentUtils::PushEnabled",
|
||||
Exposed=ServiceWorker]
|
||||
interface PushMessageData
|
||||
{
|
||||
|
@ -36,7 +36,7 @@ dictionary PushSubscriptionInit
|
||||
BufferSource? appServerKey;
|
||||
};
|
||||
|
||||
[Exposed=(Window,Worker), Func="mozilla::dom::DOMPreferences::PushEnabled",
|
||||
[Exposed=(Window,Worker), Func="nsContentUtils::PushEnabled",
|
||||
ChromeConstructor(PushSubscriptionInit initDict)]
|
||||
interface PushSubscription
|
||||
{
|
||||
|
@ -7,7 +7,7 @@
|
||||
* https://w3c.github.io/push-api/
|
||||
*/
|
||||
|
||||
[Exposed=(Window,Worker), Func="mozilla::dom::DOMPreferences::PushEnabled"]
|
||||
[Exposed=(Window,Worker), Func="nsContentUtils::PushEnabled"]
|
||||
interface PushSubscriptionOptions
|
||||
{
|
||||
[SameObject, Throws]
|
||||
|
@ -17,7 +17,7 @@ interface Request {
|
||||
readonly attribute USVString url;
|
||||
[SameObject] readonly attribute Headers headers;
|
||||
|
||||
[Func="mozilla::dom::DOMPreferences::RequestContextEnabled"]
|
||||
[Func="mozilla::dom::Request::RequestContextEnabled"]
|
||||
readonly attribute RequestContext context;
|
||||
readonly attribute USVString referrer;
|
||||
readonly attribute ReferrerPolicy referrerPolicy;
|
||||
@ -61,7 +61,7 @@ dictionary RequestInit {
|
||||
|
||||
AbortSignal? signal;
|
||||
|
||||
[Func="mozilla::dom::DOMPreferences::FetchObserverEnabled"]
|
||||
[Func="FetchObserver::IsEnabled"]
|
||||
ObserverCallback observe;
|
||||
};
|
||||
|
||||
|
@ -35,7 +35,7 @@ Response implements Body;
|
||||
// This should be part of Body but we don't want to expose body to request yet.
|
||||
// See bug 1387483.
|
||||
partial interface Response {
|
||||
[GetterThrows, Func="mozilla::dom::DOMPreferences::StreamsEnabled"]
|
||||
[GetterThrows, Func="nsContentUtils::StreamsEnabled"]
|
||||
readonly attribute ReadableStream? body;
|
||||
};
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
* https://notifications.spec.whatwg.org/
|
||||
*/
|
||||
|
||||
[Func="mozilla::dom::DOMPreferences::ServiceWorkersEnabled",
|
||||
[Func="mozilla::dom::ServiceWorkerRegistration::Visible",
|
||||
Exposed=(Window,Worker)]
|
||||
interface ServiceWorkerRegistration : EventTarget {
|
||||
[Unforgeable] readonly attribute ServiceWorker? installing;
|
||||
@ -38,14 +38,14 @@ enum ServiceWorkerUpdateViaCache {
|
||||
|
||||
// https://w3c.github.io/push-api/
|
||||
partial interface ServiceWorkerRegistration {
|
||||
[Throws, Exposed=(Window,Worker), Func="mozilla::dom::DOMPreferences::PushEnabled"]
|
||||
[Throws, Exposed=(Window,Worker), Func="nsContentUtils::PushEnabled"]
|
||||
readonly attribute PushManager pushManager;
|
||||
};
|
||||
|
||||
// https://notifications.spec.whatwg.org/
|
||||
partial interface ServiceWorkerRegistration {
|
||||
[Throws, Func="mozilla::dom::DOMPreferences::NotificationEnabledInServiceWorkers"]
|
||||
[Throws, Func="mozilla::dom::ServiceWorkerRegistration::NotificationAPIVisible"]
|
||||
Promise<void> showNotification(DOMString title, optional NotificationOptions options);
|
||||
[Throws, Func="mozilla::dom::DOMPreferences::NotificationEnabledInServiceWorkers"]
|
||||
[Throws, Func="mozilla::dom::ServiceWorkerRegistration::NotificationAPIVisible"]
|
||||
Promise<sequence<Notification>> getNotifications(optional GetNotificationOptions filter);
|
||||
};
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
[SecureContext,
|
||||
Exposed=(Window,Worker),
|
||||
Func="mozilla::dom::DOMPreferences::StorageManagerEnabled"]
|
||||
Func="mozilla::dom::StorageManager::PrefEnabled"]
|
||||
interface StorageManager {
|
||||
[Throws]
|
||||
Promise<boolean> persisted();
|
||||
|
@ -803,7 +803,7 @@ WebGLRenderingContext implements WebGLRenderingContextBase;
|
||||
// Reference: https://wiki.whatwg.org/wiki/OffscreenCanvas
|
||||
[Exposed=(Window,Worker)]
|
||||
partial interface WebGLRenderingContext {
|
||||
[Func="mozilla::dom::DOMPreferences::OffscreenCanvasEnabled"]
|
||||
[Func="mozilla::dom::OffscreenCanvas::PrefEnabled"]
|
||||
void commit();
|
||||
};
|
||||
|
||||
|
@ -62,7 +62,7 @@ partial interface WindowOrWorkerGlobalScope {
|
||||
|
||||
// https://w3c.github.io/ServiceWorker/#self-caches
|
||||
partial interface WindowOrWorkerGlobalScope {
|
||||
[Throws, Func="mozilla::dom::DOMPreferences::DOMCachesEnabled", SameObject]
|
||||
[Throws, Func="mozilla::dom::cache::CacheStorage::PrefEnabled", SameObject]
|
||||
readonly attribute CacheStorage caches;
|
||||
};
|
||||
|
||||
|
@ -16,6 +16,6 @@ WorkerNavigator implements NavigatorStorage;
|
||||
// http://wicg.github.io/netinfo/#extensions-to-the-navigator-interface
|
||||
[Exposed=(Worker)]
|
||||
partial interface WorkerNavigator {
|
||||
[Func="mozilla::dom::DOMPreferences::NetworkInformationEnabled", Throws]
|
||||
[Func="mozilla::dom::network::Connection::IsEnabled", Throws]
|
||||
readonly attribute NetworkInformation connection;
|
||||
};
|
||||
|
@ -1442,6 +1442,7 @@ struct RuntimeService::IdleThreadInfo
|
||||
|
||||
// This is only touched on the main thread. Initialized in Init() below.
|
||||
JSSettings RuntimeService::sDefaultJSSettings;
|
||||
bool RuntimeService::sDefaultPreferences[WORKERPREF_COUNT] = { false };
|
||||
|
||||
RuntimeService::RuntimeService()
|
||||
: mMutex("RuntimeService::mMutex"), mObserved(false),
|
||||
@ -1965,17 +1966,17 @@ RuntimeService::Init()
|
||||
PREF_JS_OPTIONS_PREFIX PREF_GCZEAL)) ||
|
||||
#endif
|
||||
|
||||
#define WORKER_SIMPLE_PREF(name, getter, NAME) \
|
||||
NS_FAILED(Preferences::RegisterCallbackAndCall( \
|
||||
WorkerPrefChanged, \
|
||||
name, \
|
||||
reinterpret_cast<void*>(WORKERPREF_##NAME))) ||
|
||||
#define WORKER_PREF(name, callback) \
|
||||
NS_FAILED(Preferences::RegisterCallbackAndCall( \
|
||||
callback, \
|
||||
name)) ||
|
||||
WORKER_PREF("intl.accept_languages", PrefLanguagesChanged)
|
||||
WORKER_PREF("general.appname.override", AppNameOverrideChanged)
|
||||
WORKER_PREF("general.appversion.override", AppVersionOverrideChanged)
|
||||
WORKER_PREF("general.platform.override", PlatformOverrideChanged)
|
||||
#ifdef JS_GC_ZEAL
|
||||
WORKER_PREF("dom.workers.options.gcZeal", LoadGCZealOptions)
|
||||
#endif
|
||||
#include "WorkerPrefs.h"
|
||||
#undef WORKER_SIMPLE_PREF
|
||||
#undef WORKER_PREF
|
||||
|
||||
NS_FAILED(Preferences::RegisterPrefixCallbackAndCall(
|
||||
@ -2261,17 +2262,17 @@ RuntimeService::Cleanup()
|
||||
NS_FAILED(Preferences::UnregisterPrefixCallback(LoadContextOptions,
|
||||
PREF_WORKERS_OPTIONS_PREFIX)) ||
|
||||
|
||||
#define WORKER_SIMPLE_PREF(name, getter, NAME) \
|
||||
NS_FAILED(Preferences::UnregisterCallback( \
|
||||
WorkerPrefChanged, \
|
||||
name, \
|
||||
reinterpret_cast<void*>(WORKERPREF_##NAME))) ||
|
||||
#define WORKER_PREF(name, callback) \
|
||||
NS_FAILED(Preferences::UnregisterCallback( \
|
||||
callback, \
|
||||
name)) ||
|
||||
WORKER_PREF("intl.accept_languages", PrefLanguagesChanged)
|
||||
WORKER_PREF("general.appname.override", AppNameOverrideChanged)
|
||||
WORKER_PREF("general.appversion.override", AppVersionOverrideChanged)
|
||||
WORKER_PREF("general.platform.override", PlatformOverrideChanged)
|
||||
#ifdef JS_GC_ZEAL
|
||||
WORKER_PREF("dom.workers.options.gcZeal", LoadGCZealOptions)
|
||||
#endif
|
||||
#include "WorkerPrefs.h"
|
||||
#undef WORKER_SIMPLE_PREF
|
||||
#undef WORKER_PREF
|
||||
|
||||
#ifdef JS_GC_ZEAL
|
||||
@ -2671,6 +2672,12 @@ RuntimeService::UpdatePlatformOverridePreference(const nsAString& aValue)
|
||||
mNavigatorProperties.mPlatformOverridden = aValue;
|
||||
}
|
||||
|
||||
void
|
||||
RuntimeService::UpdateAllWorkerPreference(WorkerPreference aPref, bool aValue)
|
||||
{
|
||||
BROADCAST_ALL_WORKERS(UpdatePreference, aPref, aValue);
|
||||
}
|
||||
|
||||
void
|
||||
RuntimeService::UpdateAllWorkerLanguages(const nsTArray<nsString>& aLanguages)
|
||||
{
|
||||
@ -2790,6 +2797,34 @@ RuntimeService::Observe(nsISupports* aSubject, const char* aTopic,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* static */ void
|
||||
RuntimeService::WorkerPrefChanged(const char* aPrefName, void* aClosure)
|
||||
{
|
||||
AssertIsOnMainThread();
|
||||
|
||||
const WorkerPreference key =
|
||||
static_cast<WorkerPreference>(reinterpret_cast<uintptr_t>(aClosure));
|
||||
|
||||
switch (key) {
|
||||
#define WORKER_SIMPLE_PREF(name, getter, NAME) case WORKERPREF_##NAME:
|
||||
#define WORKER_PREF(name, callback)
|
||||
#include "WorkerPrefs.h"
|
||||
#undef WORKER_SIMPLE_PREF
|
||||
#undef WORKER_PREF
|
||||
sDefaultPreferences[key] = Preferences::GetBool(aPrefName, false);
|
||||
break;
|
||||
|
||||
default:
|
||||
MOZ_ASSERT_UNREACHABLE("Invalid pref key");
|
||||
break;
|
||||
}
|
||||
|
||||
RuntimeService* rts = RuntimeService::GetService();
|
||||
if (rts) {
|
||||
rts->UpdateAllWorkerPreference(key, sDefaultPreferences[key]);
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
LogViolationDetailsRunnable::MainThreadRun()
|
||||
{
|
||||
|
@ -91,6 +91,7 @@ class RuntimeService final : public nsIObserver
|
||||
nsCOMPtr<nsITimer> mIdleThreadTimer;
|
||||
|
||||
static JSSettings sDefaultJSSettings;
|
||||
static bool sDefaultPreferences[WORKERPREF_COUNT];
|
||||
|
||||
public:
|
||||
struct NavigatorProperties
|
||||
@ -172,6 +173,13 @@ public:
|
||||
aSettings = sDefaultJSSettings;
|
||||
}
|
||||
|
||||
static void
|
||||
GetDefaultPreferences(bool aPreferences[WORKERPREF_COUNT])
|
||||
{
|
||||
AssertIsOnMainThread();
|
||||
memcpy(aPreferences, sDefaultPreferences, WORKERPREF_COUNT * sizeof(bool));
|
||||
}
|
||||
|
||||
static void
|
||||
SetDefaultContextOptions(const JS::ContextOptions& aContextOptions)
|
||||
{
|
||||
@ -194,6 +202,9 @@ public:
|
||||
void
|
||||
UpdateAllWorkerLanguages(const nsTArray<nsString>& aLanguages);
|
||||
|
||||
void
|
||||
UpdateAllWorkerPreference(WorkerPreference aPref, bool aValue);
|
||||
|
||||
static void
|
||||
SetDefaultJSGCSettings(JSGCParamKey aKey, uint32_t aValue)
|
||||
{
|
||||
@ -259,6 +270,9 @@ private:
|
||||
static void
|
||||
ShutdownIdleThreads(nsITimer* aTimer, void* aClosure);
|
||||
|
||||
static void
|
||||
WorkerPrefChanged(const char* aPrefName, void* aClosure);
|
||||
|
||||
nsresult
|
||||
CreateSharedWorkerFromLoadInfo(JSContext* aCx,
|
||||
WorkerLoadInfo* aLoadInfo,
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include "ServiceWorkerPrivate.h"
|
||||
#include "WorkerPrivate.h"
|
||||
|
||||
#include "mozilla/dom/DOMPreferences.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/dom/Promise.h"
|
||||
#include "mozilla/dom/ServiceWorkerGlobalScopeBinding.h"
|
||||
|
||||
@ -32,7 +32,7 @@ bool
|
||||
ServiceWorkerVisible(JSContext* aCx, JSObject* aObj)
|
||||
{
|
||||
if (NS_IsMainThread()) {
|
||||
return DOMPreferences::ServiceWorkersEnabled();
|
||||
return Preferences::GetBool("dom.serviceWorkers.enabled", false);
|
||||
}
|
||||
|
||||
return IS_INSTANCE_OF(ServiceWorkerGlobalScope, aObj);
|
||||
|
@ -13,7 +13,6 @@
|
||||
#include "mozilla/ErrorResult.h"
|
||||
#include "mozilla/dom/BindingDeclarations.h"
|
||||
#include "mozilla/dom/ClientBinding.h"
|
||||
#include "mozilla/dom/DOMPreferences.h"
|
||||
|
||||
class nsIDocument;
|
||||
|
||||
|
@ -12,7 +12,6 @@
|
||||
|
||||
#include "mozilla/dom/WorkerScope.h"
|
||||
#include "mozilla/dom/BindingDeclarations.h"
|
||||
#include "mozilla/dom/DOMPreferences.h"
|
||||
#include "mozilla/dom/ClientsBinding.h"
|
||||
#include "mozilla/ErrorResult.h"
|
||||
|
||||
|
@ -12,12 +12,12 @@
|
||||
#include "nsIURL.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/Services.h"
|
||||
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
|
||||
#include "mozilla/dom/DOMPreferences.h"
|
||||
#include "mozilla/dom/Navigator.h"
|
||||
#include "mozilla/dom/Promise.h"
|
||||
#include "mozilla/dom/ServiceWorkerContainerBinding.h"
|
||||
@ -53,7 +53,7 @@ ServiceWorkerContainer::IsEnabled(JSContext* aCx, JSObject* aGlobal)
|
||||
return false;
|
||||
}
|
||||
|
||||
return DOMPreferences::ServiceWorkersEnabled();
|
||||
return Preferences::GetBool("dom.serviceWorkers.enabled", false);
|
||||
}
|
||||
|
||||
ServiceWorkerContainer::ServiceWorkerContainer(nsPIDOMWindowInner* aWindow)
|
||||
|
@ -38,7 +38,6 @@
|
||||
#include "mozilla/Telemetry.h"
|
||||
#include "mozilla/dom/BindingUtils.h"
|
||||
#include "mozilla/dom/ContentParent.h"
|
||||
#include "mozilla/dom/DOMPreferences.h"
|
||||
#include "mozilla/dom/ErrorEvent.h"
|
||||
#include "mozilla/dom/Headers.h"
|
||||
#include "mozilla/dom/InternalHeaders.h"
|
||||
@ -741,7 +740,7 @@ ServiceWorkerManager::Register(mozIDOMWindow* aWindow,
|
||||
outerWindow->GetServiceWorkersTestingEnabled();
|
||||
|
||||
bool authenticatedOrigin;
|
||||
if (DOMPreferences::ServiceWorkersTestingEnabled() ||
|
||||
if (Preferences::GetBool("dom.serviceWorkers.testing.enabled") ||
|
||||
serviceWorkersTestingEnabled) {
|
||||
authenticatedOrigin = true;
|
||||
} else {
|
||||
@ -3215,7 +3214,7 @@ ServiceWorkerManager::GetAllClients(nsIPrincipal* aPrincipal,
|
||||
// Treat http windows with devtools opened as secure if the correct devtools
|
||||
// setting is enabled.
|
||||
if (!doc->GetWindow()->GetServiceWorkersTestingEnabled() &&
|
||||
!DOMPreferences::ServiceWorkersTestingEnabled() &&
|
||||
!Preferences::GetBool("dom.serviceWorkers.testing.enabled") &&
|
||||
!IsFromAuthenticatedOrigin(doc)) {
|
||||
continue;
|
||||
}
|
||||
|
@ -25,7 +25,6 @@
|
||||
#include "WorkerRunnable.h"
|
||||
#include "WorkerScope.h"
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/dom/DOMPreferences.h"
|
||||
#include "mozilla/dom/FetchUtil.h"
|
||||
#include "mozilla/dom/IndexedDatabaseManager.h"
|
||||
#include "mozilla/dom/InternalHeaders.h"
|
||||
@ -1938,7 +1937,7 @@ ServiceWorkerPrivate::TerminateWorker()
|
||||
mIdleWorkerTimer->Cancel();
|
||||
mIdleKeepAliveToken = nullptr;
|
||||
if (mWorkerPrivate) {
|
||||
if (DOMPreferences::ServiceWorkersTestingEnabled()) {
|
||||
if (Preferences::GetBool("dom.serviceWorkers.testing.enabled")) {
|
||||
nsCOMPtr<nsIObserverService> os = services::GetObserverService();
|
||||
if (os) {
|
||||
os->NotifyObservers(nullptr, "service-worker-shutdown", nullptr);
|
||||
|
@ -7,13 +7,13 @@
|
||||
#include "ServiceWorkerRegistration.h"
|
||||
|
||||
#include "ipc/ErrorIPCUtils.h"
|
||||
#include "mozilla/dom/DOMPreferences.h"
|
||||
#include "mozilla/dom/Notification.h"
|
||||
#include "mozilla/dom/Promise.h"
|
||||
#include "mozilla/dom/PromiseWorkerProxy.h"
|
||||
#include "mozilla/dom/PushManagerBinding.h"
|
||||
#include "mozilla/dom/PushManager.h"
|
||||
#include "mozilla/dom/ServiceWorkerRegistrationBinding.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/Services.h"
|
||||
#include "mozilla/Unused.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
@ -37,6 +37,38 @@ using namespace mozilla::dom::workers;
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
/* static */ bool
|
||||
ServiceWorkerRegistration::Visible(JSContext* aCx, JSObject* aObj)
|
||||
{
|
||||
if (NS_IsMainThread()) {
|
||||
return Preferences::GetBool("dom.serviceWorkers.enabled", false);
|
||||
}
|
||||
|
||||
// Otherwise check the pref via the work private helper
|
||||
WorkerPrivate* workerPrivate = GetWorkerPrivateFromContext(aCx);
|
||||
if (!workerPrivate) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return workerPrivate->ServiceWorkersEnabled();
|
||||
}
|
||||
|
||||
/* static */ bool
|
||||
ServiceWorkerRegistration::NotificationAPIVisible(JSContext* aCx, JSObject* aObj)
|
||||
{
|
||||
if (NS_IsMainThread()) {
|
||||
return Preferences::GetBool("dom.webnotifications.serviceworker.enabled", false);
|
||||
}
|
||||
|
||||
// Otherwise check the pref via the work private helper
|
||||
WorkerPrivate* workerPrivate = GetWorkerPrivateFromContext(aCx);
|
||||
if (!workerPrivate) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return workerPrivate->DOMServiceWorkerNotificationEnabled();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
// Main Thread implementation
|
||||
|
||||
|
@ -8,11 +8,11 @@
|
||||
#define mozilla_dom_ServiceWorkerRegistration_h
|
||||
|
||||
#include "mozilla/DOMEventTargetHelper.h"
|
||||
#include "mozilla/dom/DOMPreferences.h"
|
||||
#include "mozilla/dom/ServiceWorkerBinding.h"
|
||||
#include "mozilla/dom/ServiceWorkerCommon.h"
|
||||
#include "mozilla/dom/ServiceWorkerRegistrationBinding.h"
|
||||
#include "mozilla/dom/workers/bindings/WorkerHolder.h"
|
||||
#include "nsContentUtils.h" // Required for nsContentUtils::PushEnabled
|
||||
|
||||
// Support for Notification API extension.
|
||||
#include "mozilla/dom/NotificationBinding.h"
|
||||
@ -61,6 +61,13 @@ public:
|
||||
|
||||
IMPL_EVENT_HANDLER(updatefound)
|
||||
|
||||
static bool
|
||||
Visible(JSContext* aCx, JSObject* aObj);
|
||||
|
||||
static bool
|
||||
NotificationAPIVisible(JSContext* aCx, JSObject* aObj);
|
||||
|
||||
|
||||
static already_AddRefed<ServiceWorkerRegistration>
|
||||
CreateForMainThread(nsPIDOMWindowInner* aWindow,
|
||||
const nsAString& aScope);
|
||||
|
@ -5,7 +5,6 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "mozilla/dom/BindingUtils.h"
|
||||
#include "mozilla/dom/DOMPreferences.h"
|
||||
#include "mozilla/dom/Promise.h"
|
||||
#include "mozilla/dom/PromiseWorkerProxy.h"
|
||||
#include "mozilla/dom/StorageManager.h"
|
||||
@ -82,11 +81,11 @@ WorkerNavigator::GetAppName(nsString& aAppName, CallerType aCallerType) const
|
||||
MOZ_ASSERT(workerPrivate);
|
||||
|
||||
if ((!mProperties.mAppNameOverridden.IsEmpty() ||
|
||||
DOMPreferences::ResistFingerprintingEnabled()) &&
|
||||
workerPrivate->ResistFingerprintingEnabled()) &&
|
||||
!workerPrivate->UsesSystemPrincipal()) {
|
||||
// We will spoof this value when 'privacy.resistFingerprinting' is true.
|
||||
// See nsRFPService.h for spoofed value.
|
||||
aAppName = DOMPreferences::ResistFingerprintingEnabled() ?
|
||||
aAppName = workerPrivate->ResistFingerprintingEnabled() ?
|
||||
NS_LITERAL_STRING(SPOOFED_APPNAME) : mProperties.mAppNameOverridden;
|
||||
} else {
|
||||
aAppName = mProperties.mAppName;
|
||||
@ -101,11 +100,11 @@ WorkerNavigator::GetAppVersion(nsString& aAppVersion, CallerType aCallerType,
|
||||
MOZ_ASSERT(workerPrivate);
|
||||
|
||||
if ((!mProperties.mAppVersionOverridden.IsEmpty() ||
|
||||
DOMPreferences::ResistFingerprintingEnabled()) &&
|
||||
workerPrivate->ResistFingerprintingEnabled()) &&
|
||||
!workerPrivate->UsesSystemPrincipal()) {
|
||||
// We will spoof this value when 'privacy.resistFingerprinting' is true.
|
||||
// See nsRFPService.h for spoofed value.
|
||||
aAppVersion = DOMPreferences::ResistFingerprintingEnabled() ?
|
||||
aAppVersion = workerPrivate->ResistFingerprintingEnabled() ?
|
||||
NS_LITERAL_STRING(SPOOFED_APPVERSION) : mProperties.mAppVersionOverridden;
|
||||
} else {
|
||||
aAppVersion = mProperties.mAppVersion;
|
||||
@ -120,11 +119,11 @@ WorkerNavigator::GetPlatform(nsString& aPlatform, CallerType aCallerType,
|
||||
MOZ_ASSERT(workerPrivate);
|
||||
|
||||
if ((!mProperties.mPlatformOverridden.IsEmpty() ||
|
||||
DOMPreferences::ResistFingerprintingEnabled()) &&
|
||||
workerPrivate->ResistFingerprintingEnabled()) &&
|
||||
!workerPrivate->UsesSystemPrincipal()) {
|
||||
// We will spoof this value when 'privacy.resistFingerprinting' is true.
|
||||
// See nsRFPService.h for spoofed value.
|
||||
aPlatform = DOMPreferences::ResistFingerprintingEnabled() ?
|
||||
aPlatform = workerPrivate->ResistFingerprintingEnabled() ?
|
||||
NS_LITERAL_STRING(SPOOFED_PLATFORM) : mProperties.mPlatformOverridden;
|
||||
} else {
|
||||
aPlatform = mProperties.mPlatform;
|
||||
|
54
dom/workers/WorkerPrefs.h
Normal file
54
dom/workers/WorkerPrefs.h
Normal file
@ -0,0 +1,54 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||
/* 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/. */
|
||||
|
||||
// This is the list of the preferences that are exposed to workers.
|
||||
// The format is as follows:
|
||||
//
|
||||
// WORKER_SIMPLE_PREF("foo.bar", FooBar, FOO_BAR, UpdaterFunction)
|
||||
//
|
||||
// * First argument is the name of the pref.
|
||||
// * The name of the getter function. This defines a FindName()
|
||||
// function that returns the value of the pref on WorkerPrivate.
|
||||
// * The macro version of the name. This defines a WORKERPREF_FOO_BAR
|
||||
// macro in Workers.h.
|
||||
// * The name of the function that updates the new value of a pref.
|
||||
//
|
||||
// WORKER_PREF("foo.bar", UpdaterFunction)
|
||||
//
|
||||
// * First argument is the name of the pref.
|
||||
// * The name of the function that updates the new value of a pref.
|
||||
|
||||
#if !(defined(DEBUG) || defined(MOZ_ENABLE_JS_DUMP))
|
||||
WORKER_SIMPLE_PREF("browser.dom.window.dump.enabled", DumpEnabled, DUMP)
|
||||
#endif
|
||||
WORKER_SIMPLE_PREF("canvas.imagebitmap_extensions.enabled", ImageBitmapExtensionsEnabled, IMAGEBITMAP_EXTENSIONS_ENABLED)
|
||||
WORKER_SIMPLE_PREF("dom.caches.enabled", DOMCachesEnabled, DOM_CACHES)
|
||||
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)
|
||||
WORKER_SIMPLE_PREF("dom.webnotifications.requireinteraction.enabled", DOMWorkerNotificationRIEnabled, DOM_WORKERNOTIFICATIONRI)
|
||||
WORKER_SIMPLE_PREF("dom.serviceWorkers.enabled", ServiceWorkersEnabled, SERVICEWORKERS_ENABLED)
|
||||
WORKER_SIMPLE_PREF("dom.serviceWorkers.testing.enabled", ServiceWorkersTestingEnabled, SERVICEWORKERS_TESTING_ENABLED)
|
||||
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)
|
||||
WORKER_SIMPLE_PREF("dom.streams.enabled", StreamsEnabled, STREAMS_ENABLED)
|
||||
WORKER_SIMPLE_PREF("dom.requestcontext.enabled", RequestContextEnabled, REQUESTCONTEXT_ENABLED)
|
||||
WORKER_SIMPLE_PREF("gfx.offscreencanvas.enabled", OffscreenCanvasEnabled, OFFSCREENCANVAS_ENABLED)
|
||||
WORKER_SIMPLE_PREF("dom.webkitBlink.dirPicker.enabled", WebkitBlinkDirectoryPickerEnabled, DOM_WEBKITBLINK_DIRPICKER_WEBKITBLINK)
|
||||
WORKER_SIMPLE_PREF("dom.netinfo.enabled", NetworkInformationEnabled, NETWORKINFORMATION_ENABLED)
|
||||
WORKER_SIMPLE_PREF("dom.fetchObserver.enabled", FetchObserverEnabled, FETCHOBSERVER_ENABLED)
|
||||
WORKER_SIMPLE_PREF("privacy.resistFingerprinting", ResistFingerprintingEnabled, RESISTFINGERPRINTING_ENABLED)
|
||||
WORKER_SIMPLE_PREF("devtools.enabled", DevToolsEnabled, DEVTOOLS_ENABLED)
|
||||
WORKER_PREF("intl.accept_languages", PrefLanguagesChanged)
|
||||
WORKER_PREF("general.appname.override", AppNameOverrideChanged)
|
||||
WORKER_PREF("general.appversion.override", AppVersionOverrideChanged)
|
||||
WORKER_PREF("general.platform.override", PlatformOverrideChanged)
|
||||
#ifdef JS_GC_ZEAL
|
||||
WORKER_PREF("dom.workers.options.gcZeal", LoadGCZealOptions)
|
||||
#endif
|
@ -1377,6 +1377,28 @@ private:
|
||||
}
|
||||
};
|
||||
|
||||
class UpdatePreferenceRunnable final : public WorkerControlRunnable
|
||||
{
|
||||
WorkerPreference mPref;
|
||||
bool mValue;
|
||||
|
||||
public:
|
||||
UpdatePreferenceRunnable(WorkerPrivate* aWorkerPrivate,
|
||||
WorkerPreference aPref,
|
||||
bool aValue)
|
||||
: WorkerControlRunnable(aWorkerPrivate, WorkerThreadUnchangedBusyCount),
|
||||
mPref(aPref),
|
||||
mValue(aValue)
|
||||
{ }
|
||||
|
||||
virtual bool
|
||||
WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate) override
|
||||
{
|
||||
aWorkerPrivate->UpdatePreferenceInternal(mPref, mValue);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
class UpdateLanguagesRunnable final : public WorkerRunnable
|
||||
{
|
||||
nsTArray<nsString> mLanguages;
|
||||
@ -3486,6 +3508,20 @@ WorkerPrivateParent<Derived>::UpdateContextOptions(
|
||||
}
|
||||
}
|
||||
|
||||
template <class Derived>
|
||||
void
|
||||
WorkerPrivateParent<Derived>::UpdatePreference(WorkerPreference aPref, bool aValue)
|
||||
{
|
||||
AssertIsOnParentThread();
|
||||
MOZ_ASSERT(aPref >= 0 && aPref < WORKERPREF_COUNT);
|
||||
|
||||
RefPtr<UpdatePreferenceRunnable> runnable =
|
||||
new UpdatePreferenceRunnable(ParentAsWorkerPrivate(), aPref, aValue);
|
||||
if (!runnable->Dispatch()) {
|
||||
NS_WARNING("Failed to update worker preferences!");
|
||||
}
|
||||
}
|
||||
|
||||
template <class Derived>
|
||||
void
|
||||
WorkerPrivateParent<Derived>::UpdateLanguages(const nsTArray<nsString>& aLanguages)
|
||||
@ -4500,10 +4536,12 @@ WorkerPrivate::WorkerPrivate(WorkerPrivate* aParent,
|
||||
{
|
||||
if (aParent) {
|
||||
aParent->AssertIsOnWorkerThread();
|
||||
aParent->GetAllPreferences(mPreferences);
|
||||
mOnLine = aParent->OnLine();
|
||||
}
|
||||
else {
|
||||
AssertIsOnMainThread();
|
||||
RuntimeService::GetDefaultPreferences(mPreferences);
|
||||
mOnLine = !NS_IsOffline();
|
||||
}
|
||||
|
||||
@ -6787,6 +6825,19 @@ WorkerPrivate::UpdateLanguagesInternal(const nsTArray<nsString>& aLanguages)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
WorkerPrivate::UpdatePreferenceInternal(WorkerPreference aPref, bool aValue)
|
||||
{
|
||||
AssertIsOnWorkerThread();
|
||||
MOZ_ASSERT(aPref >= 0 && aPref < WORKERPREF_COUNT);
|
||||
|
||||
mPreferences[aPref] = aValue;
|
||||
|
||||
for (uint32_t index = 0; index < mChildWorkers.Length(); index++) {
|
||||
mChildWorkers[index]->UpdatePreference(aPref, aValue);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
WorkerPrivate::UpdateJSWorkerMemoryParameterInternal(JSContext* aCx,
|
||||
JSGCParamKey aKey,
|
||||
|
@ -409,6 +409,9 @@ public:
|
||||
void
|
||||
UpdateLanguages(const nsTArray<nsString>& aLanguages);
|
||||
|
||||
void
|
||||
UpdatePreference(WorkerPreference aPref, bool aValue);
|
||||
|
||||
void
|
||||
UpdateJSWorkerMemoryParameter(JSGCParamKey key, uint32_t value);
|
||||
|
||||
@ -1069,6 +1072,7 @@ class WorkerPrivate : public WorkerPrivateParent<WorkerPrivate>
|
||||
bool mIdleGCTimerRunning;
|
||||
bool mWorkerScriptExecutedSuccessfully;
|
||||
bool mFetchHandlerWasAdded;
|
||||
bool mPreferences[WORKERPREF_COUNT];
|
||||
bool mOnLine;
|
||||
|
||||
protected:
|
||||
@ -1272,6 +1276,9 @@ public:
|
||||
void
|
||||
UpdateLanguagesInternal(const nsTArray<nsString>& aLanguages);
|
||||
|
||||
void
|
||||
UpdatePreferenceInternal(WorkerPreference aPref, bool aValue);
|
||||
|
||||
void
|
||||
UpdateJSWorkerMemoryParameterInternal(JSContext* aCx, JSGCParamKey key, uint32_t aValue);
|
||||
|
||||
@ -1394,6 +1401,18 @@ public:
|
||||
bool
|
||||
RegisterDebuggerBindings(JSContext* aCx, JS::Handle<JSObject*> aGlobal);
|
||||
|
||||
#define WORKER_SIMPLE_PREF(name, getter, NAME) \
|
||||
bool \
|
||||
getter() const \
|
||||
{ \
|
||||
AssertIsOnWorkerThread(); \
|
||||
return mPreferences[WORKERPREF_##NAME]; \
|
||||
}
|
||||
#define WORKER_PREF(name, callback)
|
||||
#include "WorkerPrefs.h"
|
||||
#undef WORKER_SIMPLE_PREF
|
||||
#undef WORKER_PREF
|
||||
|
||||
bool
|
||||
OnLine() const
|
||||
{
|
||||
@ -1551,6 +1570,13 @@ private:
|
||||
const Sequence<JSObject*>& aTransferable,
|
||||
ErrorResult& aRv);
|
||||
|
||||
void
|
||||
GetAllPreferences(bool aPreferences[WORKERPREF_COUNT]) const
|
||||
{
|
||||
AssertIsOnWorkerThread();
|
||||
memcpy(aPreferences, mPreferences, WORKERPREF_COUNT * sizeof(bool));
|
||||
}
|
||||
|
||||
// If the worker shutdown status is equal or greater then aFailStatus, this
|
||||
// operation will fail and nullptr will be returned. See WorkerHolder.h for
|
||||
// more information about the correct value to use.
|
||||
|
@ -10,9 +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"
|
||||
#include "mozilla/dom/FunctionBinding.h"
|
||||
#include "mozilla/dom/IDBFactory.h"
|
||||
@ -372,7 +370,7 @@ WorkerGlobalScope::Dump(const Optional<nsAString>& aString) const
|
||||
}
|
||||
|
||||
#if !(defined(DEBUG) || defined(MOZ_ENABLE_JS_DUMP))
|
||||
if (!DOMPreferences::DumpEnabled()) {
|
||||
if (!mWorkerPrivate->DumpEnabled()) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
@ -481,7 +479,7 @@ WorkerGlobalScope::CreateImageBitmap(JSContext* aCx,
|
||||
const Sequence<ChannelPixelLayout>& aLayout,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
if (!DOMPreferences::ImageBitmapExtensionsEnabled()) {
|
||||
if (!ImageBitmap::ExtensionsEnabled(aCx)) {
|
||||
aRv.Throw(NS_ERROR_TYPE_ERR);
|
||||
return nullptr;
|
||||
}
|
||||
@ -850,6 +848,15 @@ 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,6 +300,9 @@ public:
|
||||
WrapGlobalObject(JSContext* aCx,
|
||||
JS::MutableHandle<JSObject*> aReflector) override;
|
||||
|
||||
static bool
|
||||
OpenWindowEnabled(JSContext* aCx, JSObject* aObj);
|
||||
|
||||
void
|
||||
GetScope(nsString& aScope) const
|
||||
{
|
||||
|
@ -186,6 +186,16 @@ struct JSSettings
|
||||
}
|
||||
};
|
||||
|
||||
enum WorkerPreference
|
||||
{
|
||||
#define WORKER_SIMPLE_PREF(name, getter, NAME) WORKERPREF_ ## NAME,
|
||||
#define WORKER_PREF(name, callback)
|
||||
#include "mozilla/dom/WorkerPrefs.h"
|
||||
#undef WORKER_SIMPLE_PREF
|
||||
#undef WORKER_PREF
|
||||
WORKERPREF_COUNT
|
||||
};
|
||||
|
||||
// Implemented in WorkerPrivate.cpp
|
||||
|
||||
struct WorkerLoadInfo
|
||||
|
@ -19,6 +19,7 @@ EXPORTS.mozilla.dom += [
|
||||
'ServiceWorkerRegistration.h',
|
||||
'WorkerLocation.h',
|
||||
'WorkerNavigator.h',
|
||||
'WorkerPrefs.h',
|
||||
'WorkerPrivate.h',
|
||||
'WorkerRunnable.h',
|
||||
'WorkerScope.h',
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include "WorkletGlobalScope.h"
|
||||
#include "mozilla/dom/WorkletGlobalScopeBinding.h"
|
||||
#include "mozilla/dom/Console.h"
|
||||
#include "mozilla/dom/DOMPreferences.h"
|
||||
#include "nsContentUtils.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
@ -70,7 +70,7 @@ WorkletGlobalScope::GetConsole(ErrorResult& aRv)
|
||||
void
|
||||
WorkletGlobalScope::Dump(const Optional<nsAString>& aString) const
|
||||
{
|
||||
if (!DOMPreferences::DumpEnabled()) {
|
||||
if (!nsContentUtils::DOMWindowDumpEnabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,6 @@
|
||||
#include "mozilla/MacroForEach.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/ScriptPreloader.h"
|
||||
#include "mozilla/dom/DOMPreferences.h"
|
||||
#include "mozilla/dom/ScriptSettings.h"
|
||||
#include "mozilla/UniquePtrExtensions.h"
|
||||
#include "mozilla/Unused.h"
|
||||
@ -89,7 +88,7 @@ static LazyLogModule gJSCLLog("JSComponentLoader");
|
||||
static bool
|
||||
Dump(JSContext* cx, unsigned argc, Value* vp)
|
||||
{
|
||||
if (!mozilla::dom::DOMPreferences::DumpEnabled()) {
|
||||
if (!nsContentUtils::DOMWindowDumpEnabled()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,6 @@
|
||||
#include "mozilla/dom/cache/CacheStorage.h"
|
||||
#include "mozilla/dom/CSSBinding.h"
|
||||
#include "mozilla/dom/DirectoryBinding.h"
|
||||
#include "mozilla/dom/DOMPreferences.h"
|
||||
#include "mozilla/dom/IndexedDatabaseManager.h"
|
||||
#include "mozilla/dom/Fetch.h"
|
||||
#include "mozilla/dom/FileBinding.h"
|
||||
@ -115,7 +114,7 @@ xpc::NewSandboxConstructor()
|
||||
static bool
|
||||
SandboxDump(JSContext* cx, unsigned argc, Value* vp)
|
||||
{
|
||||
if (!DOMPreferences::DumpEnabled()) {
|
||||
if (!nsContentUtils::DOMWindowDumpEnabled()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "xpcprivate.h"
|
||||
#include "jsprf.h"
|
||||
#include "nsArrayEnumerator.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsINamed.h"
|
||||
#include "nsIScriptError.h"
|
||||
#include "nsWrapperCache.h"
|
||||
@ -19,7 +20,6 @@
|
||||
#include "mozilla/dom/BindingUtils.h"
|
||||
#include "mozilla/dom/DOMException.h"
|
||||
#include "mozilla/dom/DOMExceptionBinding.h"
|
||||
#include "mozilla/dom/DOMPreferences.h"
|
||||
#include "mozilla/jsipc/CrossProcessObjectWrappers.h"
|
||||
|
||||
#include "jsapi.h"
|
||||
@ -948,7 +948,7 @@ nsXPCWrappedJSClass::CheckForException(XPCCallContext & ccx,
|
||||
}
|
||||
|
||||
if (reportable) {
|
||||
if (DOMPreferences::DumpEnabled()) {
|
||||
if (nsContentUtils::DOMWindowDumpEnabled()) {
|
||||
static const char line[] =
|
||||
"************************************************************\n";
|
||||
static const char preamble[] =
|
||||
|
@ -23,7 +23,6 @@
|
||||
|
||||
#include "mozilla/dom/BindingUtils.h"
|
||||
#include "mozilla/dom/DOMException.h"
|
||||
#include "mozilla/dom/DOMPreferences.h"
|
||||
#include "mozilla/dom/Exceptions.h"
|
||||
#include "mozilla/dom/Promise.h"
|
||||
|
||||
@ -270,7 +269,7 @@ xpc::ErrorBase::AppendErrorDetailsTo(nsCString& error)
|
||||
void
|
||||
xpc::ErrorNote::LogToStderr()
|
||||
{
|
||||
if (!DOMPreferences::DumpEnabled())
|
||||
if (!nsContentUtils::DOMWindowDumpEnabled())
|
||||
return;
|
||||
|
||||
nsAutoCString error;
|
||||
@ -284,7 +283,7 @@ xpc::ErrorNote::LogToStderr()
|
||||
void
|
||||
xpc::ErrorReport::LogToStderr()
|
||||
{
|
||||
if (!DOMPreferences::DumpEnabled())
|
||||
if (!nsContentUtils::DOMWindowDumpEnabled())
|
||||
return;
|
||||
|
||||
nsAutoCString error;
|
||||
|
@ -125,7 +125,6 @@
|
||||
#include "mozilla/dom/ipc/IPCBlobInputStreamStorage.h"
|
||||
#include "mozilla/dom/U2FTokenManager.h"
|
||||
#include "mozilla/dom/PointerEventHandler.h"
|
||||
#include "mozilla/dom/DOMPreferences.h"
|
||||
#include "nsHostObjectProtocolHandler.h"
|
||||
|
||||
using namespace mozilla;
|
||||
@ -318,9 +317,6 @@ nsLayoutStatics::Initialize()
|
||||
mozilla::dom::IPCBlobInputStreamStorage::Initialize();
|
||||
|
||||
mozilla::dom::U2FTokenManager::Initialize();
|
||||
|
||||
mozilla::dom::DOMPreferences::Initialize();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,6 @@
|
||||
#include "mozilla/dom/NodeInfo.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/dom/DataTransfer.h"
|
||||
#include "mozilla/dom/DOMPreferences.h"
|
||||
#include "mozilla/dom/HTMLButtonElement.h"
|
||||
#include "mozilla/dom/HTMLInputElement.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
@ -355,7 +354,7 @@ nsFileControlFrame::DnDListener::GetBlobImplForWebkitDirectory(nsIDOMFileList* a
|
||||
HTMLInputElement* inputElement =
|
||||
HTMLInputElement::FromContent(mFrame->GetContent());
|
||||
bool webkitDirPicker =
|
||||
DOMPreferences::WebkitBlinkDirectoryPickerEnabled() &&
|
||||
Preferences::GetBool("dom.webkitBlink.dirPicker.enabled", false) &&
|
||||
inputElement->HasAttr(kNameSpaceID_None, nsGkAtoms::webkitdirectory);
|
||||
if (!webkitDirPicker) {
|
||||
return NS_OK;
|
||||
|
@ -5013,15 +5013,10 @@ Preferences::AddAtomicUintVarCache(Atomic<uint32_t, Order>* aCache,
|
||||
|
||||
// Since the definition of template functions is not in a header file, we
|
||||
// need to explicitly specify the instantiations that are required. Currently
|
||||
// only the order=Relaxed and SequentiallyConsistent variants are needed.
|
||||
// only the order=Relaxed variant is needed.
|
||||
template nsresult
|
||||
Preferences::AddAtomicBoolVarCache(Atomic<bool, Relaxed>*, const char*, bool);
|
||||
|
||||
template nsresult
|
||||
Preferences::AddAtomicBoolVarCache(Atomic<bool, SequentiallyConsistent>*,
|
||||
const char*,
|
||||
bool);
|
||||
|
||||
template nsresult
|
||||
Preferences::AddAtomicIntVarCache(Atomic<int32_t, Relaxed>*,
|
||||
const char*,
|
||||
|
Loading…
Reference in New Issue
Block a user