Bug 1353074 - Run Components permission test in all sandboxes; r=maja_zf
☠☠ backed out by 7c7029cf53f5 ☠ ☠
authorAndreas Tolfsen <ato@mozilla.com>
Mon, 03 Apr 2017 19:18:25 +0100
changeset 558291 9c1ca76fba9b8011a0349bbaff8ee09682734819
parent 558290 8dcd190a0a593331f0754cd00111e5c5a44cb6c2
child 558292 001f220710a211db655f98aa08b40d7b5911e4fc
push id52860
push userbmo:walkingice0204@gmail.com
push dateFri, 07 Apr 2017 13:29:26 +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)