New issue
Advanced search Search tips

Issue 701889 link

Starred by 1 user

Issue metadata

Status: Assigned
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

Worker's importScript weird behaviour with blob urls

Project Member Reported by fs...@chromium.org, Mar 15 2017

Issue description

If you create a worker using the common snippet.

var blob = new Blob([document.getElementById('id').textContent]);
var worker = new Worker(URL.createObjectURL(blob));

And then inside the worker try to use importScripts("a.js"); it fails saying a.js is an invalid URL. If I do "http://mydomain:port/a.js", it works.

I'm not sure what the standards is on this, but it seems to comes from:

1. blob urls are of the format: "blob:http://mydomain:port/<blobid>"
2. workers keep the same protocol/host/port as requests (in this case is keeping "blob", but it probably should keep "http", "mydomain", "port").
3. because of that, importScript'ing "a.js", causes a import to "blob:a.js" which is invalid.
4. afaik, blob url's have the same origin policy as the creator, not as the blob. Hence the bug.

Even if this is theoretically "working as intended", I'd suggest it makes sense to revisit the standards to go around this or similar use cases.
 
Owner: nhiroki@chromium.org
Status: Assigned (was: Untriaged)
Could you take a look?

Comment 2 by fs...@chromium.org, Sep 19 2017

Ping?
Labels: WorkerBacklog

Sign in to add a comment