Closed Bug 1287645 Opened 8 years ago Closed 8 years ago

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

Categories

(WebExtensions :: Untriaged, defect)

defect
Not set
normal

Tracking

(firefox50 affected)

RESOLVED WONTFIX
Tracking Status
firefox50 --- affected

People

(Reporter: robwu, Unassigned)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

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: 8 years ago
Resolution: --- → WONTFIX
Product: Toolkit → WebExtensions
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: