Issue #2490 - Part 3: Give CSS rules a PreCreate hook so we can safely wrappercache them.

This commit is contained in:
Moonchild 2024-03-30 11:38:44 +01:00 • committed by roytam1
commit e510cc84af
2 changed files with 84 additions and 16 deletions

View file

@ -172,6 +172,29 @@ public:
}
};
// Makes sure that we always create our wrapper in the right global, so we won't
// cache one from the wrong global.
class nsCSSRuleSH : public nsDOMGenericSH
{
protected:
explicit nsCSSRuleSH(nsDOMClassInfoData* aData) : nsDOMGenericSH(aData)
{
}
virtual ~nsCSSRuleSH()
{
}
public:
NS_IMETHOD PreCreate(nsISupports *nativeObj, JSContext *cx,
JSObject *globalObj, JSObject **parentObj) override;
static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
{
return new nsCSSRuleSH(aData);
}
};
// A place to hang some static methods that we should really consider
// moving to be nsGlobalWindow member methods. See bug 1062418.
class nsWindowSH