mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 978197 - Simplify the process to map a setting and a pref. r=fabrice
This commit is contained in:
parent
2d0e4e14c7
commit
25c7404dbf
@ -122,51 +122,6 @@ SettingsListener.observe('language.current', 'en-US', function(value) {
|
||||
});
|
||||
});
|
||||
|
||||
SettingsListener.observe('ril.mms.retrieval_mode', 'manual',
|
||||
function(value) {
|
||||
Services.prefs.setCharPref('dom.mms.retrieval_mode', value);
|
||||
});
|
||||
|
||||
SettingsListener.observe('ril.sms.strict7BitEncoding.enabled', false,
|
||||
function(value) {
|
||||
Services.prefs.setBoolPref('dom.sms.strict7BitEncoding', value);
|
||||
});
|
||||
|
||||
SettingsListener.observe('ril.sms.requestStatusReport.enabled', false,
|
||||
function(value) {
|
||||
Services.prefs.setBoolPref('dom.sms.requestStatusReport', value);
|
||||
});
|
||||
|
||||
SettingsListener.observe('ril.mms.requestStatusReport.enabled', false,
|
||||
function(value) {
|
||||
Services.prefs.setBoolPref('dom.mms.requestStatusReport', value);
|
||||
});
|
||||
|
||||
SettingsListener.observe('ril.mms.requestReadReport.enabled', true,
|
||||
function(value) {
|
||||
Services.prefs.setBoolPref('dom.mms.requestReadReport', value);
|
||||
});
|
||||
|
||||
SettingsListener.observe('ril.cellbroadcast.disabled', false,
|
||||
function(value) {
|
||||
Services.prefs.setBoolPref('ril.cellbroadcast.disabled', value);
|
||||
});
|
||||
|
||||
SettingsListener.observe('ril.radio.disabled', false,
|
||||
function(value) {
|
||||
Services.prefs.setBoolPref('ril.radio.disabled', value);
|
||||
});
|
||||
|
||||
SettingsListener.observe('wap.UAProf.url', '',
|
||||
function(value) {
|
||||
Services.prefs.setCharPref('wap.UAProf.url', value);
|
||||
});
|
||||
|
||||
SettingsListener.observe('wap.UAProf.tagname', 'x-wap-profile',
|
||||
function(value) {
|
||||
Services.prefs.setCharPref('wap.UAProf.tagname', value);
|
||||
});
|
||||
|
||||
// DSDS default service IDs
|
||||
['mms', 'sms', 'telephony', 'voicemail'].forEach(function(key) {
|
||||
SettingsListener.observe('ril.' + key + '.defaultServiceId', 0,
|
||||
@ -235,10 +190,6 @@ SettingsListener.observe('devtools.overlay', false, (value) => {
|
||||
}
|
||||
});
|
||||
|
||||
SettingsListener.observe('devtools.eventlooplag.threshold', 100, function(value) {
|
||||
Services.prefs.setIntPref('devtools.eventlooplag.threshold', value);
|
||||
});
|
||||
|
||||
// =================== Debugger / ADB ====================
|
||||
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
@ -525,11 +476,6 @@ SettingsListener.observe('debugger.remote-mode', false, function(value) {
|
||||
#endif
|
||||
});
|
||||
|
||||
|
||||
SettingsListener.observe('debug.log-animations.enabled', false, function(value) {
|
||||
Services.prefs.setBoolPref('layers.offmainthreadcomposition.log-animations', value);
|
||||
});
|
||||
|
||||
// =================== Device Storage ====================
|
||||
SettingsListener.observe('device.storage.writable.name', 'sdcard', function(value) {
|
||||
if (Services.prefs.getPrefType('device.storage.writable.name') != Ci.nsIPrefBranch.PREF_STRING) {
|
||||
@ -541,10 +487,6 @@ SettingsListener.observe('device.storage.writable.name', 'sdcard', function(valu
|
||||
});
|
||||
|
||||
// =================== Privacy ====================
|
||||
SettingsListener.observe('privacy.donottrackheader.enabled', false, function(value) {
|
||||
Services.prefs.setBoolPref('privacy.donottrackheader.enabled', value);
|
||||
});
|
||||
|
||||
SettingsListener.observe('privacy.donottrackheader.value', 1, function(value) {
|
||||
Services.prefs.setIntPref('privacy.donottrackheader.value', value);
|
||||
// If the user specifically disallows tracking, we set the value of
|
||||
@ -604,22 +546,7 @@ function setUpdateTrackingId() {
|
||||
}
|
||||
setUpdateTrackingId();
|
||||
|
||||
SettingsListener.observe('app.update.interval', 86400, function(value) {
|
||||
Services.prefs.setIntPref('app.update.interval', value);
|
||||
});
|
||||
|
||||
// ================ Debug ================
|
||||
// XXX could factor out into a settings->pref map.
|
||||
SettingsListener.observe("debug.fps.enabled", false, function(value) {
|
||||
Services.prefs.setBoolPref("layers.acceleration.draw-fps", value);
|
||||
});
|
||||
SettingsListener.observe("debug.paint-flashing.enabled", false, function(value) {
|
||||
Services.prefs.setBoolPref("nglayout.debug.paint_flashing", value);
|
||||
});
|
||||
SettingsListener.observe("layers.draw-borders", false, function(value) {
|
||||
Services.prefs.setBoolPref("layers.draw-borders", value);
|
||||
});
|
||||
|
||||
(function Composer2DSettingToPref() {
|
||||
//layers.composer.enabled can be enabled in three ways
|
||||
//In order of precedence they are:
|
||||
@ -675,11 +602,6 @@ SettingsListener.observe("accessibility.screenreader", false, function(value) {
|
||||
})();
|
||||
|
||||
// =================== AsyncPanZoom ======================
|
||||
|
||||
SettingsListener.observe('apz.force-enable', false, function(value) {
|
||||
Services.prefs.setBoolPref('dom.browser_frames.useAsyncPanZoom', value);
|
||||
});
|
||||
|
||||
SettingsListener.observe('apz.displayport.heuristics', 'default', function(value) {
|
||||
// first reset everything to default
|
||||
Services.prefs.clearUserPref('apz.velocity_bias');
|
||||
@ -711,19 +633,89 @@ SettingsListener.observe('apz.displayport.heuristics', 'default', function(value
|
||||
}
|
||||
});
|
||||
|
||||
SettingsListener.observe('layers.enable-tiles', false, function(value) {
|
||||
Services.prefs.setBoolPref('layers.enable-tiles', value);
|
||||
});
|
||||
// =================== Various simple mapping ======================
|
||||
let settingsToObserve = {
|
||||
'ril.mms.retrieval_mode': {
|
||||
prefName: 'dom.mms.retrieval_mode',
|
||||
defaultValue: 'manual'
|
||||
},
|
||||
'ril.sms.strict7BitEncoding.enabled': {
|
||||
prefName: 'dom.sms.strict7BitEncoding',
|
||||
defaultValue: false
|
||||
},
|
||||
'ril.sms.requestStatusReport.enabled': {
|
||||
prefName: 'dom.sms.requestStatusReport',
|
||||
defaultValue: false
|
||||
},
|
||||
'ril.mms.requestStatusReport.enabled': {
|
||||
prefName: 'dom.mms.requestStatusReport',
|
||||
defaultValue: false
|
||||
},
|
||||
'ril.mms.requestReadReport.enabled': {
|
||||
prefName: 'dom.mms.requestReadReport',
|
||||
defaultValue: true
|
||||
},
|
||||
'ril.cellbroadcast.disabled': false,
|
||||
'ril.radio.disabled': false,
|
||||
'wap.UAProf.url': '',
|
||||
'wap.UAProf.tagname': 'x-wap-profile',
|
||||
'devtools.eventlooplag.threshold': 100,
|
||||
'privacy.donottrackheader.enabled': false,
|
||||
'apz.force-enable': {
|
||||
prefName: 'dom.browser_frames.useAsyncPanZoom',
|
||||
defaultValue: false
|
||||
},
|
||||
'layers.enable-tiles': false,
|
||||
'layers.progressive-paint': false,
|
||||
'layers.draw-tile-borders': false,
|
||||
'layers.dump': false,
|
||||
'debug.fps.enabled': {
|
||||
prefName: 'layers.acceleration.draw-fps',
|
||||
defaultValue: false
|
||||
},
|
||||
'debug.paint-flashing.enabled': {
|
||||
prefName: 'nglayout.debug.paint_flashing',
|
||||
defaultValue: false
|
||||
},
|
||||
'layers.draw-borders': false,
|
||||
'app.update.interval': 86400,
|
||||
'debug.log-animations.enabled': {
|
||||
prefName: 'layers.offmainthreadcomposition.log-animations',
|
||||
defaultValue: false
|
||||
}
|
||||
};
|
||||
|
||||
SettingsListener.observe('layers.progressive-paint', false, function(value) {
|
||||
Services.prefs.setBoolPref('layers.progressive-paint', value);
|
||||
});
|
||||
for (let key in settingsToObserve) {
|
||||
let setting = settingsToObserve[key];
|
||||
|
||||
SettingsListener.observe('layers.draw-tile-borders', false, function(value) {
|
||||
Services.prefs.setBoolPref('layers.draw-tile-borders', value);
|
||||
});
|
||||
// By default, assume the setting name and the pref name are the same.
|
||||
let prefName = key;
|
||||
let defaultValue = setting;
|
||||
|
||||
SettingsListener.observe('layers.dump', false, function(value) {
|
||||
Services.prefs.setBoolPref('layers.dump', value);
|
||||
});
|
||||
// Check if the pref name has been overidden.
|
||||
if (typeof setting == 'object') {
|
||||
prefName = setting.prefName;
|
||||
defaultValue = setting.defaultValue;
|
||||
}
|
||||
|
||||
switch (typeof defaultValue) {
|
||||
case 'boolean':
|
||||
SettingsListener.observe(key, defaultValue, function(value) {
|
||||
Services.prefs.setBoolPref(prefName, value);
|
||||
});
|
||||
break;
|
||||
|
||||
case 'string':
|
||||
SettingsListener.observe(key, defaultValue, function(value) {
|
||||
Services.prefs.setCharPref(prefName, value);
|
||||
});
|
||||
break;
|
||||
|
||||
case 'number':
|
||||
SettingsListener.observe(key, defaultValue, function(value) {
|
||||
Services.prefs.setIntPref(prefName, value);
|
||||
});
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user