Backed out changeset a8ee7948d5cf (bug 920551)
authorEd Morley <emorley@mozilla.com>
Fri, 25 Oct 2013 10:52:20 +0100
changeset 166000 ab8db0fa3da7d0931794932c0c9153e45bf6908c
parent 165999 5bebff43ffbdc595d0ef5d93053c6c0e8e58a7c2
child 166001 e10a51bf91083d17b08b387ddee33ddeb4698d40
push id3066
push userakeybl@mozilla.com
push dateMon, 09 Dec 2013 19:58:46 +0000
treeherdermozilla-beta@a31a0dce83aa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs920551
milestone27.0a1
backs outa8ee7948d5cf3f83b37f123e3220112c3ec56881
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 a8ee7948d5cf (bug 920551)
b2g/app/b2g.js
b2g/chrome/content/shell.js
b2g/installer/package-manifest.in
content/events/src/Makefile.in
dom/dom-config.mk
dom/moz.build
dom/network/interfaces/moz.build
dom/network/src/moz.build
dom/network/tests/Makefile.in
dom/system/gonk/NetworkManager.js
dom/system/gonk/SystemWorkerManager.cpp
dom/system/gonk/SystemWorkerManager.h
dom/system/gonk/moz.build
dom/system/moz.build
dom/webidl/moz.build
ipc/moz.build
ipc/ril/Ril.cpp
ipc/ril/Ril.h
js/xpconnect/src/event_impl_gen.conf.in
layout/build/Makefile.in
layout/build/nsLayoutModule.cpp
toolkit/library/Makefile.in
--- a/b2g/app/b2g.js
+++ b/b2g/app/b2g.js
@@ -425,17 +425,17 @@ pref("services.push.retryBaseInterval", 
 // is considered closed.
 pref("services.push.pingInterval", 1800000); // 30 minutes
 // How long before a DOMRequest errors as timeout
 pref("services.push.requestTimeout", 10000);
 // enable udp wakeup support
 pref("services.push.udp.wakeupEnabled", true);
 
 // NetworkStats
-#ifdef MOZ_WIDGET_GONK
+#ifdef MOZ_B2G_RIL
 pref("dom.mozNetworkStats.enabled", true);
 pref("dom.webapps.firstRunWithSIM", true);
 #endif
 
 // WebSettings
 pref("dom.mozSettings.enabled", true);
 pref("dom.navigator-property.disable.mozSettings", false);
 pref("dom.mozPermissionSettings.enabled", true);
--- a/b2g/chrome/content/shell.js
+++ b/b2g/chrome/content/shell.js
@@ -13,17 +13,17 @@ Cu.import('resource://gre/modules/Permis
 Cu.import('resource://gre/modules/ObjectWrapper.jsm');
 Cu.import('resource://gre/modules/NotificationDB.jsm');
 Cu.import('resource://gre/modules/accessibility/AccessFu.jsm');
 Cu.import('resource://gre/modules/Payment.jsm');
 Cu.import("resource://gre/modules/AppsUtils.jsm");
 Cu.import('resource://gre/modules/UserAgentOverrides.jsm');
 Cu.import('resource://gre/modules/Keyboard.jsm');
 Cu.import('resource://gre/modules/ErrorPage.jsm');
-#ifdef MOZ_WIDGET_GONK
+#ifdef MOZ_B2G_RIL
 Cu.import('resource://gre/modules/NetworkStatsService.jsm');
 #endif
 
 // identity
 Cu.import('resource://gre/modules/SignInToWebsite.jsm');
 SignInToWebsiteController.init();
 
 XPCOMUtils.defineLazyServiceGetter(Services, 'env',
@@ -606,17 +606,17 @@ var shell = {
 
     this.reportCrash(true);
 
     Cu.import('resource://gre/modules/Webapps.jsm');
     DOMApplicationRegistry.allAppsLaunchable = true;
 
     this.sendEvent(window, 'ContentStart');
 
-#ifdef MOZ_WIDGET_GONK
+#ifdef MOZ_B2G_RIL
     Cu.import('resource://gre/modules/OperatorApps.jsm');
 #endif
 
     content.addEventListener('load', function shell_homeLoaded() {
       content.removeEventListener('load', shell_homeLoaded);
       shell.isHomeLoaded = true;
 
 #ifdef MOZ_WIDGET_GONK
--- a/b2g/installer/package-manifest.in
+++ b/b2g/installer/package-manifest.in
@@ -159,22 +159,20 @@
 @BINPATH@/components/diskspacewatcher.xpt
 @BINPATH@/components/docshell.xpt
 @BINPATH@/components/dom.xpt
 @BINPATH@/components/dom_activities.xpt
 @BINPATH@/components/dom_apps.xpt
 @BINPATH@/components/dom_audiochannel.xpt
 @BINPATH@/components/dom_base.xpt
 @BINPATH@/components/dom_system.xpt
-#ifdef MOZ_WIDGET_GONK
+#ifdef MOZ_B2G_RIL
+@BINPATH@/components/dom_voicemail.xpt
 @BINPATH@/components/dom_wifi.xpt
 @BINPATH@/components/dom_system_gonk.xpt
-#endif
-#ifdef MOZ_B2G_RIL
-@BINPATH@/components/dom_voicemail.xpt
 @BINPATH@/components/dom_icc.xpt
 @BINPATH@/components/dom_cellbroadcast.xpt
 @BINPATH@/components/dom_wappush.xpt
 #endif
 #ifdef MOZ_B2G_BT
 @BINPATH@/components/dom_bluetooth.xpt
 #endif
 @BINPATH@/components/dom_camera.xpt
@@ -397,41 +395,21 @@
 @BINPATH@/components/jsconsole-clhandler.js
 @BINPATH@/components/nsHelperAppDlg.manifest
 @BINPATH@/components/nsHelperAppDlg.js
 @BINPATH@/components/nsDownloadManagerUI.manifest
 @BINPATH@/components/nsDownloadManagerUI.js
 @BINPATH@/components/nsSidebar.manifest
 @BINPATH@/components/nsSidebar.js
 
-; WiFi, NetworkManager, NetworkStats
-#ifdef MOZ_WIDGET_GONK
-@BINPATH@/components/DOMWifiManager.js
-@BINPATH@/components/DOMWifiManager.manifest
-@BINPATH@/components/NetworkInterfaceListService.js
-@BINPATH@/components/NetworkInterfaceListService.manifest
-@BINPATH@/components/NetworkManager.js
-@BINPATH@/components/NetworkManager.manifest
-@BINPATH@/components/NetworkStatsManager.js
-@BINPATH@/components/NetworkStatsManager.manifest
-@BINPATH@/components/NetworkStatsServiceProxy.js
-@BINPATH@/components/NetworkStatsServiceProxy.manifest
-@BINPATH@/components/WifiWorker.js
-@BINPATH@/components/WifiWorker.manifest
-#endif // MOZ_WIDGET_GONK
-
-; RIL
 #if defined(MOZ_WIDGET_GONK) && defined(MOZ_B2G_RIL)
 @BINPATH@/components/MmsService.js
 @BINPATH@/components/MmsService.manifest
 @BINPATH@/components/MobileMessageDatabaseService.js
 @BINPATH@/components/MobileMessageDatabaseService.manifest
-@BINPATH@/components/RadioInterfaceLayer.js
-@BINPATH@/components/RadioInterfaceLayer.manifest
-@BINPATH@/components/RILContentHelper.js
 @BINPATH@/components/TelephonyProvider.js
 @BINPATH@/components/TelephonyProvider.manifest
 #endif // MOZ_WIDGET_GONK && MOZ_B2G_RIL
 
 #ifndef MOZ_WIDGET_GONK
 @BINPATH@/components/extensions.manifest
 @BINPATH@/components/addonManager.js
 @BINPATH@/components/amContentHandler.js
@@ -491,16 +469,33 @@
 @BINPATH@/components/messageWakeupService.manifest
 @BINPATH@/components/SettingsManager.js
 @BINPATH@/components/SettingsManager.manifest
 @BINPATH@/components/SettingsService.js
 @BINPATH@/components/SettingsService.manifest
 @BINPATH@/components/webvtt.xpt
 @BINPATH@/components/WebVTT.manifest
 @BINPATH@/components/WebVTTParserWrapper.js
+#ifdef MOZ_B2G_RIL
+@BINPATH@/components/NetworkManager.manifest
+@BINPATH@/components/NetworkManager.js
+@BINPATH@/components/RadioInterfaceLayer.manifest
+@BINPATH@/components/RadioInterfaceLayer.js
+@BINPATH@/components/RILContentHelper.js
+@BINPATH@/components/WifiWorker.js
+@BINPATH@/components/WifiWorker.manifest
+@BINPATH@/components/DOMWifiManager.js
+@BINPATH@/components/DOMWifiManager.manifest
+@BINPATH@/components/NetworkStatsManager.js
+@BINPATH@/components/NetworkStatsManager.manifest
+@BINPATH@/components/NetworkInterfaceListService.manifest
+@BINPATH@/components/NetworkInterfaceListService.js
+@BINPATH@/components/NetworkStatsServiceProxy.manifest
+@BINPATH@/components/NetworkStatsServiceProxy.js
+#endif
 #ifdef MOZ_ENABLE_DBUS
 @BINPATH@/components/@DLL_PREFIX@dbusservice@DLL_SUFFIX@
 #endif
 @BINPATH@/components/nsINIProcessor.manifest
 @BINPATH@/components/nsINIProcessor.js
 @BINPATH@/components/nsPrompter.manifest
 @BINPATH@/components/nsPrompter.js
 #ifdef MOZ_SERVICES_SYNC
--- a/content/events/src/Makefile.in
+++ b/content/events/src/Makefile.in
@@ -14,17 +14,17 @@ LOCAL_INCLUDES	+= \
              -I$(srcdir)/../../../dom/base \
              -I$(srcdir)/../../../dom/settings \
              -I$(srcdir)/../../../dom/src/storage \
              -I$(srcdir)/../../../layout/generic \
              -I$(srcdir)/../../../layout/xul/base/src \
              -I$(srcdir)/../../../layout/xul/tree/ \
              $(NULL)
 
-ifeq (gonk,$(MOZ_WIDGET_TOOLKIT))
+ifdef MOZ_B2G_RIL
 LOCAL_INCLUDES += \
               -I$(srcdir)/../../../dom/wifi \
               $(NULL)
 endif
 
 ifdef MOZ_JSDEBUGGER
 DEFINES += -DMOZ_JSDEBUGGER
 endif
--- a/dom/dom-config.mk
+++ b/dom/dom-config.mk
@@ -32,17 +32,17 @@ DOM_SRCDIRS = \
   content/svg/content/src \
   layout/generic \
   layout/style \
   layout/xul/base/src \
   layout/xul/tree \
   dom/camera \
   $(NULL)
 
-ifeq (gonk,$(MOZ_WIDGET_TOOLKIT))
+ifdef MOZ_B2G_RIL
 DOM_SRCDIRS += \
   dom/system/gonk \
   dom/wifi \
   $(NULL)
 endif
 
 ifdef MOZ_B2G_FM
 DOM_SRCDIRS += \
--- a/dom/moz.build
+++ b/dom/moz.build
@@ -75,21 +75,19 @@ PARALLEL_DIRS += [
     'telephony',
     'inputmethod',
     'webidl',
 ]
 
 if CONFIG['OS_ARCH'] == 'WINNT':
     PARALLEL_DIRS += ['plugins/ipc/hangui']
 
-if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
-    PARALLEL_DIRS += ['wifi']
-
 if CONFIG['MOZ_B2G_RIL']:
     PARALLEL_DIRS += [
+        'wifi',
         'icc',
         'cellbroadcast',
         'voicemail',
         'wappush',
     ]
 
 if CONFIG['MOZ_PAY']:
     PARALLEL_DIRS += ['payment']
--- a/dom/network/interfaces/moz.build
+++ b/dom/network/interfaces/moz.build
@@ -17,20 +17,16 @@ XPIDL_SOURCES += [
 
 if CONFIG['MOZ_B2G_RIL']:
     XPIDL_SOURCES += [
         'nsIDOMCFStateChangeEvent.idl',
         'nsIDOMDataErrorEvent.idl',
         'nsIDOMMobileConnection.idl',
         'nsIDOMMozEmergencyCbModeEvent.idl',
         'nsIDOMMozOtaStatusEvent.idl',
+        'nsIDOMNetworkStats.idl',
+        'nsIDOMNetworkStatsManager.idl',
         'nsIDOMUSSDReceivedEvent.idl',
         'nsIMobileConnectionProvider.idl',
-    ]
-
-if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
-    XPIDL_SOURCES += [
-        'nsIDOMNetworkStats.idl',
-        'nsIDOMNetworkStatsManager.idl',
         'nsINetworkStatsServiceProxy.idl',
     ]
 
 XPIDL_MODULE = 'dom_network'
--- a/dom/network/src/moz.build
+++ b/dom/network/src/moz.build
@@ -23,34 +23,32 @@ CPP_SOURCES += [
 
 if CONFIG['MOZ_B2G_RIL']:
     EXPORTS.mozilla.dom.network += [
         'MobileConnection.h',
     ]
     CPP_SOURCES += [
         'MobileConnection.cpp',
     ]
-
-if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
     EXTRA_JS_MODULES = [
         'NetworkStatsDB.jsm',
         'NetworkStatsService.jsm',
     ]
 
 EXTRA_COMPONENTS += [
     'TCPServerSocket.js',
     'TCPSocket.manifest',
     'TCPSocketParentIntermediary.js',
 ]
 
 EXTRA_PP_COMPONENTS += [
     'TCPSocket.js',
 ]
 
-if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
+if CONFIG['MOZ_B2G_RIL']:
     EXTRA_COMPONENTS += [
         'NetworkStatsManager.js',
         'NetworkStatsManager.manifest',
         'NetworkStatsServiceProxy.js',
         'NetworkStatsServiceProxy.manifest',
     ]
 
 IPDL_SOURCES += [
--- a/dom/network/tests/Makefile.in
+++ b/dom/network/tests/Makefile.in
@@ -4,16 +4,16 @@
 
 MOCHITEST_FILES = \
   test_network_basics.html \
   test_tcpsocket_default_permissions.html \
   test_tcpsocket_enabled_no_perm.html \
   test_tcpsocket_enabled_with_perm.html \
   $(NULL)
 
-ifeq (gonk,$(MOZ_WIDGET_TOOLKIT))
+ifdef MOZ_B2G_RIL
 MOCHITEST_FILES = \
   test_networkstats_basics.html \
   test_networkstats_disabled.html \
   test_networkstats_enabled_no_perm.html \
   test_networkstats_enabled_perm.html \
   $(NULL)
 endif
--- a/dom/system/gonk/NetworkManager.js
+++ b/dom/system/gonk/NetworkManager.js
@@ -128,20 +128,18 @@ function defineLazyRegExp(obj, name, pat
 
 /**
  * This component watches for network interfaces changing state and then
  * adjusts routes etc. accordingly.
  */
 function NetworkManager() {
   this.networkInterfaces = {};
   Services.obs.addObserver(this, TOPIC_INTERFACE_STATE_CHANGED, true);
-#ifdef MOZ_B2G_RIL
   Services.obs.addObserver(this, TOPIC_INTERFACE_REGISTERED, true);
   Services.obs.addObserver(this, TOPIC_INTERFACE_UNREGISTERED, true);
-#endif
   Services.obs.addObserver(this, TOPIC_XPCOM_SHUTDOWN, false);
   Services.obs.addObserver(this, TOPIC_MOZSETTINGS_CHANGED, false);
 
   debug("Starting worker.");
   this.worker = new ChromeWorker("resource://gre/modules/net_worker.js");
   this.worker.onmessage = this.handleWorkerMessage.bind(this);
   this.worker.onerror = function onerror(event) {
     debug("Received error from worker: " + event.filename +
@@ -226,123 +224,105 @@ NetworkManager.prototype = {
 
   observe: function observe(subject, topic, data) {
     switch (topic) {
       case TOPIC_INTERFACE_STATE_CHANGED:
         let network = subject.QueryInterface(Ci.nsINetworkInterface);
         debug("Network " + network.name + " changed state to " + network.state);
         switch (network.state) {
           case Ci.nsINetworkInterface.NETWORK_STATE_CONNECTED:
-#ifdef MOZ_B2G_RIL
             // Add host route for data calls
             if (network.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE ||
                 network.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_MMS ||
                 network.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_SUPL) {
               this.removeHostRoutes(network.name);
               this.addHostRoute(network);
             }
             // Add extra host route. For example, mms proxy or mmsc.
             this.setExtraHostRoute(network);
-#endif
             // Remove pre-created default route and let setAndConfigureActive()
             // to set default route only on preferred network
             this.removeDefaultRoute(network.name);
             this.setAndConfigureActive();
-#ifdef MOZ_B2G_RIL
             // Update data connection when Wifi connected/disconnected
             if (network.type == Ci.nsINetworkInterface.NETWORK_TYPE_WIFI) {
               this.mRIL.getRadioInterface(0).updateRILNetworkInterface();
             }
-#endif
 
             this.onConnectionChanged(network);
 
             // Probing the public network accessibility after routing table is ready
             CaptivePortalDetectionHelper.notify(CaptivePortalDetectionHelper.EVENT_CONNECT, this.active);
             break;
           case Ci.nsINetworkInterface.NETWORK_STATE_DISCONNECTED:
-#ifdef MOZ_B2G_RIL
             // Remove host route for data calls
             if (network.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE ||
                 network.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_MMS ||
                 network.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_SUPL) {
               this.removeHostRoute(network);
             }
             // Remove extra host route. For example, mms proxy or mmsc.
             this.removeExtraHostRoute(network);
-#endif
             // Remove routing table in /proc/net/route
             if (network.type == Ci.nsINetworkInterface.NETWORK_TYPE_WIFI) {
               this.resetRoutingTable(network);
-#ifdef MOZ_B2G_RIL
             } else if (network.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE) {
               this.removeDefaultRoute(network.name);
-#endif
             }
             // Abort ongoing captive portal detection on the wifi interface
             CaptivePortalDetectionHelper.notify(CaptivePortalDetectionHelper.EVENT_DISCONNECT, network);
             this.setAndConfigureActive();
-#ifdef MOZ_B2G_RIL
             // Update data connection when Wifi connected/disconnected
             if (network.type == Ci.nsINetworkInterface.NETWORK_TYPE_WIFI) {
               this.mRIL.getRadioInterface(0).updateRILNetworkInterface();
             }
-#endif
             break;
         }
         break;
-#ifdef MOZ_B2G_RIL
       case TOPIC_INTERFACE_REGISTERED:
         let regNetwork = subject.QueryInterface(Ci.nsINetworkInterface);
         // Add extra host route. For example, mms proxy or mmsc.
         this.setExtraHostRoute(regNetwork);
         break;
       case TOPIC_INTERFACE_UNREGISTERED:
         let unregNetwork = subject.QueryInterface(Ci.nsINetworkInterface);
         // Remove extra host route. For example, mms proxy or mmsc.
         this.removeExtraHostRoute(unregNetwork);
         break;
-#endif
       case TOPIC_MOZSETTINGS_CHANGED:
         let setting = JSON.parse(data);
         this.handle(setting.key, setting.value);
         break;
       case TOPIC_PREF_CHANGED:
         this._manageOfflineStatus =
           Services.prefs.getBoolPref(PREF_MANAGE_OFFLINE_STATUS);
         debug(PREF_MANAGE_OFFLINE_STATUS + " has changed to " + this._manageOfflineStatus);
         break;
       case TOPIC_XPCOM_SHUTDOWN:
         Services.obs.removeObserver(this, TOPIC_XPCOM_SHUTDOWN);
         Services.obs.removeObserver(this, TOPIC_MOZSETTINGS_CHANGED);
-#ifdef MOZ_B2G_RIL
         Services.obs.removeObserver(this, TOPIC_INTERFACE_REGISTERED);
         Services.obs.removeObserver(this, TOPIC_INTERFACE_UNREGISTERED);
-#endif
         Services.obs.removeObserver(this, TOPIC_INTERFACE_STATE_CHANGED);
         break;
     }
   },
 
   receiveMessage: function receiveMessage(aMsg) {
     switch (aMsg.name) {
       case "NetworkInterfaceList:ListInterface": {
-#ifdef MOZ_B2G_RIL
         let excludeMms = aMsg.json.exculdeMms;
         let excludeSupl = aMsg.json.exculdeSupl;
-#endif
         let interfaces = [];
 
         for each (let i in this.networkInterfaces) {
-#ifdef MOZ_B2G_RIL
           if ((i.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_MMS && excludeMms) ||
               (i.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_SUPL && excludeSupl)) {
             continue;
           }
-#endif
           interfaces.push({
             state: i.state,
             type: i.type,
             name: i.name,
             ip: i.ip,
             netmask: i.netmask,
             broadcast: i.broadcast,
             gateway: i.gateway,
@@ -364,24 +344,22 @@ NetworkManager.prototype = {
       throw Components.Exception("Argument must be nsINetworkInterface.",
                                  Cr.NS_ERROR_INVALID_ARG);
     }
     if (network.name in this.networkInterfaces) {
       throw Components.Exception("Network with that name already registered!",
                                  Cr.NS_ERROR_INVALID_ARG);
     }
     this.networkInterfaces[network.name] = network;
-#ifdef MOZ_B2G_RIL
     // Add host route for data calls
     if (network.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE ||
         network.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_MMS ||
         network.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_SUPL) {
       this.addHostRoute(network);
     }
-#endif
     // Remove pre-created default route and let setAndConfigureActive()
     // to set default route only on preferred network
     this.removeDefaultRoute(network.name);
     this.setAndConfigureActive();
     Services.obs.notifyObservers(network, TOPIC_INTERFACE_REGISTERED, null);
     debug("Network '" + network.name + "' registered.");
   },
 
@@ -390,62 +368,54 @@ NetworkManager.prototype = {
       throw Components.Exception("Argument must be nsINetworkInterface.",
                                  Cr.NS_ERROR_INVALID_ARG);
     }
     if (!(network.name in this.networkInterfaces)) {
       throw Components.Exception("No network with that name registered.",
                                  Cr.NS_ERROR_INVALID_ARG);
     }
     delete this.networkInterfaces[network.name];
-#ifdef MOZ_B2G_RIL
     // Remove host route for data calls
     if (network.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE ||
         network.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_MMS ||
         network.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_SUPL) {
       this.removeHostRoute(network);
     }
-#endif
     this.setAndConfigureActive();
     Services.obs.notifyObservers(network, TOPIC_INTERFACE_UNREGISTERED, null);
     debug("Network '" + network.name + "' unregistered.");
   },
 
   _manageOfflineStatus: true,
 
   networkInterfaces: null,
 
   _preferredNetworkType: DEFAULT_PREFERRED_NETWORK_TYPE,
   get preferredNetworkType() {
     return this._preferredNetworkType;
   },
   set preferredNetworkType(val) {
-#ifdef MOZ_B2G_RIL
     if ([Ci.nsINetworkInterface.NETWORK_TYPE_WIFI,
          Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE].indexOf(val) == -1) {
-#else
-    if (val != Ci.nsINetworkInterface.NETWORK_TYPE_WIFI) {
-#endif
       throw "Invalid network type";
     }
     this._preferredNetworkType = val;
   },
 
   active: null,
   _overriddenActive: null,
 
   // Clone network info so we can still get information when network is disconnected
   _activeInfo: null,
 
   overrideActive: function overrideActive(network) {
-#ifdef MOZ_B2G_RIL
     if (network.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_MMS ||
         network.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_SUPL) {
       throw "Invalid network type";
     }
-#endif
     this._overriddenActive = network;
     this.setAndConfigureActive();
   },
 
   getNetworkInterfaceStats: function getNetworkInterfaceStats(networkName, callback) {
     debug("getNetworkInterfaceStats for " + networkName);
 
     let params = {
@@ -507,17 +477,16 @@ NetworkManager.prototype = {
     }
     let callback = this.controlCallbacks[id];
     if (callback) {
       callback.call(this, response);
       delete this.controlCallbacks[id];
     }
   },
 
-#ifdef MOZ_B2G_RIL
   setExtraHostRoute: function setExtraHostRoute(network) {
     if (network.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_MMS) {
       debug("Network '" + network.name + "' registered, adding mmsproxy and/or mmsc route");
       let mmsHosts = this.resolveHostname(
                        [Services.prefs.getCharPref("ril.mms.mmsproxy"),
                         Services.prefs.getCharPref("ril.mms.mmsc")]);
       this.addHostRouteWithResolve(network, mmsHosts);
     }
@@ -527,24 +496,24 @@ NetworkManager.prototype = {
     if (network.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_MMS) {
       debug("Network '" + network.name + "' unregistered, removing mmsproxy and/or mmsc route");
       let mmsHosts = this.resolveHostname(
                        [Services.prefs.getCharPref("ril.mms.mmsproxy"),
                         Services.prefs.getCharPref("ril.mms.mmsc")]);
       this.removeHostRouteWithResolve(network, mmsHosts);
     }
   },
-#endif // MOZ_B2G_RIL
 
   /**
    * Determine the active interface and configure it.
    */
   setAndConfigureActive: function setAndConfigureActive() {
     debug("Evaluating whether active network needs to be changed.");
     let oldActive = this.active;
+    let defaultDataNetwork;
 
     if (this._overriddenActive) {
       debug("We have an override for the active network: " +
             this._overriddenActive.name);
       // The override was just set, so reconfigure the network.
       if (this.active != this._overriddenActive) {
         this.active = this._overriddenActive;
         this.setDefaultRouteAndDNS(oldActive);
@@ -560,56 +529,47 @@ NetworkManager.prototype = {
       debug("Active network is already our preferred type.");
       this.setDefaultRouteAndDNS(oldActive);
       return;
     }
 
     // Find a suitable network interface to activate.
     this.active = null;
     this._activeInfo = Object.create(null);
-#ifdef MOZ_B2G_RIL
-    let defaultDataNetwork;
-#endif
     for each (let network in this.networkInterfaces) {
       if (network.state != Ci.nsINetworkInterface.NETWORK_STATE_CONNECTED) {
         continue;
       }
-#ifdef MOZ_B2G_RIL
       if (network.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE) {
         defaultDataNetwork = network;
       }
-#endif
       this.active = network;
       this._activeInfo = {name:network.name, ip:network.ip, netmask:network.netmask};
       if (network.type == this.preferredNetworkType) {
         debug("Found our preferred type of network: " + network.name);
         break;
       }
     }
     if (this.active) {
-#ifdef MOZ_B2G_RIL
       // Give higher priority to default data APN than seconary APN.
       // If default data APN is not connected, we still set default route
       // and DNS on seconary APN.
       if (defaultDataNetwork &&
           (this.active.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_MMS ||
            this.active.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_SUPL) &&
           this.active.type != this.preferredNetworkType) {
         this.active = defaultDataNetwork;
       }
       // Don't set default route on secondary APN
       if (this.active.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_MMS ||
           this.active.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_SUPL) {
         this.setDNS(this.active);
       } else {
-#endif // MOZ_B2G_RIL
         this.setDefaultRouteAndDNS(oldActive);
-#ifdef MOZ_B2G_RIL
       }
-#endif
       if (this.active != oldActive) {
         Services.obs.notifyObservers(this.active, TOPIC_ACTIVE_CHANGED, null);
       }
     }
 
     if (this._manageOfflineStatus) {
       Services.io.offline = !this.active;
     }
@@ -624,28 +584,26 @@ NetworkManager.prototype = {
       cmd: "removeNetworkRoute",
       ifname: network.name,
       ip : network.ip,
       netmask: network.netmask,
     };
     this.worker.postMessage(options);
   },
 
-#ifdef MOZ_B2G_RIL
   setDNS: function setDNS(networkInterface) {
     debug("Going DNS to " + networkInterface.name);
     let options = {
       cmd: "setDNS",
       ifname: networkInterface.name,
       dns1_str: networkInterface.dns1,
       dns2_str: networkInterface.dns2
     };
     this.worker.postMessage(options);
   },
-#endif
 
   setDefaultRouteAndDNS: function setDefaultRouteAndDNS(oldInterface) {
     debug("Going to change route and DNS to " + this.active.name);
     let options = {
       cmd: "setDefaultRouteAndDNS",
       ifname: this.active.name,
       oldIfname: (oldInterface && oldInterface != this.active) ? oldInterface.name : null,
       gateway_str: this.active.gateway,
@@ -660,17 +618,16 @@ NetworkManager.prototype = {
     debug("Remove default route for " + ifname);
     let options = {
       cmd: "removeDefaultRoute",
       ifname: ifname
     }
     this.worker.postMessage(options);
   },
 
-#ifdef MOZ_B2G_RIL
   addHostRoute: function addHostRoute(network) {
     debug("Going to add host route on " + network.name);
     let options = {
       cmd: "addHostRoute",
       ifname: network.name,
       gateway: network.gateway,
       hostnames: [network.dns1, network.dns2, network.httpProxyHost]
     };
@@ -740,17 +697,16 @@ NetworkManager.prototype = {
     let options = {
       cmd: "removeHostRoute",
       ifname: network.name,
       gateway: network.gateway,
       hostnames: hosts
     };
     this.worker.postMessage(options);
   },
-#endif // MOZ_B2G_RIL
 
   setNetworkProxy: function setNetworkProxy(network) {
     try {
       if (!network.httpProxyHost || network.httpProxyHost == "") {
         // Sets direct connection to internet.
         Services.prefs.clearUserPref("network.proxy.type");
         Services.prefs.clearUserPref("network.proxy.share_proxy_settings");
         Services.prefs.clearUserPref("network.proxy.http");
@@ -1259,21 +1215,19 @@ let CaptivePortalDetectionHelper = (func
             _abort(network.name);
           }
           break;
       }
     }
   };
 }());
 
-#ifdef MOZ_B2G_RIL
 XPCOMUtils.defineLazyServiceGetter(NetworkManager.prototype, "mRIL",
                                    "@mozilla.org/ril;1",
                                    "nsIRadioInterfaceLayer");
-#endif
 
 this.NSGetFactory = XPCOMUtils.generateNSGetFactory([NetworkManager]);
 
 
 let debug;
 if (DEBUG) {
   debug = function (s) {
     dump("-*- NetworkManager: " + s + "\n");
--- a/dom/system/gonk/SystemWorkerManager.cpp
+++ b/dom/system/gonk/SystemWorkerManager.cpp
@@ -19,50 +19,153 @@
 
 #include "nsINetworkManager.h"
 #include "nsIWifi.h"
 #include "nsIWorkerHolder.h"
 #include "nsIXPConnect.h"
 
 #include "jsfriendapi.h"
 #include "mozilla/dom/workers/Workers.h"
+#ifdef MOZ_WIDGET_GONK
 #include "mozilla/ipc/Netd.h"
 #include "AutoMounter.h"
 #include "TimeZoneSettingObserver.h"
 #include "AudioManager.h"
-#ifdef MOZ_B2G_RIL
+#endif
 #include "mozilla/ipc/Ril.h"
-#endif
 #include "mozilla/ipc/KeyStore.h"
 #include "nsIObserverService.h"
 #include "nsCxPusher.h"
 #include "nsServiceManagerUtils.h"
 #include "nsThreadUtils.h"
 #include "nsRadioInterfaceLayer.h"
 #include "WifiWorker.h"
 #include "mozilla/Services.h"
 
 USING_WORKERS_NAMESPACE
 
 using namespace mozilla::dom::gonk;
 using namespace mozilla::ipc;
+#ifdef MOZ_WIDGET_GONK
 using namespace mozilla::system;
+#endif
 
 #define NS_NETWORKMANAGER_CID \
   { 0x33901e46, 0x33b8, 0x11e1, \
   { 0x98, 0x69, 0xf4, 0x6d, 0x04, 0xd2, 0x5b, 0xcc } }
 
 namespace {
 
 NS_DEFINE_CID(kWifiWorkerCID, NS_WIFIWORKER_CID);
 NS_DEFINE_CID(kNetworkManagerCID, NS_NETWORKMANAGER_CID);
 
 // Doesn't carry a reference, we're owned by services.
 SystemWorkerManager *gInstance = nullptr;
 
+class ConnectWorkerToRIL : public WorkerTask
+{
+public:
+  ConnectWorkerToRIL()
+  { }
+
+  virtual bool RunTask(JSContext *aCx);
+};
+
+class SendRilSocketDataTask : public nsRunnable
+{
+public:
+  SendRilSocketDataTask(unsigned long aClientId,
+                        UnixSocketRawData *aRawData)
+    : mRawData(aRawData)
+    , mClientId(aClientId)
+  { }
+
+  NS_IMETHOD Run()
+  {
+    MOZ_ASSERT(NS_IsMainThread());
+    SystemWorkerManager::SendRilRawData(mClientId, mRawData);
+    return NS_OK;
+  }
+
+private:
+  UnixSocketRawData *mRawData;
+  unsigned long mClientId;
+};
+
+bool
+PostToRIL(JSContext *cx, unsigned argc, JS::Value *vp)
+{
+  NS_ASSERTION(!NS_IsMainThread(), "Expecting to be on the worker thread");
+
+  if (argc != 2) {
+    JS_ReportError(cx, "Expecting two arguments with the RIL message");
+    return false;
+  }
+
+  JS::Value cv = JS_ARGV(cx, vp)[0];
+  int clientId = cv.toInt32();
+
+  JS::Value v = JS_ARGV(cx, vp)[1];
+
+  JSAutoByteString abs;
+  void *data;
+  size_t size;
+  if (JSVAL_IS_STRING(v)) {
+    JSString *str = JSVAL_TO_STRING(v);
+    if (!abs.encodeUtf8(cx, str)) {
+      return false;
+    }
+
+    data = abs.ptr();
+    size = abs.length();
+  } else if (!JSVAL_IS_PRIMITIVE(v)) {
+    JSObject *obj = JSVAL_TO_OBJECT(v);
+    if (!JS_IsTypedArrayObject(obj)) {
+      JS_ReportError(cx, "Object passed in wasn't a typed array");
+      return false;
+    }
+
+    uint32_t type = JS_GetArrayBufferViewType(obj);
+    if (type != js::ArrayBufferView::TYPE_INT8 &&
+        type != js::ArrayBufferView::TYPE_UINT8 &&
+        type != js::ArrayBufferView::TYPE_UINT8_CLAMPED) {
+      JS_ReportError(cx, "Typed array data is not octets");
+      return false;
+    }
+
+    size = JS_GetTypedArrayByteLength(obj);
+    data = JS_GetArrayBufferViewData(obj);
+  } else {
+    JS_ReportError(cx,
+                   "Incorrect argument. Expecting a string or a typed array");
+    return false;
+  }
+
+  UnixSocketRawData* raw = new UnixSocketRawData(data, size);
+
+  nsRefPtr<SendRilSocketDataTask> task = new SendRilSocketDataTask(clientId, raw);
+  NS_DispatchToMainThread(task);
+  return true;
+}
+
+bool
+ConnectWorkerToRIL::RunTask(JSContext *aCx)
+{
+  // Set up the postRILMessage on the function for worker -> RIL thread
+  // communication.
+  NS_ASSERTION(!NS_IsMainThread(), "Expecting to be on the worker thread");
+  NS_ASSERTION(!JS_IsRunning(aCx), "Are we being called somehow?");
+  JSObject *workerGlobal = JS::CurrentGlobalOrNull(aCx);
+
+  return !!JS_DefineFunction(aCx, workerGlobal, "postRILMessage", PostToRIL, 1,
+                             0);
+}
+
+#ifdef MOZ_WIDGET_GONK
+
 bool
 DoNetdCommand(JSContext *cx, unsigned argc, JS::Value *vp)
 {
   NS_ASSERTION(!NS_IsMainThread(), "Expecting to be on the worker thread");
 
   if (argc != 1) {
     JS_ReportError(cx, "Expecting a single argument with the Netd message");
     return false;
@@ -198,16 +301,18 @@ NetdReceiver::DispatchNetdEvent::RunTask
   }
 
   memcpy(JS_GetUint8ArrayData(array), mMessage->mData, mMessage->mSize);
   JS::Value argv[] = { OBJECT_TO_JSVAL(array) };
   return JS_CallFunctionName(aCx, obj, "onNetdMessage", NS_ARRAY_LENGTH(argv),
                              argv, argv);
 }
 
+#endif // MOZ_WIDGET_GONK
+
 } // anonymous namespace
 
 SystemWorkerManager::SystemWorkerManager()
   : mShutdown(false)
 {
   NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
   NS_ASSERTION(!gInstance, "There should only be one instance!");
 }
@@ -235,22 +340,24 @@ SystemWorkerManager::Init()
   nsresult rv = InitWifi(cx);
   if (NS_FAILED(rv)) {
     NS_WARNING("Failed to initialize WiFi Networking!");
     return rv;
   }
 
   InitKeyStore(cx);
 
+#ifdef MOZ_WIDGET_GONK
   InitAutoMounter();
   InitializeTimeZoneSettingObserver();
   rv = InitNetd(cx);
   NS_ENSURE_SUCCESS(rv, rv);
   nsCOMPtr<nsIAudioManager> audioManager =
     do_GetService(NS_AUDIOMANAGER_CONTRACTID);
+#endif
 
   nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
   if (!obs) {
     NS_WARNING("Failed to get observer service!");
     return NS_ERROR_FAILURE;
   }
 
   rv = obs->AddObserver(this, WORKERS_SHUTDOWN_TOPIC, false);
@@ -264,24 +371,31 @@ SystemWorkerManager::Init()
 
 void
 SystemWorkerManager::Shutdown()
 {
   NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
 
   mShutdown = true;
 
+#ifdef MOZ_WIDGET_GONK
   ShutdownAutoMounter();
-
-#ifdef MOZ_B2G_RIL
-  RilConsumer::Shutdown();
 #endif
 
+  for (unsigned long i = 0; i < mRilConsumers.Length(); i++) {
+    if (mRilConsumers[i]) {
+      mRilConsumers[i]->Shutdown();
+      mRilConsumers[i] = nullptr;
+    }
+  }
+
+#ifdef MOZ_WIDGET_GONK
   StopNetd();
   mNetdWorker = nullptr;
+#endif
 
   nsCOMPtr<nsIWifi> wifi(do_QueryInterface(mWifiWorker));
   if (wifi) {
     wifi->Shutdown();
     wifi = nullptr;
   }
   mWifiWorker = nullptr;
 
@@ -314,58 +428,86 @@ SystemWorkerManager::FactoryCreate()
 
 // static
 nsIInterfaceRequestor*
 SystemWorkerManager::GetInterfaceRequestor()
 {
   return gInstance;
 }
 
+bool
+SystemWorkerManager::SendRilRawData(unsigned long aClientId,
+                                    UnixSocketRawData* aRaw)
+{
+  if ((gInstance->mRilConsumers.Length() <= aClientId) ||
+      !gInstance->mRilConsumers[aClientId] ||
+      gInstance->mRilConsumers[aClientId]->GetConnectionStatus() != SOCKET_CONNECTED) {
+    // Probably shuting down.
+    delete aRaw;
+    return true;
+  }
+  return gInstance->mRilConsumers[aClientId]->SendSocketData(aRaw);
+}
+
 NS_IMETHODIMP
 SystemWorkerManager::GetInterface(const nsIID &aIID, void **aResult)
 {
   NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
 
   if (aIID.Equals(NS_GET_IID(nsIWifi))) {
     return CallQueryInterface(mWifiWorker,
                               reinterpret_cast<nsIWifi**>(aResult));
   }
 
+#ifdef MOZ_WIDGET_GONK
   if (aIID.Equals(NS_GET_IID(nsINetworkManager))) {
     return CallQueryInterface(mNetdWorker,
                               reinterpret_cast<nsINetworkManager**>(aResult));
   }
+#endif
 
   NS_WARNING("Got nothing for the requested IID!");
   return NS_ERROR_NO_INTERFACE;
 }
 
 nsresult
 SystemWorkerManager::RegisterRilWorker(unsigned int aClientId,
                                        const JS::Value& aWorker,
                                        JSContext *aCx)
 {
-#ifndef MOZ_B2G_RIL
-  return NS_ERROR_NOT_IMPLEMENTED;
-#else
   NS_ENSURE_TRUE(!JSVAL_IS_PRIMITIVE(aWorker), NS_ERROR_UNEXPECTED);
 
+  mRilConsumers.EnsureLengthAtLeast(aClientId + 1);
+
+  if (mRilConsumers[aClientId]) {
+    NS_WARNING("RilConsumer already registered");
+    return NS_ERROR_FAILURE;
+  }
+
   JSAutoCompartment ac(aCx, JSVAL_TO_OBJECT(aWorker));
 
   WorkerCrossThreadDispatcher *wctd =
     GetWorkerCrossThreadDispatcher(aCx, aWorker);
   if (!wctd) {
     NS_WARNING("Failed to GetWorkerCrossThreadDispatcher for ril");
     return NS_ERROR_FAILURE;
   }
 
-  return RilConsumer::Register(aClientId, wctd);
-#endif // MOZ_B2G_RIL
+  nsRefPtr<ConnectWorkerToRIL> connection = new ConnectWorkerToRIL();
+  if (!wctd->PostTask(connection)) {
+    NS_WARNING("Failed to connect worker to ril");
+    return NS_ERROR_UNEXPECTED;
+  }
+
+  // Now that we're set up, connect ourselves to the RIL thread.
+  mRilConsumers[aClientId] = new RilConsumer(aClientId, wctd);
+  return NS_OK;
 }
 
+#ifdef MOZ_WIDGET_GONK
 nsresult
 SystemWorkerManager::InitNetd(JSContext *cx)
 {
   nsCOMPtr<nsIWorkerHolder> worker = do_GetService(kNetworkManagerCID);
   NS_ENSURE_TRUE(worker, NS_ERROR_FAILURE);
 
   JS::Value workerval;
   nsresult rv = worker->GetWorker(&workerval);
@@ -388,16 +530,17 @@ SystemWorkerManager::InitNetd(JSContext 
   }
 
   // Now that we're set up, connect ourselves to the Netd process.
   mozilla::RefPtr<NetdReceiver> receiver = new NetdReceiver(wctd);
   StartNetd(receiver);
   mNetdWorker = worker;
   return NS_OK;
 }
+#endif
 
 nsresult
 SystemWorkerManager::InitWifi(JSContext *cx)
 {
   nsCOMPtr<nsIWorkerHolder> worker = do_CreateInstance(kWifiWorkerCID);
   NS_ENSURE_TRUE(worker, NS_ERROR_FAILURE);
 
   mWifiWorker = worker;
--- a/dom/system/gonk/SystemWorkerManager.h
+++ b/dom/system/gonk/SystemWorkerManager.h
@@ -18,23 +18,28 @@
 #ifndef mozilla_dom_system_b2g_systemworkermanager_h__
 #define mozilla_dom_system_b2g_systemworkermanager_h__
 
 #include "nsIInterfaceRequestor.h"
 #include "nsISystemWorkerManager.h"
 #include "nsIObserver.h"
 #include "nsAutoPtr.h"
 #include "nsCOMPtr.h"
-#include "nsXULAppAPI.h" // For XRE_GetProcessType
+#include "nsDebug.h"
+#include "nsDOMEventTargetHelper.h"
+#include "nsString.h"
+#include "nsTArray.h"
 
 class nsIWorkerHolder;
 
 namespace mozilla {
 
 namespace ipc {
+  class RilConsumer;
+  class UnixSocketRawData;
   class KeyStore;
 }
 
 namespace dom {
 namespace gonk {
 
 class SystemWorkerManager : public nsIObserver,
                             public nsIInterfaceRequestor,
@@ -50,27 +55,35 @@ public:
   void Shutdown();
 
   static already_AddRefed<SystemWorkerManager>
   FactoryCreate();
 
   static nsIInterfaceRequestor*
   GetInterfaceRequestor();
 
+  static bool SendRilRawData(unsigned long aClientId,
+                             ipc::UnixSocketRawData* aRaw);
+
 private:
   SystemWorkerManager();
   ~SystemWorkerManager();
 
+#ifdef MOZ_WIDGET_GONK
   nsresult InitNetd(JSContext *cx);
+#endif
   nsresult InitWifi(JSContext *cx);
   nsresult InitKeyStore(JSContext *cx);
 
+#ifdef MOZ_WIDGET_GONK
   nsCOMPtr<nsIWorkerHolder> mNetdWorker;
+#endif
   nsCOMPtr<nsIWorkerHolder> mWifiWorker;
 
+  nsTArray<nsRefPtr<ipc::RilConsumer> > mRilConsumers;
   nsRefPtr<ipc::KeyStore> mKeyStore;
 
   bool mShutdown;
 };
 
 }
 }
 }
--- a/dom/system/gonk/moz.build
+++ b/dom/system/gonk/moz.build
@@ -13,81 +13,76 @@
 # 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.
 
 XPIDL_SOURCES += [
     'nsIAudioManager.idl',
     'nsINetworkInterfaceListService.idl',
     'nsINetworkManager.idl',
+    'nsIRadioInterfaceLayer.idl',
     'nsISystemWorkerManager.idl',
     'nsIVolume.idl',
     'nsIVolumeMountLock.idl',
     'nsIVolumeService.idl',
     'nsIVolumeStat.idl',
     'nsIWorkerHolder.idl',
 ]
 
 XPIDL_MODULE = 'dom_system_gonk'
 
 MODULE = 'dom'
 
-EXPORTS += [
-    'GonkGPSGeolocationProvider.h',
-    'nsVolume.h',
-    'nsVolumeService.h',
-]
-CPP_SOURCES += [
-    'AudioChannelManager.cpp',
-    'AudioManager.cpp',
-    'AutoMounter.cpp',
-    'AutoMounterSetting.cpp',
-    'GonkGPSGeolocationProvider.cpp',
-    'nsVolume.cpp',
-    'nsVolumeMountLock.cpp',
-    'nsVolumeService.cpp',
-    'nsVolumeStat.cpp',
-    'OpenFileFinder.cpp',
-    'SystemWorkerManager.cpp',
-    'TimeZoneSettingObserver.cpp',
-    'Volume.cpp',
-    'VolumeCommand.cpp',
-    'VolumeManager.cpp',
-    'VolumeServiceIOThread.cpp',
-    'VolumeServiceTest.cpp',
-]
+if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
+    EXPORTS += [
+        'GonkGPSGeolocationProvider.h',
+        'nsVolume.h',
+        'nsVolumeService.h',
+    ]
+    CPP_SOURCES += [
+        'AudioChannelManager.cpp',
+        'AudioManager.cpp',
+        'AutoMounter.cpp',
+        'AutoMounterSetting.cpp',
+        'GonkGPSGeolocationProvider.cpp',
+        'nsVolume.cpp',
+        'nsVolumeMountLock.cpp',
+        'nsVolumeService.cpp',
+        'nsVolumeStat.cpp',
+        'OpenFileFinder.cpp',
+        'TimeZoneSettingObserver.cpp',
+        'Volume.cpp',
+        'VolumeCommand.cpp',
+        'VolumeManager.cpp',
+        'VolumeServiceIOThread.cpp',
+        'VolumeServiceTest.cpp',
+    ]
 
 if CONFIG['ENABLE_TESTS']:
     XPCSHELL_TESTS_MANIFESTS += ['tests/xpcshell.ini']
 
+CPP_SOURCES += [
+    'SystemWorkerManager.cpp',
+]
+
 EXTRA_COMPONENTS += [
     'NetworkInterfaceListService.js',
     'NetworkInterfaceListService.manifest',
+    'NetworkManager.js',
     'NetworkManager.manifest',
-]
-EXTRA_PP_COMPONENTS += [
-    'NetworkManager.js',
-]
-EXTRA_JS_MODULES += [
-    'net_worker.js',
-    'systemlibs.js',
+    'RadioInterfaceLayer.js',
+    'RadioInterfaceLayer.manifest',
+    'RILContentHelper.js',
 ]
 
-if CONFIG['MOZ_B2G_RIL']:
-    XPIDL_SOURCES += [
-        'nsIRadioInterfaceLayer.idl',
-    ]
-    EXTRA_COMPONENTS += [
-        'RadioInterfaceLayer.js',
-        'RadioInterfaceLayer.manifest',
-        'RILContentHelper.js',
-    ]
-    EXTRA_JS_MODULES += [
-        'ril_consts.js',
-        'ril_worker.js',
-    ]
+EXTRA_JS_MODULES += [
+    'net_worker.js',
+    'ril_consts.js',
+    'ril_worker.js',
+    'systemlibs.js',
+]
 
 FAIL_ON_WARNINGS = True
 
 LIBXUL_LIBRARY = True
 
 LIBRARY_NAME = 'domsystemgonk_s'
 
--- a/dom/system/moz.build
+++ b/dom/system/moz.build
@@ -9,17 +9,18 @@ toolkit = CONFIG['MOZ_WIDGET_TOOLKIT']
 if toolkit in ('qt', 'gtk2', 'gtk3'):
     DIRS += ['unix']
 elif toolkit == 'windows':
     DIRS += ['windows']
 elif toolkit == 'cocoa':
     DIRS += ['mac']
 elif toolkit == 'android':
     DIRS += ['android']
-elif toolkit == 'gonk':
+
+if CONFIG['MOZ_B2G_RIL']:
     DIRS += ['gonk']
 
 TEST_DIRS += ['tests']
 
 XPIDL_SOURCES += [
     'nsIOSFileConstantsService.idl',
 ]
 
--- a/dom/webidl/moz.build
+++ b/dom/webidl/moz.build
@@ -508,23 +508,19 @@ if CONFIG['MOZ_B2G_RIL']:
         'IccCardLockError.webidl',
         'MozCellBroadcast.webidl',
         'MozCellBroadcastEvent.webidl',
         'MozEmergencyCbModeEvent.webidl',
         'MozOtaStatusEvent.webidl',
         'MozStkCommandEvent.webidl',
         'MozVoicemail.webidl',
         'MozVoicemailEvent.webidl',
-        'USSDReceivedEvent.webidl',
-    ]
-
-if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
-    WEBIDL_FILES += [
         'MozWifiConnectionInfoEvent.webidl',
         'MozWifiStatusChangeEvent.webidl',
+        'USSDReceivedEvent.webidl',
     ]
 
 if CONFIG['MOZ_WEBSPEECH']:
     WEBIDL_FILES += [
         'SpeechRecognitionError.webidl',
         'SpeechRecognitionEvent.webidl',
     ]
 
--- a/ipc/moz.build
+++ b/ipc/moz.build
@@ -12,15 +12,15 @@ DIRS += [
 ]
 
 if CONFIG['MOZ_B2G_RIL']:
     DIRS += ['ril']
 
 if CONFIG['MOZ_B2G_BT_BLUEZ']:
     DIRS += ['dbus']
 
-if CONFIG['MOZ_B2G_RIL'] or CONFIG['MOZ_B2G_BT'] or CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
-    DIRS += ['unixsocket']
+if CONFIG['MOZ_B2G_RIL'] or CONFIG['MOZ_B2G_BT']:
+    DIRS += ['unixsocket', 'keystore']
 
 if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
-    DIRS += ['netd', 'keystore']
+    DIRS += ['netd']
 
 TOOL_DIRS += ['app']
--- a/ipc/ril/Ril.cpp
+++ b/ipc/ril/Ril.cpp
@@ -1,168 +1,53 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /* vim: set sw=4 ts=8 et ft=cpp: */
 /* 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/. */
 
-#include "mozilla/ipc/Ril.h"
-
 #include <fcntl.h>
 #include <sys/socket.h>
 #include <sys/un.h>
 #include <netdb.h> // For gethostbyname.
 
 #undef LOG
 #if defined(MOZ_WIDGET_GONK)
 #include <android/log.h>
 #define LOG(args...)  __android_log_print(ANDROID_LOG_INFO, "Gonk", args)
 #else
 #define LOG(args...)  printf(args);
 #endif
 
 #include "jsfriendapi.h"
-#include "nsTArray.h"
 #include "nsThreadUtils.h" // For NS_IsMainThread.
+#include "Ril.h"
 
 USING_WORKERS_NAMESPACE
 using namespace mozilla::ipc;
 
 namespace {
 
 const char* RIL_SOCKET_NAME = "/dev/socket/rilproxy";
 
 // Network port to connect to for adb forwarded sockets when doing
 // desktop development.
 const uint32_t RIL_TEST_PORT = 6200;
 
-nsTArray<nsRefPtr<mozilla::ipc::RilConsumer> > sRilConsumers;
-
-class ConnectWorkerToRIL : public WorkerTask
+class DispatchRILEvent : public WorkerTask
 {
 public:
-    ConnectWorkerToRIL()
+    DispatchRILEvent(UnixSocketRawData* aMessage)
+      : mMessage(aMessage)
     { }
 
     virtual bool RunTask(JSContext *aCx);
-};
-
-class SendRilSocketDataTask : public nsRunnable
-{
-public:
-    SendRilSocketDataTask(unsigned long aClientId,
-                          UnixSocketRawData *aRawData)
-        : mRawData(aRawData)
-        , mClientId(aClientId)
-    { }
-
-    NS_IMETHOD Run()
-    {
-        MOZ_ASSERT(NS_IsMainThread());
-
-        if (sRilConsumers.Length() <= mClientId ||
-            !sRilConsumers[mClientId] ||
-            sRilConsumers[mClientId]->GetConnectionStatus() != SOCKET_CONNECTED) {
-            // Probably shuting down.
-            delete mRawData;
-            return NS_OK;
-        }
-
-        sRilConsumers[mClientId]->SendSocketData(mRawData);
-        return NS_OK;
-    }
 
 private:
-    UnixSocketRawData *mRawData;
-    unsigned long mClientId;
-};
-
-bool
-PostToRIL(JSContext *aCx,
-          unsigned aArgc,
-          JS::Value *aArgv)
-{
-    NS_ASSERTION(!NS_IsMainThread(), "Expecting to be on the worker thread");
-
-    if (aArgc != 2) {
-        JS_ReportError(aCx, "Expecting two arguments with the RIL message");
-        return false;
-    }
-
-    JS::Value cv = JS_ARGV(aCx, aArgv)[0];
-    int clientId = cv.toInt32();
-
-    JS::Value v = JS_ARGV(aCx, aArgv)[1];
-
-    JSAutoByteString abs;
-    void *data;
-    size_t size;
-    if (JSVAL_IS_STRING(v)) {
-        JSString *str = JSVAL_TO_STRING(v);
-        if (!abs.encodeUtf8(aCx, str)) {
-            return false;
-        }
-
-        data = abs.ptr();
-        size = abs.length();
-    } else if (!JSVAL_IS_PRIMITIVE(v)) {
-        JSObject *obj = JSVAL_TO_OBJECT(v);
-        if (!JS_IsTypedArrayObject(obj)) {
-            JS_ReportError(aCx, "Object passed in wasn't a typed array");
-            return false;
-        }
-
-        uint32_t type = JS_GetArrayBufferViewType(obj);
-        if (type != js::ArrayBufferView::TYPE_INT8 &&
-            type != js::ArrayBufferView::TYPE_UINT8 &&
-            type != js::ArrayBufferView::TYPE_UINT8_CLAMPED) {
-            JS_ReportError(aCx, "Typed array data is not octets");
-            return false;
-        }
-
-        size = JS_GetTypedArrayByteLength(obj);
-        data = JS_GetArrayBufferViewData(obj);
-    } else {
-        JS_ReportError(aCx,
-                       "Incorrect argument. Expecting a string or a typed array");
-        return false;
-    }
-
-    UnixSocketRawData* raw = new UnixSocketRawData(data, size);
-
-    nsRefPtr<SendRilSocketDataTask> task =
-        new SendRilSocketDataTask(clientId, raw);
-    NS_DispatchToMainThread(task);
-    return true;
-}
-
-bool
-ConnectWorkerToRIL::RunTask(JSContext *aCx)
-{
-    // Set up the postRILMessage on the function for worker -> RIL thread
-    // communication.
-    NS_ASSERTION(!NS_IsMainThread(), "Expecting to be on the worker thread");
-    NS_ASSERTION(!JS_IsRunning(aCx), "Are we being called somehow?");
-    JSObject *workerGlobal = JS::CurrentGlobalOrNull(aCx);
-
-    return !!JS_DefineFunction(aCx, workerGlobal,
-                               "postRILMessage", PostToRIL, 1, 0);
-}
-
-class DispatchRILEvent : public WorkerTask
-{
-public:
-        DispatchRILEvent(UnixSocketRawData* aMessage)
-            : mMessage(aMessage)
-        { }
-
-        virtual bool RunTask(JSContext *aCx);
-
-private:
-        nsAutoPtr<UnixSocketRawData> mMessage;
+    nsAutoPtr<UnixSocketRawData> mMessage;
 };
 
 bool
 DispatchRILEvent::RunTask(JSContext *aCx)
 {
     JSObject *obj = JS::CurrentGlobalOrNull(aCx);
 
     JSObject *array = JS_NewUint8Array(aCx, mMessage->mSize);
@@ -294,83 +179,49 @@ RilConsumer::RilConsumer(unsigned long a
         snprintf(addr_un.sun_path, sizeof addr_un.sun_path, "%s%lu",
                  RIL_SOCKET_NAME, aClientId);
         mAddress = addr_un.sun_path;
     }
 
     ConnectSocket(new RilConnector(mClientId), mAddress.get());
 }
 
-nsresult
-RilConsumer::Register(unsigned int aClientId,
-                      WorkerCrossThreadDispatcher* aDispatcher)
-{
-    MOZ_ASSERT(NS_IsMainThread());
-
-    sRilConsumers.EnsureLengthAtLeast(aClientId + 1);
-
-    if (sRilConsumers[aClientId]) {
-        NS_WARNING("RilConsumer already registered");
-        return NS_ERROR_FAILURE;
-    }
-
-    nsRefPtr<ConnectWorkerToRIL> connection = new ConnectWorkerToRIL();
-    if (!aDispatcher->PostTask(connection)) {
-        NS_WARNING("Failed to connect worker to ril");
-        return NS_ERROR_UNEXPECTED;
-    }
-
-    // Now that we're set up, connect ourselves to the RIL thread.
-    sRilConsumers[aClientId] = new RilConsumer(aClientId, aDispatcher);
-    return NS_OK;
-}
-
 void
 RilConsumer::Shutdown()
 {
-    MOZ_ASSERT(NS_IsMainThread());
-
-    for (unsigned long i = 0; i < sRilConsumers.Length(); i++) {
-        nsRefPtr<RilConsumer>& instance = sRilConsumers[i];
-        if (!instance) {
-            continue;
-        }
-
-        instance->mShutdown = true;
-        instance->CloseSocket();
-        instance = nullptr;
-    }
+    mShutdown = true;
+    CloseSocket();
 }
 
 void
 RilConsumer::ReceiveSocketData(nsAutoPtr<UnixSocketRawData>& aMessage)
 {
     MOZ_ASSERT(NS_IsMainThread());
 
     nsRefPtr<DispatchRILEvent> dre(new DispatchRILEvent(aMessage.forget()));
     mDispatcher->PostTask(dre);
 }
 
 void
 RilConsumer::OnConnectSuccess()
 {
     // Nothing to do here.
-    LOG("RIL[%lu]: %s\n", mClientId, __FUNCTION__);
+    LOG("RIL[%u]: %s\n", mClientId, __FUNCTION__);
 }
 
 void
 RilConsumer::OnConnectError()
 {
-    LOG("RIL[%lu]: %s\n", mClientId, __FUNCTION__);
+    LOG("RIL[%u]: %s\n", mClientId, __FUNCTION__);
     CloseSocket();
 }
 
 void
 RilConsumer::OnDisconnect()
 {
-    LOG("RIL[%lu]: %s\n", mClientId, __FUNCTION__);
+    LOG("RIL[%u]: %s\n", mClientId, __FUNCTION__);
     if (!mShutdown) {
         ConnectSocket(new RilConnector(mClientId), mAddress.get(), 1000);
     }
 }
 
 } // namespace ipc
 } // namespace mozilla
--- a/ipc/ril/Ril.h
+++ b/ipc/ril/Ril.h
@@ -11,26 +11,23 @@
 #include <mozilla/ipc/UnixSocket.h>
 
 namespace mozilla {
 namespace ipc {
 
 class RilConsumer : public mozilla::ipc::UnixSocketConsumer
 {
 public:
+  RilConsumer(unsigned long aClientId,
+              mozilla::dom::workers::WorkerCrossThreadDispatcher* aDispatcher);
   virtual ~RilConsumer() { }
 
-  static nsresult Register(unsigned int aClientId,
-                           mozilla::dom::workers::WorkerCrossThreadDispatcher* aDispatcher);
-  static void Shutdown();
+  void Shutdown();
 
 private:
-  RilConsumer(unsigned long aClientId,
-              mozilla::dom::workers::WorkerCrossThreadDispatcher* aDispatcher);
-
   virtual void ReceiveSocketData(nsAutoPtr<UnixSocketRawData>& aMessage);
 
   virtual void OnConnectSuccess();
   virtual void OnConnectError();
   virtual void OnDisconnect();
 
 private:
   nsRefPtr<mozilla::dom::workers::WorkerCrossThreadDispatcher> mDispatcher;
--- a/js/xpconnect/src/event_impl_gen.conf.in
+++ b/js/xpconnect/src/event_impl_gen.conf.in
@@ -18,29 +18,27 @@ simple_events = [
     'HashChangeEvent',
     'CloseEvent',
     'DeviceOrientationEvent',
     'MozApplicationEvent',
     'SmartCardEvent',
     'StyleRuleChangeEvent',
     'StyleSheetChangeEvent',
     'StyleSheetApplicableStateChangeEvent',
-#ifdef MOZ_WIDGET_GONK
-    'MozWifiStatusChangeEvent',
-    'MozWifiConnectionInfoEvent',
-#endif
 #ifdef MOZ_B2G_BT
     'BluetoothDeviceEvent',
     'BluetoothStatusChangedEvent',
 #endif
 #ifdef MOZ_B2G_RIL
     'CFStateChangeEvent',
     'DataErrorEvent',
     'MozEmergencyCbModeEvent',
     'MozOtaStatusEvent',
+    'MozWifiStatusChangeEvent',
+    'MozWifiConnectionInfoEvent',
     'MozCellBroadcastEvent',
     'MozVoicemailEvent',
     'USSDReceivedEvent',
 #endif
     'ElementReplaceEvent',
     'MozSmsEvent',
     'MozMmsEvent',
 #ifdef MOZ_WEBSPEECH
--- a/layout/build/Makefile.in
+++ b/layout/build/Makefile.in
@@ -122,24 +122,19 @@ SHARED_LIBRARY_LIBS	+= \
 endif #}
 
 ifdef MOZ_B2G_BT #{
 SHARED_LIBRARY_LIBS += $(DEPTH)/dom/bluetooth/$(LIB_PREFIX)dombluetooth_s.$(LIB_SUFFIX)
 endif #}
 
 SHARED_LIBRARY_LIBS	+= $(DEPTH)/dom/camera/$(LIB_PREFIX)domcamera_s.$(LIB_SUFFIX)
 
-ifeq (gonk,$(MOZ_WIDGET_TOOLKIT))
+ifdef MOZ_B2G_RIL #{
 SHARED_LIBRARY_LIBS	+= \
   $(DEPTH)/dom/system/gonk/$(LIB_PREFIX)domsystemgonk_s.$(LIB_SUFFIX) \
-  $(NULL)
-endif #}
-
-ifdef MOZ_B2G_RIL #{
-SHARED_LIBRARY_LIBS	+= \
   $(DEPTH)/dom/icc/src/$(LIB_PREFIX)dom_icc_s.$(LIB_SUFFIX) \
   $(DEPTH)/dom/cellbroadcast/src/$(LIB_PREFIX)dom_cellbroadcast_s.$(LIB_SUFFIX) \
   $(DEPTH)/dom/voicemail/$(LIB_PREFIX)domvoicemail_s.$(LIB_SUFFIX) \
   $(NULL)
 endif #}
 
 ifdef MOZ_OGG
 SHARED_LIBRARY_LIBS 	+= \
@@ -327,17 +322,17 @@ LOCAL_INCLUDES	+= -I$(srcdir)/../base \
 		   -I$(topsrcdir)/extensions/cookie \
 		   -I$(topsrcdir)/netwerk/cookie \
 		   $(NULL)
 
 ifdef MOZ_GSTREAMER
 LOCAL_INCLUDES	+= $(GSTREAMER_CFLAGS)
 endif
 
-ifeq (gonk,$(MOZ_WIDGET_TOOLKIT))
+ifdef MOZ_B2G_RIL #{
 LOCAL_INCLUDES	+= -I$(topsrcdir)/dom/system/gonk
 endif #}
 
 ifdef MOZ_B2G_FM #{
 LOCAL_INCLUDES	+= -I$(topsrcdir)/dom/fmradio
 endif #}
 
 ifdef MOZ_B2G_BT #{
--- a/layout/build/nsLayoutModule.cpp
+++ b/layout/build/nsLayoutModule.cpp
@@ -96,17 +96,17 @@
 #include "mozilla/OSFileConstants.h"
 #include "mozilla/Services.h"
 
 #ifdef MOZ_WEBSPEECH
 #include "mozilla/dom/FakeSpeechRecognitionService.h"
 #include "mozilla/dom/nsSynthVoiceRegistry.h"
 #endif
 
-#ifdef MOZ_WIDGET_GONK
+#ifdef MOZ_B2G_RIL
 #include "SystemWorkerManager.h"
 using mozilla::dom::gonk::SystemWorkerManager;
 #define SYSTEMWORKERMANAGER_CID \
   {0xd53b6524, 0x6ac3, 0x42b0, {0xae, 0xca, 0x62, 0xb3, 0xc4, 0xe5, 0x2b, 0x04}}
 #define SYSTEMWORKERMANAGER_CONTRACTID \
   "@mozilla.org/telephony/system-worker-manager;1"
 #endif
 
@@ -283,17 +283,17 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(DOMSessio
 NS_GENERIC_FACTORY_CONSTRUCTOR(DOMLocalStorageManager)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsChannelPolicy)
 NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(IndexedDatabaseManager,
                                          IndexedDatabaseManager::FactoryCreate)
 NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(DOMRequestService,
                                          DOMRequestService::FactoryCreate)
 NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(QuotaManager,
                                          QuotaManager::FactoryCreate)
-#ifdef MOZ_WIDGET_GONK
+#ifdef MOZ_B2G_RIL
 NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(SystemWorkerManager,
                                          SystemWorkerManager::FactoryCreate)
 #endif
 #ifdef MOZ_B2G_BT
 NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(BluetoothService,
                                          BluetoothService::FactoryCreate)
 #endif
 
@@ -749,17 +749,17 @@ NS_DEFINE_NAMED_CID(NS_DOMACTIVITY_CID);
 NS_DEFINE_NAMED_CID(NS_DOMPARSER_CID);
 NS_DEFINE_NAMED_CID(NS_DOMSESSIONSTORAGEMANAGER_CID);
 NS_DEFINE_NAMED_CID(NS_DOMLOCALSTORAGEMANAGER_CID);
 NS_DEFINE_NAMED_CID(NS_DOMJSON_CID);
 NS_DEFINE_NAMED_CID(NS_TEXTEDITOR_CID);
 NS_DEFINE_NAMED_CID(INDEXEDDB_MANAGER_CID);
 NS_DEFINE_NAMED_CID(DOMREQUEST_SERVICE_CID);
 NS_DEFINE_NAMED_CID(QUOTA_MANAGER_CID);
-#ifdef MOZ_WIDGET_GONK
+#ifdef MOZ_B2G_RIL
 NS_DEFINE_NAMED_CID(SYSTEMWORKERMANAGER_CID);
 #endif
 #ifdef MOZ_B2G_BT
 NS_DEFINE_NAMED_CID(BLUETOOTHSERVICE_CID);
 #endif
 #ifdef MOZ_WIDGET_GONK
 NS_DEFINE_NAMED_CID(NS_AUDIOMANAGER_CID);
 NS_DEFINE_NAMED_CID(NS_VOLUMESERVICE_CID);
@@ -1038,17 +1038,17 @@ static const mozilla::Module::CIDEntry k
   { &kNS_XPCEXCEPTION_CID, false, nullptr, ExceptionConstructor },
   { &kNS_DOMSESSIONSTORAGEMANAGER_CID, false, nullptr, DOMSessionStorageManagerConstructor },
   { &kNS_DOMLOCALSTORAGEMANAGER_CID, false, nullptr, DOMLocalStorageManagerConstructor },
   { &kNS_DOMJSON_CID, false, nullptr, NS_NewJSON },
   { &kNS_TEXTEDITOR_CID, false, nullptr, nsPlaintextEditorConstructor },
   { &kINDEXEDDB_MANAGER_CID, false, nullptr, IndexedDatabaseManagerConstructor },
   { &kDOMREQUEST_SERVICE_CID, false, nullptr, DOMRequestServiceConstructor },
   { &kQUOTA_MANAGER_CID, false, nullptr, QuotaManagerConstructor },
-#ifdef MOZ_WIDGET_GONK
+#ifdef MOZ_B2G_RIL
   { &kSYSTEMWORKERMANAGER_CID, true, nullptr, SystemWorkerManagerConstructor },
 #endif
 #ifdef MOZ_B2G_BT
   { &kBLUETOOTHSERVICE_CID, true, nullptr, BluetoothServiceConstructor },
 #endif
 #ifdef MOZ_WIDGET_GONK
   { &kNS_AUDIOMANAGER_CID, true, nullptr, AudioManagerConstructor },
   { &kNS_VOLUMESERVICE_CID, true, nullptr, nsVolumeServiceConstructor },
@@ -1196,17 +1196,17 @@ static const mozilla::Module::ContractID
   // Keeping the old ContractID for backward compatibility
   { "@mozilla.org/dom/storagemanager;1", &kNS_DOMLOCALSTORAGEMANAGER_CID },
   { "@mozilla.org/dom/sessionStorage-manager;1", &kNS_DOMSESSIONSTORAGEMANAGER_CID },
   { "@mozilla.org/dom/json;1", &kNS_DOMJSON_CID },
   { "@mozilla.org/editor/texteditor;1", &kNS_TEXTEDITOR_CID },
   { INDEXEDDB_MANAGER_CONTRACTID, &kINDEXEDDB_MANAGER_CID },
   { DOMREQUEST_SERVICE_CONTRACTID, &kDOMREQUEST_SERVICE_CID },
   { QUOTA_MANAGER_CONTRACTID, &kQUOTA_MANAGER_CID },
-#ifdef MOZ_WIDGET_GONK
+#ifdef MOZ_B2G_RIL
   { SYSTEMWORKERMANAGER_CONTRACTID, &kSYSTEMWORKERMANAGER_CID },
 #endif
 #ifdef MOZ_B2G_BT
   { BLUETOOTHSERVICE_CONTRACTID, &kBLUETOOTHSERVICE_CID },
 #endif
 #ifdef MOZ_WIDGET_GONK
   { NS_AUDIOMANAGER_CONTRACTID, &kNS_AUDIOMANAGER_CID },
   { NS_VOLUMESERVICE_CONTRACTID, &kNS_VOLUMESERVICE_CID },
@@ -1281,18 +1281,18 @@ static const mozilla::Module::CategoryEn
   { "net-channel-event-sinks", "CSPService", CSPSERVICE_CONTRACTID },
   { JAVASCRIPT_GLOBAL_STATIC_NAMESET_CATEGORY, "PrivilegeManager", NS_SECURITYNAMESET_CONTRACTID },
   { "app-startup", "Script Security Manager", "service," NS_SCRIPTSECURITYMANAGER_CONTRACTID },
   { TOPIC_WEB_APP_CLEAR_DATA, "QuotaManager", "service," QUOTA_MANAGER_CONTRACTID },
 #ifdef MOZ_WIDGET_GONK
   { "app-startup", "Volume Service", "service," NS_VOLUMESERVICE_CONTRACTID },
 #endif
   CONTENTDLF_CATEGORIES
-#ifdef MOZ_WIDGET_GONK
-  { "profile-after-change", "Gonk System Worker Manager", SYSTEMWORKERMANAGER_CONTRACTID },
+#ifdef MOZ_B2G_RIL
+  { "profile-after-change", "Telephony System Worker Manager", SYSTEMWORKERMANAGER_CONTRACTID },
 #endif
 #ifdef MOZ_B2G_BT
   { "profile-after-change", "Bluetooth Service", BLUETOOTHSERVICE_CONTRACTID },
 #endif
   { nullptr }
 };
 
 static void
--- a/toolkit/library/Makefile.in
+++ b/toolkit/library/Makefile.in
@@ -91,22 +91,22 @@ endif #}
 
 ifdef MOZ_B2G_BT_BLUEZ #{
 STATIC_LIBS += mozdbus_s
 ifeq (gonk,$(MOZ_WIDGET_TOOLKIT))
 OS_LIBS += -ldbus
 endif
 endif #}
 
-ifneq ($(strip $(MOZ_B2G_RIL)$(MOZ_B2G_BT)$(filter gonk,$(MOZ_WIDGET_TOOLKIT))),) #{
-STATIC_LIBS += mozipcunixsocket_s
+ifneq ($(strip $(MOZ_B2G_RIL)$(MOZ_B2G_BT)),) #{
+STATIC_LIBS += mozipcunixsocket_s mozkeystore_s
 endif #}
 
 ifeq (gonk,$(MOZ_WIDGET_TOOLKIT))
-STATIC_LIBS += moznetd_s mozkeystore_s
+STATIC_LIBS += moznetd_s
 endif
 
 ifdef MOZ_B2G_CAMERA #{
 OS_LIBS += -lstagefright -lstagefright_omx
 endif #}
 
 ifdef MOZ_IPDL_TESTS
 STATIC_LIBS += ipdlunittest_s