Backed out changeset cbbd94e6ab32 (bug 861496) for mochitest-2 orange.
authorRyan VanderMeulen <ryanvm@gmail.com>
Fri, 26 Apr 2013 11:27:48 -0400
changeset 136718 d4e57a4a2fcd8b6edcb3cf12e2a00d2629e39f2f
parent 136717 52a6a51d2dca79786e3ddcc68e57e1ea9958893e
child 136719 10c026f436ed4503950c0c1331132e6580d41aeb
push id3752
push userlsblakk@mozilla.com
push dateMon, 13 May 2013 17:21:10 +0000
treeherdermozilla-aurora@1580544aef0b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs861496
milestone23.0a1
backs outcbbd94e6ab326be36f8a524bfebb6cd8351ae9cd
Backed out changeset cbbd94e6ab32 (bug 861496) for mochitest-2 orange.
b2g/app/b2g.js
b2g/confvars.sh
configure.in
dom/activities/src/Activity.h
dom/apps/src/Webapps.jsm
dom/base/Navigator.cpp
dom/base/Navigator.h
dom/base/nsDOMClassInfo.cpp
modules/libpref/src/init/all.js
--- a/b2g/app/b2g.js
+++ b/b2g/app/b2g.js
@@ -513,18 +513,16 @@ pref("extensions.getAddons.cache.enabled
 
 // Context Menu
 pref("ui.click_hold_context_menus", true);
 pref("ui.click_hold_context_menus.delay", 750);
 
 // Enable device storage
 pref("device.storage.enabled", true);
 
-// Enable system message
-pref("dom.sysmsg.enabled", true);
 pref("media.plugins.enabled", false);
 pref("media.omx.enabled", true);
 
 // Disable printing (particularly, window.print())
 pref("dom.disable_window_print", true);
 
 // Disable window.showModalDialog
 pref("dom.disable_window_showModalDialog", true);
--- a/b2g/confvars.sh
+++ b/b2g/confvars.sh
@@ -41,16 +41,17 @@ else
 MOZ_XULRUNNER=
 fi
 
 MOZ_MEDIA_NAVIGATOR=1
 
 MOZ_APP_ID={3c2e2abc-06d4-11e1-ac3b-374f68613e61}
 MOZ_EXTENSION_MANAGER=1
 
+MOZ_SYS_MSG=1
 MOZ_TIME_MANAGER=1
 
 MOZ_B2G_CERTDATA=1
 MOZ_PAY=1
 MOZ_TOOLKIT_SEARCH=
 MOZ_PLACES=
 MOZ_B2G=1
 MOZ_FOLD_LIBS=1
--- a/configure.in
+++ b/configure.in
@@ -4259,16 +4259,17 @@ NECKO_PROTOCOLS_DEFAULT="about data file
 USE_ARM_KUSER=
 BUILD_CTYPES=1
 MOZ_USE_NATIVE_POPUP_WINDOWS=
 MOZ_ANDROID_HISTORY=
 MOZ_WEBSMS_BACKEND=
 MOZ_ANDROID_WALLPAPER=
 MOZ_ANDROID_BEAM=
 ACCESSIBILITY=1
+MOZ_SYS_MSG=
 MOZ_TIME_MANAGER=
 MOZ_PAY=
 MOZ_AUDIO_CHANNEL_MANAGER=
 
 case "$target_os" in
     mingw*)
         NS_ENABLE_TSF=1
         AC_DEFINE(NS_ENABLE_TSF)
@@ -7620,16 +7621,24 @@ MOZ_ARG_ENABLE_BOOL(b2g-bt,
     MOZ_B2G_BT=1,
     MOZ_B2G_BT= )
 if test -n "$MOZ_B2G_BT"; then
     AC_DEFINE(MOZ_B2G_BT)
 fi
 AC_SUBST(MOZ_B2G_BT)
 
 dnl ========================================================
+dnl = Enable Support for System Messages API
+dnl ========================================================
+if test -n "$MOZ_SYS_MSG"; then
+    AC_DEFINE(MOZ_SYS_MSG)
+fi
+AC_SUBST(MOZ_SYS_MSG)
+
+dnl ========================================================
 dnl = Enable Support for Time Manager API
 dnl ========================================================
 if test -n "$MOZ_TIME_MANAGER"; then
     AC_DEFINE(MOZ_TIME_MANAGER)
 fi
 AC_SUBST(MOZ_TIME_MANAGER)
 
 dnl ========================================================
--- a/dom/activities/src/Activity.h
+++ b/dom/activities/src/Activity.h
@@ -3,17 +3,16 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef mozilla_dom_activities_Activity_h
 #define mozilla_dom_activities_Activity_h
 
 #include "DOMRequest.h"
 #include "mozilla/dom/BindingDeclarations.h"
 #include "nsIActivityProxy.h"
-#include "mozilla/Preferences.h"
 
 #define NS_DOMACTIVITY_CID                          \
  {0x1c5b0930, 0xc90c, 0x4e9c, {0xaf, 0x4e, 0xb0, 0xb7, 0xa6, 0x59, 0xb4, 0xed}}
 
 #define NS_DOMACTIVITY_CONTRACTID "@mozilla.org/dom/activity;1"
 
 namespace mozilla {
 namespace dom {
@@ -24,17 +23,21 @@ public:
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(Activity, DOMRequest)
 
   virtual JSObject*
   WrapObject(JSContext* aCx, JSObject* aScope) MOZ_OVERRIDE;
 
   static bool PrefEnabled()
   {
-    return Preferences::GetBool("dom.sysmsg.enabled", false);
+#ifdef MOZ_SYS_MSG
+    return true;
+#else
+    return false;
+#endif
   }
 
   static already_AddRefed<Activity>
   Constructor(const GlobalObject& aOwner,
               nsIDOMMozActivityOptions* aOptions,
               ErrorResult& aRv)
   {
     nsRefPtr<Activity> activity = new Activity();
--- a/dom/apps/src/Webapps.jsm
+++ b/dom/apps/src/Webapps.jsm
@@ -20,24 +20,16 @@ Cu.import("resource://gre/modules/Permis
 Cu.import("resource://gre/modules/OfflineCacheInstaller.jsm");
 Cu.import("resource://gre/modules/SystemMessagePermissionsChecker.jsm");
 Cu.import("resource://gre/modules/AppDownloadManager.jsm");
 
 function debug(aMsg) {
   //dump("-*-*- Webapps.jsm : " + aMsg + "\n");
 }
 
-let cachedSysMsgPref = null;
-function supportSystemMessages() {
-  if (_sysMsgPref === null) {
-    cachedSysMsgPref = Services.prefs.getBoolPref("dom.sysmsg.enabled");
-  }
-  return cachedSysMsgPref;
-}
-
 // Minimum delay between two progress events while downloading, in ms.
 const MIN_PROGRESS_EVENT_DELAY = 1000;
 
 const WEBAPP_RUNTIME = Services.appinfo.ID == "webapprt@mozilla.org";
 
 XPCOMUtils.defineLazyGetter(this, "NetUtil", function() {
   Cu.import("resource://gre/modules/NetUtil.jsm");
   return NetUtil;
@@ -183,31 +175,31 @@ this.DOMApplicationRegistry = {
 
   // Registers all the activities and system messages.
   registerAppsHandlers: function registerAppsHandlers(aRunUpdate) {
     this.notifyAppsRegistryStart();
     let ids = [];
     for (let id in this.webapps) {
       ids.push({ id: id });
     }
-    if (supportSystemMessages()) {
-      this._processManifestForIds(ids, aRunUpdate);
-    } else {
-      // Read the CSPs. If MOZ_SYS_MSG is defined this is done on
-      // _processManifestForIds so as to not reading the manifests
-      // twice
-      this._readManifests(ids, (function readCSPs(aResults) {
-        aResults.forEach(function registerManifest(aResult) {
-          this.webapps[aResult.id].csp = aResult.manifest.csp || "";
-        }, this);
-      }).bind(this));
-
-      // Nothing else to do but notifying we're ready.
-      this.notifyAppsRegistryReady();
-    }
+#ifdef MOZ_SYS_MSG
+    this._processManifestForIds(ids, aRunUpdate);
+#else
+    // Read the CSPs. If MOZ_SYS_MSG is defined this is done on
+    // _processManifestForIds so as to not reading the manifests
+    // twice
+    this._readManifests(ids, (function readCSPs(aResults) {
+      aResults.forEach(function registerManifest(aResult) {
+        this.webapps[aResult.id].csp = aResult.manifest.csp || "";
+      }, this);
+    }).bind(this));
+
+    // Nothing else to do but notifying we're ready.
+    this.notifyAppsRegistryReady();
+#endif
   },
 
   updatePermissionsForApp: function updatePermissionsForApp(aId) {
     if (!this.webapps[aId]) {
       return;
     }
 
     // Install the permissions for this app, as if we were updating
@@ -442,16 +434,17 @@ this.DOMApplicationRegistry = {
       else
         onAppsLoaded();
 #else
       onAppsLoaded();
 #endif
     }).bind(this));
   },
 
+#ifdef MOZ_SYS_MSG
   // |aEntryPoint| is either the entry_point name or the null in which case we
   // use the root of the manifest.
   _registerSystemMessagesForEntryPoint: function(aManifest, aApp, aEntryPoint) {
     let root = aManifest;
     if (aEntryPoint && aManifest.entry_points[aEntryPoint]) {
       root = aManifest.entry_points[aEntryPoint];
     }
 
@@ -659,16 +652,17 @@ this.DOMApplicationRegistry = {
         app.name = manifest.name;
         app.csp = manifest.csp || "";
         this._registerSystemMessages(manifest, app);
         appsToRegister.push({ manifest: manifest, app: app });
       }, this);
       this._registerActivitiesForApps(appsToRegister, aRunUpdate);
     }).bind(this));
   },
+#endif
 
   observe: function(aSubject, aTopic, aData) {
     if (aTopic == "xpcom-shutdown") {
       this.messages.forEach((function(msgName) {
         ppmm.removeMessageListener(msgName, this);
       }).bind(this));
       Services.obs.removeObserver(this, "xpcom-shutdown");
       ppmm = null;
@@ -1285,27 +1279,26 @@ this.DOMApplicationRegistry = {
     return [toHexString(hash.charCodeAt(i)) for (i in hash)].join("");
   },
 
   // Updates the activities and system message handlers.
   // aOldManifest can be null if we don't have any handler to unregister.
   updateAppHandlers: function(aOldManifest, aNewManifest, aApp) {
     debug("updateAppHandlers: old=" + aOldManifest + " new=" + aNewManifest);
     this.notifyAppsRegistryStart();
-
-    if (supportSystemMessages()) {
-      if (aOldManifest) {
-        this._unregisterActivities(aOldManifest, aApp);
-      }
-      this._registerSystemMessages(aNewManifest, aApp);
-      this._registerActivities(aNewManifest, aApp, true);
-    } else {
-      // Nothing else to do but notifying we're ready.
-      this.notifyAppsRegistryReady();
+#ifdef MOZ_SYS_MSG
+    if (aOldManifest) {
+      this._unregisterActivities(aOldManifest, aApp);
     }
+    this._registerSystemMessages(aNewManifest, aApp);
+    this._registerActivities(aNewManifest, aApp, true);
+#else
+    // Nothing else to do but notifying we're ready.
+    this.notifyAppsRegistryReady();
+#endif
   },
 
   checkForUpdate: function(aData, aMm) {
     debug("checkForUpdate for " + aData.manifestURL);
 
     function sendError(aError) {
       aData.error = aError;
       aMm.sendAsyncMessage("Webapps:CheckForUpdate:Return:KO", aData);
@@ -2488,21 +2481,21 @@ this.DOMApplicationRegistry = {
       this._clearPrivateData(app.localId, false);
 
       // Then notify observers.
       Services.obs.notifyObservers(aMm, "webapps-uninstall", JSON.stringify(aData));
 
       let appNote = JSON.stringify(AppsUtils.cloneAppObject(app));
       appNote.id = id;
 
-      if (supportSystemMessages()) {
-        this._readManifests([{ id: id }], (function unregisterManifest(aResult) {
-          this._unregisterActivities(aResult[0].manifest, app);
-        }).bind(this));
-      }
+#ifdef MOZ_SYS_MSG
+      this._readManifests([{ id: id }], (function unregisterManifest(aResult) {
+        this._unregisterActivities(aResult[0].manifest, app);
+      }).bind(this));
+#endif
 
       let dir = this._getAppDir(id);
       try {
         dir.remove(true);
       } catch (e) {}
 
       delete this.webapps[id];
 
--- a/dom/base/Navigator.cpp
+++ b/dom/base/Navigator.cpp
@@ -220,19 +220,21 @@ Navigator::Invalidate()
 #ifdef MOZ_B2G_BT
   if (mBluetooth) {
     mBluetooth = nullptr;
   }
 #endif
 
   mCameraManager = nullptr;
 
+#ifdef MOZ_SYS_MSG
   if (mMessagesManager) {
     mMessagesManager = nullptr;
   }
+#endif
 
 #ifdef MOZ_AUDIO_CHANNEL_MANAGER
   if (mAudioChannelManager) {
     mAudioChannelManager = nullptr;
   }
 #endif
 
   uint32_t len = mDeviceStorageStores.Length();
@@ -1404,16 +1406,17 @@ Navigator::GetMozBluetooth(nsIDOMBluetoo
   bluetooth.forget(aBluetooth);
   return NS_OK;
 }
 #endif //MOZ_B2G_BT
 
 //*****************************************************************************
 //    nsNavigator::nsIDOMNavigatorSystemMessages
 //*****************************************************************************
+#ifdef MOZ_SYS_MSG
 nsresult
 Navigator::EnsureMessagesManager()
 {
   if (mMessagesManager) {
     return NS_OK;
   }
 
   nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);
@@ -1431,43 +1434,44 @@ Navigator::EnsureMessagesManager()
   JS::Value prop_val = JSVAL_VOID;
   rv = gpi->Init(window, &prop_val);
   NS_ENSURE_SUCCESS(rv, rv);
 
   mMessagesManager = messageManager.forget();
 
   return NS_OK;
 }
+#endif
 
 NS_IMETHODIMP
 Navigator::MozHasPendingMessage(const nsAString& aType, bool *aResult)
 {
-  if (!Preferences::GetBool("dom.sysmsg.enabled", false)) {
-    return NS_ERROR_NOT_IMPLEMENTED;
-  }
-
+#ifdef MOZ_SYS_MSG
   *aResult = false;
   nsresult rv = EnsureMessagesManager();
   NS_ENSURE_SUCCESS(rv, rv);
 
   return mMessagesManager->MozHasPendingMessage(aType, aResult);
+#else
+  return NS_ERROR_NOT_IMPLEMENTED;
+#endif
 }
 
 NS_IMETHODIMP
 Navigator::MozSetMessageHandler(const nsAString& aType,
                                 nsIDOMSystemMessageCallback *aCallback)
 {
-  if (!Preferences::GetBool("dom.sysmsg.enabled", false)) {
-    return NS_ERROR_NOT_IMPLEMENTED;
-  }
-
+#ifdef MOZ_SYS_MSG
   nsresult rv = EnsureMessagesManager();
   NS_ENSURE_SUCCESS(rv, rv);
 
   return mMessagesManager->MozSetMessageHandler(aType, aCallback);
+#else
+  return NS_ERROR_NOT_IMPLEMENTED;
+#endif
 }
 
 //*****************************************************************************
 //    Navigator::nsIDOMNavigatorTime
 //*****************************************************************************
 #ifdef MOZ_TIME_MANAGER
 NS_IMETHODIMP
 Navigator::GetMozTime(nsIDOMMozTimeManager** aTime)
--- a/dom/base/Navigator.h
+++ b/dom/base/Navigator.h
@@ -181,19 +181,20 @@ public:
    */
   void SetWindow(nsPIDOMWindow *aInnerWindow);
 
   /**
    * Called when the inner window navigates to a new page.
    */
   void OnNavigation();
 
+#ifdef MOZ_SYS_MSG
   // Helper to initialize mMessagesManager.
   nsresult EnsureMessagesManager();
-
+#endif
   NS_DECL_NSIDOMNAVIGATORCAMERA
 
 private:
   bool CheckPermission(const char* type);
 
   nsRefPtr<nsMimeTypeArray> mMimeTypes;
   nsRefPtr<nsPluginArray> mPlugins;
   nsRefPtr<Geolocation> mGeolocation;
--- a/dom/base/nsDOMClassInfo.cpp
+++ b/dom/base/nsDOMClassInfo.cpp
@@ -279,18 +279,16 @@
 #include "mozilla/dom/indexedDB/IDBKeyRange.h"
 #include "mozilla/dom/indexedDB/IDBIndex.h"
 
 using mozilla::dom::indexedDB::IDBWrapperCache;
 using mozilla::dom::workers::ResolveWorkerClasses;
 
 #include "nsIDOMMediaQueryList.h"
 
-#include "mozilla/dom/Activity.h"
-
 #include "nsDOMTouchEvent.h"
 
 #include "nsWrapperCacheInlines.h"
 #include "mozilla/dom/HTMLCollectionBinding.h"
 
 #include "BatteryManager.h"
 #include "nsIDOMPowerManager.h"
 #include "nsIDOMWakeLock.h"
@@ -1671,18 +1669,19 @@ nsDOMClassInfo::Init()
     DOM_CLASSINFO_MAP_ENTRY(nsIMozNavigatorMobileConnection)
     DOM_CLASSINFO_MAP_ENTRY(nsIMozNavigatorCellBroadcast)
     DOM_CLASSINFO_MAP_ENTRY(nsIMozNavigatorVoicemail)
 #endif
 #ifdef MOZ_B2G_BT
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMNavigatorBluetooth)
 #endif
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMNavigatorCamera)
-    DOM_CLASSINFO_MAP_CONDITIONAL_ENTRY(nsIDOMNavigatorSystemMessages,
-                                        Activity::PrefEnabled())
+#ifdef MOZ_SYS_MSG
+    DOM_CLASSINFO_MAP_ENTRY(nsIDOMNavigatorSystemMessages)
+#endif
 #ifdef MOZ_TIME_MANAGER
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMMozNavigatorTime)
 #endif
 #ifdef MOZ_AUDIO_CHANNEL_MANAGER
     DOM_CLASSINFO_MAP_ENTRY(nsIMozNavigatorAudioChannelManager)
 #endif
 
   DOM_CLASSINFO_MAP_END
--- a/modules/libpref/src/init/all.js
+++ b/modules/libpref/src/init/all.js
@@ -735,19 +735,16 @@ pref("dom.xbl_scopes", true);
 pref("dom.omit_components_in_content", true);
 
 // Don't use new input types
 pref("dom.experimental_forms", false);
 
 // Don't enable <input type=range> yet:
 pref("dom.experimental_forms_range", true);
 
-// Enables system messages and activities
-pref("dom.sysmsg.enabled", false);
-
 // Allocation Threshold for Workers
 pref("dom.workers.mem.gc_allocation_threshold_mb", 30);
 
 // Parsing perf prefs. For now just mimic what the old code did.
 #ifndef XP_WIN
 pref("content.sink.pending_event_mode", 0);
 #endif