Closed Bug 1280279 Opened 8 years ago Closed 8 years ago

moz-extension:blob cannot load on content script

Categories

(WebExtensions :: Untriaged, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: pasta0915, Unassigned)

Details

Attachments

(1 file)

1.38 KB, application/zip
Details
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36

Steps to reproduce:

Get a file from internet via XHR (xhr.responsetype='arraybuffer') on Background script and send this blob object url to content script. Then, get this blob object via XHR for avoid CSP.


Actual results:

On Chrome Extension, content script can load blob and inject it onto html But Firefox throw exception on content script.
Exception type is `NS_ERROR_DOM_BAD_URI`
I upload sample: https://github.com/pastak/moz-bug-1280279
Attached file Sample xpi
Anything you can XHR from the background script,you can also XHR from the content script (blob URLs excluded). And if you want to send data to the content script, just send the ArrayBuffer directly.
Status: UNCONFIRMED → RESOLVED
Closed: 8 years ago
Resolution: --- → WONTFIX
Send it how, exactly? `ArrayBuffer` isn't JSON-serialiazable.
Thanks. I noticed I can send ArrayBuffer encoded as Base64.  I successed.
Message passing uses structured clone, not JSON. You can send ArrayBuffers directly.
(In reply to Kris Maglione [:kmag] from comment #7)
> Message passing uses structured clone, not JSON. You can send ArrayBuffers
> directly.

So it does. Don't think I'm not pleased, but Chrome messaging uses JSON, not structured clone, so WONTFIX means new code is needed to pass `Blob`s in Firefox. Both incompatibilities should be documented.
https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Chrome_incompatibilities

(In reply to Kris Maglione [:kmag] from comment #4)
> Anything you can XHR from the background script,you can also XHR from the content script

In FF47 the content script is only able to load images from the page origin. If that has been fixed (has it?), then why can't this be fixed? If the content script can have a different CSP than the corresponding page, then this is only a question of adding an origin, so why WONTFIX?
Product: Toolkit → WebExtensions
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: