Forbidden Extensions: revised to check property existence

This commit is contained in:
Rick Waldron 2020-10-09 09:17:39 -04:00
parent 72154b17fc
commit 0a84a4f176
71 changed files with 1202 additions and 547 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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');

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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');

View File

@ -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');

View File

@ -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');

View File

@ -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');

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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');

View File

@ -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');

View File

@ -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');

View File

@ -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');

View File

@ -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');

View File

@ -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');

View File

@ -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');

View File

@ -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');

View File

@ -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');

View File

@ -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');

View File

@ -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');

View File

@ -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');

View File

@ -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');

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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');

View File

@ -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');

View File

@ -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');

View File

@ -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');

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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');

View File

@ -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');

View File

@ -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');

View File

@ -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');

View File

@ -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');

View File

@ -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');

View File

@ -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');

View File

@ -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');

View File

@ -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');

View File

@ -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');