jscript: Avoid crash when calling stringify() with no arguments.
Signed-off-by: Zebediah Figura <z.figura12@gmail.com> Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
2e9b17922e
commit
bf47aebdee
|
@ -768,6 +768,12 @@ static HRESULT JSON_stringify(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, un
|
||||||
|
|
||||||
TRACE("\n");
|
TRACE("\n");
|
||||||
|
|
||||||
|
if(!argc) {
|
||||||
|
if(r)
|
||||||
|
*r = jsval_undefined();
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|
||||||
if(argc >= 2 && is_object_instance(argv[1])) {
|
if(argc >= 2 && is_object_instance(argv[1])) {
|
||||||
FIXME("Replacer %s not yet supported\n", debugstr_jsval(argv[1]));
|
FIXME("Replacer %s not yet supported\n", debugstr_jsval(argv[1]));
|
||||||
return E_NOTIMPL;
|
return E_NOTIMPL;
|
||||||
|
|
|
@ -1810,6 +1810,7 @@ ok(isNaN(tmp), "Math.tan(-Infinity) is not NaN");
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var stringify_tests = [
|
var stringify_tests = [
|
||||||
|
[[], undefined],
|
||||||
[[true], "true"],
|
[[true], "true"],
|
||||||
[[false], "false"],
|
[[false], "false"],
|
||||||
[[null], "null"],
|
[[null], "null"],
|
||||||
|
@ -1836,6 +1837,9 @@ ok(isNaN(tmp), "Math.tan(-Infinity) is not NaN");
|
||||||
"["+i+"] stringify(" + stringify_tests[i][0] + ") returned " + s + " expected " + stringify_tests[i][1]);
|
"["+i+"] stringify(" + stringify_tests[i][0] + ") returned " + s + " expected " + stringify_tests[i][1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
s = JSON.stringify();
|
||||||
|
ok(s === undefined, "stringify() returned " + s + " expected undefined");
|
||||||
|
|
||||||
s = JSON.stringify(testObj);
|
s = JSON.stringify(testObj);
|
||||||
ok(s === undefined || s === "undefined" /* broken on some old versions */,
|
ok(s === undefined || s === "undefined" /* broken on some old versions */,
|
||||||
"stringify(testObj) returned " + s + " expected undfined");
|
"stringify(testObj) returned " + s + " expected undfined");
|
||||||
|
|
Loading…
Reference in New Issue