Skip to content

Commit

Permalink
Add quotes for strings in javascript.assemble
Browse files Browse the repository at this point in the history
  • Loading branch information
The-Compiler committed Aug 4, 2016
1 parent 08b70f0 commit a8ef956
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion qutebrowser/utils/javascript.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def _convert_js_arg(arg):
if arg is None:
return 'undefined'
elif isinstance(arg, str):
return string_escape(arg)
return '"{}"'.format(string_escape(arg))
elif isinstance(arg, int):
return str(arg)
else:
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/utils/test_javascript.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ def test_real_escape_hypothesis(self, webframe, qtbot, text):


@pytest.mark.parametrize('arg, expected', [
('foobar', 'foobar'),
('foo\\bar', r'foo\\bar'),
('foobar', '"foobar"'),
('foo\\bar', r'"foo\\bar"'),
(42, '42'),
(None, 'undefined'),
(object(), TypeError),
Expand Down

0 comments on commit a8ef956

Please sign in to comment.