Bug 477128 - Don't throw if XPCNativeWrapper is called as a function but passed a primitive value to allow for safe primitive testing. r+sr=jst a=dveditz
git-svn-id: svn://10.0.0.236/trunk@256562 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -807,7 +807,13 @@ XPCNativeWrapperCtor(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
|
||||
jsval native = argv[0];
|
||||
|
||||
if (JSVAL_IS_PRIMITIVE(native)) {
|
||||
return ThrowException(NS_ERROR_XPC_BAD_CONVERT_JS, cx);
|
||||
JSStackFrame *fp = nsnull;
|
||||
if (JS_FrameIterator(cx, &fp) && JS_IsConstructorFrame(cx, fp)) {
|
||||
return ThrowException(NS_ERROR_ILLEGAL_VALUE, cx);
|
||||
}
|
||||
|
||||
*rval = native;
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
JSObject *nativeObj = JSVAL_TO_OBJECT(native);
|
||||
|
||||
Reference in New Issue
Block a user