diff --git a/qutebrowser/utils/javascript.py b/qutebrowser/utils/javascript.py index 93df8e70f..21b373dd1 100644 --- a/qutebrowser/utils/javascript.py +++ b/qutebrowser/utils/javascript.py @@ -59,6 +59,8 @@ def _convert_js_arg(arg): return str(arg).lower() elif isinstance(arg, (int, float)): return str(arg) + elif isinstance(arg, list): + return '[{}]'.format(', '.join(_convert_js_arg(e) for e in arg)) else: raise TypeError("Don't know how to handle {!r} of type {}!".format( arg, type(arg).__name__)) diff --git a/tests/unit/utils/test_javascript.py b/tests/unit/utils/test_javascript.py index 29e090fd0..0a196cfa1 100644 --- a/tests/unit/utils/test_javascript.py +++ b/tests/unit/utils/test_javascript.py @@ -84,6 +84,7 @@ class TestStringEscape: (None, 'undefined'), (object(), TypeError), (True, 'true'), + ([23, True, 'x'], '[23, true, "x"]'), ]) def test_convert_js_arg(arg, expected): if expected is TypeError: