browser icon indicating copy to clipboard operation
browser copied to clipboard

Use v8 Snapshot to inject polyfills

Open krichprollsch opened this issue 1 month ago • 0 comments

We use JS polyfills to supports some web APIs. These polyfills are injected into v8 during page initialization.

The polyfill loader executes the pre-load part of the polyfill, and it lazy loads the reset by implementing a V8's callback on missing elements.

This lazy load is a hacking and not perfect way to inject polyfill, and we would prefer loading them all the time but faster.

Since we know these scripts are always the same, we would like to use a faster way to inject them into v8, one idea was to use the snapshot feature from v8. We had an attempt to implement them previously, but it didn't work. See https://github.com/lightpanda-io/zig-v8-fork/pull/82 and #845

krichprollsch avatar Oct 24 '25 10:10 krichprollsch