Bug 658909 - Remove GWNOJO for helper stubs. r=mrbkap

This commit is contained in:
Bobby Holley 2013-03-21 08:20:43 -07:00
parent e61c5d98a2
commit 606f6b8992

View File

@ -848,13 +848,21 @@ XPC_WN_MaybeResolvingStrictPropertyStub(JSContext *cx, JSHandleObject obj, JSHan
#define PRE_HELPER_STUB \
XPCWrappedNative* wrapper; \
nsIXPCScriptable* si; \
if (IS_SLIM_WRAPPER(obj)) { \
wrapper = nullptr; \
si = GetSlimWrapperProto(obj)->GetScriptableInfo()->GetCallback(); \
JSObject *unwrapped = js::UnwrapObjectChecked(obj, false); \
if (!unwrapped) { \
JS_ReportError(cx, "Permission denied to operate on object."); \
return false; \
} \
else \
{ \
wrapper = XPCWrappedNative::GetWrappedNativeOfJSObject(cx, obj); \
if (!IS_WRAPPER_CLASS(js::GetObjectClass(unwrapped))) { \
return Throw(NS_ERROR_XPC_BAD_OP_ON_WN_PROTO, cx); \
} \
if (IS_SLIM_WRAPPER_OBJECT(unwrapped)) { \
wrapper = nullptr; \
si = GetSlimWrapperProto(unwrapped)->GetScriptableInfo() \
->GetCallback(); \
} else { \
MOZ_ASSERT(IS_WN_WRAPPER_OBJECT(unwrapped)); \
wrapper = XPCWrappedNative::Get(unwrapped); \
THROW_AND_RETURN_IF_BAD_WRAPPER(cx, wrapper); \
si = wrapper->GetScriptableCallback(); \
} \
@ -1349,11 +1357,6 @@ XPCNativeScriptableShared::PopulateJSClass()
if (mFlags.WantCheckAccess())
mJSClass.base.checkAccess = XPC_WN_Helper_CheckAccess;
// Note that we *must* set the ObjectOps (even for the cases were it does
// not do much) because with these dynamically generated JSClasses, the
// code in XPCWrappedNative::GetWrappedNativeOfJSObject() needs to look
// for that these callback pointers in order to identify that a given
// JSObject represents a wrapper.
js::ObjectOps *ops = &mJSClass.base.ops;
ops->enumerate = XPC_WN_JSOp_Enumerate;
ops->thisObject = XPC_WN_JSOp_ThisObject;