mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-05 06:32:30 +02:00
LibJS: Follow the spec more closely for tagged template literals
This resolves a FIXME in its code generation, particularly for: - Caching the template object - Setting the correct property attributes - Freezing the resulting objects This allows archive.org to load, which uses the Lit library. The Lit library caches these template objects to determine if a template has changed, allowing it to determine to do a full template rerender or only partially update the rendering. Before, we would always cause a full rerender on update because we didn't return the same template object. This caused issues with archive.org's code, I believe particularly with its router library, where we would constantly detach and reattach nodes unexpectedly, ending up with the page content not being attached to the router's custom element.
This commit is contained in:
committed by
Shannon Booth
parent
d766e41c94
commit
c4c9ac08ad
Notes:
github-actions[bot]
2026-01-06 22:26:30 +00:00
Author: https://github.com/Lubrsi Commit: https://github.com/LadybirdBrowser/ladybird/commit/c4c9ac08ad8 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/7355 Reviewed-by: https://github.com/shannonbooth
@@ -348,6 +348,7 @@ public:
|
||||
|
||||
[[nodiscard]] size_t next_global_variable_cache() { return m_next_global_variable_cache++; }
|
||||
[[nodiscard]] size_t next_property_lookup_cache() { return m_next_property_lookup_cache++; }
|
||||
[[nodiscard]] size_t next_template_object_cache() { return m_next_template_object_cache++; }
|
||||
|
||||
enum class DeduplicateConstant {
|
||||
Yes,
|
||||
@@ -426,6 +427,7 @@ private:
|
||||
u32 m_next_block { 1 };
|
||||
u32 m_next_property_lookup_cache { 0 };
|
||||
u32 m_next_global_variable_cache { 0 };
|
||||
u32 m_next_template_object_cache { 0 };
|
||||
FunctionKind m_enclosing_function_kind { FunctionKind::Normal };
|
||||
Vector<LabelableScope> m_continuable_scopes;
|
||||
Vector<LabelableScope> m_breakable_scopes;
|
||||
|
||||
Reference in New Issue
Block a user