Bug 1025994 - Rewrite webapps-manage test. r=baku, a=test-only
authorDavid Chan <dchan@mozilla.com>
Thu, 26 Jun 2014 15:00:52 -0700
changeset 208658 7056302f99fe4d29e0cef33ec1bf007a1c141f21
parent 208657 87da0cff32d4919330ab970fbc2c4f12165cce30
child 208659 874c3fc4f6aeff61a934bb319c198de273b2c492
push id494
push userraliiev@mozilla.com
push dateMon, 25 Aug 2014 18:42:16 +0000
treeherdermozilla-release@a3cc3e46b571 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku, test-only
bugs1025994
milestone32.0a2
Bug 1025994 - Rewrite webapps-manage test. r=baku, a=test-only
dom/permission/tests/file_shim.html
dom/permission/tests/test_webapps-manage.html
--- a/dom/permission/tests/file_shim.html
+++ b/dom/permission/tests/file_shim.html
@@ -16,17 +16,23 @@ TestData.prototype = {
     }
 
     // only one of the 2 should be set
     if ((this.idl && this.webidl) ||
         (!this.idl && !this.webidl)) {
       return null;
     }
 
-    var obj = window.navigator[this.obj];
+    // split on . to allow nested props
+    var props = this.obj.split(".");
+    var obj = window.navigator;
+
+    for (var i = 0; i < props.length && obj !== undefined; i++) {
+      obj = obj[props[i]];
+    }
 
     if ((this.webidl && obj instanceof window[this.webidl]) ||
         (this.idl && obj instanceof SpecialPowers.Ci[this.idl])) {
       return obj;
     } else {
       return null;
     }
   },
--- a/dom/permission/tests/test_webapps-manage.html
+++ b/dom/permission/tests/test_webapps-manage.html
@@ -11,33 +11,20 @@ https://bugzilla.mozilla.org/show_bug.cg
 </head>
 <body>
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=815105">Mozilla Bug 815105 </a>
 <p id="display"></p>
 <div id="content" style="display: none"></div>
 <pre id="test">
 <script type="application/javascript;version=1.8" src="file_framework.js"></script>
 <script type="application/javascript;version=1.8">
-function verifier(success, failure) {
-  try {
-    var req = window.navigator.mozApps.mgmt.getAll();
-    req.onsuccess = function() {
-      success("Got mgmt");
-    }
-    req.onerror = function() {
-      failure("Got error");
-    }
-  } catch (e) {
-    failure("Got exception " + e);
-  }
-}
-
 var gData = [
   {
     perm: ["webapps-manage"],
-    verifier: verifier.toSource(),
+    obj: "mozApps.mgmt",
+    idl: "mozIDOMApplicationMgmt",
   }
 ]
 </script>
 </pre>
 </body>
 </html>