Optimise WebExtension implementaion pt.1

This commit is contained in:
wuggy 2026-08-07 13:09:19 -07:00
commit 3be08bc94b
3 changed files with 22 additions and 19 deletions

View file

@ -16,6 +16,8 @@
#include "mozilla/dom/WebComponentsBinding.h"
#include "nsCycleCollectionParticipant.h"
#include "nsGenericHTMLElement.h"
#include "nsHashKeys.h"
#include "nsTHashtable.h"
#include "nsWrapperCache.h"
class nsDocument;
@ -166,6 +168,9 @@ struct CustomElementDefinition
// The list of attributes that this custom element observes.
nsCOMArray<nsIAtom> mObservedAttributes;
// Hash set for O(1) lookup of observed attributes.
nsTHashtable<nsISupportsHashKey> mObservedAttributesSet;
// The prototype to use for new custom elements of this type.
JS::Heap<JSObject *> mPrototype;
@ -189,7 +194,7 @@ struct CustomElementDefinition
return false;
}
return mObservedAttributes.Contains(aName);
return mObservedAttributesSet.Contains(aName);
}
private: