Bug 1353074 - Use tuples for script arguments; r=maja_zf
☠☠ backed out by 7c7029cf53f5 ☠ ☠
authorAndreas Tolfsen <ato@mozilla.com>
Mon, 03 Apr 2017 19:14:16 +0100
changeset 558288 8112153e07938722d989d6079d0e98ca3cedbac4
parent 558287 2670eec1ed8ab10cb44c7010d996fa28af565442
child 558289 23409efe536f0e06b74dd4fd69c3a3a620d33e57
push id52860
push userbmo:walkingice0204@gmail.com
push dateFri, 07 Apr 2017 13:29:26 +0000
reviewersmaja_zf
bugs1353074
milestone55.0a1
Bug 1353074 - Use tuples for script arguments; r=maja_zf The Python standard library uses tuples to define arguments for functions, whenever they are invoked through meta programming. The Marionette client only allows the list type for backwards compatibility, so we prefer tuples in this case. Another good argument for tuples is that tuples are immutable. MozReview-Commit-ID: 72zPzYvBz7Q
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
@@ -91,34 +91,34 @@ class TestExecuteContent(MarionetteTestC
     def test_no_return_value(self):
         self.assertIsNone(self.marionette.execute_script("true"))
 
     def test_argument_null(self):
         self.assertIsNone(self.marionette.execute_script("return arguments[0]", [None]))
 
     def test_argument_number(self):
         self.assertEqual(
-            1, self.marionette.execute_script("return arguments[0]", [1]))
+            1, self.marionette.execute_script("return arguments[0]", (1,)))
         self.assertEqual(
-            1.5, self.marionette.execute_script("return arguments[0]", [1.5]))
+            1.5, self.marionette.execute_script("return arguments[0]", (1.5,)))
 
     def test_argument_boolean(self):
-        self.assertTrue(self.marionette.execute_script("return arguments[0]", [True]))
+        self.assertTrue(self.marionette.execute_script("return arguments[0]", (True,)))
 
     def test_argument_string(self):
         self.assertEqual(
-            "foo", self.marionette.execute_script("return arguments[0]", ["foo"]))
+            "foo", self.marionette.execute_script("return arguments[0]", ("foo",)))
 
     def test_argument_array(self):
         self.assertEqual(
-            [1, 2], self.marionette.execute_script("return arguments[0]", [[1, 2]]))
+            [1, 2], self.marionette.execute_script("return arguments[0]", ([1, 2],)))
 
     def test_argument_object(self):
         self.assertEqual({"foo": 1}, self.marionette.execute_script(
-            "return arguments[0]", [{"foo": 1}]))
+            "return arguments[0]", ({"foo": 1},)))
 
     def test_globals(self):
         for property in globals:
             self.assert_is_defined(property)
         self.assert_is_defined("Components")
         self.assert_is_defined("window.wrappedJSObject")
 
     def test_system_globals(self):