Bug 1353074 - Run wrappedJSObject execute script tests in all sandboxes; r=maja_zf, a=test-only
authorAndreas Tolfsen <ato@mozilla.com>
Mon, 03 Apr 2017 19:19:05 +0100
changeset 396290 d47a756d658a3e418a947f2d5141e32a6f48295a
parent 396289 1f8a283d4a991ed70b3f154d7f36264319c11c04
child 396291 6f07c769efddb3071fbd5a8730d8f651c6a9b967
push id1468
push userasasaki@mozilla.com
push dateMon, 05 Jun 2017 19:31:07 +0000
treeherdermozilla-release@0641fc6ee9d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmaja_zf, test-only
bugs1353074
milestone54.0
Bug 1353074 - Run wrappedJSObject execute script tests in all sandboxes; r=maja_zf, a=test-only 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):