Closed Bug 1378636 Opened 7 years ago Closed 7 years ago

Extension generated blob cannot run inline javascript

Categories

(WebExtensions :: General, defect)

53 Branch
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INVALID

People

(Reporter: danny0838, Unassigned)

References

Details

User Agent: Mozilla/5.0 (Windows NT 6.1; rv:53.0) Gecko/20100101 Firefox/53.0
Build ID: 20170518000419

Steps to reproduce:

Run the above code in an extension page (e.g. options.html):

var content = '<script>alert("Hello world");</script>';
var blob = new Blob([content], {type: "text/html"});
var url = URL.createObjectURL(blob);
window.open(url);


Actual results:

The alert does not run.


Expected results:

The alert should run since a blob generated by an extension is not considered a extension page and chrome (or browser) is not executable in it.

This works in Chrome.
Component: Untriaged → WebExtensions: General
Product: Firefox → Toolkit
Extension blob URLs run with the same privileges as the document that created them, which means that they have the same CSP. And extension CSPs do not allow inline scripts.
Status: UNCONFIRMED → RESOLVED
Closed: 7 years ago
Resolution: --- → INVALID
(In reply to Kris Maglione [:kmag] (long backlog; ping on IRC if you're blocked) from comment #1)
> Extension blob URLs run with the same privileges as the document that
> created them, which means that they have the same CSP. And extension CSPs do
> not allow inline scripts.

This behavior is different from Chromium (which extension blob URLs does not have extension privilege and CSP), and this behavior difference causes an incompatibility for extensions/addons. If there is no better rationale for "extension blob URLs run with the same privileges as the document that created them" (e.g. for security concerns), I think it'd better to make the behavior consistent with Chromium.
Product: Toolkit → WebExtensions
You need to log in before you can comment on or make changes to this bug.