Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Whitelist "blob" and "data" schemes for Workers #5683

Closed
shanewholloway opened this issue May 20, 2020 · 2 comments
Closed

Whitelist "blob" and "data" schemes for Workers #5683

shanewholloway opened this issue May 20, 2020 · 2 comments
Labels
cli related to cli/ dir suggestion suggestions for new features (yet to be agreed) web related to Web APIs

Comments

@shanewholloway
Copy link

const blob_src = new Blob(['console.log("Worker from BLOB")'])

new Worker(URL.createObjectURL(blob_src), {type:'module'})

On deno 1.0.1 v8 8.4.300 typescript 3.9.2 results in the following unsupported scheme error:

error: Uncaught Error: Unsupported scheme "blob" for module "blob:http://deno-opaque-origin/953cec0c-2344-4c5b-89ee-c9e7b4de975e". Supported schemes: [
    "http",
    "https",
    "file",
]


Workers from Blob URLs is expected to work from what I see in #2726 and #2729.

Can the "blob" and "data" schemes be whitelisted for Deno Workers?

@shanewholloway shanewholloway changed the title Whitelist "blob" and "data" schemes for Workers Whitelist "blob" and "data" schemes for Workers May 20, 2020
@bartlomieju bartlomieju added cli related to cli/ dir feat new feature (which has been agreed to/accepted) web related to Web APIs labels May 21, 2020
@EliteScientist
Copy link

This would be nice. I'm working on a project where I need to dynamically spawn threads. I've attempted to use this method and received the same error. I attempted to make a worker that allows me to pass the model in and use dynamic imports to load the code and still get the same error.

The only other option I see is to create an internal HTTP Server that will serve the worker code. (I'd prefer not to do this because its bulky) but there is a huge need to be able to create Workers from code for our product.

Its not only whitelisting the blob and data urls but URL.createObjectURL was removed in 1.4.1 (not sure why as its in the spec).

I'm using 1.4.5 right now.

@bartlomieju bartlomieju mentioned this issue Dec 18, 2020
22 tasks
@kitsonk kitsonk added this to the 1.8.0 milestone Jan 21, 2021
@kitsonk kitsonk self-assigned this Jan 21, 2021
@kitsonk kitsonk added suggestion suggestions for new features (yet to be agreed) and removed feat new feature (which has been agreed to/accepted) labels Jan 21, 2021
@kitsonk kitsonk removed this from the 1.8.0 milestone Jan 21, 2021
@kitsonk
Copy link
Contributor

kitsonk commented Jan 21, 2021

As of 1.7 we have support for data: URLs.

Supporting blob/Object URLs is a lot more complex and so I have split if off as a suggestion in #9210. Closing this issue in lieu of that one.

@kitsonk kitsonk closed this as completed Jan 21, 2021
@kitsonk kitsonk removed their assignment Jan 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli related to cli/ dir suggestion suggestions for new features (yet to be agreed) web related to Web APIs
Projects
None yet
Development

No branches or pull requests

4 participants