Fix Convert to work for JSTYPE_VOID and make sure it reports an error. bug 394436, r=jst sr=brendan

This commit is contained in:
mrbkap@gmail.com 2007-09-22 14:09:51 -07:00
parent 51598ca325
commit dbdd20c732

View File

@ -789,9 +789,15 @@ XPC_XOW_Convert(JSContext *cx, JSObject *obj, JSType type, jsval *vp)
return JS_TRUE;
}
// Note: JSTYPE_VOID and JSTYPE_STRING are equivalent.
nsresult rv = IsWrapperSameOrigin(cx, wrappedObj);
if (NS_FAILED(rv) &&
(rv != NS_ERROR_DOM_PROP_ACCESS_DENIED || type != JSTYPE_STRING)) {
(rv != NS_ERROR_DOM_PROP_ACCESS_DENIED ||
(type != JSTYPE_STRING && type != JSTYPE_VOID))) {
// Ensure that we report some kind of error.
if (rv == NS_ERROR_DOM_PROP_ACCESS_DENIED) {
ThrowException(rv, cx);
}
return JS_FALSE;
}