Drop JSON.stringify stack overflow tests

This commit is contained in:
Alexey Shvayka 2020-03-25 14:41:12 +02:00 committed by Rick Waldron
parent dfc7ecc678
commit 8fe71e1f56
2 changed files with 0 additions and 70 deletions

View File

@ -1,35 +0,0 @@
// Copyright (C) 2020 Alexey Shvayka. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-json.stringify
description: >
Stack overflow due to infinite recursion in replacer throws an expected error.
---*/
var getStackOverflowError = function() {
try {
return getStackOverflowError();
} catch (err) {
return err;
}
};
var StackOverflowError = getStackOverflowError().constructor;
var obj = {};
var objReplacer = function() {
return {key: obj};
};
assert.throws(StackOverflowError, function() {
JSON.stringify(null, objReplacer);
});
var arr = [];
var arrReplacer = function() {
return [arr];
};
assert.throws(StackOverflowError, function() {
JSON.stringify(null, arrReplacer);
});

View File

@ -1,35 +0,0 @@
// Copyright (C) 2020 Alexey Shvayka. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-json.stringify
description: >
Stack overflow due to infinite recursion in toJSON throws an expected error.
---*/
var getStackOverflowError = function() {
try {
return getStackOverflowError();
} catch (err) {
return err;
}
};
var StackOverflowError = getStackOverflowError().constructor;
var obj = {};
obj.toJSON = function() {
return {key: obj};
};
assert.throws(StackOverflowError, function() {
JSON.stringify(obj);
});
var arr = [];
arr.toJSON = function() {
return [arr];
};
assert.throws(StackOverflowError, function() {
JSON.stringify(arr);
});