Bug 1167808 P1 Add dom.serviceWorkers.interception.opaque.enabled pref. r=ehsan

This commit is contained in:
Ben Kelly 2015-07-02 20:09:20 -07:00
parent 9369c26bd9
commit 9b0d642c00
4 changed files with 24 additions and 0 deletions

View File

@ -165,6 +165,7 @@ static_assert(MAX_WORKERS_PER_DOMAIN >= 1,
#define PREF_SERVICEWORKERS_ENABLED "dom.serviceWorkers.enabled"
#define PREF_SERVICEWORKERS_TESTING_ENABLED "dom.serviceWorkers.testing.enabled"
#define PREF_INTERCEPTION_ENABLED "dom.serviceWorkers.interception.enabled"
#define PREF_INTERCEPTION_OPAQUE_ENABLED "dom.serviceWorkers.interception.opaque.enabled"
namespace {
@ -1932,6 +1933,10 @@ RuntimeService::Init()
WorkerPrefChanged,
PREF_INTERCEPTION_ENABLED,
reinterpret_cast<void *>(WORKERPREF_INTERCEPTION_ENABLED))) ||
NS_FAILED(Preferences::RegisterCallbackAndCall(
WorkerPrefChanged,
PREF_INTERCEPTION_OPAQUE_ENABLED,
reinterpret_cast<void *>(WORKERPREF_INTERCEPTION_OPAQUE_ENABLED))) ||
NS_FAILED(Preferences::RegisterCallbackAndCall(
WorkerPrefChanged,
PREF_DOM_CACHES_TESTING_ENABLED,
@ -2143,6 +2148,10 @@ RuntimeService::Cleanup()
WorkerPrefChanged,
PREF_DOM_CACHES_TESTING_ENABLED,
reinterpret_cast<void *>(WORKERPREF_DOM_CACHES_TESTING))) ||
NS_FAILED(Preferences::UnregisterCallback(
WorkerPrefChanged,
PREF_INTERCEPTION_OPAQUE_ENABLED,
reinterpret_cast<void *>(WORKERPREF_INTERCEPTION_OPAQUE_ENABLED))) ||
NS_FAILED(Preferences::UnregisterCallback(
WorkerPrefChanged,
PREF_INTERCEPTION_ENABLED,
@ -2704,6 +2713,7 @@ RuntimeService::WorkerPrefChanged(const char* aPrefName, void* aClosure)
case WORKERPREF_DUMP:
#endif
case WORKERPREF_INTERCEPTION_ENABLED:
case WORKERPREF_INTERCEPTION_OPAQUE_ENABLED:
case WORKERPREF_SERVICEWORKERS:
case WORKERPREF_SERVICEWORKERS_TESTING:
sDefaultPreferences[key] = Preferences::GetBool(aPrefName, false);

View File

@ -1291,6 +1291,13 @@ public:
return mPreferences[WORKERPREF_INTERCEPTION_ENABLED];
}
bool
OpaqueInterceptionEnabled() const
{
AssertIsOnWorkerThread();
return mPreferences[WORKERPREF_INTERCEPTION_OPAQUE_ENABLED];
}
bool
DOMWorkerNotificationEnabled() const
{

View File

@ -202,6 +202,7 @@ enum WorkerPreference
WORKERPREF_DOM_WORKERNOTIFICATION, // dom.webnotifications.workers.enabled
WORKERPREF_DOM_CACHES_TESTING, // dom.caches.testing.enabled
WORKERPREF_SERVICEWORKERS_TESTING, // dom.serviceWorkers.testing.enabled
WORKERPREF_INTERCEPTION_OPAQUE_ENABLED, // dom.serviceWorkers.interception.opaque.enabled
WORKERPREF_COUNT
};

View File

@ -135,6 +135,12 @@ pref("dom.workers.sharedWorkers.enabled", true);
// Service workers
pref("dom.serviceWorkers.enabled", false);
// Allow service workers to intercept network requests using the fetch event
pref("dom.serviceWorkers.interception.enabled", false);
// Allow service workers to intercept opaque (cross origin) responses
pref("dom.serviceWorkers.interception.opaque.enabled", false);
// Whether nonzero values can be returned from performance.timing.*
pref("dom.enable_performance", true);