Enable strict mode testing for sm/JSON/parse-with-source.js

This commit is contained in:
André Bargull 2025-04-30 14:16:42 +02:00 committed by Philip Chimento
parent 15be7166d5
commit 0ee9b57cba

View File

@ -3,8 +3,6 @@
/*--- /*---
includes: [compareArray.js] includes: [compareArray.js]
flags:
- noStrict
description: | description: |
pending pending
esid: pending esid: pending
@ -121,11 +119,12 @@ features: [json-parse-with-source]
assert.sameValue(obj.rawJSON, "false"); assert.sameValue(obj.rawJSON, "false");
})(); })();
(function checkErrorsComeFromCorrectRealm() { // Check errors come from correct realm.
{
const otherGlobal = $262.createRealm().global; const otherGlobal = $262.createRealm().global;
assert.sameValue(TypeError !== otherGlobal.TypeError, true); assert.sameValue(TypeError !== otherGlobal.TypeError, true);
assertErrorComesFromCorrectRealm = (fun, thisRealmType) => { let assertErrorComesFromCorrectRealm = (fun, thisRealmType) => {
assert.throws(thisRealmType, () => fun(this), assert.throws(thisRealmType, () => fun(this),
`${thisRealmType.name} should come from this realm.`); `${thisRealmType.name} should come from this realm.`);
assert.throws(otherGlobal[thisRealmType.name], () => fun(otherGlobal), assert.throws(otherGlobal[thisRealmType.name], () => fun(otherGlobal),
@ -142,5 +141,4 @@ features: [json-parse-with-source]
assertErrorComesFromCorrectRealm((gbl) => gbl.JSON.rawJSON('123\n'), SyntaxError); assertErrorComesFromCorrectRealm((gbl) => gbl.JSON.rawJSON('123\n'), SyntaxError);
assertErrorComesFromCorrectRealm((gbl) => gbl.JSON.rawJSON('\t123'), SyntaxError); assertErrorComesFromCorrectRealm((gbl) => gbl.JSON.rawJSON('\t123'), SyntaxError);
assertErrorComesFromCorrectRealm((gbl) => gbl.JSON.rawJSON(''), SyntaxError); assertErrorComesFromCorrectRealm((gbl) => gbl.JSON.rawJSON(''), SyntaxError);
})(); }