Bug 1157028 - Add feature detection for OpenMobile. r=ehsan, a=bajaj
authorFabrice Desré <fabrice@mozilla.com>
Wed, 22 Apr 2015 14:21:44 -0700
changeset 238238 0eaf53250fba2f9fad7e0a9a96dd7e0d8a041932
parent 238237 abdf81fc5e80ce9b1ee4b5d8a03eb9a2bc274259
child 238239 de84bccbc51dfda048bdf9d497293af68d159523
push id533
push userryanvm@gmail.com
push dateFri, 24 Apr 2015 16:09:28 +0000
treeherdermozilla-b2g37_v2_2@0eaf53250fba [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan, bajaj
bugs1157028
milestone37.0
Bug 1157028 - Add feature detection for OpenMobile. r=ehsan, a=bajaj
dom/base/Navigator.cpp
--- a/dom/base/Navigator.cpp
+++ b/dom/base/Navigator.cpp
@@ -111,16 +111,20 @@
 #include "mozilla/dom/ContentChild.h"
 
 #include "mozilla/dom/FeatureList.h"
 
 #ifdef MOZ_EME
 #include "mozilla/EMEUtils.h"
 #endif
 
+#ifdef MOZ_WIDGET_GONK
+#include <cutils/properties.h>
+#endif
+
 namespace mozilla {
 namespace dom {
 
 static bool sDoNotTrackEnabled = false;
 static bool sVibratorEnabled   = false;
 static uint32_t sMaxVibrateMS  = 0;
 static uint32_t sMaxVibrateListLen = 0;
 
@@ -1428,16 +1432,27 @@ Navigator::GetFeature(const nsAString& a
         mozilla::dom::ContentChild::GetSingleton();
       nsRefPtr<Promise> ipcRef(p);
       cc->SendGetSystemMemory(reinterpret_cast<uint64_t>(ipcRef.forget().take()));
     }
     return p.forget();
   } // hardware.memory
 #endif
 
+#ifdef MOZ_WIDGET_GONK
+  if (aName.EqualsLiteral("acl.version")) {
+    char value[PROPERTY_VALUE_MAX];
+    uint32_t len = property_get("persist.acl.version", value, nullptr);
+    if (len > 0) {
+      p->MaybeResolve(NS_ConvertUTF8toUTF16(value));
+      return p.forget();
+    }
+  }
+#endif
+
   p->MaybeResolve(JS::UndefinedHandleValue);
   return p.forget();
 }
 
 already_AddRefed<Promise>
 Navigator::HasFeature(const nsAString& aName, ErrorResult& aRv)
 {
   nsCOMPtr<nsIGlobalObject> go = do_QueryInterface(mWindow);