Bug 1029620 P5 Create dom.fetch.enabled pref, defaulted to false. r=ehsan

This commit is contained in:
Ben Kelly 2014-07-28 15:28:20 -04:00
Родитель d1a0102e04
Коммит a6ae9ed383
4 изменённых файлов: 26 добавлений и 0 удалений

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

@ -151,6 +151,7 @@ static_assert(MAX_WORKERS_PER_DOMAIN >= 1,
#define PREF_DOM_WINDOW_DUMP_ENABLED "browser.dom.window.dump.enabled"
#endif
#define PREF_DOM_FETCH_ENABLED "dom.fetch.enabled"
#define PREF_WORKERS_LATEST_JS_VERSION "dom.workers.latestJSVersion"
namespace {
@ -1772,6 +1773,10 @@ RuntimeService::Init()
PREF_DOM_WINDOW_DUMP_ENABLED,
reinterpret_cast<void *>(WORKERPREF_DUMP))) ||
#endif
NS_FAILED(Preferences::RegisterCallbackAndCall(
WorkerPrefChanged,
PREF_DOM_FETCH_ENABLED,
reinterpret_cast<void *>(WORKERPREF_DOM_FETCH))) ||
NS_FAILED(Preferences::RegisterCallback(LoadRuntimeAndContextOptions,
PREF_JS_OPTIONS_PREFIX,
nullptr)) ||
@ -1931,6 +1936,10 @@ RuntimeService::Cleanup()
NS_FAILED(Preferences::UnregisterCallback(LoadRuntimeAndContextOptions,
PREF_WORKERS_OPTIONS_PREFIX,
nullptr)) ||
NS_FAILED(Preferences::UnregisterCallback(
WorkerPrefChanged,
PREF_DOM_FETCH_ENABLED,
reinterpret_cast<void *>(WORKERPREF_DOM_FETCH))) ||
#if DUMP_CONTROLLED_BY_PREF
NS_FAILED(Preferences::UnregisterCallback(
WorkerPrefChanged,
@ -2481,6 +2490,12 @@ RuntimeService::WorkerPrefChanged(const char* aPrefName, void* aClosure)
}
#endif
if (key == WORKERPREF_DOM_FETCH) {
key = WORKERPREF_DOM_FETCH;
sDefaultPreferences[WORKERPREF_DOM_FETCH] =
Preferences::GetBool(PREF_DOM_FETCH_ENABLED, false);
}
// This function should never be registered as a callback for a preference it
// does not handle.
MOZ_ASSERT(key != WORKERPREF_COUNT);

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

@ -1041,6 +1041,13 @@ public:
return mPreferences[WORKERPREF_DUMP];
}
bool
DOMFetchEnabled() const
{
AssertIsOnWorkerThread();
return mPreferences[WORKERPREF_DOM_FETCH];
}
bool
OnLine() const
{

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

@ -166,6 +166,7 @@ struct JSSettings
enum WorkerPreference
{
WORKERPREF_DUMP = 0, // browser.dom.window.dump.enabled
WORKERPREF_DOM_FETCH,// dom.fetch.enabled
WORKERPREF_COUNT
};

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

@ -4299,6 +4299,9 @@ pref("beacon.enabled", true);
// Camera prefs
pref("camera.control.autofocus_moving_callback.enabled", true);
pref("camera.control.face_detection.enabled", true);
// Fetch API.
pref("dom.fetch.enabled", false);
#ifdef MOZ_WIDGET_GONK
// Empirically, this is the value returned by hal::GetTotalSystemMemory()
// when Flame's memory is limited to 512MiB. If the camera stack determines