зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
59561d1fd7
Коммит
4a02a0cdc2
|
@ -1679,7 +1679,7 @@ class Marionette(object):
|
||||||
return value
|
return value
|
||||||
|
|
||||||
def execute_script(self, script, script_args=(), new_sandbox=True,
|
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
|
"""Executes a synchronous JavaScript script, and returns the
|
||||||
result (or None if the script does return a value).
|
result (or None if the script does return a value).
|
||||||
|
|
||||||
|
@ -1749,14 +1749,13 @@ class Marionette(object):
|
||||||
"args": args,
|
"args": args,
|
||||||
"newSandbox": new_sandbox,
|
"newSandbox": new_sandbox,
|
||||||
"sandbox": sandbox,
|
"sandbox": sandbox,
|
||||||
"scriptTimeout": script_timeout,
|
|
||||||
"line": int(frame[1]),
|
"line": int(frame[1]),
|
||||||
"filename": filename}
|
"filename": filename}
|
||||||
rv = self._send_message("WebDriver:ExecuteScript", body, key="value")
|
rv = self._send_message("WebDriver:ExecuteScript", body, key="value")
|
||||||
return self._from_json(rv)
|
return self._from_json(rv)
|
||||||
|
|
||||||
def execute_async_script(self, script, script_args=(), new_sandbox=True,
|
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
|
"""Executes an asynchronous JavaScript script, and returns the
|
||||||
result (or None if the script does return a value).
|
result (or None if the script does return a value).
|
||||||
|
|
||||||
|
@ -1796,7 +1795,6 @@ class Marionette(object):
|
||||||
"args": args,
|
"args": args,
|
||||||
"newSandbox": new_sandbox,
|
"newSandbox": new_sandbox,
|
||||||
"sandbox": sandbox,
|
"sandbox": sandbox,
|
||||||
"scriptTimeout": script_timeout,
|
|
||||||
"line": int(frame[1]),
|
"line": int(frame[1]),
|
||||||
"filename": filename}
|
"filename": filename}
|
||||||
|
|
||||||
|
|
|
@ -24,10 +24,6 @@ class TestExecuteAsyncContent(MarionetteTestCase):
|
||||||
def test_execute_async_timeout(self):
|
def test_execute_async_timeout(self):
|
||||||
self.assertRaises(ScriptTimeoutException, self.marionette.execute_async_script, "var x = 1;")
|
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):
|
def test_no_timeout(self):
|
||||||
self.marionette.timeout.script = 10
|
self.marionette.timeout.script = 10
|
||||||
self.assertTrue(self.marionette.execute_async_script("""
|
self.assertTrue(self.marionette.execute_async_script("""
|
||||||
|
|
|
@ -388,11 +388,12 @@ class TestExecuteChrome(WindowManagerMixin, TestExecuteContent):
|
||||||
self.close_all_windows()
|
self.close_all_windows()
|
||||||
|
|
||||||
def test_async_script_timeout(self):
|
def test_async_script_timeout(self):
|
||||||
|
self.marionette.timeout.script = 0.1
|
||||||
with self.assertRaises(errors.ScriptTimeoutException):
|
with self.assertRaises(errors.ScriptTimeoutException):
|
||||||
self.marionette.execute_async_script("""
|
self.marionette.execute_async_script("""
|
||||||
var cb = arguments[arguments.length - 1];
|
const [cb] = arguments;
|
||||||
setTimeout(function() { cb() }, 2500);
|
setTimeout(() => cb(), 2500);
|
||||||
""", script_timeout=100)
|
""")
|
||||||
|
|
||||||
def test_lasting_side_effects(self):
|
def test_lasting_side_effects(self):
|
||||||
pass
|
pass
|
||||||
|
|
Загрузка…
Ссылка в новой задаче