From 0a84a4f1766a5649bc29f5e823b7119a093a0b29 Mon Sep 17 00:00:00 2001 From: Rick Waldron Date: Fri, 9 Oct 2020 09:17:39 -0400 Subject: [PATCH] Forbidden Extensions: revised to check property existence --- ...dden-ext-direct-access-prop-arguments.case | 19 ++++++--- ...rbidden-ext-direct-access-prop-caller.case | 19 ++++++--- ...t-indirect-access-own-prop-caller-get.case | 34 ++++++++++++++++ ...indirect-access-own-prop-caller-value.case | 34 ++++++++++++++++ ...idden-ext-indirect-access-prop-caller.case | 22 ++++++++--- .../bullet-one/arrow-function.template | 8 ++-- .../bullet-one/async-arrow-function.template | 12 ++---- .../bullet-one/async-func-decl.template | 14 +++---- .../bullet-one/async-func-expr-named.template | 14 +++---- .../async-func-expr-nameless.template | 14 +++---- .../bullet-one/async-gen-func-decl.template | 14 +++---- .../bullet-one/async-gen-func-expr.template | 14 +++---- .../bullet-one/async-gen-meth.template | 14 +++---- .../async-gen-named-func-expr.template | 14 +++---- .../bullet-one/async-meth.template | 14 +++---- .../cls-decl-async-gen-meth-static.template | 14 +++---- .../cls-decl-async-gen-meth.template | 14 +++---- .../cls-decl-async-meth-static.template | 14 +++---- .../bullet-one/cls-decl-async-meth.template | 14 +++---- .../cls-decl-gen-meth-static.template | 12 +++--- .../bullet-one/cls-decl-gen-meth.template | 12 +++--- .../bullet-one/cls-decl-meth-static.template | 11 +++--- .../bullet-one/cls-decl-meth.template | 11 +++--- .../cls-expr-async-gen-meth-static.template | 14 +++---- .../cls-expr-async-gen-meth.template | 14 +++---- .../cls-expr-async-meth-static.template | 14 +++---- .../bullet-one/cls-expr-async-meth.template | 14 +++---- .../cls-expr-gen-meth-static.template | 12 +++--- .../bullet-one/cls-expr-gen-meth.template | 12 +++--- .../bullet-one/cls-expr-meth-static.template | 11 +++--- .../bullet-one/cls-expr-meth.template | 11 +++--- .../bullet-one/func-decl-strict.template | 11 +++--- .../bullet-one/func-decl.template | 21 ---------- .../bullet-one/func-expr-strict.template | 11 +++--- .../bullet-one/func-expr.template | 22 ----------- .../bullet-one/gen-func-decl.template | 10 ++--- .../bullet-one/gen-func-expr.template | 11 +++--- .../bullet-one/gen-meth.template | 10 ++--- .../bullet-one/meth.template | 10 ++--- .../bullet-two/arrow-function.template | 33 +++++++++++++--- .../bullet-two/async-arrow-function.template | 36 +++++++++++++---- .../bullet-two/async-func-decl.template | 38 +++++++++++++----- .../bullet-two/async-func-expr-named.template | 39 ++++++++++++++----- .../async-func-expr-nameless.template | 39 ++++++++++++++----- .../bullet-two/async-gen-func-decl.template | 38 +++++++++++++----- .../bullet-two/async-gen-func-expr.template | 38 +++++++++++++----- .../bullet-two/async-gen-meth.template | 38 +++++++++++++----- .../async-gen-named-func-expr.template | 38 +++++++++++++----- .../bullet-two/async-meth.template | 38 +++++++++++++----- .../cls-decl-async-gen-meth-static.template | 38 +++++++++++++----- .../cls-decl-async-gen-meth.template | 38 +++++++++++++----- .../cls-decl-async-meth-static.template | 38 +++++++++++++----- .../bullet-two/cls-decl-async-meth.template | 38 +++++++++++++----- .../cls-decl-gen-meth-static.template | 36 +++++++++++++---- .../bullet-two/cls-decl-gen-meth.template | 36 +++++++++++++---- .../bullet-two/cls-decl-meth-static.template | 35 ++++++++++++++--- .../bullet-two/cls-decl-meth.template | 35 ++++++++++++++--- .../cls-expr-async-gen-meth-static.template | 38 +++++++++++++----- .../cls-expr-async-gen-meth.template | 38 +++++++++++++----- .../cls-expr-async-meth-static.template | 38 +++++++++++++----- .../bullet-two/cls-expr-async-meth.template | 38 +++++++++++++----- .../cls-expr-gen-meth-static.template | 36 +++++++++++++---- .../bullet-two/cls-expr-gen-meth.template | 37 ++++++++++++++---- .../bullet-two/cls-expr-meth-static.template | 36 ++++++++++++++--- .../bullet-two/cls-expr-meth.template | 36 ++++++++++++++--- .../bullet-two/func-decl.template | 36 ++++++++++++++--- .../bullet-two/func-expr.template | 36 ++++++++++++++--- .../bullet-two/gen-func-decl.template | 36 ++++++++++++++--- .../bullet-two/gen-func-expr.template | 36 ++++++++++++++--- .../bullet-two/gen-meth.template | 34 +++++++++++++--- .../bullet-two/meth.template | 35 ++++++++++++++--- 71 files changed, 1202 insertions(+), 547 deletions(-) create mode 100644 src/function-forms/forbidden-ext-indirect-access-own-prop-caller-get.case create mode 100644 src/function-forms/forbidden-ext-indirect-access-own-prop-caller-value.case delete mode 100644 src/function-forms/forbidden-extensions/bullet-one/func-decl.template delete mode 100644 src/function-forms/forbidden-extensions/bullet-one/func-expr.template diff --git a/src/function-forms/forbidden-ext-direct-access-prop-arguments.case b/src/function-forms/forbidden-ext-direct-access-prop-arguments.case index fc0fb3aedb..ae1d1dd7b0 100644 --- a/src/function-forms/forbidden-ext-direct-access-prop-arguments.case +++ b/src/function-forms/forbidden-ext-direct-access-prop-arguments.case @@ -6,14 +6,23 @@ esid: sec-forbidden-extensions desc: > Forbidden extension, f.arguments info: | - ECMAScript function objects defined using syntactic constructors in strict mode code must not be created with own properties named "caller" or "arguments". Such own properties also must not be created for function objects defined using an ArrowFunction, MethodDefinition, GeneratorDeclaration, GeneratorExpression, AsyncGeneratorDeclaration, AsyncGeneratorExpression, ClassDeclaration, ClassExpression, AsyncFunctionDeclaration, AsyncFunctionExpression, or AsyncArrowFunction regardless of whether the definition is contained in strict mode code. Built-in functions, strict functions created using the Function constructor, generator functions created using the Generator constructor, async functions created using the AsyncFunction constructor, and functions created using the bind method also must not be created with such own properties. + ECMAScript function objects defined using syntactic constructors in strict mode code must + not be created with own properties named "caller" or "arguments". Such own properties also + must not be created for function objects defined using an ArrowFunction, MethodDefinition, + GeneratorDeclaration, GeneratorExpression, AsyncGeneratorDeclaration, AsyncGeneratorExpression, + ClassDeclaration, ClassExpression, AsyncFunctionDeclaration, AsyncFunctionExpression, or + AsyncArrowFunction regardless of whether the definition is contained in strict mode code. + Built-in functions, strict functions created using the Function constructor, generator functions + created using the Generator constructor, async functions created using the AsyncFunction + constructor, and functions created using the bind method also must not be created with such own + properties. flags: [noStrict] ---*/ -//- function-body -f.arguments; -//- method-body -this.method.arguments; +//- function-has-forbidden-property +f.hasOwnProperty("arguments") +//- method-has-forbidden-property +this.method.hasOwnProperty("arguments") //- error TypeError diff --git a/src/function-forms/forbidden-ext-direct-access-prop-caller.case b/src/function-forms/forbidden-ext-direct-access-prop-caller.case index dfbc139a16..f08222d118 100644 --- a/src/function-forms/forbidden-ext-direct-access-prop-caller.case +++ b/src/function-forms/forbidden-ext-direct-access-prop-caller.case @@ -6,14 +6,23 @@ esid: sec-forbidden-extensions desc: > Forbidden extension, o.caller info: | - ECMAScript function objects defined using syntactic constructors in strict mode code must not be created with own properties named "caller" or "arguments". Such own properties also must not be created for function objects defined using an ArrowFunction, MethodDefinition, GeneratorDeclaration, GeneratorExpression, AsyncGeneratorDeclaration, AsyncGeneratorExpression, ClassDeclaration, ClassExpression, AsyncFunctionDeclaration, AsyncFunctionExpression, or AsyncArrowFunction regardless of whether the definition is contained in strict mode code. Built-in functions, strict functions created using the Function constructor, generator functions created using the Generator constructor, async functions created using the AsyncFunction constructor, and functions created using the bind method also must not be created with such own properties. + ECMAScript function objects defined using syntactic constructors in strict mode code must + not be created with own properties named "caller" or "arguments". Such own properties also + must not be created for function objects defined using an ArrowFunction, MethodDefinition, + GeneratorDeclaration, GeneratorExpression, AsyncGeneratorDeclaration, AsyncGeneratorExpression, + ClassDeclaration, ClassExpression, AsyncFunctionDeclaration, AsyncFunctionExpression, or + AsyncArrowFunction regardless of whether the definition is contained in strict mode code. + Built-in functions, strict functions created using the Function constructor, generator functions + created using the Generator constructor, async functions created using the AsyncFunction + constructor, and functions created using the bind method also must not be created with such own + properties. flags: [noStrict] ---*/ -//- function-body -f.caller; -//- method-body -this.method.caller; +//- function-has-forbidden-property +f.hasOwnProperty("caller") +//- method-has-forbidden-property +this.method.hasOwnProperty("caller") //- error TypeError diff --git a/src/function-forms/forbidden-ext-indirect-access-own-prop-caller-get.case b/src/function-forms/forbidden-ext-indirect-access-own-prop-caller-get.case new file mode 100644 index 0000000000..23f4969f83 --- /dev/null +++ b/src/function-forms/forbidden-ext-indirect-access-own-prop-caller-get.case @@ -0,0 +1,34 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +template: forbidden-extensions/bullet-two +esid: sec-forbidden-extensions +desc: > + Forbidden extension, o.caller +info: | + If an implementation extends any function object with an own property named "caller" the value of + that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function + object. If it is an accessor property, the function that is the value of the property's [[Get]] + attribute must never return a strict function when called. + +flags: [noStrict] +---*/ + +//- setup +var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol(); +function inner() { + // This property may exist, but is forbidden from having a value that is a strict function object + return inner.hasOwnProperty("caller") + ? inner.caller + : CALLER_OWN_PROPERTY_DOES_NOT_EXIST; +} +//- define-own-caller +true +//- define-own-caller-descriptor +{get(){return 1}} +//- function-object +f +//- method-object +this.method +//- error +TypeError diff --git a/src/function-forms/forbidden-ext-indirect-access-own-prop-caller-value.case b/src/function-forms/forbidden-ext-indirect-access-own-prop-caller-value.case new file mode 100644 index 0000000000..3b9a5382e3 --- /dev/null +++ b/src/function-forms/forbidden-ext-indirect-access-own-prop-caller-value.case @@ -0,0 +1,34 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +template: forbidden-extensions/bullet-two +esid: sec-forbidden-extensions +desc: > + Forbidden extension, o.caller +info: | + If an implementation extends any function object with an own property named "caller" the value of + that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function + object. If it is an accessor property, the function that is the value of the property's [[Get]] + attribute must never return a strict function when called. + +flags: [noStrict] +---*/ + +//- setup +var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol(); +function inner() { + // This property may exist, but is forbidden from having a value that is a strict function object + return inner.hasOwnProperty("caller") + ? inner.caller + : CALLER_OWN_PROPERTY_DOES_NOT_EXIST; +} +//- define-own-caller +true +//- define-own-caller-descriptor +{value: 1} +//- function-object +f +//- method-object +this.method +//- error +TypeError diff --git a/src/function-forms/forbidden-ext-indirect-access-prop-caller.case b/src/function-forms/forbidden-ext-indirect-access-prop-caller.case index 972a89df7c..0198414d44 100644 --- a/src/function-forms/forbidden-ext-indirect-access-prop-caller.case +++ b/src/function-forms/forbidden-ext-indirect-access-prop-caller.case @@ -6,17 +6,29 @@ esid: sec-forbidden-extensions desc: > Forbidden extension, o.caller info: | - If an implementation extends any function object with an own property named "caller" the value of that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function object. If it is an accessor property, the function that is the value of the property's [[Get]] attribute must never return a strict function when called. + If an implementation extends any function object with an own property named "caller" the value of + that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function + object. If it is an accessor property, the function that is the value of the property's [[Get]] + attribute must never return a strict function when called. flags: [noStrict] ---*/ //- setup +var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol(); function inner() { - // This property is forbidden from having a value that is strict function object - return inner.caller; + // This property may exist, but is forbidden from having a value that is a strict function object + return inner.hasOwnProperty("caller") + ? inner.caller + : CALLER_OWN_PROPERTY_DOES_NOT_EXIST; } -//- body -inner().toString(); +//- define-own-caller +false +//- define-own-caller-descriptor +{} +//- function-object +f +//- method-object +this.method //- error TypeError diff --git a/src/function-forms/forbidden-extensions/bullet-one/arrow-function.template b/src/function-forms/forbidden-extensions/bullet-one/arrow-function.template index 7d21248e7a..fe80f3c5c8 100644 --- a/src/function-forms/forbidden-extensions/bullet-one/arrow-function.template +++ b/src/function-forms/forbidden-extensions/bullet-one/arrow-function.template @@ -6,16 +6,16 @@ name: arrow function expression esid: sec-arrow-function-definitions-runtime-semantics-evaluation info: | ArrowFunction : ArrowParameters => ConciseBody +features: [arrow-function] ---*/ var callCount = 0; var f; f = (/*{ params }*/) => { - /*{ function-body }*/ + assert.sameValue(/*{ function-has-forbidden-property }*/, false); callCount++; }; -assert.throws(/*{ error }*/, function() { + f(/*{ args }*/); -}); -assert.sameValue(callCount, 0, 'arrow function body not evaluated'); +assert.sameValue(callCount, 1, 'arrow function body evaluated'); diff --git a/src/function-forms/forbidden-extensions/bullet-one/async-arrow-function.template b/src/function-forms/forbidden-extensions/bullet-one/async-arrow-function.template index ee2d111fd6..0198125135 100644 --- a/src/function-forms/forbidden-extensions/bullet-one/async-arrow-function.template +++ b/src/function-forms/forbidden-extensions/bullet-one/async-arrow-function.template @@ -14,21 +14,17 @@ info: | { AsyncFunctionBody } flags: [async] -features: [async-functions] +features: [arrow-function, async-functions] ---*/ var callCount = 0; var f; f = async (/*{ params }*/) => { - /*{ function-body }*/ + assert.sameValue(/*{ function-has-forbidden-property }*/, false); callCount++; }; f(/*{ args }*/) - .then(_ => { - throw new Test262Error('function should not be resolved'); - }, error => assert.sameValue(error.constructor, /*{ error }*/)) .then(() => { - assert.sameValue(callCount, 0, 'function body is not evaluated'); - }, $DONE) - .then($DONE, $DONE); + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/src/function-forms/forbidden-extensions/bullet-one/async-func-decl.template b/src/function-forms/forbidden-extensions/bullet-one/async-func-decl.template index cef62fdffd..4857a44192 100644 --- a/src/function-forms/forbidden-extensions/bullet-one/async-func-decl.template +++ b/src/function-forms/forbidden-extensions/bullet-one/async-func-decl.template @@ -9,20 +9,16 @@ info: | AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } flags: [async] -features: [async-functions] +features: [arrow-function, async-functions] ---*/ var callCount = 0; -async function f(/*{ params }*/) { - /*{ function-body }*/ +async function f() { + assert.sameValue(/*{ function-has-forbidden-property }*/, false); callCount++; } f(/*{ args }*/) - .then(_ => { - throw new Test262Error('function should not be resolved'); - }, error => assert.sameValue(error.constructor, /*{ error }*/)) .then(() => { - assert.sameValue(callCount, 0, 'function body is not evaluated'); - }, $DONE) - .then($DONE, $DONE); + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/src/function-forms/forbidden-extensions/bullet-one/async-func-expr-named.template b/src/function-forms/forbidden-extensions/bullet-one/async-func-expr-named.template index 076c65b572..2ca7a50cc1 100644 --- a/src/function-forms/forbidden-extensions/bullet-one/async-func-expr-named.template +++ b/src/function-forms/forbidden-extensions/bullet-one/async-func-expr-named.template @@ -9,20 +9,16 @@ info: | AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } flags: [async] -features: [async-functions] +features: [arrow-function, async-functions] ---*/ var callCount = 0; -var f = async function f(/*{ params }*/) { - /*{ function-body }*/ +var f = async function f() { + assert.sameValue(/*{ function-has-forbidden-property }*/, false); callCount++; } f(/*{ args }*/) - .then(_ => { - throw new Test262Error('function should not be resolved'); - }, error => assert.sameValue(error.constructor, /*{ error }*/)) .then(() => { - assert.sameValue(callCount, 0, 'function body is not evaluated'); - }, $DONE) - .then($DONE, $DONE); + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/src/function-forms/forbidden-extensions/bullet-one/async-func-expr-nameless.template b/src/function-forms/forbidden-extensions/bullet-one/async-func-expr-nameless.template index d4eecd0e35..1bdad7dbc5 100644 --- a/src/function-forms/forbidden-extensions/bullet-one/async-func-expr-nameless.template +++ b/src/function-forms/forbidden-extensions/bullet-one/async-func-expr-nameless.template @@ -9,20 +9,16 @@ info: | AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody } flags: [async] -features: [async-functions] +features: [arrow-function, async-functions] ---*/ var callCount = 0; -var f = async function(/*{ params }*/) { - /*{ function-body }*/ +var f = async function() { + assert.sameValue(/*{ function-has-forbidden-property }*/, false); callCount++; } f(/*{ args }*/) - .then(_ => { - throw new Test262Error('function should not be resolved'); - }, error => assert.sameValue(error.constructor, /*{ error }*/)) .then(() => { - assert.sameValue(callCount, 0, 'function body is not evaluated'); - }, $DONE) - .then($DONE, $DONE); + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/src/function-forms/forbidden-extensions/bullet-one/async-gen-func-decl.template b/src/function-forms/forbidden-extensions/bullet-one/async-gen-func-decl.template index d1de68d029..92a00d026c 100644 --- a/src/function-forms/forbidden-extensions/bullet-one/async-gen-func-decl.template +++ b/src/function-forms/forbidden-extensions/bullet-one/async-gen-func-decl.template @@ -9,21 +9,17 @@ info: | AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } -features: [async-iteration] +features: [arrow-function, async-functions, async-iteration] flags: [async] ---*/ var callCount = 0; -async function* f(/*{ params }*/) { - /*{ function-body }*/ +async function* f() { + assert.sameValue(/*{ function-has-forbidden-property }*/, false); callCount++; } f(/*{ args }*/).next() - .then(_ => { - throw new Test262Error('function should not be resolved'); - }, error => assert.sameValue(error.constructor, /*{ error }*/)) .then(() => { - assert.sameValue(callCount, 0, 'function body is not evaluated'); - }, $DONE) - .then($DONE, $DONE); + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/src/function-forms/forbidden-extensions/bullet-one/async-gen-func-expr.template b/src/function-forms/forbidden-extensions/bullet-one/async-gen-func-expr.template index 4418c66cc2..f4869a3d09 100644 --- a/src/function-forms/forbidden-extensions/bullet-one/async-gen-func-expr.template +++ b/src/function-forms/forbidden-extensions/bullet-one/async-gen-func-expr.template @@ -9,22 +9,18 @@ info: | AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { AsyncGeneratorBody } -features: [async-iteration] +features: [arrow-function, async-functions, async-iteration] flags: [async] ---*/ var callCount = 0; var f; -f = async function*(/*{ params }*/) { - /*{ function-body }*/ +f = async function*() { + assert.sameValue(/*{ function-has-forbidden-property }*/, false); callCount++; }; f(/*{ args }*/).next() - .then(_ => { - throw new Test262Error('function should not be resolved'); - }, error => assert.sameValue(error.constructor, /*{ error }*/)) .then(() => { - assert.sameValue(callCount, 0, 'function body is not evaluated'); - }, $DONE) - .then($DONE, $DONE); + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/src/function-forms/forbidden-extensions/bullet-one/async-gen-meth.template b/src/function-forms/forbidden-extensions/bullet-one/async-gen-meth.template index 8423967fa8..60c108a9f4 100644 --- a/src/function-forms/forbidden-extensions/bullet-one/async-gen-meth.template +++ b/src/function-forms/forbidden-extensions/bullet-one/async-gen-meth.template @@ -9,23 +9,19 @@ info: | async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } -features: [async-iteration] +features: [arrow-function, async-iteration, generators] flags: [async] ---*/ var callCount = 0; var obj = { - async *method(/*{ params }*/) { - /*{ method-body }*/ + async *method() { + assert.sameValue(/*{ method-has-forbidden-property }*/, false); callCount++; } }; obj.method(/*{ args }*/).next() - .then(_ => { - throw new Test262Error('function should not be resolved'); - }, error => assert.sameValue(error.constructor, /*{ error }*/)) .then(() => { - assert.sameValue(callCount, 0, 'function body is not evaluated'); - }, $DONE) - .then($DONE, $DONE); + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/src/function-forms/forbidden-extensions/bullet-one/async-gen-named-func-expr.template b/src/function-forms/forbidden-extensions/bullet-one/async-gen-named-func-expr.template index db93fb7aa5..43d07f4d80 100644 --- a/src/function-forms/forbidden-extensions/bullet-one/async-gen-named-func-expr.template +++ b/src/function-forms/forbidden-extensions/bullet-one/async-gen-named-func-expr.template @@ -9,22 +9,18 @@ info: | AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } -features: [async-iteration] +features: [arrow-function, async-functions, async-iteration] flags: [async] ---*/ var callCount = 0; var f; -f = async function* g(/*{ params }*/) { - /*{ function-body }*/ +f = async function* g() { + assert.sameValue(/*{ function-has-forbidden-property }*/, false); callCount++; }; f(/*{ args }*/).next() - .then(_ => { - throw new Test262Error('function should not be resolved'); - }, error => assert.sameValue(error.constructor, /*{ error }*/)) .then(() => { - assert.sameValue(callCount, 0, 'function body is not evaluated'); - }, $DONE) - .then($DONE, $DONE); + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/src/function-forms/forbidden-extensions/bullet-one/async-meth.template b/src/function-forms/forbidden-extensions/bullet-one/async-meth.template index 1c6f58eb8a..62c6867024 100644 --- a/src/function-forms/forbidden-extensions/bullet-one/async-meth.template +++ b/src/function-forms/forbidden-extensions/bullet-one/async-meth.template @@ -9,23 +9,19 @@ info: | AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } flags: [async] -features: [async-functions] +features: [arrow-function, async-functions] ---*/ var callCount = 0; var obj = { - async method(/*{ params }*/) { - /*{ method-body }*/ + async method() { + assert.sameValue(/*{ method-has-forbidden-property }*/, false); callCount++; } }; obj.method(/*{ args }*/) - .then(_ => { - throw new Test262Error('function should not be resolved'); - }, error => assert.sameValue(error.constructor, /*{ error }*/)) .then(() => { - assert.sameValue(callCount, 0, 'function body is not evaluated'); - }, $DONE) - .then($DONE, $DONE); + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/src/function-forms/forbidden-extensions/bullet-one/cls-decl-async-gen-meth-static.template b/src/function-forms/forbidden-extensions/bullet-one/cls-decl-async-gen-meth-static.template index 8ae840c2ba..973a80fead 100644 --- a/src/function-forms/forbidden-extensions/bullet-one/cls-decl-async-gen-meth-static.template +++ b/src/function-forms/forbidden-extensions/bullet-one/cls-decl-async-gen-meth-static.template @@ -7,23 +7,19 @@ name: static class expression generator method esid: sec-runtime-semantics-bindingclassdeclarationevaluation info: | ClassDeclaration : class BindingIdentifier ClassTail -features: [async-iteration] +features: [arrow-function, async-functions, async-iteration, class] flags: [async] ---*/ var callCount = 0; class C { - static async *method(/*{ params }*/) { - /*{ method-body }*/ + static async *method() { + assert.sameValue(/*{ method-has-forbidden-property }*/, false); callCount++; } } C.method(/*{ args }*/).next() - .then(_ => { - throw new Test262Error('function should not be resolved'); - }, error => assert.sameValue(error.constructor, /*{ error }*/)) .then(() => { - assert.sameValue(callCount, 0, 'function body is not evaluated'); - }, $DONE) - .then($DONE, $DONE); + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/src/function-forms/forbidden-extensions/bullet-one/cls-decl-async-gen-meth.template b/src/function-forms/forbidden-extensions/bullet-one/cls-decl-async-gen-meth.template index aef39be3d2..54e5038ab0 100644 --- a/src/function-forms/forbidden-extensions/bullet-one/cls-decl-async-gen-meth.template +++ b/src/function-forms/forbidden-extensions/bullet-one/cls-decl-async-gen-meth.template @@ -6,23 +6,19 @@ name: class expression method esid: sec-class-definitions-runtime-semantics-evaluation info: | ClassDeclaration : class BindingIdentifier ClassTail -features: [async-iteration] +features: [arrow-function, async-functions, async-iteration, class, generators] flags: [async] ---*/ var callCount = 0; class C { - async *method(/*{ params }*/) { - /*{ method-body }*/ + async *method() { + assert.sameValue(/*{ method-has-forbidden-property }*/, false); callCount++; } } C.prototype.method(/*{ args }*/).next() - .then(_ => { - throw new Test262Error('function should not be resolved'); - }, error => assert.sameValue(error.constructor, /*{ error }*/)) .then(() => { - assert.sameValue(callCount, 0, 'function body is not evaluated'); - }, $DONE) - .then($DONE, $DONE); + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/src/function-forms/forbidden-extensions/bullet-one/cls-decl-async-meth-static.template b/src/function-forms/forbidden-extensions/bullet-one/cls-decl-async-meth-static.template index 7553add107..9a9121d489 100644 --- a/src/function-forms/forbidden-extensions/bullet-one/cls-decl-async-meth-static.template +++ b/src/function-forms/forbidden-extensions/bullet-one/cls-decl-async-meth-static.template @@ -7,23 +7,19 @@ name: static class declaration async method esid: sec-runtime-semantics-bindingclassdeclarationevaluation info: | ClassDeclaration : class BindingIdentifier ClassTail -features: [async-functions] +features: [arrow-function, async-functions, async-iteration, class] flags: [async] ---*/ var callCount = 0; class C { - static async method(/*{ params }*/) { - /*{ method-body }*/ + static async method() { + assert.sameValue(/*{ method-has-forbidden-property }*/, false); callCount++; } } C.method(/*{ args }*/) - .then(_ => { - throw new Test262Error('function should not be resolved'); - }, error => assert.sameValue(error.constructor, /*{ error }*/)) .then(() => { - assert.sameValue(callCount, 0, 'function body is not evaluated'); - }, $DONE) - .then($DONE, $DONE); + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/src/function-forms/forbidden-extensions/bullet-one/cls-decl-async-meth.template b/src/function-forms/forbidden-extensions/bullet-one/cls-decl-async-meth.template index d73b151f9d..d56cf83753 100644 --- a/src/function-forms/forbidden-extensions/bullet-one/cls-decl-async-meth.template +++ b/src/function-forms/forbidden-extensions/bullet-one/cls-decl-async-meth.template @@ -8,22 +8,18 @@ esid: sec-class-definitions-runtime-semantics-evaluation info: | ClassDeclaration : class BindingIdentifier ClassTail flags: [async] -features: [async-functions] +features: [arrow-function, async-functions, class] ---*/ var callCount = 0; class C { - async method(/*{ params }*/) { - /*{ method-body }*/ + async method() { + assert.sameValue(/*{ method-has-forbidden-property }*/, false); callCount++; } } C.prototype.method(/*{ args }*/) - .then(_ => { - throw new Test262Error('function should not be resolved'); - }, error => assert.sameValue(error.constructor, /*{ error }*/)) .then(() => { - assert.sameValue(callCount, 0, 'function body is not evaluated'); - }, $DONE) - .then($DONE, $DONE); + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/src/function-forms/forbidden-extensions/bullet-one/cls-decl-gen-meth-static.template b/src/function-forms/forbidden-extensions/bullet-one/cls-decl-gen-meth-static.template index a1b0a4fe74..25e1dfb3ae 100644 --- a/src/function-forms/forbidden-extensions/bullet-one/cls-decl-gen-meth-static.template +++ b/src/function-forms/forbidden-extensions/bullet-one/cls-decl-gen-meth-static.template @@ -6,19 +6,17 @@ name: static class expression generator method esid: sec-runtime-semantics-bindingclassdeclarationevaluation info: | ClassDeclaration : class BindingIdentifier ClassTail -features: [generators] +features: [class, generators] ---*/ var callCount = 0; class C { - static *method(/*{ params }*/) { - /*{ method-body }*/ + static *method() { + assert.sameValue(/*{ method-has-forbidden-property }*/, false); callCount++; } } -assert.throws(/*{ error }*/, function() { - C.method(/*{ args }*/).next(); -}); +C.method(/*{ args }*/).next(); +assert.sameValue(callCount, 1, 'method body evaluated'); -assert.sameValue(callCount, 0, 'method body not evaluated'); diff --git a/src/function-forms/forbidden-extensions/bullet-one/cls-decl-gen-meth.template b/src/function-forms/forbidden-extensions/bullet-one/cls-decl-gen-meth.template index 2740c1e0f9..f394e56622 100644 --- a/src/function-forms/forbidden-extensions/bullet-one/cls-decl-gen-meth.template +++ b/src/function-forms/forbidden-extensions/bullet-one/cls-decl-gen-meth.template @@ -6,18 +6,16 @@ name: class expression method esid: sec-class-definitions-runtime-semantics-evaluation info: | ClassDeclaration : class BindingIdentifier ClassTail -features: [generators] +features: [class, generators] ---*/ var callCount = 0; class C { - *method(/*{ params }*/) { - /*{ method-body }*/ + *method() { + assert.sameValue(/*{ method-has-forbidden-property }*/, false); callCount++; } } -assert.throws(/*{ error }*/, function() { - C.prototype.method(/*{ args }*/).next(); -}); -assert.sameValue(callCount, 0, 'method body not evaluated'); +C.prototype.method(/*{ args }*/).next(); +assert.sameValue(callCount, 1, 'method body evaluated'); diff --git a/src/function-forms/forbidden-extensions/bullet-one/cls-decl-meth-static.template b/src/function-forms/forbidden-extensions/bullet-one/cls-decl-meth-static.template index bb4d8b3605..e89a2755c3 100644 --- a/src/function-forms/forbidden-extensions/bullet-one/cls-decl-meth-static.template +++ b/src/function-forms/forbidden-extensions/bullet-one/cls-decl-meth-static.template @@ -6,17 +6,16 @@ name: static class expression method esid: sec-runtime-semantics-bindingclassdeclarationevaluation info: | ClassDeclaration : class BindingIdentifier ClassTail +features: [class] ---*/ var callCount = 0; class C { - static method(/*{ params }*/) { - /*{ method-body }*/ + static method() { + assert.sameValue(/*{ method-has-forbidden-property }*/, false); callCount++; } } -assert.throws(/*{ error }*/, function() { - C.method(/*{ args }*/); -}); -assert.sameValue(callCount, 0, 'method body not evaluated'); +C.method(/*{ args }*/); +assert.sameValue(callCount, 1, 'method body evaluated'); diff --git a/src/function-forms/forbidden-extensions/bullet-one/cls-decl-meth.template b/src/function-forms/forbidden-extensions/bullet-one/cls-decl-meth.template index d642ad9d3c..9434379cc3 100644 --- a/src/function-forms/forbidden-extensions/bullet-one/cls-decl-meth.template +++ b/src/function-forms/forbidden-extensions/bullet-one/cls-decl-meth.template @@ -6,17 +6,16 @@ name: class expression method esid: sec-runtime-semantics-bindingclassdeclarationevaluation info: | ClassDeclaration : class BindingIdentifier ClassTail +features: [class] ---*/ var callCount = 0; class C { - method(/*{ params }*/) { - /*{ method-body }*/ + method() { + assert.sameValue(/*{ method-has-forbidden-property }*/, false); callCount++; } } -assert.throws(/*{ error }*/, function() { - C.prototype.method(/*{ args }*/); -}); -assert.sameValue(callCount, 0, 'method body not evaluated'); +C.prototype.method(/*{ args }*/); +assert.sameValue(callCount, 1, 'method body evaluated'); diff --git a/src/function-forms/forbidden-extensions/bullet-one/cls-expr-async-gen-meth-static.template b/src/function-forms/forbidden-extensions/bullet-one/cls-expr-async-gen-meth-static.template index fe33b8e8fe..35f7f28357 100644 --- a/src/function-forms/forbidden-extensions/bullet-one/cls-expr-async-gen-meth-static.template +++ b/src/function-forms/forbidden-extensions/bullet-one/cls-expr-async-gen-meth-static.template @@ -6,23 +6,19 @@ name: static class expression async generator method esid: sec-class-definitions-runtime-semantics-evaluation info: | ClassExpression : class BindingIdentifieropt ClassTail -features: [async-iteration] +features: [arrow-function, async-functions, async-iteration, class] flags: [async] ---*/ var callCount = 0; var C = class { - static async *method(/*{ params }*/) { - /*{ method-body }*/ + static async *method() { + assert.sameValue(/*{ method-has-forbidden-property }*/, false); callCount++; } }; C.method(/*{ args }*/).next() - .then(_ => { - throw new Test262Error('function should not be resolved'); - }, error => assert.sameValue(error.constructor, /*{ error }*/)) .then(() => { - assert.sameValue(callCount, 0, 'function body is not evaluated'); - }, $DONE) - .then($DONE, $DONE); + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/src/function-forms/forbidden-extensions/bullet-one/cls-expr-async-gen-meth.template b/src/function-forms/forbidden-extensions/bullet-one/cls-expr-async-gen-meth.template index 6243aa2956..ca43394fda 100644 --- a/src/function-forms/forbidden-extensions/bullet-one/cls-expr-async-gen-meth.template +++ b/src/function-forms/forbidden-extensions/bullet-one/cls-expr-async-gen-meth.template @@ -6,23 +6,19 @@ name: class expression async generator method esid: sec-class-definitions-runtime-semantics-evaluation info: | ClassExpression : class BindingIdentifieropt ClassTail -features: [async-iteration] +features: [arrow-function, async-functions, async-iteration, class] flags: [async] ---*/ var callCount = 0; var C = class { - async *method(/*{ params }*/) { - /*{ method-body }*/ + async *method() { + assert.sameValue(/*{ method-has-forbidden-property }*/, false); callCount++; } }; C.prototype.method(/*{ args }*/).next() - .then(_ => { - throw new Test262Error('function should not be resolved'); - }, error => assert.sameValue(error.constructor, /*{ error }*/)) .then(() => { - assert.sameValue(callCount, 0, 'function body is not evaluated'); - }, $DONE) - .then($DONE, $DONE); + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/src/function-forms/forbidden-extensions/bullet-one/cls-expr-async-meth-static.template b/src/function-forms/forbidden-extensions/bullet-one/cls-expr-async-meth-static.template index 623e575795..1d4bb887f6 100644 --- a/src/function-forms/forbidden-extensions/bullet-one/cls-expr-async-meth-static.template +++ b/src/function-forms/forbidden-extensions/bullet-one/cls-expr-async-meth-static.template @@ -7,24 +7,20 @@ name: static class expression async method esid: sec-class-definitions-runtime-semantics-evaluation info: | ClassExpression : class BindingIdentifieropt ClassTail -features: [async-functions] +features: [arrow-function, async-functions, class] flags: [async] ---*/ var callCount = 0; var C = class { - static async method(/*{ params }*/) { - /*{ method-body }*/ + static async method() { + assert.sameValue(/*{ method-has-forbidden-property }*/, false); callCount++; } }; C.method(/*{ args }*/) - .then(_ => { - throw new Test262Error('function should not be resolved'); - }, error => assert.sameValue(error.constructor, /*{ error }*/)) .then(() => { - assert.sameValue(callCount, 0, 'function body is not evaluated'); - }, $DONE) - .then($DONE, $DONE); + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/src/function-forms/forbidden-extensions/bullet-one/cls-expr-async-meth.template b/src/function-forms/forbidden-extensions/bullet-one/cls-expr-async-meth.template index 3ed379baab..f65634d26e 100644 --- a/src/function-forms/forbidden-extensions/bullet-one/cls-expr-async-meth.template +++ b/src/function-forms/forbidden-extensions/bullet-one/cls-expr-async-meth.template @@ -7,23 +7,19 @@ name: class expression async method esid: sec-class-definitions-runtime-semantics-evaluation info: | ClassExpression : class BindingIdentifieropt ClassTail -features: [async-functions] +features: [arrow-function, async-functions, class] flags: [async] ---*/ var callCount = 0; var C = class { - async method(/*{ params }*/) { - /*{ method-body }*/ + async method() { + assert.sameValue(/*{ method-has-forbidden-property }*/, false); callCount++; } }; C.prototype.method(/*{ args }*/) - .then(_ => { - throw new Test262Error('function should not be resolved'); - }, error => assert.sameValue(error.constructor, /*{ error }*/)) .then(() => { - assert.sameValue(callCount, 0, 'function body is not evaluated'); - }, $DONE) - .then($DONE, $DONE); + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/src/function-forms/forbidden-extensions/bullet-one/cls-expr-gen-meth-static.template b/src/function-forms/forbidden-extensions/bullet-one/cls-expr-gen-meth-static.template index 0005511802..4e00322871 100644 --- a/src/function-forms/forbidden-extensions/bullet-one/cls-expr-gen-meth-static.template +++ b/src/function-forms/forbidden-extensions/bullet-one/cls-expr-gen-meth-static.template @@ -6,18 +6,16 @@ name: static class expression generator method esid: sec-class-definitions-runtime-semantics-evaluation info: | ClassExpression : class BindingIdentifieropt ClassTail -features: [generators] +features: [class, generators] ---*/ var callCount = 0; var C = class { - static *method(/*{ params }*/) { - /*{ method-body }*/ + static *method() { + assert.sameValue(/*{ method-has-forbidden-property }*/, false); callCount++; } }; -assert.throws(/*{ error }*/, function() { - C.method(/*{ args }*/).next(); -}); -assert.sameValue(callCount, 0, 'method body not evaluated'); +C.method(/*{ args }*/).next(); +assert.sameValue(callCount, 1, 'method body evaluated'); diff --git a/src/function-forms/forbidden-extensions/bullet-one/cls-expr-gen-meth.template b/src/function-forms/forbidden-extensions/bullet-one/cls-expr-gen-meth.template index e071751fa8..4e5777a25a 100644 --- a/src/function-forms/forbidden-extensions/bullet-one/cls-expr-gen-meth.template +++ b/src/function-forms/forbidden-extensions/bullet-one/cls-expr-gen-meth.template @@ -6,18 +6,16 @@ name: class expression method esid: sec-class-definitions-runtime-semantics-evaluation info: | ClassExpression : class BindingIdentifieropt ClassTail -features: [generators] +features: [class, generators] ---*/ var callCount = 0; var C = class { - *method(/*{ params }*/) { - /*{ method-body }*/ + *method() { + assert.sameValue(/*{ method-has-forbidden-property }*/, false); callCount++; } }; -assert.throws(/*{ error }*/, function() { - C.prototype.method(/*{ args }*/).next(); -}); -assert.sameValue(callCount, 0, 'method body not evaluated'); +C.prototype.method(/*{ args }*/).next(); +assert.sameValue(callCount, 1, 'method body evaluated'); diff --git a/src/function-forms/forbidden-extensions/bullet-one/cls-expr-meth-static.template b/src/function-forms/forbidden-extensions/bullet-one/cls-expr-meth-static.template index 29166ae650..436c45b1ba 100644 --- a/src/function-forms/forbidden-extensions/bullet-one/cls-expr-meth-static.template +++ b/src/function-forms/forbidden-extensions/bullet-one/cls-expr-meth-static.template @@ -6,17 +6,16 @@ name: static class expression method esid: sec-class-definitions-runtime-semantics-evaluation info: | ClassExpression : class BindingIdentifieropt ClassTail +features: [class] ---*/ var callCount = 0; var C = class { - static method(/*{ params }*/) { - /*{ method-body }*/ + static method() { + assert.sameValue(/*{ method-has-forbidden-property }*/, false); callCount++; } }; -assert.throws(/*{ error }*/, function() { - C.method(/*{ args }*/); -}); -assert.sameValue(callCount, 0, 'method body not evaluated'); +C.method(/*{ args }*/); +assert.sameValue(callCount, 1, 'method body evaluated'); diff --git a/src/function-forms/forbidden-extensions/bullet-one/cls-expr-meth.template b/src/function-forms/forbidden-extensions/bullet-one/cls-expr-meth.template index a60f2281d0..4456827c94 100644 --- a/src/function-forms/forbidden-extensions/bullet-one/cls-expr-meth.template +++ b/src/function-forms/forbidden-extensions/bullet-one/cls-expr-meth.template @@ -6,17 +6,16 @@ name: class expression method esid: sec-class-definitions-runtime-semantics-evaluation info: | ClassExpression : class BindingIdentifieropt ClassTail +features: [class] ---*/ var callCount = 0; var C = class { - method(/*{ params }*/) { - /*{ method-body }*/ + method() { + assert.sameValue(/*{ method-has-forbidden-property }*/, false); callCount++; } }; -assert.throws(/*{ error }*/, function() { - C.prototype.method(/*{ args }*/); -}); -assert.sameValue(callCount, 0, 'method body not evaluated'); +C.prototype.method(/*{ args }*/); +assert.sameValue(callCount, 1, 'method body evaluated'); diff --git a/src/function-forms/forbidden-extensions/bullet-one/func-decl-strict.template b/src/function-forms/forbidden-extensions/bullet-one/func-decl-strict.template index 5747b045d1..3ad1656557 100644 --- a/src/function-forms/forbidden-extensions/bullet-one/func-decl-strict.template +++ b/src/function-forms/forbidden-extensions/bullet-one/func-decl-strict.template @@ -10,12 +10,11 @@ info: | ---*/ var callCount = 0; -function f(/*{ params }*/) { +function f() { "use strict"; - /*{ function-body }*/ + assert.sameValue(/*{ function-has-forbidden-property }*/, false); callCount++; } -assert.throws(/*{ error }*/, function() { - f(/*{ args }*/); -}); -assert.sameValue(callCount, 0, 'function body not evaluated'); + +f(/*{ args }*/); +assert.sameValue(callCount, 1, 'function body evaluated'); diff --git a/src/function-forms/forbidden-extensions/bullet-one/func-decl.template b/src/function-forms/forbidden-extensions/bullet-one/func-decl.template deleted file mode 100644 index 0bb81df964..0000000000 --- a/src/function-forms/forbidden-extensions/bullet-one/func-decl.template +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (C) 2020 Rick Waldron. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -path: language/statements/function/forbidden-ext/b1/func-decl- -name: function declaration -esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject -info: | - FunctionDeclaration : - function BindingIdentifier ( FormalParameters ) { FunctionBody } - - In non-strict mode code, a function object created using the FunctionDeclaration - syntactic constructor, is not subject to the following forbidden extension: ----*/ - -var callCount = 0; -function f(/*{ params }*/) { - /*{ function-body }*/ - callCount++; -} -f(/*{ args }*/); -assert.sameValue(callCount, 1, 'function was evaluated'); diff --git a/src/function-forms/forbidden-extensions/bullet-one/func-expr-strict.template b/src/function-forms/forbidden-extensions/bullet-one/func-expr-strict.template index 1d604549c0..91c461749f 100644 --- a/src/function-forms/forbidden-extensions/bullet-one/func-expr-strict.template +++ b/src/function-forms/forbidden-extensions/bullet-one/func-expr-strict.template @@ -10,12 +10,11 @@ info: | var callCount = 0; var f; -f = function(/*{ params }*/) { +f = function() { "use strict"; - /*{ function-body }*/ + assert.sameValue(/*{ function-has-forbidden-property }*/, false); callCount++; }; -assert.throws(/*{ error }*/, function() { - f(/*{ args }*/); -}); -assert.sameValue(callCount, 0, 'function body not evaluated'); + +f(/*{ args }*/); +assert.sameValue(callCount, 1, 'function body evaluated'); diff --git a/src/function-forms/forbidden-extensions/bullet-one/func-expr.template b/src/function-forms/forbidden-extensions/bullet-one/func-expr.template deleted file mode 100644 index 106b09c12b..0000000000 --- a/src/function-forms/forbidden-extensions/bullet-one/func-expr.template +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (C) 2020 Rick Waldron. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. -/*--- -path: language/expressions/function/forbidden-ext/b1/func-expr- -name: function expression -esid: sec-function-definitions-runtime-semantics-evaluation -info: | - FunctionExpression : function ( FormalParameters ) { FunctionBody } - - In non-strict mode code, a function object created using the FunctionExpression - syntactic constructor, is not subject to the following forbidden extension: ----*/ - -var callCount = 0; -var f; -f = function(/*{ params }*/) { - /*{ function-body }*/ - callCount++; -}; -f(/*{ args }*/); - -assert.sameValue(callCount, 1, 'function was evaluated'); diff --git a/src/function-forms/forbidden-extensions/bullet-one/gen-func-decl.template b/src/function-forms/forbidden-extensions/bullet-one/gen-func-decl.template index bdd15ba469..bb8c16184e 100644 --- a/src/function-forms/forbidden-extensions/bullet-one/gen-func-decl.template +++ b/src/function-forms/forbidden-extensions/bullet-one/gen-func-decl.template @@ -10,13 +10,11 @@ features: [generators] ---*/ var callCount = 0; -function* f(/*{ params }*/) { - /*{ function-body }*/ +function* f() { + assert.sameValue(/*{ function-has-forbidden-property }*/, false); callCount++; } -assert.throws(/*{ error }*/, function() { - f(/*{ args }*/).next(); -}); +f(/*{ args }*/).next(); +assert.sameValue(callCount, 1, 'generator function body evaluated'); -assert.sameValue(callCount, 0, 'generator function body not evaluated'); diff --git a/src/function-forms/forbidden-extensions/bullet-one/gen-func-expr.template b/src/function-forms/forbidden-extensions/bullet-one/gen-func-expr.template index c21288160e..7c504958aa 100644 --- a/src/function-forms/forbidden-extensions/bullet-one/gen-func-expr.template +++ b/src/function-forms/forbidden-extensions/bullet-one/gen-func-expr.template @@ -11,12 +11,11 @@ features: [generators] var callCount = 0; var f; -f = function*(/*{ params }*/) { - /*{ function-body }*/ +f = function*() { + assert.sameValue(/*{ function-has-forbidden-property }*/, false); callCount++; }; -assert.throws(/*{ error }*/, function() { - f(/*{ args }*/).next(); -}); -assert.sameValue(callCount, 0, 'generator function body not evaluated'); +f(/*{ args }*/).next(); +assert.sameValue(callCount, 1, 'generator function body evaluated'); + diff --git a/src/function-forms/forbidden-extensions/bullet-one/gen-meth.template b/src/function-forms/forbidden-extensions/bullet-one/gen-meth.template index 91f11c6b53..b9e5ef8c46 100644 --- a/src/function-forms/forbidden-extensions/bullet-one/gen-meth.template +++ b/src/function-forms/forbidden-extensions/bullet-one/gen-meth.template @@ -13,13 +13,11 @@ features: [generators] var callCount = 0; var obj = { - *method(/*{ params }*/) { - /*{ method-body }*/ + *method() { + assert.sameValue(/*{ method-has-forbidden-property }*/, false); callCount++; } }; -assert.throws(/*{ error }*/, function() { - obj.method(/*{ args }*/).next(); -}); -assert.sameValue(callCount, 0, 'generator method body not evaluated'); +obj.method(/*{ args }*/).next(); +assert.sameValue(callCount, 1, 'generator method body evaluated'); diff --git a/src/function-forms/forbidden-extensions/bullet-one/meth.template b/src/function-forms/forbidden-extensions/bullet-one/meth.template index f56f5a2ddf..09b1f13875 100644 --- a/src/function-forms/forbidden-extensions/bullet-one/meth.template +++ b/src/function-forms/forbidden-extensions/bullet-one/meth.template @@ -10,13 +10,11 @@ info: | var callCount = 0; var obj = { - method(/*{ params }*/) { - /*{ method-body }*/ + method() { + assert.sameValue(/*{ method-has-forbidden-property }*/, false); callCount++; } }; -assert.throws(/*{ error }*/, function() { - obj.method(/*{ args }*/); -}); -assert.sameValue(callCount, 0, 'method body not evaluated'); +obj.method(/*{ args }*/); +assert.sameValue(callCount, 1, 'method body evaluated'); diff --git a/src/function-forms/forbidden-extensions/bullet-two/arrow-function.template b/src/function-forms/forbidden-extensions/bullet-two/arrow-function.template index 63c7242f55..882374547c 100644 --- a/src/function-forms/forbidden-extensions/bullet-two/arrow-function.template +++ b/src/function-forms/forbidden-extensions/bullet-two/arrow-function.template @@ -6,17 +6,40 @@ name: arrow function expression esid: sec-arrow-definitions-runtime-semantics-evaluation info: | ArrowFunction : ArrowParameters => ConciseBody +features: [arrow-function] ---*/ var callCount = 0; var f; f = (/*{ params }*/) => { "use strict"; - /*{ body }*/ + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + // the same templates. + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) { + Object.defineProperty(inner, "caller", /*{ define-own-caller-descriptor }*/); + } + var result = inner(); + if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, /*{ function-object }*/); + } callCount++; }; -assert.throws(/*{ error }*/, function() { - f(/*{ args }*/); -}); -assert.sameValue(callCount, 0, 'arrow function body not evaluated'); +f(/*{ args }*/); +assert.sameValue(callCount, 1, 'arrow function body evaluated'); diff --git a/src/function-forms/forbidden-extensions/bullet-two/async-arrow-function.template b/src/function-forms/forbidden-extensions/bullet-two/async-arrow-function.template index 402eecd6df..2ebda6f2de 100644 --- a/src/function-forms/forbidden-extensions/bullet-two/async-arrow-function.template +++ b/src/function-forms/forbidden-extensions/bullet-two/async-arrow-function.template @@ -14,22 +14,42 @@ info: | { AsyncFunctionBody } flags: [async] -features: [async-functions] +features: [arrow-function, async-functions] ---*/ var callCount = 0; var f; f = async (/*{ params }*/) => { "use strict"; - /*{ body }*/ + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + // the same templates. + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) { + Object.defineProperty(inner, "caller", /*{ define-own-caller-descriptor }*/); + } + var result = inner(); + if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, /*{ function-object }*/); + } callCount++; }; f(/*{ args }*/) - .then(_ => { - throw new Test262Error('function should not be resolved'); - }, error => assert.sameValue(error.constructor, /*{ error }*/)) .then(() => { - assert.sameValue(callCount, 0, 'function body is not evaluated'); - }, $DONE) - .then($DONE, $DONE); + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/src/function-forms/forbidden-extensions/bullet-two/async-func-decl.template b/src/function-forms/forbidden-extensions/bullet-two/async-func-decl.template index f97ad290d6..23cc29b1f0 100644 --- a/src/function-forms/forbidden-extensions/bullet-two/async-func-decl.template +++ b/src/function-forms/forbidden-extensions/bullet-two/async-func-decl.template @@ -9,21 +9,41 @@ info: | AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } flags: [async] -features: [async-functions] +features: [arrow-function, async-functions] ---*/ var callCount = 0; -async function f(/*{ params }*/) { +async function f() { "use strict"; - /*{ body }*/ + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + // the same templates. + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) { + Object.defineProperty(inner, "caller", /*{ define-own-caller-descriptor }*/); + } + var result = inner(); + if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, /*{ function-object }*/); + } callCount++; } f(/*{ args }*/) - .then(_ => { - throw new Test262Error('function should not be resolved'); - }, error => assert.sameValue(error.constructor, /*{ error }*/)) .then(() => { - assert.sameValue(callCount, 0, 'function body is not evaluated'); - }, $DONE) - .then($DONE, $DONE); + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/src/function-forms/forbidden-extensions/bullet-two/async-func-expr-named.template b/src/function-forms/forbidden-extensions/bullet-two/async-func-expr-named.template index 015d05c2bf..84fcac17db 100644 --- a/src/function-forms/forbidden-extensions/bullet-two/async-func-expr-named.template +++ b/src/function-forms/forbidden-extensions/bullet-two/async-func-expr-named.template @@ -9,21 +9,42 @@ info: | AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } flags: [async] -features: [async-functions] +features: [arrow-function, async-functions] ---*/ var callCount = 0; -var f = async function f(/*{ params }*/) { +var f; +f = async function f() { "use strict"; - /*{ body }*/ + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + // the same templates. + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) { + Object.defineProperty(inner, "caller", /*{ define-own-caller-descriptor }*/); + } + var result = inner(); + if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, /*{ function-object }*/); + } callCount++; } f(/*{ args }*/) - .then(_ => { - throw new Test262Error('function should not be resolved'); - }, error => assert.sameValue(error.constructor, /*{ error }*/)) .then(() => { - assert.sameValue(callCount, 0, 'function body is not evaluated'); - }, $DONE) - .then($DONE, $DONE); + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/src/function-forms/forbidden-extensions/bullet-two/async-func-expr-nameless.template b/src/function-forms/forbidden-extensions/bullet-two/async-func-expr-nameless.template index d70d4c9b45..823af23f1c 100644 --- a/src/function-forms/forbidden-extensions/bullet-two/async-func-expr-nameless.template +++ b/src/function-forms/forbidden-extensions/bullet-two/async-func-expr-nameless.template @@ -9,21 +9,42 @@ info: | AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody } flags: [async] -features: [async-functions] +features: [arrow-function, async-functions] ---*/ var callCount = 0; -var f = async function(/*{ params }*/) { +var f; +f = async function() { "use strict"; - /*{ body }*/ + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + // the same templates. + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) { + Object.defineProperty(inner, "caller", /*{ define-own-caller-descriptor }*/); + } + var result = inner(); + if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, /*{ function-object }*/); + } callCount++; } f(/*{ args }*/) - .then(_ => { - throw new Test262Error('function should not be resolved'); - }, error => assert.sameValue(error.constructor, /*{ error }*/)) .then(() => { - assert.sameValue(callCount, 0, 'function body is not evaluated'); - }, $DONE) - .then($DONE, $DONE); + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/src/function-forms/forbidden-extensions/bullet-two/async-gen-func-decl.template b/src/function-forms/forbidden-extensions/bullet-two/async-gen-func-decl.template index cea1c22800..9b3f501b2f 100644 --- a/src/function-forms/forbidden-extensions/bullet-two/async-gen-func-decl.template +++ b/src/function-forms/forbidden-extensions/bullet-two/async-gen-func-decl.template @@ -9,22 +9,42 @@ info: | AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } -features: [async-iteration] +features: [arrow-function, async-functions, async-iteration] flags: [async] ---*/ var callCount = 0; -async function* f(/*{ params }*/) { +async function* f() { "use strict"; - /*{ body }*/ + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + // the same templates. + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) { + Object.defineProperty(inner, "caller", /*{ define-own-caller-descriptor }*/); + } + var result = inner(); + if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, /*{ function-object }*/); + } callCount++; } f(/*{ args }*/).next() - .then(_ => { - throw new Test262Error('function should not be resolved'); - }, error => assert.sameValue(error.constructor, /*{ error }*/)) .then(() => { - assert.sameValue(callCount, 0, 'function body is not evaluated'); - }, $DONE) - .then($DONE, $DONE); + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/src/function-forms/forbidden-extensions/bullet-two/async-gen-func-expr.template b/src/function-forms/forbidden-extensions/bullet-two/async-gen-func-expr.template index 1690b3bf64..95c97b7025 100644 --- a/src/function-forms/forbidden-extensions/bullet-two/async-gen-func-expr.template +++ b/src/function-forms/forbidden-extensions/bullet-two/async-gen-func-expr.template @@ -9,23 +9,43 @@ info: | AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { AsyncGeneratorBody } -features: [async-iteration] +features: [arrow-function, async-functions, async-iteration] flags: [async] ---*/ var callCount = 0; var f; -f = async function*(/*{ params }*/) { +f = async function*() { "use strict"; - /*{ body }*/ + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + // the same templates. + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) { + Object.defineProperty(inner, "caller", /*{ define-own-caller-descriptor }*/); + } + var result = inner(); + if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, /*{ function-object }*/); + } callCount++; }; f(/*{ args }*/).next() - .then(_ => { - throw new Test262Error('function should not be resolved'); - }, error => assert.sameValue(error.constructor, /*{ error }*/)) .then(() => { - assert.sameValue(callCount, 0, 'function body is not evaluated'); - }, $DONE) - .then($DONE, $DONE); + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/src/function-forms/forbidden-extensions/bullet-two/async-gen-meth.template b/src/function-forms/forbidden-extensions/bullet-two/async-gen-meth.template index b61033f878..d95f69ca17 100644 --- a/src/function-forms/forbidden-extensions/bullet-two/async-gen-meth.template +++ b/src/function-forms/forbidden-extensions/bullet-two/async-gen-meth.template @@ -9,24 +9,44 @@ info: | async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody } -features: [async-iteration] +features: [arrow-function, async-iteration, generators] flags: [async] ---*/ var callCount = 0; var obj = { - async *method(/*{ params }*/) { + async *method() { "use strict"; - /*{ body }*/ + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) { + Object.defineProperty(inner, "caller", /*{ define-own-caller-descriptor }*/); + } + var result = inner(); + if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, /*{ method-object }*/); + } callCount++; } }; obj.method(/*{ args }*/).next() - .then(_ => { - throw new Test262Error('function should not be resolved'); - }, error => assert.sameValue(error.constructor, /*{ error }*/)) .then(() => { - assert.sameValue(callCount, 0, 'function body is not evaluated'); - }, $DONE) - .then($DONE, $DONE); + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/src/function-forms/forbidden-extensions/bullet-two/async-gen-named-func-expr.template b/src/function-forms/forbidden-extensions/bullet-two/async-gen-named-func-expr.template index d608d2a731..0ea00ce62a 100644 --- a/src/function-forms/forbidden-extensions/bullet-two/async-gen-named-func-expr.template +++ b/src/function-forms/forbidden-extensions/bullet-two/async-gen-named-func-expr.template @@ -9,23 +9,43 @@ info: | AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody } -features: [async-iteration] +features: [arrow-function, async-functions, async-iteration] flags: [async] ---*/ var callCount = 0; var f; -f = async function* g(/*{ params }*/) { +f = async function* g() { "use strict"; - /*{ body }*/ + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + // the same templates. + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) { + Object.defineProperty(inner, "caller", /*{ define-own-caller-descriptor }*/); + } + var result = inner(); + if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, /*{ function-object }*/); + } callCount++; }; f(/*{ args }*/).next() - .then(_ => { - throw new Test262Error('function should not be resolved'); - }, error => assert.sameValue(error.constructor, /*{ error }*/)) .then(() => { - assert.sameValue(callCount, 0, 'function body is not evaluated'); - }, $DONE) - .then($DONE, $DONE); + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/src/function-forms/forbidden-extensions/bullet-two/async-meth.template b/src/function-forms/forbidden-extensions/bullet-two/async-meth.template index 05529a1a6c..9de013ad1e 100644 --- a/src/function-forms/forbidden-extensions/bullet-two/async-meth.template +++ b/src/function-forms/forbidden-extensions/bullet-two/async-meth.template @@ -9,24 +9,44 @@ info: | AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } flags: [async] -features: [async-functions] +features: [arrow-function, async-functions] ---*/ var callCount = 0; var obj = { - async method(/*{ params }*/) { + async method() { "use strict"; - /*{ body }*/ + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) { + Object.defineProperty(inner, "caller", /*{ define-own-caller-descriptor }*/); + } + var result = inner(); + if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, /*{ method-object }*/); + } callCount++; } }; obj.method(/*{ args }*/) - .then(_ => { - throw new Test262Error('function should not be resolved'); - }, error => assert.sameValue(error.constructor, /*{ error }*/)) .then(() => { - assert.sameValue(callCount, 0, 'function body is not evaluated'); - }, $DONE) - .then($DONE, $DONE); + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/src/function-forms/forbidden-extensions/bullet-two/cls-decl-async-gen-meth-static.template b/src/function-forms/forbidden-extensions/bullet-two/cls-decl-async-gen-meth-static.template index 799f53c6e1..79a0d9643f 100644 --- a/src/function-forms/forbidden-extensions/bullet-two/cls-decl-async-gen-meth-static.template +++ b/src/function-forms/forbidden-extensions/bullet-two/cls-decl-async-gen-meth-static.template @@ -7,24 +7,44 @@ name: static class expression generator method esid: sec-runtime-semantics-bindingclassdeclarationevaluation info: | ClassDeclaration : class BindingIdentifier ClassTail -features: [async-iteration] +features: [arrow-function, async-functions, async-iteration, class] flags: [async] ---*/ var callCount = 0; class C { - static async *method(/*{ params }*/) { + static async *method() { /* implicit strict */ - /*{ body }*/ + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) { + Object.defineProperty(inner, "caller", /*{ define-own-caller-descriptor }*/); + } + var result = inner(); + if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, /*{ method-object }*/); + } callCount++; } } C.method(/*{ args }*/).next() - .then(_ => { - throw new Test262Error('function should not be resolved'); - }, error => assert.sameValue(error.constructor, /*{ error }*/)) .then(() => { - assert.sameValue(callCount, 0, 'function body is not evaluated'); - }, $DONE) - .then($DONE, $DONE); + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/src/function-forms/forbidden-extensions/bullet-two/cls-decl-async-gen-meth.template b/src/function-forms/forbidden-extensions/bullet-two/cls-decl-async-gen-meth.template index d7cd9cc0f8..9aa39c01df 100644 --- a/src/function-forms/forbidden-extensions/bullet-two/cls-decl-async-gen-meth.template +++ b/src/function-forms/forbidden-extensions/bullet-two/cls-decl-async-gen-meth.template @@ -6,24 +6,44 @@ name: class expression method esid: sec-class-definitions-runtime-semantics-evaluation info: | ClassDeclaration : class BindingIdentifier ClassTail -features: [async-iteration] +features: [arrow-function, async-functions, async-iteration, class] flags: [async] ---*/ var callCount = 0; class C { - async *method(/*{ params }*/) { + async *method() { /* implicit strict */ - /*{ body }*/ + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) { + Object.defineProperty(inner, "caller", /*{ define-own-caller-descriptor }*/); + } + var result = inner(); + if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, /*{ method-object }*/); + } callCount++; } } C.prototype.method(/*{ args }*/).next() - .then(_ => { - throw new Test262Error('function should not be resolved'); - }, error => assert.sameValue(error.constructor, /*{ error }*/)) .then(() => { - assert.sameValue(callCount, 0, 'function body is not evaluated'); - }, $DONE) - .then($DONE, $DONE); + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/src/function-forms/forbidden-extensions/bullet-two/cls-decl-async-meth-static.template b/src/function-forms/forbidden-extensions/bullet-two/cls-decl-async-meth-static.template index 84d4cbed07..726464cecb 100644 --- a/src/function-forms/forbidden-extensions/bullet-two/cls-decl-async-meth-static.template +++ b/src/function-forms/forbidden-extensions/bullet-two/cls-decl-async-meth-static.template @@ -7,24 +7,44 @@ name: static class declaration async method esid: sec-runtime-semantics-bindingclassdeclarationevaluation info: | ClassDeclaration : class BindingIdentifier ClassTail -features: [async-functions] +features: [arrow-function, async-functions, class] flags: [async] ---*/ var callCount = 0; class C { - static async method(/*{ params }*/) { + static async method() { /* implicit strict */ - /*{ body }*/ + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) { + Object.defineProperty(inner, "caller", /*{ define-own-caller-descriptor }*/); + } + var result = inner(); + if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, /*{ method-object }*/); + } callCount++; } } C.method(/*{ args }*/) - .then(_ => { - throw new Test262Error('function should not be resolved'); - }, error => assert.sameValue(error.constructor, /*{ error }*/)) .then(() => { - assert.sameValue(callCount, 0, 'function body is not evaluated'); - }, $DONE) - .then($DONE, $DONE); + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/src/function-forms/forbidden-extensions/bullet-two/cls-decl-async-meth.template b/src/function-forms/forbidden-extensions/bullet-two/cls-decl-async-meth.template index 9e979a835a..36cacab098 100644 --- a/src/function-forms/forbidden-extensions/bullet-two/cls-decl-async-meth.template +++ b/src/function-forms/forbidden-extensions/bullet-two/cls-decl-async-meth.template @@ -8,23 +8,43 @@ esid: sec-class-definitions-runtime-semantics-evaluation info: | ClassDeclaration : class BindingIdentifier ClassTail flags: [async] -features: [async-functions] +features: [arrow-function, async-functions, class] ---*/ var callCount = 0; class C { - async method(/*{ params }*/) { + async method() { /* implicit strict */ - /*{ body }*/ + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) { + Object.defineProperty(inner, "caller", /*{ define-own-caller-descriptor }*/); + } + var result = inner(); + if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, /*{ method-object }*/); + } callCount++; } } C.prototype.method(/*{ args }*/) - .then(_ => { - throw new Test262Error('function should not be resolved'); - }, error => assert.sameValue(error.constructor, /*{ error }*/)) .then(() => { - assert.sameValue(callCount, 0, 'function body is not evaluated'); - }, $DONE) - .then($DONE, $DONE); + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/src/function-forms/forbidden-extensions/bullet-two/cls-decl-gen-meth-static.template b/src/function-forms/forbidden-extensions/bullet-two/cls-decl-gen-meth-static.template index 497d0cb54b..6cdf6140f1 100644 --- a/src/function-forms/forbidden-extensions/bullet-two/cls-decl-gen-meth-static.template +++ b/src/function-forms/forbidden-extensions/bullet-two/cls-decl-gen-meth-static.template @@ -6,20 +6,42 @@ name: static class expression generator method esid: sec-runtime-semantics-bindingclassdeclarationevaluation info: | ClassDeclaration : class BindingIdentifier ClassTail -features: [generators] +features: [class, generators] ---*/ var callCount = 0; class C { - static *method(/*{ params }*/) { + static *method() { /* implicit strict */ - /*{ body }*/ + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) { + Object.defineProperty(inner, "caller", /*{ define-own-caller-descriptor }*/); + } + var result = inner(); + if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, /*{ method-object }*/); + } callCount++; } } -assert.throws(/*{ error }*/, function() { - C.method(/*{ args }*/).next(); -}); +C.method(/*{ args }*/).next(); -assert.sameValue(callCount, 0, 'method body not evaluated'); +assert.sameValue(callCount, 1, 'method body evaluated'); diff --git a/src/function-forms/forbidden-extensions/bullet-two/cls-decl-gen-meth.template b/src/function-forms/forbidden-extensions/bullet-two/cls-decl-gen-meth.template index f0383e016b..d5ed183029 100644 --- a/src/function-forms/forbidden-extensions/bullet-two/cls-decl-gen-meth.template +++ b/src/function-forms/forbidden-extensions/bullet-two/cls-decl-gen-meth.template @@ -6,19 +6,41 @@ name: class expression method esid: sec-class-definitions-runtime-semantics-evaluation info: | ClassDeclaration : class BindingIdentifier ClassTail -features: [generators] +features: [class, generators] ---*/ var callCount = 0; class C { - *method(/*{ params }*/) { + *method() { /* implicit strict */ - /*{ body }*/ + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) { + Object.defineProperty(inner, "caller", /*{ define-own-caller-descriptor }*/); + } + var result = inner(); + if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, /*{ method-object }*/); + } callCount++; } } -assert.throws(/*{ error }*/, function() { - C.prototype.method(/*{ args }*/).next(); -}); -assert.sameValue(callCount, 0, 'method body not evaluated'); +C.prototype.method(/*{ args }*/).next(); +assert.sameValue(callCount, 1, 'method body evaluated'); diff --git a/src/function-forms/forbidden-extensions/bullet-two/cls-decl-meth-static.template b/src/function-forms/forbidden-extensions/bullet-two/cls-decl-meth-static.template index ebcbdfab5e..89e73b0c8c 100644 --- a/src/function-forms/forbidden-extensions/bullet-two/cls-decl-meth-static.template +++ b/src/function-forms/forbidden-extensions/bullet-two/cls-decl-meth-static.template @@ -6,18 +6,41 @@ name: static class expression method esid: sec-runtime-semantics-bindingclassdeclarationevaluation info: | ClassDeclaration : class BindingIdentifier ClassTail +features: [class] ---*/ var callCount = 0; class C { - static method(/*{ params }*/) { + static method() { /* implicit strict */ - /*{ body }*/ + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) { + Object.defineProperty(inner, "caller", /*{ define-own-caller-descriptor }*/); + } + var result = inner(); + if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, /*{ method-object }*/); + } callCount++; } } -assert.throws(/*{ error }*/, function() { - C.method(/*{ args }*/); -}); -assert.sameValue(callCount, 0, 'method body not evaluated'); +C.method(/*{ args }*/); +assert.sameValue(callCount, 1, 'method body evaluated'); diff --git a/src/function-forms/forbidden-extensions/bullet-two/cls-decl-meth.template b/src/function-forms/forbidden-extensions/bullet-two/cls-decl-meth.template index 5bb5840c76..87f3e28b3e 100644 --- a/src/function-forms/forbidden-extensions/bullet-two/cls-decl-meth.template +++ b/src/function-forms/forbidden-extensions/bullet-two/cls-decl-meth.template @@ -6,18 +6,41 @@ name: class expression method esid: sec-runtime-semantics-bindingclassdeclarationevaluation info: | ClassDeclaration : class BindingIdentifier ClassTail +features: [class] ---*/ var callCount = 0; class C { - method(/*{ params }*/) { + method() { /* implicit strict */ - /*{ body }*/ + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) { + Object.defineProperty(inner, "caller", /*{ define-own-caller-descriptor }*/); + } + var result = inner(); + if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, /*{ method-object }*/); + } callCount++; } } -assert.throws(/*{ error }*/, function() { - C.prototype.method(/*{ args }*/); -}); -assert.sameValue(callCount, 0, 'method body not evaluated'); +C.prototype.method(/*{ args }*/); +assert.sameValue(callCount, 1, 'method body evaluated'); diff --git a/src/function-forms/forbidden-extensions/bullet-two/cls-expr-async-gen-meth-static.template b/src/function-forms/forbidden-extensions/bullet-two/cls-expr-async-gen-meth-static.template index 25d6c0ff10..f6fab2ef15 100644 --- a/src/function-forms/forbidden-extensions/bullet-two/cls-expr-async-gen-meth-static.template +++ b/src/function-forms/forbidden-extensions/bullet-two/cls-expr-async-gen-meth-static.template @@ -6,24 +6,44 @@ name: static class expression async generator method esid: sec-class-definitions-runtime-semantics-evaluation info: | ClassExpression : class BindingIdentifieropt ClassTail -features: [async-iteration] +features: [arrow-function, async-functions, async-iteration, class] flags: [async] ---*/ var callCount = 0; var C = class { - static async *method(/*{ params }*/) { + static async *method() { /* implicit strict */ - /*{ body }*/ + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) { + Object.defineProperty(inner, "caller", /*{ define-own-caller-descriptor }*/); + } + var result = inner(); + if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, /*{ method-object }*/); + } callCount++; } }; C.method(/*{ args }*/).next() - .then(_ => { - throw new Test262Error('function should not be resolved'); - }, error => assert.sameValue(error.constructor, /*{ error }*/)) .then(() => { - assert.sameValue(callCount, 0, 'function body is not evaluated'); - }, $DONE) - .then($DONE, $DONE); + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/src/function-forms/forbidden-extensions/bullet-two/cls-expr-async-gen-meth.template b/src/function-forms/forbidden-extensions/bullet-two/cls-expr-async-gen-meth.template index 968654ec3b..45d5c1c40f 100644 --- a/src/function-forms/forbidden-extensions/bullet-two/cls-expr-async-gen-meth.template +++ b/src/function-forms/forbidden-extensions/bullet-two/cls-expr-async-gen-meth.template @@ -6,24 +6,44 @@ name: class expression async generator method esid: sec-class-definitions-runtime-semantics-evaluation info: | ClassExpression : class BindingIdentifieropt ClassTail -features: [async-iteration] +features: [arrow-function, async-functions, async-iteration, class] flags: [async] ---*/ var callCount = 0; var C = class { - async *method(/*{ params }*/) { + async *method() { /* implicit strict */ - /*{ body }*/ + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) { + Object.defineProperty(inner, "caller", /*{ define-own-caller-descriptor }*/); + } + var result = inner(); + if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, /*{ method-object }*/); + } callCount++; } }; C.prototype.method(/*{ args }*/).next() - .then(_ => { - throw new Test262Error('function should not be resolved'); - }, error => assert.sameValue(error.constructor, /*{ error }*/)) .then(() => { - assert.sameValue(callCount, 0, 'function body is not evaluated'); - }, $DONE) - .then($DONE, $DONE); + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/src/function-forms/forbidden-extensions/bullet-two/cls-expr-async-meth-static.template b/src/function-forms/forbidden-extensions/bullet-two/cls-expr-async-meth-static.template index b5ba869676..bff6edb7f3 100644 --- a/src/function-forms/forbidden-extensions/bullet-two/cls-expr-async-meth-static.template +++ b/src/function-forms/forbidden-extensions/bullet-two/cls-expr-async-meth-static.template @@ -7,25 +7,45 @@ name: static class expression async method esid: sec-class-definitions-runtime-semantics-evaluation info: | ClassExpression : class BindingIdentifieropt ClassTail -features: [async-functions] +features: [arrow-function, async-functions, class] flags: [async] ---*/ var callCount = 0; var C = class { - static async method(/*{ params }*/) { + static async method() { /* implicit strict */ - /*{ body }*/ + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) { + Object.defineProperty(inner, "caller", /*{ define-own-caller-descriptor }*/); + } + var result = inner(); + if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, /*{ method-object }*/); + } callCount++; } }; C.method(/*{ args }*/) - .then(_ => { - throw new Test262Error('function should not be resolved'); - }, error => assert.sameValue(error.constructor, /*{ error }*/)) .then(() => { - assert.sameValue(callCount, 0, 'function body is not evaluated'); - }, $DONE) - .then($DONE, $DONE); + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/src/function-forms/forbidden-extensions/bullet-two/cls-expr-async-meth.template b/src/function-forms/forbidden-extensions/bullet-two/cls-expr-async-meth.template index 56ae9c2ef9..596dd3868f 100644 --- a/src/function-forms/forbidden-extensions/bullet-two/cls-expr-async-meth.template +++ b/src/function-forms/forbidden-extensions/bullet-two/cls-expr-async-meth.template @@ -7,24 +7,44 @@ name: class expression async method esid: sec-class-definitions-runtime-semantics-evaluation info: | ClassExpression : class BindingIdentifieropt ClassTail -features: [async-functions] +features: [arrow-function, async-functions, class] flags: [async] ---*/ var callCount = 0; var C = class { - async method(/*{ params }*/) { + async method() { /* implicit strict */ - /*{ body }*/ + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) { + Object.defineProperty(inner, "caller", /*{ define-own-caller-descriptor }*/); + } + var result = inner(); + if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, /*{ method-object }*/); + } callCount++; } }; C.prototype.method(/*{ args }*/) - .then(_ => { - throw new Test262Error('function should not be resolved'); - }, error => assert.sameValue(error.constructor, /*{ error }*/)) .then(() => { - assert.sameValue(callCount, 0, 'function body is not evaluated'); - }, $DONE) - .then($DONE, $DONE); + assert.sameValue(callCount, 1, 'function body evaluated'); + }, $DONE).then($DONE, $DONE); diff --git a/src/function-forms/forbidden-extensions/bullet-two/cls-expr-gen-meth-static.template b/src/function-forms/forbidden-extensions/bullet-two/cls-expr-gen-meth-static.template index a1d21fc1ee..6db14df8ed 100644 --- a/src/function-forms/forbidden-extensions/bullet-two/cls-expr-gen-meth-static.template +++ b/src/function-forms/forbidden-extensions/bullet-two/cls-expr-gen-meth-static.template @@ -6,19 +6,41 @@ name: static class expression generator method esid: sec-class-definitions-runtime-semantics-evaluation info: | ClassExpression : class BindingIdentifieropt ClassTail -features: [generators] +features: [class, generators] ---*/ var callCount = 0; var C = class { - static *method(/*{ params }*/) { + static *method() { /* implicit strict */ - /*{ body }*/ + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) { + Object.defineProperty(inner, "caller", /*{ define-own-caller-descriptor }*/); + } + var result = inner(); + if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, /*{ method-object }*/); + } callCount++; } }; -assert.throws(/*{ error }*/, function() { - C.method(/*{ args }*/).next(); -}); -assert.sameValue(callCount, 0, 'method body not evaluated'); +C.method(/*{ args }*/).next(); +assert.sameValue(callCount, 1, 'method body evaluated'); diff --git a/src/function-forms/forbidden-extensions/bullet-two/cls-expr-gen-meth.template b/src/function-forms/forbidden-extensions/bullet-two/cls-expr-gen-meth.template index d2de50015b..f98067593e 100644 --- a/src/function-forms/forbidden-extensions/bullet-two/cls-expr-gen-meth.template +++ b/src/function-forms/forbidden-extensions/bullet-two/cls-expr-gen-meth.template @@ -6,19 +6,42 @@ name: class expression method esid: sec-class-definitions-runtime-semantics-evaluation info: | ClassExpression : class BindingIdentifieropt ClassTail -features: [generators] +features: [class, generators] ---*/ var callCount = 0; var C = class { - *method(/*{ params }*/) { + *method() { /* implicit strict */ - /*{ body }*/ + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) { + Object.defineProperty(inner, "caller", /*{ define-own-caller-descriptor }*/); + } + var result = inner(); + if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, /*{ method-object }*/); + } + callCount++; } }; -assert.throws(/*{ error }*/, function() { - C.prototype.method(/*{ args }*/).next(); -}); -assert.sameValue(callCount, 0, 'method body not evaluated'); +C.prototype.method(/*{ args }*/).next(); +assert.sameValue(callCount, 1, 'method body evaluated'); diff --git a/src/function-forms/forbidden-extensions/bullet-two/cls-expr-meth-static.template b/src/function-forms/forbidden-extensions/bullet-two/cls-expr-meth-static.template index 39fd84eb38..9f017597e1 100644 --- a/src/function-forms/forbidden-extensions/bullet-two/cls-expr-meth-static.template +++ b/src/function-forms/forbidden-extensions/bullet-two/cls-expr-meth-static.template @@ -6,18 +6,42 @@ name: static class expression method esid: sec-class-definitions-runtime-semantics-evaluation info: | ClassExpression : class BindingIdentifieropt ClassTail +features: [class] ---*/ var callCount = 0; var C = class { - static method(/*{ params }*/) { + static method() { /* implicit strict */ - /*{ body }*/ + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) { + Object.defineProperty(inner, "caller", /*{ define-own-caller-descriptor }*/); + } + var result = inner(); + if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, /*{ method-object }*/); + } + callCount++; } }; -assert.throws(/*{ error }*/, function() { - C.method(/*{ args }*/); -}); -assert.sameValue(callCount, 0, 'method body not evaluated'); +C.method(/*{ args }*/); +assert.sameValue(callCount, 1, 'method body evaluated'); diff --git a/src/function-forms/forbidden-extensions/bullet-two/cls-expr-meth.template b/src/function-forms/forbidden-extensions/bullet-two/cls-expr-meth.template index 4d89f84b75..c1a9267b6d 100644 --- a/src/function-forms/forbidden-extensions/bullet-two/cls-expr-meth.template +++ b/src/function-forms/forbidden-extensions/bullet-two/cls-expr-meth.template @@ -6,18 +6,42 @@ name: class expression method esid: sec-class-definitions-runtime-semantics-evaluation info: | ClassExpression : class BindingIdentifieropt ClassTail +features: [class] ---*/ var callCount = 0; var C = class { - method(/*{ params }*/) { + method() { /* implicit strict */ - /*{ body }*/ + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) { + Object.defineProperty(inner, "caller", /*{ define-own-caller-descriptor }*/); + } + var result = inner(); + if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, /*{ method-object }*/); + } + callCount++; } }; -assert.throws(/*{ error }*/, function() { - C.prototype.method(/*{ args }*/); -}); -assert.sameValue(callCount, 0, 'method body not evaluated'); +C.prototype.method(/*{ args }*/); +assert.sameValue(callCount, 1, 'method body evaluated'); diff --git a/src/function-forms/forbidden-extensions/bullet-two/func-decl.template b/src/function-forms/forbidden-extensions/bullet-two/func-decl.template index d6c458f5ad..143864432f 100644 --- a/src/function-forms/forbidden-extensions/bullet-two/func-decl.template +++ b/src/function-forms/forbidden-extensions/bullet-two/func-decl.template @@ -10,12 +10,36 @@ info: | ---*/ var callCount = 0; -function f(/*{ params }*/) { +function f() { "use strict"; - /*{ body }*/ + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + // the same templates. + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) { + Object.defineProperty(inner, "caller", /*{ define-own-caller-descriptor }*/); + } + var result = inner(); + if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, /*{ function-object }*/); + } + callCount++; } -assert.throws(/*{ error }*/, function() { - f(/*{ args }*/); -}); -assert.sameValue(callCount, 0, 'method body not evaluated'); +f(/*{ args }*/); +assert.sameValue(callCount, 1, 'body evaluated'); diff --git a/src/function-forms/forbidden-extensions/bullet-two/func-expr.template b/src/function-forms/forbidden-extensions/bullet-two/func-expr.template index 0c69cec221..d384784f3e 100644 --- a/src/function-forms/forbidden-extensions/bullet-two/func-expr.template +++ b/src/function-forms/forbidden-extensions/bullet-two/func-expr.template @@ -10,12 +10,36 @@ info: | var callCount = 0; var f; -f = function(/*{ params }*/) { +f = function() { "use strict"; - /*{ body }*/ + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + // the same templates. + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) { + Object.defineProperty(inner, "caller", /*{ define-own-caller-descriptor }*/); + } + var result = inner(); + if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, /*{ function-object }*/); + } + callCount++; }; -assert.throws(/*{ error }*/, function() { - f(/*{ args }*/); -}); -assert.sameValue(callCount, 0, 'method body not evaluated'); +f(/*{ args }*/); +assert.sameValue(callCount, 1, 'body evaluated'); diff --git a/src/function-forms/forbidden-extensions/bullet-two/gen-func-decl.template b/src/function-forms/forbidden-extensions/bullet-two/gen-func-decl.template index ed3c7641e7..a447823243 100644 --- a/src/function-forms/forbidden-extensions/bullet-two/gen-func-decl.template +++ b/src/function-forms/forbidden-extensions/bullet-two/gen-func-decl.template @@ -10,14 +10,38 @@ features: [generators] ---*/ var callCount = 0; -function* f(/*{ params }*/) { +function* f() { "use strict"; - /*{ body }*/ + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + // the same templates. + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) { + Object.defineProperty(inner, "caller", /*{ define-own-caller-descriptor }*/); + } + var result = inner(); + if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, /*{ function-object }*/); + } + callCount++; } -assert.throws(/*{ error }*/, function() { - f(/*{ args }*/).next(); -}); +f(/*{ args }*/).next(); -assert.sameValue(callCount, 0, 'generator function body not evaluated'); +assert.sameValue(callCount, 1, 'generator function body evaluated'); diff --git a/src/function-forms/forbidden-extensions/bullet-two/gen-func-expr.template b/src/function-forms/forbidden-extensions/bullet-two/gen-func-expr.template index dfb472e2b6..e723d12089 100644 --- a/src/function-forms/forbidden-extensions/bullet-two/gen-func-expr.template +++ b/src/function-forms/forbidden-extensions/bullet-two/gen-func-expr.template @@ -11,13 +11,37 @@ features: [generators] var callCount = 0; var f; -f = function*(/*{ params }*/) { +f = function*() { "use strict"; - /*{ body }*/ + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + // the same templates. + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) { + Object.defineProperty(inner, "caller", /*{ define-own-caller-descriptor }*/); + } + var result = inner(); + if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, /*{ function-object }*/); + } + callCount++; }; -assert.throws(/*{ error }*/, function() { - f(/*{ args }*/).next(); -}); -assert.sameValue(callCount, 0, 'generator function body not evaluated'); +f(/*{ args }*/).next(); +assert.sameValue(callCount, 1, 'generator function body evaluated'); diff --git a/src/function-forms/forbidden-extensions/bullet-two/gen-meth.template b/src/function-forms/forbidden-extensions/bullet-two/gen-meth.template index d066d5dffa..fb3f88c5da 100644 --- a/src/function-forms/forbidden-extensions/bullet-two/gen-meth.template +++ b/src/function-forms/forbidden-extensions/bullet-two/gen-meth.template @@ -13,14 +13,36 @@ features: [generators] var callCount = 0; var obj = { - *method(/*{ params }*/) { + *method() { "use strict"; - /*{ body }*/ + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) { + Object.defineProperty(inner, "caller", /*{ define-own-caller-descriptor }*/); + } + var result = inner(); + if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, /*{ method-object }*/); + } callCount++; } }; -assert.throws(/*{ error }*/, function() { - obj.method(/*{ args }*/).next(); -}); -assert.sameValue(callCount, 0, 'generator method body not evaluated'); +obj.method(/*{ args }*/).next().value; +assert.sameValue(callCount, 1, 'generator method body was evaluated'); diff --git a/src/function-forms/forbidden-extensions/bullet-two/meth.template b/src/function-forms/forbidden-extensions/bullet-two/meth.template index 2f722cb113..6ffc3a4ca0 100644 --- a/src/function-forms/forbidden-extensions/bullet-two/meth.template +++ b/src/function-forms/forbidden-extensions/bullet-two/meth.template @@ -10,14 +10,37 @@ info: | var callCount = 0; var obj = { - method(/*{ params }*/) { + method() { "use strict"; - /*{ body }*/ + // This and the following conditional value is set in the test's .case file. + // For every test that has a "true" value here, there is a + // corresponding test that has a "false" value here. + // They are generated from two different case files, which use + let descriptor = Object.getOwnPropertyDescriptor(inner, "caller"); + if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) { + Object.defineProperty(inner, "caller", /*{ define-own-caller-descriptor }*/); + } + var result = inner(); + if (descriptor && descriptor.configurable && /*{ define-own-caller }*/) { + assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.'); + } + + // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from + // forbidden-ext-indirect-access-prop-caller.case + // + // If the function object "inner" has an own property + // named "caller", then its value will be returned. + // + // If the function object "inner" DOES NOT have an + // own property named "caller", then the symbol + // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned. + if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) { + assert.notSameValue(result, /*{ method-object }*/); + } + callCount++; } }; -assert.throws(/*{ error }*/, function() { - obj.method(/*{ args }*/); -}); -assert.sameValue(callCount, 0, 'method body not evaluated'); +obj.method(/*{ args }*/); +assert.sameValue(callCount, 1, 'method body evaluated');