Bug 1217187 - Modify navigator.hasFeature method to detect new
authorJuan Gomez <jgomez@mozilla.com>
Tue, 27 Oct 2015 13:40:41 +0800
changeset 269592 3acb49afffb780bf44607538de40c2cc68fea8ff
parent 269591 080fb640f419b9f98418be0613a582fe75a9e852
child 269593 62c2a87afdb715a6817258a3d2dde103c873c49d
push id18326
push usergwagner@mozilla.com
push dateTue, 27 Oct 2015 05:41:17 +0000
treeherderb2g-inbound@3acb49afffb7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1217187
milestone44.0a1
Bug 1217187 - Modify navigator.hasFeature method to detect new replaceable homescreen and add the unit test. r=ehsan
dom/base/Navigator.cpp
dom/base/test/test_getFeature_with_perm.html
--- a/dom/base/Navigator.cpp
+++ b/dom/base/Navigator.cpp
@@ -1618,16 +1618,17 @@ Navigator::HasFeature(const nsAString& a
 
   // Hardcoded manifest features. Some are still b2g specific.
   const char manifestFeatures[][64] = {
     "manifest.origin"
   , "manifest.redirects"
 #ifdef MOZ_B2G
   , "manifest.chrome.navigation"
   , "manifest.precompile"
+  , "manifest.role.homescreen"
 #endif
   };
 
   nsAutoCString feature = NS_ConvertUTF16toUTF8(aName);
   for (uint32_t i = 0; i < MOZ_ARRAY_LENGTH(manifestFeatures); i++) {
     if (feature.Equals(manifestFeatures[i])) {
       p->MaybeResolve(true);
       return p.forget();
--- a/dom/base/test/test_getFeature_with_perm.html
+++ b/dom/base/test/test_getFeature_with_perm.html
@@ -121,16 +121,17 @@ SpecialPowers.pushPermissions([
   ok('hasFeature' in navigator, "navigator.hasFeature should exist");
   // B2G specific manifest features.
   // Touching navigator before pushPermissions makes it fail.
   if (!navigator.userAgent.includes("Android") &&
         /Mobile|Tablet/.test(navigator.userAgent)) {
     info("Adding B2G specific tests");
     tests.push(createManifestTest("manifest.chrome.navigation"));
     tests.push(createManifestTest("manifest.precompile"));
+    tests.push(createManifestTest("manifest.role.homescreen"));
   }
   runNextTest();
   ok(true, "Test DONE");
 });
 
 SimpleTest.waitForExplicitFinish();
 
 </script>