mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-06-11 17:46:32 -04:00
We'll have two types of contexts: one for pages and one for workers. They'll [probably] both be js.Context, but they'll have distinct FunctionTemplates attached to their global. The Worker template will only contain a small subset of the main Page's types, along with 1 or 2 of its own specific ones. The Snapshot now creates the templates for both, so that the Env contains the function templates for both contexts. Furthermore, having a "merged" view like this ensures that the env.template[N] indices are consistent between the two. However, the snapshot only attaches the Page-specific types to the snapshot context. This allows the Page-context to be created as-is (e.g. efficiently). The worker context will be created lazily, on demand, but from the templates loaded into the env (since, again, the env contains templates for both).