Bug 913267 - Don't use settingsService in settings.js. r=timdream
authorGregor Wagner <anygregor@gmail.com>
Mon, 09 Sep 2013 12:28:01 +0200
changeset 146139 b58034e5d781a2fcf149c1811276a0ed879876b9
parent 146138 491a98fa85fbe2059f428452c55330306745a600
child 146140 8e2aef1ce87ee474b58a956ac50ff10c3aac477c
push id25243
push userryanvm@gmail.com
push dateMon, 09 Sep 2013 19:52:36 +0000
treeherdermozilla-central@9edc229b7d09 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstimdream
bugs913267
milestone26.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 913267 - Don't use settingsService in settings.js. r=timdream
b2g/chrome/content/settings.js
--- a/b2g/chrome/content/settings.js
+++ b/b2g/chrome/content/settings.js
@@ -158,49 +158,49 @@ SettingsListener.observe('language.curre
       Services.prefs.setCharPref('wap.UAProf.tagname', value);
   });
 })();
 
 //=================== DeviceInfo ====================
 Components.utils.import('resource://gre/modules/XPCOMUtils.jsm');
 Components.utils.import('resource://gre/modules/ctypes.jsm');
 (function DeviceInfoToSettings() {
-  XPCOMUtils.defineLazyServiceGetter(this, 'gSettingsService',
-                                     '@mozilla.org/settingsService;1',
-                                     'nsISettingsService');
-  let lock = gSettingsService.createLock();
   // MOZ_B2G_VERSION is set in b2g/confvars.sh, and is output as a #define value
   // from configure.in, defaults to 1.0.0 if this value is not exist.
 #filter attemptSubstitution
   let os_version = '@MOZ_B2G_VERSION@';
   let os_name = '@MOZ_B2G_OS_NAME@';
 #unfilter attemptSubstitution
-  lock.set('deviceinfo.os', os_version, null, null);
-  lock.set('deviceinfo.software', os_name + ' ' + os_version, null, null);
 
   let appInfo = Cc["@mozilla.org/xre/app-info;1"]
                   .getService(Ci.nsIXULAppInfo);
-  lock.set('deviceinfo.platform_version', appInfo.platformVersion, null, null);
-  lock.set('deviceinfo.platform_build_id', appInfo.platformBuildID, null, null);
-
   let update_channel = Services.prefs.getCharPref('app.update.channel');
-  lock.set('deviceinfo.update_channel', update_channel, null, null);
 
   // Get the hardware info and firmware revision from device properties.
   let hardware_info = null;
   let firmware_revision = null;
   let product_model = null;
 #ifdef MOZ_WIDGET_GONK
     hardware_info = libcutils.property_get('ro.hardware');
     firmware_revision = libcutils.property_get('ro.firmware_revision');
     product_model = libcutils.property_get('ro.product.model');
 #endif
-  lock.set('deviceinfo.hardware', hardware_info, null, null);
-  lock.set('deviceinfo.firmware_revision', firmware_revision, null, null);
-  lock.set('deviceinfo.product_model', product_model, null, null);
+
+  let software = os_name + ' ' + os_version;
+  let setting = {
+    'deviceinfo.os': os_version,
+    'deviceinfo.software': software,
+    'deviceinfo.platform_version': appInfo.platformVersion,
+    'deviceinfo.platform_build_id': appInfo.platformBuildID,
+    'deviceinfo.update_channel': update_channel,
+    'deviceinfo.hardware': hardware_info,
+    'deviceinfo.firmware_revision': firmware_revision,
+    'deviceinfo.product_model': product_model
+  }
+  window.navigator.mozSettings.createLock().set(setting);
 })();
 
 // =================== Debugger / ADB ====================
 
 #ifdef MOZ_WIDGET_GONK
 let AdbController = {
   DEBUG: false,
   locked: undefined,