зеркало из https://github.com/mozilla/gecko-dev.git
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
This commit is contained in:
Родитель
093c63ada7
Коммит
f6229466f3
|
@ -880,7 +880,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);
|
||||
|
|
Загрузка…
Ссылка в новой задаче