bug 1510929: marionette: remove script_timeout kwarg from client; r=whimboo

This removes the script_timeouts keyword argument from
Marionette#execute_script and #execute_async_script as it is not
compatible with the semantic meaning associated with null in WebDriver.

The script timeout duration for the session can instead be set
using Marionette#timeouts#script.

Depends on D13993

Differential Revision: https://phabricator.services.mozilla.com/D13994

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Andreas Tolfsen 2018-12-20 21:24:05 +00:00
Родитель 59561d1fd7
Коммит 4a02a0cdc2
3 изменённых файлов: 6 добавлений и 11 удалений

Просмотреть файл

@ -1679,7 +1679,7 @@ class Marionette(object):
return value
def execute_script(self, script, script_args=(), new_sandbox=True,
sandbox="default", script_timeout=None):
sandbox="default"):
"""Executes a synchronous JavaScript script, and returns the
result (or None if the script does return a value).
@ -1749,14 +1749,13 @@ class Marionette(object):
"args": args,
"newSandbox": new_sandbox,
"sandbox": sandbox,
"scriptTimeout": script_timeout,
"line": int(frame[1]),
"filename": filename}
rv = self._send_message("WebDriver:ExecuteScript", body, key="value")
return self._from_json(rv)
def execute_async_script(self, script, script_args=(), new_sandbox=True,
sandbox="default", script_timeout=None):
sandbox="default"):
"""Executes an asynchronous JavaScript script, and returns the
result (or None if the script does return a value).
@ -1796,7 +1795,6 @@ class Marionette(object):
"args": args,
"newSandbox": new_sandbox,
"sandbox": sandbox,
"scriptTimeout": script_timeout,
"line": int(frame[1]),
"filename": filename}

Просмотреть файл

@ -24,10 +24,6 @@ class TestExecuteAsyncContent(MarionetteTestCase):
def test_execute_async_timeout(self):
self.assertRaises(ScriptTimeoutException, self.marionette.execute_async_script, "var x = 1;")
def test_execute_async_unique_timeout(self):
self.assertEqual(2, self.marionette.execute_async_script("setTimeout(() => arguments[0](2), 2000);", script_timeout=5000))
self.assertRaises(ScriptTimeoutException, self.marionette.execute_async_script, "setTimeout(() => arguments[0](3), 2000);")
def test_no_timeout(self):
self.marionette.timeout.script = 10
self.assertTrue(self.marionette.execute_async_script("""

Просмотреть файл

@ -388,11 +388,12 @@ class TestExecuteChrome(WindowManagerMixin, TestExecuteContent):
self.close_all_windows()
def test_async_script_timeout(self):
self.marionette.timeout.script = 0.1
with self.assertRaises(errors.ScriptTimeoutException):
self.marionette.execute_async_script("""
var cb = arguments[arguments.length - 1];
setTimeout(function() { cb() }, 2500);
""", script_timeout=100)
const [cb] = arguments;
setTimeout(() => cb(), 2500);
""")
def test_lasting_side_effects(self):
pass