mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1139964 part 2. Add classinfo helpers for the various message manager stuff to install WebIDL Exposed=System things on those globals. r=smaug
This commit is contained in:
parent
b8657d7de0
commit
ce73369f1b
@ -257,11 +257,15 @@ static nsDOMClassInfoData sClassInfoData[] = {
|
||||
NS_DEFINE_CLASSINFO_DATA(CSSFontFaceRule, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
|
||||
NS_DEFINE_CHROME_ONLY_CLASSINFO_DATA(ContentFrameMessageManager, nsEventTargetSH,
|
||||
NS_DEFINE_CHROME_ONLY_CLASSINFO_DATA(ContentFrameMessageManager,
|
||||
nsMessageManagerSH<nsEventTargetSH>,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS |
|
||||
nsIXPCScriptable::WANT_ENUMERATE |
|
||||
nsIXPCScriptable::IS_GLOBAL_OBJECT)
|
||||
NS_DEFINE_CHROME_ONLY_CLASSINFO_DATA(ContentProcessMessageManager, nsDOMGenericSH,
|
||||
NS_DEFINE_CHROME_ONLY_CLASSINFO_DATA(ContentProcessMessageManager,
|
||||
nsMessageManagerSH<nsDOMGenericSH>,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS |
|
||||
nsIXPCScriptable::WANT_ENUMERATE |
|
||||
nsIXPCScriptable::IS_GLOBAL_OBJECT)
|
||||
NS_DEFINE_CHROME_ONLY_CLASSINFO_DATA(ChromeMessageBroadcaster, nsDOMGenericSH,
|
||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||
@ -2587,3 +2591,42 @@ nsNonDOMObjectSH::GetFlags(uint32_t *aFlags)
|
||||
*aFlags = nsIClassInfo::MAIN_THREAD_ONLY | nsIClassInfo::SINGLETON_CLASSINFO;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// nsContentFrameMessageManagerSH
|
||||
|
||||
template<typename Super>
|
||||
NS_IMETHODIMP
|
||||
nsMessageManagerSH<Super>::Resolve(nsIXPConnectWrappedNative* wrapper,
|
||||
JSContext* cx, JSObject* obj_,
|
||||
jsid id_, bool* resolvedp,
|
||||
bool* _retval)
|
||||
{
|
||||
JS::Rooted<JSObject*> obj(cx, obj_);
|
||||
JS::Rooted<jsid> id(cx, id_);
|
||||
|
||||
*_retval = SystemGlobalResolve(cx, obj, id, resolvedp);
|
||||
NS_ENSURE_TRUE(*_retval, NS_ERROR_FAILURE);
|
||||
|
||||
if (*resolvedp) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return Super::Resolve(wrapper, cx, obj, id, resolvedp, _retval);
|
||||
}
|
||||
|
||||
template<typename Super>
|
||||
NS_IMETHODIMP
|
||||
nsMessageManagerSH<Super>::Enumerate(nsIXPConnectWrappedNative* wrapper,
|
||||
JSContext* cx, JSObject* obj_,
|
||||
bool* _retval)
|
||||
{
|
||||
JS::Rooted<JSObject*> obj(cx, obj_);
|
||||
|
||||
*_retval = SystemGlobalEnumerate(cx, obj);
|
||||
NS_ENSURE_TRUE(*_retval, NS_ERROR_FAILURE);
|
||||
|
||||
// Don't call up to our superclass, since neither nsDOMGenericSH nor
|
||||
// nsEventTargetSH have WANT_ENUMERATE.
|
||||
MOZ_ASSERT(!(this->GetScriptableFlags() & nsIXPCScriptable::WANT_ENUMERATE));
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -313,4 +313,29 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
template<typename Super>
|
||||
class nsMessageManagerSH : public Super
|
||||
{
|
||||
protected:
|
||||
explicit nsMessageManagerSH(nsDOMClassInfoData* aData)
|
||||
: Super(aData)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~nsMessageManagerSH()
|
||||
{
|
||||
}
|
||||
public:
|
||||
NS_IMETHOD Resolve(nsIXPConnectWrappedNative* wrapper, JSContext* cx,
|
||||
JSObject* obj_, jsid id_, bool* resolvedp,
|
||||
bool* _retval) MOZ_OVERRIDE;
|
||||
NS_IMETHOD Enumerate(nsIXPConnectWrappedNative* wrapper, JSContext* cx,
|
||||
JSObject* obj_, bool* _retval) MOZ_OVERRIDE;
|
||||
|
||||
static nsIClassInfo *doCreate(nsDOMClassInfoData* aData)
|
||||
{
|
||||
return new nsMessageManagerSH(aData);
|
||||
}
|
||||
};
|
||||
|
||||
#endif /* nsDOMClassInfo_h___ */
|
||||
|
Loading…
Reference in New Issue
Block a user