Truly independent web browser
LibWeb: Preserve scoped registry document association order
Andreas Kling0d217675b062
diff --git a/Libraries/LibGC/WeakHashSet.h b/Libraries/LibGC/WeakHashSet.hindex 72a7f1f57a3..2890cb2a167 100644--- a/Libraries/LibGC/WeakHashSet.h+++ b/Libraries/LibGC/WeakHashSet.h@@ -11,7 +11,7 @@namespace GC {-template<typename T>+template<typename T, bool IsOrdered = false>class WeakHashSet {struct InternalTraits : public DefaultTraits<Weak<T>> {static unsigned hash(Weak<T> const& value)@@ -20,7 +20,7 @@ class WeakHashSet {}};- using TableType = HashTable<Weak<T>, InternalTraits>;+ using TableType = HashTable<Weak<T>, InternalTraits, IsOrdered>;public:WeakHashSet() = default;@@ -153,4 +153,7 @@ private:size_t m_mutations_since_last_prune { 0 };};+template<typename T>+using OrderedWeakHashSet = WeakHashSet<T, true>;+}diff --git a/Libraries/LibWeb/HTML/CustomElements/CustomElementRegistry.h b/Libraries/LibWeb/HTML/CustomElements/CustomElementRegistry.hindex 2cf4aa2d8bd..3fe6cddd74e 100644--- a/Libraries/LibWeb/HTML/CustomElements/CustomElementRegistry.h+++ b/Libraries/LibWeb/HTML/CustomElements/CustomElementRegistry.h@@ -64,7 +64,8 @@ private:// https://html.spec.whatwg.org/multipage/custom-elements.html#scoped-document-set// Every CustomElementRegistry has a scoped document set, a set of Document objects, initially « ».// NB: This is a "weak set", see https://github.com/whatwg/html/issues/12092#issuecomment-3769252677- GC::WeakHashSet<DOM::Document> m_scoped_documents;+ // NB: Keep association order when defining elements across documents.+ GC::OrderedWeakHashSet<DOM::Document> m_scoped_documents;// https://html.spec.whatwg.org/multipage/custom-elements.html#custom-element-definition-set// Every CustomElementRegistry has a custom element definition set, a set of custom element definitions,diff --git a/Tests/LibWeb/TestConfig.ini b/Tests/LibWeb/TestConfig.iniindex e782b6d1df8..efbdb79fc8e 100644--- a/Tests/LibWeb/TestConfig.ini+++ b/Tests/LibWeb/TestConfig.ini@@ -1384,9 +1384,6 @@ Text/input/wpt-import/html/semantics/forms/form-submission-0/jsurl-navigation-th; Custom element registry test that times outText/input/wpt-import/custom-elements/registries/per-document.html-; Custom element test that has inconsistent passes/fails-Text/input/wpt-import/custom-elements/registries/scoped-registry-define-upgrade-order.html-; sizes attribute tests are flaky.Text/input/wpt-import/html/semantics/embedded-content/the-img-element/sizes/parse-a-sizes-attribute-display-none.htmlText/input/wpt-import/html/semantics/embedded-content/the-img-element/sizes/parse-a-sizes-attribute-width-1000px.html