Bug 1122609 - Test that setting script_args for multiple execute_script calls in chrome scope works when the sanbox is reused.;r=jgriffin
authorChris Manchester <cmanchester@mozilla.com>
Tue, 20 Jan 2015 20:35:15 -0500
changeset 251950 8f41739aee272a56835f072f23baec3535f4b438
parent 251949 077140ba65d0ffab8395545496e21d963c01baf5
child 251951 ffa9eece82875fb681722503aa78d66086391cfb
push id4610
push userjlund@mozilla.com
push dateMon, 30 Mar 2015 18:32:55 +0000
treeherdermozilla-beta@4df54044d9ef [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjgriffin
bugs1122609
milestone38.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1122609 - Test that setting script_args for multiple execute_script calls in chrome scope works when the sanbox is reused.;r=jgriffin
testing/marionette/client/marionette/tests/unit/test_execute_async_script.py
testing/marionette/client/marionette/tests/unit/test_execute_script.py
--- a/testing/marionette/client/marionette/tests/unit/test_execute_async_script.py
+++ b/testing/marionette/client/marionette/tests/unit/test_execute_async_script.py
@@ -90,16 +90,31 @@ marionetteScriptFinished(4);
         self.assertEqual(self.marionette.execute_async_script(
             "marionetteScriptFinished(this.foobar);", new_sandbox=False), [23, 42])
 
         self.marionette.execute_async_script("global.barfoo = [42, 23];"
                                              "marionetteScriptFinished();")
         self.assertEqual(self.marionette.execute_async_script(
             "marionetteScriptFinished(global.barfoo);", new_sandbox=False), [42, 23])
 
+    def test_sandbox_refresh_arguments(self):
+        self.marionette.execute_async_script("this.foobar = [arguments[0], arguments[1]];"
+                                             "marionetteScriptFinished();",
+                                             script_args=[23, 42])
+        self.assertEqual(self.marionette.execute_async_script(
+            "marionetteScriptFinished(this.foobar);", new_sandbox=False),
+                         [23, 42])
+
+        self.marionette.execute_async_script("global.barfoo = [arguments[0], arguments[1]];"
+                                             "marionetteScriptFinished()",
+                                             script_args=[42, 23], new_sandbox=False)
+        self.assertEqual(self.marionette.execute_async_script(
+            "marionetteScriptFinished(global.barfoo);", new_sandbox=False),
+                         [42, 23])
+
 
 class TestExecuteAsyncChrome(TestExecuteAsyncContent):
     def setUp(self):
         super(TestExecuteAsyncChrome, self).setUp()
         self.marionette.set_context("chrome")
 
     def test_execute_async_unload(self):
         pass
--- a/testing/marionette/client/marionette/tests/unit/test_execute_script.py
+++ b/testing/marionette/client/marionette/tests/unit/test_execute_script.py
@@ -67,16 +67,28 @@ let prefs = Components.classes["@mozilla
     def test_sandbox_reuse(self):
         # Sandboxes between `execute_script()` invocations are shared.
         self.marionette.execute_script("this.foobar = [23, 42];")
         self.assertEqual(self.marionette.execute_script("return this.foobar;", new_sandbox=False), [23, 42])
 
         self.marionette.execute_script("global.barfoo = [42, 23];")
         self.assertEqual(self.marionette.execute_script("return global.barfoo;", new_sandbox=False), [42, 23])
 
+    def test_sandbox_refresh_arguments(self):
+        self.marionette.execute_script("this.foobar = [arguments[0], arguments[1]];",
+                                       script_args=[23, 42])
+        self.assertEqual(self.marionette.execute_script("return this.foobar;", new_sandbox=False),
+                         [23, 42])
+
+        self.marionette.execute_script("global.barfoo = [arguments[0], arguments[1]];",
+                                       script_args=[42, 23],
+                                       new_sandbox=False)
+        self.assertEqual(self.marionette.execute_script("return global.barfoo;", new_sandbox=False),
+                         [42, 23])
+
     def test_that_we_can_pass_in_floats(self):
         expected_result = 1.2
         result = self.marionette.execute_script("return arguments[0]",
                                                 [expected_result])
         self.assertTrue(isinstance(result, float))
         self.assertEqual(result, expected_result)
 
     def test_null_argument(self):