WebExtension cannot navigate to javascript:-URLs (in a content script)

RESOLVED WONTFIX

Status

defect
RESOLVED WONTFIX
3 years ago
Last year

People

(Reporter: robwu, Unassigned)

Tracking

(Blocks 1 bug)

Trunk
Dependency tree / graph

Firefox Tracking Flags

(firefox50 affected)

Details

Attachments

(1 attachment)

1. Load the attached WebExtension.
2. Visit example.com
3. Look at the console of the tab (Ctrl-Shift-K).

Expected:
Will call location.href = 'javascript:console.log("javascript:-URL from content script");' - you should see that message
javascript:-URL from content script
"This is an injected <script> and will now assign a javascript:-URL"
"javascript:-URL from injected <script>"

Actual:
The second line is missing, which indicates that navigating to javascript:-URL from the content script failed.
Attempting to open a javascript:-URL from the page itself succeeds, however (as seen from the last line).

Assigning to javascript:-URLs is used by some extensions to run code directly in the page, e.g. if they want to modify some JS variable of the page.
This is intentional:

http://searchfox.org/mozilla-central/source/docshell/base/nsDocShell.cpp#1451-1502
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → WONTFIX
Product: Toolkit → WebExtensions
You need to log in before you can comment on or make changes to this bug.