Bug 1004864 - Use SpecialPowers.pushPermissions in test_messagemanager_targetchain.html. r=smaug, a=test-only
authorKan-Ru Chen <kanru@kanru.info>
Mon, 25 May 2015 02:58:00 -0400
changeset 266111 3ff03c918bdc
parent 266110 b0b76d0add0b
child 266112 9d2ba69b0ff3
push id4758
push userryanvm@gmail.com
push date2015-05-26 18:35 +0000
treeherdermozilla-beta@928e51389b65 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug, test-only
bugs1004864
milestone39.0
Bug 1004864 - Use SpecialPowers.pushPermissions in test_messagemanager_targetchain.html. r=smaug, a=test-only
dom/base/test/test_messagemanager_targetchain.html
--- a/dom/base/test/test_messagemanager_targetchain.html
+++ b/dom/base/test/test_messagemanager_targetchain.html
@@ -97,33 +97,27 @@
       document.addEventListener("test-event", function (e) {
         ok(false, "top document shouldn't receive test event from child");
       }, true);
       document.body.appendChild(iframe);
     }
 
     addEventListener("load", function() {
       var principal = SpecialPowers.wrap(document).nodePrincipal;
-      SpecialPowers.addPermission("browser", true, { url: SpecialPowers.wrap(principal.URI).spec,
-                                                     appId: principal.appId,
-                                                     isInBrowserElement: false });
-      SpecialPowers.addPermission("browser", true, { url: SpecialPowers.wrap(principal.URI).spec,
-                                                     appId: principal.appId,
-                                                     isInBrowserElement: true });
-      SpecialPowers.pushPrefEnv({
-        "set": [
-          ["dom.mozBrowserFramesEnabled", true],
-          ["dom.ipc.browser_frames.oop_by_default", false],
-        ]
-      }, runTests);
-    });
-    SimpleTest.registerCleanupFunction(function () {
-      var principal = SpecialPowers.wrap(document).nodePrincipal;
-      SpecialPowers.removePermission("browser", { url: SpecialPowers.wrap(principal.URI).spec,
-                                                  appId: principal.appId,
-                                                  isInBrowserElement: false });
-      SpecialPowers.removePermission("browser", { url: SpecialPowers.wrap(principal.URI).spec,
-                                                  appId: principal.appId,
-                                                  isInBrowserElement: true });
+      SpecialPowers.pushPermissions([
+        { "type": "browser", "allow": 1, "context": { "url": principal.URI.spec,
+                                                      "appId": principal.appId,
+                                                      "isInBrowserElement": false }},
+        { "type": "browser", "allow": 1, "context": { "url": principal.URI.spec,
+                                                      "appId": principal.appId,
+                                                      "isInBrowserElement": true }}
+      ], () => {
+        SpecialPowers.pushPrefEnv({
+          "set": [
+            ["dom.mozBrowserFramesEnabled", true],
+            ["dom.ipc.browser_frames.oop_by_default", false],
+          ]
+        }, runTests);
+      });
     });
   </script>
 </body>
 </html>