Open Bug 1374356 Opened 7 years ago

Keyword substitution with %s doesn't escape characters in javascript: URIs

Categories

(SeaMonkey :: Bookmarks & History, defect)

SeaMonkey 2.46 Branch
defect
Not set
normal

Tracking

(Not tracked)

UNCONFIRMED

People

(Reporter: psychonaut, Unassigned)

Details

Keyword substitution with %s apparently doesn't escape characters properly (or indeed not at all) in javascript: URIs.

Steps to reproduce:

1. Create a new bookmark with the following fields:
Keyword: foo
Location: javascript:document.location='https://www.google.com/search?hl=en&q=%s+site:'+document.location.hostname;
2. Point the browser to http://www.example.com/
3. In the location bar, type "foo c++"
4. Point the browser to http://www.example.com/
5. In the location bar, type "foo i'm a teapot"

Observed behaviour:

3a. Browser points to https://www.google.com/search?hl=en&q=c+++site:www.example.com
5a. Nothing happens

Expected behaviour:

3a. Browser should point to https://www.google.com/search?hl=en&q=c%2B%2B+site:www.example.com
5a. Browser should point to https://www.google.com/search?hl=en&q=i%27m+a+teapot+site:www.example.com

However, keyword substitution in bookmarks for http(s) URIs works as expected.  For example, if in Step 1 above you change the location to https://www.google.com/search?hl=en&q=%s then invoking the bookmarklet with arguments "c++" or "i'm a teapot" works fine.

See also Bug 123006, Comment 62.
You need to log in before you can comment on or make changes to this bug.