Add a "pre" polyfill

This is always run, but only the full webcomponents polyfill, it's very
small and isn't intrusive. This introduces a layer of indirection so that,
if the full polyfill is loaded, its monkeypatched constructor will be called
This commit is contained in:
Karl Seguin
2025-07-12 19:49:19 +08:00
parent 818f4540fd
commit 1602932d72
5 changed files with 55 additions and 4 deletions

View File

@@ -284,6 +284,9 @@ pub fn pageCreated(bc: anytype, page: *Page) !void {
if (bc.isolated_world) |*isolated_world| {
// We need to recreate the isolated world context
try isolated_world.createContext(page);
const polyfill = @import("../../browser/polyfill/polyfill.zig");
try polyfill.preload(bc.arena, &isolated_world.executor.js_context.?);
}
}