Bug 1353074 - Run Components permission test in all sandboxes; r=maja_zf draft
authorAndreas Tolfsen <ato@mozilla.com>
Mon, 03 Apr 2017 19:18:25 +0100
changeset 567666 9d0cbc8e4f20d351314a165cd9ef32a0f22131fa
parent 567665 7d9c0650fa1a57730962e3e919d1723dc6866f90
child 567667 814ba78686c15173abaa3fdab789784335313f00
push id55659
push userbmo:ato@mozilla.com
push dateTue, 25 Apr 2017 11:34:29 +0000
reviewersmaja_zf
bugs1353074
milestone55.0a1
Bug 1353074 - Run Components permission test in all sandboxes; r=maja_zf The Components.classes constructor should throw an error in both the mutable and the "default" sandbox. MozReview-Commit-ID: C40nZNaVWwz
testing/marionette/harness/marionette_harness/tests/unit/test_execute_script.py
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_execute_script.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_execute_script.py
@@ -159,20 +159,20 @@ class TestExecuteContent(MarionetteTestC
 
         # by default execute_script pass the name of the python file
         self.assertIn(os.path.basename(__file__.replace(".pyc", ".py")),
                       cm.exception.stacktrace)
         self.assertIn("b is not defined", cm.exception.message)
         self.assertIn("return b", cm.exception.stacktrace)
 
     def test_permission(self):
-        with self.assertRaises(errors.JavascriptException):
-            self.marionette.execute_script("""
-                var c = Components.classes["@mozilla.org/preferences-service;1"];
-            """)
+        for sandbox in ["default", None]:
+            with self.assertRaises(errors.JavascriptException):
+               self.marionette.execute_script(
+                    "Components.classes['@mozilla.org/preferences-service;1']")
 
     def test_return_web_element(self):
         self.marionette.navigate(elements)
         expected = self.marionette.find_element(By.TAG_NAME, "p")
         actual = self.marionette.execute_script(
             "return document.querySelector('p')")
         self.assertEqual(expected, actual)