Comment 38 for bug 605513

Revision history for this message
In , M-wada (m-wada) wrote :

> http://mxr.mozilla.org/comm-central/source/mozilla/js/xpconnect/src/XPCWrappedNativeJSOps.cpp#481
> 481 XPC_WN_OnlyIWrite_SetPropertyStub(JSContext *cx, JSHandleObject obj, JSHandleId id, JSBool strict,
> 484 return XPC_WN_OnlyIWrite_AddPropertyStub(cx, obj, id, vp);
> http://mxr.mozilla.org/comm-central/source/mozilla/js/xpconnect/src/XPCWrappedNativeJSOps.cpp#467
> 467 XPC_WN_OnlyIWrite_AddPropertyStub(JSContext *cx, JSHandleObject obj, JSHandleId id, JSMutableHandleValue vp)
> 473 // Allow only XPConnect to add/set the property
> 474 if (ccx.GetResolveName() == id)
> 475 return true;
> 477 return Throw(NS_ERROR_XPC_CANT_MODIFY_PROP_ON_WN, cx);

If apparent AddPropertyStub request for non-existent property, it should be NS_ERROR_XPC_CANT_CREATE_WN, or NS_ERROR_XPC_CANT_ADD_PROP_TO_WRAPPED_NATIVE, or one like NS_ERROR_XPC_CANT_CREATE_PROP_ON_WN.
If XPC_WN_OnlyIWrite_SetPropertyStub is called both when "setting of existent property" and "stting non-existent property" case, they should be separated to NS_ERROR_XPC_CANT_CREATE_WN(or NS_ERROR_XPC_CANT_ADD_PROP_TO_WRAPPED_NATIVE or one like NS_ERROR_XPC_CANT_CREATE_PROP_ON_WN) case and NS_ERROR_XPC_CANT_MODIFY_PROP_ON_WN case.

> http://mxr.mozilla.org/comm-central/source/mozilla/xpcom/base/ErrorList.h#608
> 608 ERROR(NS_ERROR_XPC_CANT_CREATE_WN, FAILURE(25)),
> http://mxr.mozilla.org/comm-central/source/mozilla/xpcom/base/ErrorList.h#629
> 629 ERROR(NS_ERROR_XPC_CANT_ADD_PROP_TO_WRAPPED_NATIVE, FAILURE(46)),
> http://mxr.mozilla.org/comm-central/source/mozilla/xpcom/base/ErrorList.h#635
> 635 ERROR(NS_ERROR_XPC_CANT_MODIFY_PROP_ON_WN, FAILURE(52)),