Bug 963544 - Do not use NS_ENSURE_TRUE() in a few places and instead expand it to reduce WARNING messages. r=khuey
authorISHIKAWA, Chiaki <ishikawa@yk.rim.or.jp>
Mon, 27 Jan 2014 15:40:50 -0500
changeset 181439 363517e27efdc89d933ce8b2b5a4426a0e9dbfc4
parent 181438 31993b8e06cca7b45c0b9dd31e55e29cb00604b0
child 181440 6017d123b9da8d62d34ad25cd94a81f214ae60e4
push id3343
push userffxbld
push dateMon, 17 Mar 2014 21:55:32 +0000
treeherdermozilla-beta@2f7d3415f79f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskhuey
bugs963544
milestone29.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 963544 - Do not use NS_ENSURE_TRUE() in a few places and instead expand it to reduce WARNING messages. r=khuey
dom/base/Navigator.cpp
--- a/dom/base/Navigator.cpp
+++ b/dom/base/Navigator.cpp
@@ -1684,17 +1684,19 @@ Navigator::HasMobileMessageSupport(JSCon
 
 #ifndef MOZ_WEBSMS_BACKEND
   return false;
 #endif
 
   // First of all, the general pref has to be turned on.
   bool enabled = false;
   Preferences::GetBool("dom.sms.enabled", &enabled);
-  NS_ENSURE_TRUE(enabled, false);
+  if (!enabled) {
+    return false;
+  }
 
   NS_ENSURE_TRUE(win, false);
   NS_ENSURE_TRUE(win->GetDocShell(), false);
 
   if (!CheckPermission(win, "sms")) {
     return false;
   }
 
@@ -1705,17 +1707,19 @@ Navigator::HasMobileMessageSupport(JSCon
 bool
 Navigator::HasTelephonySupport(JSContext* cx, JSObject* aGlobal)
 {
   JS::Rooted<JSObject*> global(cx, aGlobal);
 
   // First of all, the general pref has to be turned on.
   bool enabled = false;
   Preferences::GetBool("dom.telephony.enabled", &enabled);
-  NS_ENSURE_TRUE(enabled, false);
+  if (!enabled) {
+    return false;
+  }
 
   nsCOMPtr<nsPIDOMWindow> win = GetWindowFromGlobal(global);
   return win && CheckPermission(win, "telephony");
 }
 
 /* static */
 bool
 Navigator::HasCameraSupport(JSContext* /* unused */, JSObject* aGlobal)
@@ -1886,17 +1890,19 @@ Navigator::HasInputMethodSupport(JSConte
 bool
 Navigator::HasDataStoreSupport(JSContext* cx, JSObject* aGlobal)
 {
   JS::Rooted<JSObject*> global(cx, aGlobal);
 
   // First of all, the general pref has to be turned on.
   bool enabled = false;
   Preferences::GetBool("dom.datastore.enabled", &enabled);
-  NS_ENSURE_TRUE(enabled, false);
+  if (!enabled) {
+    return false;
+  }
 
   // Just for testing, we can enable DataStore for any kind of app.
   if (Preferences::GetBool("dom.testing.datastore_enabled_for_hosted_apps", false)) {
     return true;
   }
 
   nsCOMPtr<nsPIDOMWindow> win = GetWindowFromGlobal(global);
   if (!win) {