mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-11 16:32:59 +00:00
Backed out changeset 9356d8836ca8 (bug 1322080)
This commit is contained in:
parent
a69bf81efe
commit
5f2a9e53a6
@ -791,6 +791,16 @@ nsDOMClassInfo::PreCreate(nsISupports *nativeObj, JSContext *cx,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMClassInfo::AddProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
JSObject *obj, jsid id, JS::Handle<JS::Value> val,
|
||||
bool *_retval)
|
||||
{
|
||||
NS_WARNING("nsDOMClassInfo::AddProperty Don't call me!");
|
||||
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMClassInfo::GetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
JSObject *obj, jsid id, JS::Value *vp,
|
||||
@ -1954,6 +1964,16 @@ nsEventTargetSH::PreCreate(nsISupports *nativeObj, JSContext *cx,
|
||||
return *parentObj ? NS_OK : NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEventTargetSH::AddProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
JSObject *obj, jsid id, JS::Handle<JS::Value> val,
|
||||
bool *_retval)
|
||||
{
|
||||
nsEventTargetSH::PreserveWrapper(GetNative(wrapper, obj));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsEventTargetSH::PreserveWrapper(nsISupports *aNative)
|
||||
{
|
||||
|
@ -175,6 +175,9 @@ protected:
|
||||
public:
|
||||
NS_IMETHOD PreCreate(nsISupports *nativeObj, JSContext *cx,
|
||||
JSObject *globalObj, JSObject **parentObj) override;
|
||||
NS_IMETHOD AddProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
JSObject *obj, jsid id, JS::Handle<JS::Value> val,
|
||||
bool *_retval) override;
|
||||
|
||||
virtual void PreserveWrapper(nsISupports *aNative) override;
|
||||
};
|
||||
|
@ -40,7 +40,7 @@ interface nsIXPCScriptable : nsISupports
|
||||
const uint32_t WANT_PRECREATE = 1 << 0;
|
||||
// unused bit here
|
||||
// unused bit here
|
||||
// unused bit here
|
||||
const uint32_t WANT_ADDPROPERTY = 1 << 3;
|
||||
// unused bit here
|
||||
const uint32_t WANT_GETPROPERTY = 1 << 5;
|
||||
const uint32_t WANT_SETPROPERTY = 1 << 6;
|
||||
@ -77,6 +77,10 @@ interface nsIXPCScriptable : nsISupports
|
||||
void preCreate(in nsISupports nativeObj, in JSContextPtr cx,
|
||||
in JSObjectPtr globalObj, out JSObjectPtr parentObj);
|
||||
|
||||
boolean addProperty(in nsIXPConnectWrappedNative wrapper,
|
||||
in JSContextPtr cx, in JSObjectPtr obj, in jsid id,
|
||||
in jsval val);
|
||||
|
||||
boolean getProperty(in nsIXPConnectWrappedNative wrapper,
|
||||
in JSContextPtr cx, in JSObjectPtr obj, in jsid id,
|
||||
in JSValPtr vp);
|
||||
|
@ -34,6 +34,9 @@ XPC_MAP_CLASSNAME::GetScriptableFlags()
|
||||
#ifdef XPC_MAP_WANT_PRECREATE
|
||||
nsIXPCScriptable::WANT_PRECREATE |
|
||||
#endif
|
||||
#ifdef XPC_MAP_WANT_ADDPROPERTY
|
||||
nsIXPCScriptable::WANT_ADDPROPERTY |
|
||||
#endif
|
||||
#ifdef XPC_MAP_WANT_GETPROPERTY
|
||||
nsIXPCScriptable::WANT_GETPROPERTY |
|
||||
#endif
|
||||
@ -74,6 +77,11 @@ NS_IMETHODIMP XPC_MAP_CLASSNAME::PreCreate(nsISupports* nativeObj, JSContext * c
|
||||
{NS_ERROR("never called"); return NS_ERROR_NOT_IMPLEMENTED;}
|
||||
#endif
|
||||
|
||||
#ifndef XPC_MAP_WANT_ADDPROPERTY
|
||||
NS_IMETHODIMP XPC_MAP_CLASSNAME::AddProperty(nsIXPConnectWrappedNative* wrapper, JSContext * cx, JSObject * obj, jsid id, JS::HandleValue val, bool* _retval)
|
||||
{NS_ERROR("never called"); return NS_ERROR_NOT_IMPLEMENTED;}
|
||||
#endif
|
||||
|
||||
#ifndef XPC_MAP_WANT_GETPROPERTY
|
||||
NS_IMETHODIMP XPC_MAP_CLASSNAME::GetProperty(nsIXPConnectWrappedNative* wrapper, JSContext * cx, JSObject * obj, jsid id, JS::Value * vp, bool* _retval)
|
||||
{NS_WARNING("never called"); return NS_ERROR_NOT_IMPLEMENTED;}
|
||||
@ -131,6 +139,10 @@ NS_IMETHODIMP XPC_MAP_CLASSNAME::PostCreatePrototype(JSContext* cx, JSObject* pr
|
||||
#undef XPC_MAP_WANT_PRECREATE
|
||||
#endif
|
||||
|
||||
#ifdef XPC_MAP_WANT_ADDPROPERTY
|
||||
#undef XPC_MAP_WANT_ADDPROPERTY
|
||||
#endif
|
||||
|
||||
#ifdef XPC_MAP_WANT_GETPROPERTY
|
||||
#undef XPC_MAP_WANT_GETPROPERTY
|
||||
#endif
|
||||
|
@ -715,6 +715,15 @@ XPC_WN_MaybeResolvingDeletePropertyStub(JSContext* cx, HandleObject obj, HandleI
|
||||
return Throw(rv, cx); \
|
||||
return retval ? result.succeed() : result.failMethod();
|
||||
|
||||
static bool
|
||||
XPC_WN_Helper_AddProperty(JSContext* cx, HandleObject obj, HandleId id,
|
||||
HandleValue v)
|
||||
{
|
||||
PRE_HELPER_STUB
|
||||
AddProperty(wrapper, cx, obj, id, v, &retval);
|
||||
POST_HELPER_STUB
|
||||
}
|
||||
|
||||
bool
|
||||
XPC_WN_Helper_GetProperty(JSContext* cx, HandleObject obj, HandleId id,
|
||||
MutableHandleValue vp)
|
||||
@ -978,7 +987,9 @@ XPCNativeScriptableShared::XPCNativeScriptableShared(uint32_t aFlags,
|
||||
memset(cOps, 0, sizeof(js::ClassOps));
|
||||
mJSClass.cOps = cOps;
|
||||
|
||||
if (mFlags.UseJSStubForAddProperty())
|
||||
if (mFlags.WantAddProperty())
|
||||
cOps->addProperty = XPC_WN_Helper_AddProperty;
|
||||
else if (mFlags.UseJSStubForAddProperty())
|
||||
cOps->addProperty = nullptr;
|
||||
else if (mFlags.AllowPropModsDuringResolve())
|
||||
cOps->addProperty = XPC_WN_MaybeResolvingPropertyStub;
|
||||
|
@ -1428,6 +1428,7 @@ public:
|
||||
#define GET_IT(f_) const { return 0 != (mFlags & nsIXPCScriptable:: f_ ); }
|
||||
|
||||
bool WantPreCreate() GET_IT(WANT_PRECREATE)
|
||||
bool WantAddProperty() GET_IT(WANT_ADDPROPERTY)
|
||||
bool WantGetProperty() GET_IT(WANT_GETPROPERTY)
|
||||
bool WantSetProperty() GET_IT(WANT_SETPROPERTY)
|
||||
bool WantEnumerate() GET_IT(WANT_ENUMERATE)
|
||||
|
Loading…
Reference in New Issue
Block a user