w3c / webextensions

Charter and administrivia for the WebExtensions Community Group (WECG)
Other
579 stars 50 forks source link

Proposal: webRequest worklets #461

Open nir-walkme opened 9 months ago

nir-walkme commented 9 months ago

It has been discussed many times that DNR does not support many use cases that were possible using Blocking webRequest. Some of the use cases are summarized in this meta ticket.

Some solutions were suggested by the browser vendors, but they are far from achieving reasonable functionality. The fact that DNR is declarative, limits its functionality and any solution based on it would probably be too limited.

Therefore I would like to suggest a non-declarative alternative to DNR and Blocking webRequest. I call it "webRequest worklets".

"webRequest worklets" would provide the benefits of DNR: security and performance, but with lower impact to developers.

How it works?

Benefits of "webRequest worklets":

Happy to hear your thoughts on this.

nir-walkme commented 9 months ago

@Celsius273 @hackademix @carlosjeurissen @ghostwords Happy to hear your thoughts on my proposal

tophf commented 9 months ago

Standard JS isn't the best choice for a worklet language probably as it's too flexible, it also has tons of built-in globals in globalThis that take time to initialize even with V8 snapshot technique, its interpreter is big as well.

The usual choice for this task is something lua-based like LuaJIT or eLua, which consume ~1000 times less memory and are much faster to start, their interpreter is much smaller and simpler and the JIT version is very performant.

ghostwords commented 9 months ago

Sounds like this would solve #302.

nir-walkme commented 9 months ago

The usual choice for this task is something lua-based like LuaJIT or eLua, which consume ~1000 times less memory and are much faster to start, their interpreter is much smaller and simpler and the JIT version is very performant.

Thanks for the suggestion. Is any lua-based language currently being used in browsers?

tophf commented 9 months ago

AFAIK none, because browser makers don't have worklets in a core performance-critical path, the currently existing use cases (audio processing or the Houdini project) have comparatively lax performance/memory restrictions.