Permalink
Browse files

Handle float in _convert_js_arg

This fixes 'gg' with QtWebEngine.
  • Loading branch information...
The-Compiler committed Aug 8, 2016
1 parent 96087bd commit 627f743c26f72792293126e12118d3e53f25d161
Showing with 2 additions and 1 deletion.
  1. +1 −1 qutebrowser/utils/javascript.py
  2. +1 −0 tests/unit/utils/test_javascript.py
@@ -55,7 +55,7 @@ def _convert_js_arg(arg):
return 'undefined'
elif isinstance(arg, str):
return '"{}"'.format(string_escape(arg))
- elif isinstance(arg, int):
+ elif isinstance(arg, (int, float)):
return str(arg)
else:
raise TypeError("Don't know how to handle {!r} of type {}!".format(
@@ -126,6 +126,7 @@ def test_real_escape_hypothesis(self, webframe, qtbot, text):
('foobar', '"foobar"'),
('foo\\bar', r'"foo\\bar"'),
(42, '42'),
+ (23.42, '23.42'),
(None, 'undefined'),
(object(), TypeError),
])

0 comments on commit 627f743

Please sign in to comment.