Bug 1353074 - Run wrappedJSObject execute script tests in all sandboxes; r=maja_zf
☠☠ backed out by 7c7029cf53f5 ☠ ☠
authorAndreas Tolfsen <ato@mozilla.com>
Mon, 03 Apr 2017 19:19:05 +0100
changeset 558292 001f220710a211db655f98aa08b40d7b5911e4fc
parent 558291 9c1ca76fba9b8011a0349bbaff8ee09682734819
child 558293 0c075043bc43c7d312d7d7147ff4ea4f9aa71b2b
push id52860
push userbmo:walkingice0204@gmail.com
push dateFri, 07 Apr 2017 13:29:26 +0000
reviewersmaja_zf
bugs1353074
milestone55.0a1
Bug 1353074 - Run wrappedJSObject execute script tests in all sandboxes; r=maja_zf MozReview-Commit-ID: 5u2u5alGb7Z
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
@@ -205,31 +205,44 @@ class TestExecuteContent(MarionetteTestC
             "return global.barfoo;", new_sandbox=False), [42, 23])
 
     def test_sandbox_refresh_arguments(self):
         self.marionette.execute_script(
             "this.foobar = [arguments[0], arguments[1]]", [23, 42])
         self.assertEqual(self.marionette.execute_script(
             "return this.foobar", new_sandbox=False), [23, 42])
 
-    def test_wrappedjsobject(self):
+    def test_mutable_sandbox_wrappedjsobject(self):
+        self.assert_is_defined("window.wrappedJSObject")
+        with self.assertRaises(errors.JavascriptException):
+            self.marionette.execute_script("window.wrappedJSObject.foo = 1", sandbox=None)
+
+    def test_default_sandbox_wrappedjsobject(self):
+        self.assert_is_defined("window.wrappedJSObject", sandbox="default")
+
         try:
-            self.marionette.execute_script("window.wrappedJSObject.foo = 3")
-            self.assertEqual(
-                self.marionette.execute_script("return window.wrappedJSObject.foo"), 3)
+            self.marionette.execute_script(
+                "window.wrappedJSObject.foo = 4", sandbox="default")
+            self.assertEqual(self.marionette.execute_script(
+                "return window.wrappedJSObject.foo", sandbox="default"), 4)
         finally:
-            self.marionette.execute_script("delete window.wrappedJSObject.foo")
+            self.marionette.execute_script(
+                "delete window.wrappedJSObject.foo", sandbox="default")
 
     def test_system_sandbox_wrappedjsobject(self):
+        self.assert_is_defined("window.wrappedJSObject", sandbox="system")
+
         self.marionette.execute_script(
             "window.wrappedJSObject.foo = 4", sandbox="system")
         self.assertEqual(self.marionette.execute_script(
             "return window.wrappedJSObject.foo", sandbox="system"), 4)
 
     def test_system_dead_object(self):
+        self.assert_is_defined("window.wrappedJSObject", sandbox="system")
+
         self.marionette.execute_script(
             "window.wrappedJSObject.foo = function() { return 'yo' }",
             sandbox="system")
         self.marionette.execute_script(
             "dump(window.wrappedJSObject.foo)", sandbox="system")
 
         self.marionette.execute_script(
             "window.wrappedJSObject.foo = function() { return 'yolo' }",
@@ -369,17 +382,23 @@ class TestExecuteChrome(WindowManagerMix
         pass
 
     def test_return_web_element_nodelist(self):
         pass
 
     def test_window_set_timeout_is_not_cancelled(self):
         pass
 
-    def test_privileged_code_inspection(self):
+    def test_mutable_sandbox_wrappedjsobject(self):
+        pass
+
+    def test_default_sandbox_wrappedjsobject(self):
+        pass
+
+    def test_system_sandbox_wrappedjsobject(self):
         pass
 
     def test_access_chrome_objects_in_event_listeners(self):
         pass
 
 
 class TestElementCollections(MarionetteTestCase):