Bug 1114935 - Part 8: Mark TODO items for deprecating RILContentHelper. r=echen
authorBevis Tseng <btseng@mozilla.com>
Fri, 13 Feb 2015 15:05:37 +0800
changeset 266493 1b274a1579047a13cbca578cd666f7eb5b66f987
parent 266492 a483c38d6f726be059403e242a8551549902bcf4
child 266494 fa6ba2e6e8290832e89f1cb68348a69484e0883c
push id830
push userraliiev@mozilla.com
push dateFri, 19 Jun 2015 19:24:37 +0000
treeherdermozilla-release@932614382a68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersechen
bugs1114935
milestone39.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 1114935 - Part 8: Mark TODO items for deprecating RILContentHelper. r=echen
dom/icc/IccManager.cpp
dom/icc/interfaces/moz.build
dom/system/gonk/RILContentHelper.manifest
dom/system/gonk/RadioInterfaceLayer.js
dom/system/gonk/moz.build
dom/system/gonk/tests/marionette/test_ril_code_quality.py
--- a/dom/icc/IccManager.cpp
+++ b/dom/icc/IccManager.cpp
@@ -8,16 +8,17 @@
 #include "IccListener.h"
 #include "mozilla/AsyncEventDispatcher.h"
 #include "mozilla/dom/IccChangeEvent.h"
 #include "mozilla/Preferences.h"
 #include "nsIIccInfo.h"
 // Service instantiation
 #include "ipc/IccIPCService.h"
 #if defined(MOZ_WIDGET_GONK) && defined(MOZ_B2G_RIL)
+// TODO: Bug 815526, deprecate RILContentHelper.
 #include "nsIRadioInterfaceLayer.h"
 #include "nsRadioInterfaceLayer.h"
 #include "nsIGonkIccService.h"
 #endif
 #include "nsXULAppAPI.h" // For XRE_GetProcessType()
 
 using namespace mozilla::dom;
 
@@ -142,16 +143,17 @@ already_AddRefed<nsIIccService>
 NS_CreateIccService()
 {
   nsCOMPtr<nsIIccService> service;
 
   if (XRE_GetProcessType() == GeckoProcessType_Content) {
     service = new mozilla::dom::icc::IccIPCService();
 #if defined(MOZ_WIDGET_GONK) && defined(MOZ_B2G_RIL)
   } else {
+    // TODO: Bug 815526, deprecate RILContentHelper.
     nsCOMPtr <nsIRadioInterfaceLayer> ril =
       do_GetService(NS_RADIOINTERFACELAYER_CONTRACTID);
     nsCOMPtr <nsIRadioInterfaceLayer_new> ril_new(do_QueryInterface(ril));
 
     service = (ril_new) ? do_GetService(GONK_ICC_SERVICE_CONTRACTID)
                         : do_GetService(NS_RILCONTENTHELPER_CONTRACTID);
 #endif
   }
--- a/dom/icc/interfaces/moz.build
+++ b/dom/icc/interfaces/moz.build
@@ -1,17 +1,17 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 XPIDL_SOURCES += [
     'nsIIccInfo.idl',
-    'nsIIccProvider.idl',
+    'nsIIccProvider.idl', # TODO: Bug 815526, deprecate RILContentHelper.
     'nsIIccService.idl',
 ]
 
 if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk' and CONFIG['MOZ_B2G_RIL']:
     XPIDL_SOURCES += [
         'nsIGonkIccService.idl',
         'nsIIccMessenger.idl',
     ]
--- a/dom/system/gonk/RILContentHelper.manifest
+++ b/dom/system/gonk/RILContentHelper.manifest
@@ -8,11 +8,13 @@
 #
 # Unless required by applicable law or agreed to in writing, software
 # distributed under the License is distributed on an "AS IS" BASIS,
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
 # RILContentHelper.js
+# TODO: Bug 815526, deprecate RILContentHelper:
+#       To be removed from b2g/installer/package-manifest.in as well.
 component {472816e1-1fd6-4405-996c-806f9ea68174} RILContentHelper.js
 contract @mozilla.org/ril/content-helper;1 {472816e1-1fd6-4405-996c-806f9ea68174}
 category profile-after-change RILContentHelper @mozilla.org/ril/content-helper;1
--- a/dom/system/gonk/RadioInterfaceLayer.js
+++ b/dom/system/gonk/RadioInterfaceLayer.js
@@ -82,16 +82,17 @@ const INT32_MAX = 2147483647;
 const NETWORK_TYPE_UNKNOWN     = Ci.nsINetworkInterface.NETWORK_TYPE_UNKNOWN;
 const NETWORK_TYPE_WIFI        = Ci.nsINetworkInterface.NETWORK_TYPE_WIFI;
 const NETWORK_TYPE_MOBILE      = Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE;
 const NETWORK_TYPE_MOBILE_MMS  = Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_MMS;
 const NETWORK_TYPE_MOBILE_SUPL = Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_SUPL;
 const NETWORK_TYPE_MOBILE_IMS  = Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_IMS;
 const NETWORK_TYPE_MOBILE_DUN  = Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_DUN;
 
+// TODO: Bug 815526, deprecate RILContentHelper.
 const RIL_IPC_ICCMANAGER_MSG_NAMES = [
   "RIL:GetRilContext",
   "RIL:SendStkResponse",
   "RIL:SendStkMenuSelection",
   "RIL:SendStkTimerExpiration",
   "RIL:SendStkEventDownload",
   "RIL:GetCardLockEnabled",
   "RIL:UnlockCardLock",
@@ -176,16 +177,17 @@ XPCOMUtils.defineLazyServiceGetter(this,
                                    "nsIIccMessenger");
 
 XPCOMUtils.defineLazyGetter(this, "gStkCmdFactory", function() {
   let stk = {};
   Cu.import("resource://gre/modules/StkProactiveCmdFactory.jsm", stk);
   return stk.StkProactiveCmdFactory;
 });
 
+// TODO: Bug 815526, deprecate RILContentHelper.
 XPCOMUtils.defineLazyGetter(this, "gMessageManager", function() {
   return {
     QueryInterface: XPCOMUtils.generateQI([Ci.nsIMessageListener,
                                            Ci.nsIObserver]),
 
     ril: null,
 
     // Manage message targets in terms of topic. Only the authorized and
@@ -1422,29 +1424,29 @@ function RadioInterfaceLayer() {
   this.radioInterfaces = [];
   for (let clientId = 0; clientId < numIfaces; clientId++) {
     this.radioInterfaces.push(new RadioInterface(clientId, workerMessenger));
   }
 
   Services.obs.addObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, false);
   Services.prefs.addObserver(kPrefRilDebuggingEnabled, this, false);
 
-  gMessageManager.init(this);
+  gMessageManager.init(this); // TODO: Bug 815526, deprecate RILContentHelper.
   gRadioEnabledController.init(this);
   gDataConnectionManager.init(this);
 }
 RadioInterfaceLayer.prototype = {
 
   classID:   RADIOINTERFACELAYER_CID,
   classInfo: XPCOMUtils.generateCI({classID: RADIOINTERFACELAYER_CID,
                                     classDescription: "RadioInterfaceLayer",
                                     interfaces: [Ci.nsIRadioInterfaceLayer]}),
 
   QueryInterface: XPCOMUtils.generateQI([Ci.nsIRadioInterfaceLayer,
-                                         Ci.nsIRadioInterfaceLayer_new,
+                                         Ci.nsIRadioInterfaceLayer_new, // TODO: Bug 815526, deprecate RILContentHelper.
                                          Ci.nsIObserver]),
 
   /**
    * nsIObserver interface methods.
    */
 
   observe: function(subject, topic, data) {
     switch (topic) {
@@ -1676,16 +1678,17 @@ WorkerMessenger.prototype = {
     }).bind(this));
   }
 };
 
 function RadioInterface(aClientId, aWorkerMessenger) {
   this.clientId = aClientId;
   this.workerMessenger = {
     send: aWorkerMessenger.send.bind(aWorkerMessenger, aClientId),
+    // TODO: Bug 815526, deprecate RILContentHelper.
     sendWithIPCMessage:
       aWorkerMessenger.sendWithIPCMessage.bind(aWorkerMessenger, aClientId),
   };
   aWorkerMessenger.registerClient(aClientId, this);
 
   this.rilContext = {
     cardState:      Ci.nsIIcc.CARD_STATE_UNKNOWN,
     iccInfo:        null,
@@ -1786,16 +1789,18 @@ RadioInterface.prototype = {
   isCardPresent: function() {
     let cardState = this.rilContext.cardState;
     return cardState !== Ci.nsIIcc.CARD_STATE_UNDETECTED &&
       cardState !== Ci.nsIIcc.CARD_STATE_UNKNOWN;
   },
 
   /**
    * Process a message from the content process.
+   *
+   * TODO: Bug 815526, deprecate RILContentHelper
    */
   receiveMessage: function(msg) {
     switch (msg.name) {
       case "RIL:GetRilContext":
         // This message is sync.
         return this.rilContext;
       case "RIL:GetCardLockEnabled":
         this.workerMessenger.sendWithIPCMessage(msg, "iccGetCardLockEnabled",
@@ -1918,16 +1923,17 @@ RadioInterface.prototype = {
         gRadioEnabledController.notifyRadioStateChanged(this.clientId,
                                                         message.radioState);
         break;
       case "cardstatechange":
         this.rilContext.cardState = message.cardState;
         gRadioEnabledController.receiveCardState(this.clientId);
         gIccService.notifyCardStateChanged(this.clientId,
                                            this.rilContext.cardState);
+        // TODO: Bug 815526, deprecate RILContentHelper.
         gMessageManager.sendIccMessage("RIL:CardStateChanged",
                                        this.clientId, message);
         break;
       case "sms-received":
         this.handleSmsReceived(message);
         break;
       case "cellbroadcast-received":
         this.handleCellbroadcastMessageReceived(message);
@@ -1947,31 +1953,33 @@ RadioInterface.prototype = {
         break;
       case "iccmwis":
         this.handleIccMwis(message.mwi);
         break;
       case "stkcommand":
         this.handleStkProactiveCommand(message);
         break;
       case "stksessionend":
+        // TODO: Bug 815526, deprecate RILContentHelper.
         gMessageManager.sendIccMessage("RIL:StkSessionEnd", this.clientId, null);
         break;
       case "cdma-info-rec-received":
         this.handleCdmaInformationRecords(message.records);
         break;
       default:
         throw new Error("Don't know about this message type: " +
                         message.rilMessageType);
     }
   },
 
   // Matches the mvnoData pattern with imsi. Characters 'x' and 'X' are skipped
   // and not compared. E.g., if the mvnoData passed is '310260x10xxxxxx',
   // then the function returns true only if imsi has the same first 6 digits,
   // 8th and 9th digit.
+  // TODO: Bug 815526, deprecate RILContentHelper.
   isImsiMatches: function(mvnoData) {
     let imsi = this.rilContext.imsi;
 
     // This should not be an error, but a mismatch.
     if (mvnoData.length > imsi.length) {
       return false;
     }
 
@@ -1979,16 +1987,17 @@ RadioInterface.prototype = {
       let c = mvnoData[i];
       if ((c !== 'x') && (c !== 'X') && (c !== imsi[i])) {
         return false;
       }
     }
     return true;
   },
 
+  // TODO: Bug 815526, deprecate RILContentHelper.
   matchMvno: function(target, message) {
     if (DEBUG) this.debug("matchMvno: " + JSON.stringify(message));
 
     if (!message || !message.mvnoData) {
       message.errorMsg = RIL.GECKO_ERROR_INVALID_PARAMETER;
     }
 
     if (!message.errorMsg) {
@@ -2216,16 +2225,18 @@ RadioInterface.prototype = {
     // Note: returnNumber and returnMessage is not available from UICC.
     service.notifyStatusChanged(this.clientId, mwi.active, mwi.msgCount,
                                 null, null);
   },
 
   handleIccInfoChange: function(message) {
     let oldSpn = this.rilContext.iccInfo ? this.rilContext.iccInfo.spn : null;
 
+    // TODO: Bug 815526, deprecate RILContentHelper:
+    //       Move the logic of updating iccInfo to IccService.js.
     if (!message || !message.iccid) {
       // If iccInfo is already `null`, don't have to clear it and send
       // RIL:IccInfoChanged.
       if (!this.rilContext.iccInfo) {
         return;
       }
 
       // Card is not detected, clear iccInfo to null.
@@ -2245,16 +2256,17 @@ RadioInterface.prototype = {
         return;
       }
 
       this.updateInfo(message, this.rilContext.iccInfo);
     }
 
     // RIL:IccInfoChanged corresponds to a DOM event that gets fired only
     // when iccInfo has changed.
+    // TODO: Bug 815526, deprecate RILContentHelper.
     gMessageManager.sendIccMessage("RIL:IccInfoChanged",
                                    this.clientId,
                                    message.iccid ? message : null);
     gIccService.notifyIccInfoChanged(this.clientId, this.rilContext.iccInfo);
 
     // Update lastKnownHomeNetwork.
     if (message.mcc && message.mnc) {
       let lastKnownHomeNetwork = message.mcc + "-" + message.mnc;
@@ -2276,16 +2288,17 @@ RadioInterface.prototype = {
   handleStkProactiveCommand: function(message) {
     if (DEBUG) this.debug("handleStkProactiveCommand " + JSON.stringify(message));
     let iccId = this.rilContext.iccInfo && this.rilContext.iccInfo.iccid;
     if (iccId) {
       gIccMessenger
         .notifyStkProactiveCommand(iccId,
                                    gStkCmdFactory.createCommand(message));
     }
+    // TODO: Bug 815526, deprecate RILContentHelper.
     gMessageManager.sendIccMessage("RIL:StkCommand", this.clientId, message);
   },
 
   _convertCbGsmGeographicalScope: function(aGeographicalScope) {
     return (aGeographicalScope != null)
       ? aGeographicalScope
       : Ci.nsICellBroadcastService.GSM_GEOGRAPHICAL_SCOPE_INVALID;
   },
--- a/dom/system/gonk/moz.build
+++ b/dom/system/gonk/moz.build
@@ -84,18 +84,18 @@ EXTRA_JS_MODULES += [
     'systemlibs.js',
 ]
 
 if CONFIG['MOZ_B2G_RIL']:
     XPIDL_SOURCES += [
         'nsIRadioInterfaceLayer.idl',
     ]
     EXTRA_COMPONENTS += [
-        'RILContentHelper.js',
-        'RILContentHelper.manifest',
+        'RILContentHelper.js', # TODO: Bug 815526, deprecate RILContentHelper.
+        'RILContentHelper.manifest', # TODO: Bug 815526, deprecate RILContentHelper.
         'RILSystemMessengerHelper.js',
         'RILSystemMessengerHelper.manifest',
     ]
     EXTRA_JS_MODULES += [
         'ril_consts.js',
         'ril_worker.js',
         'ril_worker_buf_object.js',
         'RILSystemMessenger.jsm',
--- a/dom/system/gonk/tests/marionette/test_ril_code_quality.py
+++ b/dom/system/gonk/tests/marionette/test_ril_code_quality.py
@@ -1,13 +1,13 @@
 """
 The test performs the static code analysis check by JSHint.
 
 Target js files:
-- RILContentHelper.js
+- RILContentHelper.js TODO: Bug 815526, deprecate RILContentHelper.
 - RadioInterfaceLayer.js
 - ril_worker.js
 - ril_consts.js
 
 If the js file contains the line of 'importScript()' (Ex: ril_worker.js), the
 test will perform a special merge step before excuting JSHint.
 
 Ex: Script A
@@ -95,17 +95,17 @@ class StringUtility:
 
 
 class ResourceUriFileReader:
 
     """Handle the process of reading the source code from system."""
 
     URI_PREFIX = 'resource://gre/'
     URI_PATH = {
-        'RILContentHelper.js':    'components/RILContentHelper.js',
+        'RILContentHelper.js':    'components/RILContentHelper.js', #TODO: Bug 815526, deprecate RILContentHelper.
         'RadioInterfaceLayer.js': 'components/RadioInterfaceLayer.js',
         'ril_worker.js':          'modules/ril_worker.js',
         'ril_consts.js':          'modules/ril_consts.js',
         'systemlibs.js':          'modules/systemlibs.js',
         'worker_buf.js':          'modules/workers/worker_buf.js',
     }
 
     CODE_OPEN_CHANNEL_BY_URI = '''
@@ -349,16 +349,17 @@ class TestRILCodeQuality(MarionetteTestC
             JSHintEngine(self.marionette,
                          self._read_local_file(self.JSHINT_PATH),
                          self._read_local_file(self.JSHINTRC_PATH)),
             self._get_extended_error_message)
 
     def tearDown(self):
         MarionetteTestCase.tearDown(self)
 
+    # TODO: Bug 815526, deprecate RILContentHelper.
     def test_RILContentHelper(self):
         self._check('RILContentHelper.js')
 
     def test_RadioInterfaceLayer(self):
         self._check('RadioInterfaceLayer.js')
 
     # Bug 936504. Disable the test for 'ril_worker.js'. It sometimes runs very
     # slow and causes the timeout fail on try server.