Worker's importScript weird behaviour with blob urls |
||
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.
,
Sep 19 2017
Ping?
,
Jun 8 2018
|
||
►
Sign in to add a comment |
||
Comment 1 by shimazu@chromium.org
, Mar 24 2017Status: Assigned (was: Untriaged)