wintercg / fetch

WinterCG changes to the WHATWG Fetch standard
https://fetch.spec.wintercg.org/
Other
24 stars 0 forks source link

RRS: Resolveable Resource Specifier #14

Closed frank-dspeed closed 1 year ago

frank-dspeed commented 2 years ago

The Concept of RRS maps directly to the MOJO::IPC dispatcher concept of ResourceIds that get resolved back to the real Resources

Why?

How?

Usecases

Problem: Allow the user to load and use local code with the browser context

it is mainly a concept of exposing dynamic module loading to userland via filePicker or other methods.

Problem: integrating a external graphics context directly into the canvas element or iframeelement videoelement imageelement

Allow Nativ HTML Elements to interact with dynamic registered nativ components.

Creating a fullscreen snapshot if there would be a component called gpu::0 via directly memCopy of the GPU buffer.

<img src="gpu::0"></img>

Internals

The Compositor (Shell, Browser) is able to expose IPC Channels to the serviceWorker / nodejs / deno which is able to translate the gpu::0 string to a real resourceId inside the IPC System and this way get a Handle Back for it to access.

the serviceWorker solves also write locks and all that for multiple context instances.

Successor over fetch proposal

as this allows to implement fetch as is with all its context restrictions as a none restricted fetch would be simply done by the net::https://domain.com/target.file call like it is already done internal on the C++ side.

browser implementations need to request permissions for dynamic module loads while host runtimes do not if they do not want to. it is a Runtime Shell depend.

think about it as Resolve Able Urls that do not get resolved by the Network Stack they are Internal ResolveableReferences defined as string Specifier.

this defines a Winterop component system using RRS as Specifiers Identifiers

Resolving a a module via reference inside v8

// result can be used after that via MessageChannels ports send to the context
// result can be used to supply fetch responses.
serviceWorker.load(fileHandle) // browser secure way without permissions as perimissions come from the fileHandle Request. Only localFiles
serviceWorker.load() // browser secure way without permissions as perimissions come from the fileHandle Request.
serviceWorker.load("net::https") 
serviceWorker.load("fs::/home/path/shared.so")