Backed out changeset c345da3eef13 (bug 1058440) for regressions
authorCarsten "Tomcat" Book <cbook@mozilla.com>
Mon, 01 Sep 2014 12:47:43 +0200
changeset 224450 4cfa5c8e0ad00c189d503d0f7b57ef7458137445
parent 224449 dcc0ea053389a3144e85770b3eed9d618dd53d22
child 224451 e47d5a043426b81524731dbd2a411106884b29e4
push id3979
push userraliiev@mozilla.com
push dateMon, 13 Oct 2014 16:35:44 +0000
treeherdermozilla-beta@30f2cc610691 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1058440
milestone34.0a1
backs outc345da3eef13586f8b71ffcf81aec8fffbf84385
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
Backed out changeset c345da3eef13 (bug 1058440) for regressions
dom/nfc/NfcContentHelper.js
dom/nfc/gonk/Nfc.js
dom/nfc/gonk/nfc_consts.js
--- a/dom/nfc/NfcContentHelper.js
+++ b/dom/nfc/NfcContentHelper.js
@@ -18,43 +18,36 @@
 "use strict";
 
 const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
 
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://gre/modules/DOMRequestHelper.jsm");
 
-XPCOMUtils.defineLazyServiceGetter(this, "gSettingsService",
-                                   "@mozilla.org/settingsService;1",
-                                   "nsISettingsService");
-
 XPCOMUtils.defineLazyGetter(this, "NFC", function () {
   let obj = {};
   Cu.import("resource://gre/modules/nfc_consts.js", obj);
   return obj;
 });
 
 Cu.import("resource://gre/modules/systemlibs.js");
 const NFC_ENABLED = libcutils.property_get("ro.moz.nfc.enabled", "false") === "true";
 
 // set to true to in nfc_consts.js to see debug messages
 let DEBUG = NFC.DEBUG_CONTENT_HELPER;
 
 let debug;
-function updateDebug() {
-  if (DEBUG) {
-    debug = function (s) {
-      dump("-*- NfcContentHelper: " + s + "\n");
-    };
-  } else {
-    debug = function (s) {};
-  }
-};
-updateDebug();
+if (DEBUG) {
+  debug = function (s) {
+    dump("-*- NfcContentHelper: " + s + "\n");
+  };
+} else {
+  debug = function (s) {};
+}
 
 const NFCCONTENTHELPER_CID =
   Components.ID("{4d72c120-da5f-11e1-9b23-0800200c9a66}");
 
 const NFC_IPC_MSG_NAMES = [
   "NFC:ReadNDEFResponse",
   "NFC:WriteNDEFResponse",
   "NFC:GetDetailsNDEFResponse",
@@ -79,21 +72,16 @@ function GetDetailsNDEFResponse(details)
 GetDetailsNDEFResponse.prototype = {
   __exposedProps__ : {canBeMadeReadOnly: 'r',
                       isReadOnly: 'r',
                       maxSupportedLength: 'r'}
 };
 
 function NfcContentHelper() {
   this.initDOMRequestHelper(/* aWindow */ null, NFC_IPC_MSG_NAMES);
-
-  let lock = gSettingsService.createLock();
-  lock.get(NFC.SETTING_NFC_DEBUG, this);
-
-  Services.obs.addObserver(this, NFC.TOPIC_MOZSETTINGS_CHANGED, false);
   Services.obs.addObserver(this, "xpcom-shutdown", false);
 
   this._requestMap = [];
 }
 
 NfcContentHelper.prototype = {
   __proto__: DOMRequestIpcHelper.prototype,
 
@@ -362,24 +350,18 @@ NfcContentHelper.prototype = {
                           {requestId: requestId});
     return request;
   },
 
   // nsIObserver
   observe: function observe(subject, topic, data) {
     if (topic == "xpcom-shutdown") {
       this.destroyDOMRequestHelper();
-      Services.obs.removeObserver(this, NFC.TOPIC_MOZSETTINGS_CHANGED);
       Services.obs.removeObserver(this, "xpcom-shutdown");
       cpmm = null;
-    } else if (topic == NFC.TOPIC_MOZSETTINGS_CHANGED) {
-      let setting = JSON.parse(data);
-      if (setting) {
-        this.handle(setting.key, setting.value);
-      }
     }
   },
 
   // nsIMessageListener
 
   fireRequestSuccess: function fireRequestSuccess(requestId, result) {
     let request = this.takeRequest(requestId);
     if (!request) {
@@ -440,25 +422,16 @@ NfcContentHelper.prototype = {
           case NFC.NFC_PEER_EVENT_LOST:
             this.peerEventListener.notifyPeerLost(result.sessionToken);
             break;
         }
         break;
     }
   },
 
-  handle: function handle(name, result) {
-    switch (name) {
-      case NFC.SETTING_NFC_DEBUG:
-        DEBUG = result;
-        updateDebug();
-        break;
-    }
-  },
-
   handleReadNDEFResponse: function handleReadNDEFResponse(result) {
     let requester = this._requestMap[result.requestId];
     if (!requester) {
       debug("Response Invalid requestId=" + result.requestId);
       return;
     }
     delete this._requestMap[result.requestId];
 
--- a/dom/nfc/gonk/Nfc.js
+++ b/dom/nfc/gonk/Nfc.js
@@ -17,43 +17,36 @@
 
 "use strict";
 
 const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
 
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 Cu.import("resource://gre/modules/Services.jsm");
 
-XPCOMUtils.defineLazyServiceGetter(this, "gSettingsService",
-                                   "@mozilla.org/settingsService;1",
-                                   "nsISettingsService");
-
 XPCOMUtils.defineLazyGetter(this, "NFC", function () {
   let obj = {};
   Cu.import("resource://gre/modules/nfc_consts.js", obj);
   return obj;
 });
 
 Cu.import("resource://gre/modules/systemlibs.js");
 const NFC_ENABLED = libcutils.property_get("ro.moz.nfc.enabled", "false") === "true";
 
 // set to true in nfc_consts.js to see debug messages
 let DEBUG = NFC.DEBUG_NFC;
 
 let debug;
-function updateDebug() {
-  if (DEBUG) {
-    debug = function (s) {
-      dump("-*- Nfc: " + s + "\n");
-    };
-  } else {
-    debug = function (s) {};
-  }
-};
-updateDebug();
+if (DEBUG) {
+  debug = function (s) {
+    dump("-*- Nfc: " + s + "\n");
+  };
+} else {
+  debug = function (s) {};
+}
 
 const NFC_CONTRACTID = "@mozilla.org/nfc;1";
 const NFC_CID =
   Components.ID("{2ff24790-5e74-11e1-b86c-0800200c9a66}");
 
 const NFC_IPC_MSG_NAMES = [
   "NFC:CheckSessionToken"
 ];
@@ -100,29 +93,24 @@ XPCOMUtils.defineLazyGetter(this, "gMess
 
     // Manage registered Peer Targets
     peerTargetsMap: {},
     currentPeerAppId: null,
 
     init: function init(nfc) {
       this.nfc = nfc;
 
-      let lock = gSettingsService.createLock();
-      lock.get(NFC.SETTING_NFC_DEBUG, this.nfc);
-
-      Services.obs.addObserver(this, NFC.TOPIC_MOZSETTINGS_CHANGED, false);
       Services.obs.addObserver(this, NFC.TOPIC_XPCOM_SHUTDOWN, false);
       this._registerMessageListeners();
     },
 
     _shutdown: function _shutdown() {
       this.nfc.shutdown();
       this.nfc = null;
 
-      Services.obs.removeObserver(this, NFC.TOPIC_MOZSETTINGS_CHANGED);
       Services.obs.removeObserver(this, NFC.TOPIC_XPCOM_SHUTDOWN);
       this._unregisterMessageListeners();
     },
 
     _registerMessageListeners: function _registerMessageListeners() {
       ppmm.addMessageListener("child-process-shutdown", this);
 
       for (let message of NFC_IPC_MSG_NAMES) {
@@ -325,22 +313,16 @@ XPCOMUtils.defineLazyGetter(this, "gMess
     },
 
     /**
      * nsIObserver interface methods.
      */
 
     observe: function observe(subject, topic, data) {
       switch (topic) {
-        case NFC.TOPIC_MOZSETTINGS_CHANGED:
-          let setting = JSON.parse(data);
-          if (setting) {
-            this.nfc.handle(setting.key, setting.value);
-          }
-          break;
         case NFC.TOPIC_XPCOM_SHUTDOWN:
           this._shutdown();
           break;
       }
     },
   };
 });
 
@@ -595,28 +577,16 @@ Nfc.prototype = {
         return null;
     }
     this.targetsByRequestId[message.data.requestId] = message.target;
 
     return null;
   },
 
   /**
-   * nsISettingsServiceCallback
-   */
-  handle: function handle(name, result) {
-    switch (name) {
-      case NFC.SETTING_NFC_DEBUG:
-        DEBUG = result;
-        updateDebug();
-        break;
-    }
-  },
-
-  /**
    * nsIObserver interface methods.
    */
   observe: function(subject, topic, data) {
     if (topic != "profile-after-change") {
       debug("Should receive 'profile-after-change' only, received " + topic);
     }
   },
 
--- a/dom/nfc/gonk/nfc_consts.js
+++ b/dom/nfc/gonk/nfc_consts.js
@@ -100,18 +100,15 @@ this.NFC_ERROR_MSG[this.NFC_GECKO_ERROR_
 this.NFC_ERROR_MSG[this.NFC_GECKO_ERROR_SEND_FILE_FAILED] = "NfcSendFileFailed";
 
 // NFC powerlevels must match config PDUs.
 this.NFC_POWER_LEVEL_UNKNOWN        = -1;
 this.NFC_POWER_LEVEL_DISABLED       = 0;
 this.NFC_POWER_LEVEL_LOW            = 1;
 this.NFC_POWER_LEVEL_ENABLED        = 2;
 
-this.TOPIC_MOZSETTINGS_CHANGED      = "mozsettings-changed";
 this.TOPIC_XPCOM_SHUTDOWN           = "xpcom-shutdown";
 
-this.SETTING_NFC_DEBUG = "nfc.debugging.enabled";
-
 this.NFC_PEER_EVENT_READY = 0x01;
 this.NFC_PEER_EVENT_LOST  = 0x02;
 
 // Allow this file to be imported via Components.utils.import().
 this.EXPORTED_SYMBOLS = Object.keys(this);