diff --git a/test/built-ins/ShadowRealm/prototype/evaluate/throws-typeerror-from-ctor-realm.js b/test/built-ins/ShadowRealm/prototype/evaluate/throws-error-from-ctor-realm.js similarity index 67% rename from test/built-ins/ShadowRealm/prototype/evaluate/throws-typeerror-from-ctor-realm.js rename to test/built-ins/ShadowRealm/prototype/evaluate/throws-error-from-ctor-realm.js index c36eb672ac..2d7152e531 100644 --- a/test/built-ins/ShadowRealm/prototype/evaluate/throws-typeerror-from-ctor-realm.js +++ b/test/built-ins/ShadowRealm/prototype/evaluate/throws-error-from-ctor-realm.js @@ -14,14 +14,19 @@ assert.sameValue( ); var other = $262.createRealm().global; -var OtherTypeError = other.eval('TypeError'); -var OtherShadowRealm = other.eval('ShadowRealm'); +var OtherTypeError = other.TypeError; +var OtherSyntaxError = other.SyntaxError; +var OtherShadowRealm = other.ShadowRealm; var realm = Reflect.construct(OtherShadowRealm, []); + assert.throws(OtherTypeError, () => realm.evaluate('globalThis'), 'throws a TypeError if return value can not be wrapped'); +assert.throws(OtherTypeError, () => realm.evaluate('throw new Error()'), 'throws a TypeError if completion is abrupt'); + assert.throws(OtherTypeError, () => realm.evaluate(1), 'throws a TypeError if sourceText is not a string'); +assert.throws(OtherSyntaxError, () => realm.evaluate('...'), 'throws a SyntaxError if the sourceText is not valid'); const bogus = {}; assert.throws(OtherTypeError, function() { - realm.evaluate.call(bogus, ''); + realm.evaluate.call(bogus, 'This is invalid code and should not be evaluated'); }, 'throws a TypeError if this is not a ShadowRealm object'); diff --git a/test/built-ins/ShadowRealm/prototype/evaluate/validates-realm-object.js b/test/built-ins/ShadowRealm/prototype/evaluate/validates-realm-object.js index d0e90001a4..0955a810d3 100644 --- a/test/built-ins/ShadowRealm/prototype/evaluate/validates-realm-object.js +++ b/test/built-ins/ShadowRealm/prototype/evaluate/validates-realm-object.js @@ -17,5 +17,5 @@ const r = new ShadowRealm(); const bogus = {}; assert.throws(TypeError, function() { - r.evaluate.call(bogus, ''); + r.evaluate.call(bogus, 'This is invalid code and should not be evaluated'); }, 'throws a TypeError if this is not a ShadowRealm object');