mirror of https://github.com/tc39/test262.git
Generate tests
This commit is contained in:
parent
0a84a4f176
commit
b89c3bf369
|
@ -4,22 +4,32 @@
|
|||
/*---
|
||||
description: Forbidden extension, f.arguments (arrow function expression)
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
features: [arrow-function]
|
||||
flags: [generated, noStrict]
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
var f;
|
||||
f = () => {
|
||||
f.arguments;
|
||||
assert.sameValue(f.hasOwnProperty("arguments"), false);
|
||||
callCount++;
|
||||
};
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
|
||||
f();
|
||||
});
|
||||
assert.sameValue(callCount, 0, 'arrow function body not evaluated');
|
||||
assert.sameValue(callCount, 1, 'arrow function body evaluated');
|
||||
|
|
|
@ -4,22 +4,32 @@
|
|||
/*---
|
||||
description: Forbidden extension, o.caller (arrow function expression)
|
||||
esid: sec-arrow-function-definitions-runtime-semantics-evaluation
|
||||
features: [arrow-function]
|
||||
flags: [generated, noStrict]
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
var f;
|
||||
f = () => {
|
||||
f.caller;
|
||||
assert.sameValue(f.hasOwnProperty("caller"), false);
|
||||
callCount++;
|
||||
};
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
|
||||
f();
|
||||
});
|
||||
assert.sameValue(callCount, 0, 'arrow function body not evaluated');
|
||||
assert.sameValue(callCount, 1, 'arrow function body evaluated');
|
||||
|
|
|
@ -0,0 +1,60 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-get.case
|
||||
// - src/function-forms/forbidden-extensions/bullet-two/arrow-function.template
|
||||
/*---
|
||||
description: Forbidden extension, o.caller (arrow function expression)
|
||||
esid: sec-arrow-definitions-runtime-semantics-evaluation
|
||||
features: [arrow-function]
|
||||
flags: [generated, noStrict]
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
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;
|
||||
}
|
||||
|
||||
var callCount = 0;
|
||||
var f;
|
||||
f = () => {
|
||||
"use strict";
|
||||
// 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 && true) {
|
||||
Object.defineProperty(inner, "caller", {get(){return 1}});
|
||||
}
|
||||
var result = inner();
|
||||
if (descriptor && descriptor.configurable && true) {
|
||||
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, f);
|
||||
}
|
||||
callCount++;
|
||||
};
|
||||
|
||||
f();
|
||||
assert.sameValue(callCount, 1, 'arrow function body evaluated');
|
|
@ -0,0 +1,60 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-value.case
|
||||
// - src/function-forms/forbidden-extensions/bullet-two/arrow-function.template
|
||||
/*---
|
||||
description: Forbidden extension, o.caller (arrow function expression)
|
||||
esid: sec-arrow-definitions-runtime-semantics-evaluation
|
||||
features: [arrow-function]
|
||||
flags: [generated, noStrict]
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
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;
|
||||
}
|
||||
|
||||
var callCount = 0;
|
||||
var f;
|
||||
f = () => {
|
||||
"use strict";
|
||||
// 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 && true) {
|
||||
Object.defineProperty(inner, "caller", {value: 1});
|
||||
}
|
||||
var result = inner();
|
||||
if (descriptor && descriptor.configurable && true) {
|
||||
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, f);
|
||||
}
|
||||
callCount++;
|
||||
};
|
||||
|
||||
f();
|
||||
assert.sameValue(callCount, 1, 'arrow function body evaluated');
|
|
@ -4,27 +4,57 @@
|
|||
/*---
|
||||
description: Forbidden extension, o.caller (arrow function expression)
|
||||
esid: sec-arrow-definitions-runtime-semantics-evaluation
|
||||
features: [arrow-function]
|
||||
flags: [generated, noStrict]
|
||||
info: |
|
||||
ArrowFunction : ArrowParameters => ConciseBody
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
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;
|
||||
}
|
||||
|
||||
var callCount = 0;
|
||||
var f;
|
||||
f = () => {
|
||||
"use strict";
|
||||
inner().toString();
|
||||
// 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 && false) {
|
||||
Object.defineProperty(inner, "caller", {});
|
||||
}
|
||||
var result = inner();
|
||||
if (descriptor && descriptor.configurable && false) {
|
||||
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, f);
|
||||
}
|
||||
callCount++;
|
||||
};
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
f();
|
||||
});
|
||||
assert.sameValue(callCount, 0, 'arrow function body not evaluated');
|
||||
f();
|
||||
assert.sameValue(callCount, 1, 'arrow function body evaluated');
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
/*---
|
||||
description: Forbidden extension, f.arguments (async arrow function expression)
|
||||
esid: sec-async-arrow-function-definitions
|
||||
features: [async-functions]
|
||||
features: [arrow-function, async-functions]
|
||||
flags: [generated, noStrict, async]
|
||||
info: |
|
||||
AsyncArrowFunction :
|
||||
|
@ -15,7 +15,16 @@ info: |
|
|||
{ AsyncFunctionBody }
|
||||
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
|
||||
|
@ -23,15 +32,11 @@ info: |
|
|||
var callCount = 0;
|
||||
var f;
|
||||
f = async () => {
|
||||
f.arguments;
|
||||
assert.sameValue(f.hasOwnProperty("arguments"), false);
|
||||
callCount++;
|
||||
};
|
||||
|
||||
f()
|
||||
.then(_ => {
|
||||
throw new Test262Error('function should not be resolved');
|
||||
}, error => assert.sameValue(error.constructor, TypeError))
|
||||
.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);
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
/*---
|
||||
description: Forbidden extension, o.caller (async arrow function expression)
|
||||
esid: sec-async-arrow-function-definitions
|
||||
features: [async-functions]
|
||||
features: [arrow-function, async-functions]
|
||||
flags: [generated, noStrict, async]
|
||||
info: |
|
||||
AsyncArrowFunction :
|
||||
|
@ -15,7 +15,16 @@ info: |
|
|||
{ AsyncFunctionBody }
|
||||
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
|
||||
|
@ -23,15 +32,11 @@ info: |
|
|||
var callCount = 0;
|
||||
var f;
|
||||
f = async () => {
|
||||
f.caller;
|
||||
assert.sameValue(f.hasOwnProperty("caller"), false);
|
||||
callCount++;
|
||||
};
|
||||
|
||||
f()
|
||||
.then(_ => {
|
||||
throw new Test262Error('function should not be resolved');
|
||||
}, error => assert.sameValue(error.constructor, TypeError))
|
||||
.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);
|
||||
|
|
|
@ -0,0 +1,68 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-get.case
|
||||
// - src/function-forms/forbidden-extensions/bullet-two/async-arrow-function.template
|
||||
/*---
|
||||
description: Forbidden extension, o.caller (async arrow function expression)
|
||||
esid: sec-async-arrow-definitions
|
||||
features: [arrow-function, async-functions]
|
||||
flags: [generated, noStrict, async]
|
||||
info: |
|
||||
AsyncArrowFunction :
|
||||
...
|
||||
CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody
|
||||
|
||||
AsyncConciseBody :
|
||||
{ AsyncFunctionBody }
|
||||
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
var f;
|
||||
f = async () => {
|
||||
"use strict";
|
||||
// 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 && true) {
|
||||
Object.defineProperty(inner, "caller", {get(){return 1}});
|
||||
}
|
||||
var result = inner();
|
||||
if (descriptor && descriptor.configurable && true) {
|
||||
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, f);
|
||||
}
|
||||
callCount++;
|
||||
};
|
||||
|
||||
f()
|
||||
.then(() => {
|
||||
assert.sameValue(callCount, 1, 'function body evaluated');
|
||||
}, $DONE).then($DONE, $DONE);
|
|
@ -0,0 +1,68 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-value.case
|
||||
// - src/function-forms/forbidden-extensions/bullet-two/async-arrow-function.template
|
||||
/*---
|
||||
description: Forbidden extension, o.caller (async arrow function expression)
|
||||
esid: sec-async-arrow-definitions
|
||||
features: [arrow-function, async-functions]
|
||||
flags: [generated, noStrict, async]
|
||||
info: |
|
||||
AsyncArrowFunction :
|
||||
...
|
||||
CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody
|
||||
|
||||
AsyncConciseBody :
|
||||
{ AsyncFunctionBody }
|
||||
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
var f;
|
||||
f = async () => {
|
||||
"use strict";
|
||||
// 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 && true) {
|
||||
Object.defineProperty(inner, "caller", {value: 1});
|
||||
}
|
||||
var result = inner();
|
||||
if (descriptor && descriptor.configurable && true) {
|
||||
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, f);
|
||||
}
|
||||
callCount++;
|
||||
};
|
||||
|
||||
f()
|
||||
.then(() => {
|
||||
assert.sameValue(callCount, 1, 'function body evaluated');
|
||||
}, $DONE).then($DONE, $DONE);
|
|
@ -4,7 +4,7 @@
|
|||
/*---
|
||||
description: Forbidden extension, o.caller (async arrow function expression)
|
||||
esid: sec-async-arrow-definitions
|
||||
features: [async-functions]
|
||||
features: [arrow-function, async-functions]
|
||||
flags: [generated, noStrict, async]
|
||||
info: |
|
||||
AsyncArrowFunction :
|
||||
|
@ -15,12 +15,18 @@ info: |
|
|||
{ AsyncFunctionBody }
|
||||
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
@ -28,15 +34,35 @@ var callCount = 0;
|
|||
var f;
|
||||
f = async () => {
|
||||
"use strict";
|
||||
inner().toString();
|
||||
// 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 && false) {
|
||||
Object.defineProperty(inner, "caller", {});
|
||||
}
|
||||
var result = inner();
|
||||
if (descriptor && descriptor.configurable && false) {
|
||||
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, f);
|
||||
}
|
||||
callCount++;
|
||||
};
|
||||
|
||||
f()
|
||||
.then(_ => {
|
||||
throw new Test262Error('function should not be resolved');
|
||||
}, error => assert.sameValue(error.constructor, TypeError))
|
||||
.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);
|
||||
|
|
|
@ -4,29 +4,34 @@
|
|||
/*---
|
||||
description: Forbidden extension, f.arguments (async function named expression)
|
||||
esid: sec-async-function-definitions
|
||||
features: [async-functions]
|
||||
features: [arrow-function, async-functions]
|
||||
flags: [generated, noStrict, async]
|
||||
info: |
|
||||
AsyncFunctionExpression :
|
||||
async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
|
||||
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
var f = async function f() {
|
||||
f.arguments;
|
||||
assert.sameValue(f.hasOwnProperty("arguments"), false);
|
||||
callCount++;
|
||||
}
|
||||
|
||||
f()
|
||||
.then(_ => {
|
||||
throw new Test262Error('function should not be resolved');
|
||||
}, error => assert.sameValue(error.constructor, TypeError))
|
||||
.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);
|
||||
|
|
|
@ -4,29 +4,34 @@
|
|||
/*---
|
||||
description: Forbidden extension, o.caller (async function named expression)
|
||||
esid: sec-async-function-definitions
|
||||
features: [async-functions]
|
||||
features: [arrow-function, async-functions]
|
||||
flags: [generated, noStrict, async]
|
||||
info: |
|
||||
AsyncFunctionExpression :
|
||||
async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
|
||||
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
var f = async function f() {
|
||||
f.caller;
|
||||
assert.sameValue(f.hasOwnProperty("caller"), false);
|
||||
callCount++;
|
||||
}
|
||||
|
||||
f()
|
||||
.then(_ => {
|
||||
throw new Test262Error('function should not be resolved');
|
||||
}, error => assert.sameValue(error.constructor, TypeError))
|
||||
.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);
|
||||
|
|
|
@ -4,29 +4,34 @@
|
|||
/*---
|
||||
description: Forbidden extension, f.arguments (async function nameless expression)
|
||||
esid: sec-async-function-definitions
|
||||
features: [async-functions]
|
||||
features: [arrow-function, async-functions]
|
||||
flags: [generated, noStrict, async]
|
||||
info: |
|
||||
AsyncFunctionExpression :
|
||||
async function ( FormalParameters ) { AsyncFunctionBody }
|
||||
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
var f = async function() {
|
||||
f.arguments;
|
||||
assert.sameValue(f.hasOwnProperty("arguments"), false);
|
||||
callCount++;
|
||||
}
|
||||
|
||||
f()
|
||||
.then(_ => {
|
||||
throw new Test262Error('function should not be resolved');
|
||||
}, error => assert.sameValue(error.constructor, TypeError))
|
||||
.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);
|
||||
|
|
|
@ -4,29 +4,34 @@
|
|||
/*---
|
||||
description: Forbidden extension, o.caller (async function nameless expression)
|
||||
esid: sec-async-function-definitions
|
||||
features: [async-functions]
|
||||
features: [arrow-function, async-functions]
|
||||
flags: [generated, noStrict, async]
|
||||
info: |
|
||||
AsyncFunctionExpression :
|
||||
async function ( FormalParameters ) { AsyncFunctionBody }
|
||||
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
var f = async function() {
|
||||
f.caller;
|
||||
assert.sameValue(f.hasOwnProperty("caller"), false);
|
||||
callCount++;
|
||||
}
|
||||
|
||||
f()
|
||||
.then(_ => {
|
||||
throw new Test262Error('function should not be resolved');
|
||||
}, error => assert.sameValue(error.constructor, TypeError))
|
||||
.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);
|
||||
|
|
|
@ -0,0 +1,64 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-get.case
|
||||
// - src/function-forms/forbidden-extensions/bullet-two/async-func-expr-named.template
|
||||
/*---
|
||||
description: Forbidden extension, o.caller (async function named expression)
|
||||
esid: sec-async-definitions
|
||||
features: [arrow-function, async-functions]
|
||||
flags: [generated, noStrict, async]
|
||||
info: |
|
||||
AsyncFunctionExpression :
|
||||
async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
|
||||
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
var f;
|
||||
f = async function f() {
|
||||
"use strict";
|
||||
// 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 && true) {
|
||||
Object.defineProperty(inner, "caller", {get(){return 1}});
|
||||
}
|
||||
var result = inner();
|
||||
if (descriptor && descriptor.configurable && true) {
|
||||
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, f);
|
||||
}
|
||||
callCount++;
|
||||
}
|
||||
|
||||
f()
|
||||
.then(() => {
|
||||
assert.sameValue(callCount, 1, 'function body evaluated');
|
||||
}, $DONE).then($DONE, $DONE);
|
|
@ -0,0 +1,64 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-value.case
|
||||
// - src/function-forms/forbidden-extensions/bullet-two/async-func-expr-named.template
|
||||
/*---
|
||||
description: Forbidden extension, o.caller (async function named expression)
|
||||
esid: sec-async-definitions
|
||||
features: [arrow-function, async-functions]
|
||||
flags: [generated, noStrict, async]
|
||||
info: |
|
||||
AsyncFunctionExpression :
|
||||
async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
|
||||
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
var f;
|
||||
f = async function f() {
|
||||
"use strict";
|
||||
// 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 && true) {
|
||||
Object.defineProperty(inner, "caller", {value: 1});
|
||||
}
|
||||
var result = inner();
|
||||
if (descriptor && descriptor.configurable && true) {
|
||||
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, f);
|
||||
}
|
||||
callCount++;
|
||||
}
|
||||
|
||||
f()
|
||||
.then(() => {
|
||||
assert.sameValue(callCount, 1, 'function body evaluated');
|
||||
}, $DONE).then($DONE, $DONE);
|
|
@ -4,34 +4,61 @@
|
|||
/*---
|
||||
description: Forbidden extension, o.caller (async function named expression)
|
||||
esid: sec-async-definitions
|
||||
features: [async-functions]
|
||||
features: [arrow-function, async-functions]
|
||||
flags: [generated, noStrict, async]
|
||||
info: |
|
||||
AsyncFunctionExpression :
|
||||
async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
|
||||
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
var f = async function f() {
|
||||
var f;
|
||||
f = async function f() {
|
||||
"use strict";
|
||||
inner().toString();
|
||||
// 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 && false) {
|
||||
Object.defineProperty(inner, "caller", {});
|
||||
}
|
||||
var result = inner();
|
||||
if (descriptor && descriptor.configurable && false) {
|
||||
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, f);
|
||||
}
|
||||
callCount++;
|
||||
}
|
||||
|
||||
f()
|
||||
.then(_ => {
|
||||
throw new Test262Error('function should not be resolved');
|
||||
}, error => assert.sameValue(error.constructor, TypeError))
|
||||
.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);
|
||||
|
|
|
@ -0,0 +1,64 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-get.case
|
||||
// - src/function-forms/forbidden-extensions/bullet-two/async-func-expr-nameless.template
|
||||
/*---
|
||||
description: Forbidden extension, o.caller (async function nameless expression)
|
||||
esid: sec-async-definitions
|
||||
features: [arrow-function, async-functions]
|
||||
flags: [generated, noStrict, async]
|
||||
info: |
|
||||
AsyncFunctionExpression :
|
||||
async function ( FormalParameters ) { AsyncFunctionBody }
|
||||
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
var f;
|
||||
f = async function() {
|
||||
"use strict";
|
||||
// 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 && true) {
|
||||
Object.defineProperty(inner, "caller", {get(){return 1}});
|
||||
}
|
||||
var result = inner();
|
||||
if (descriptor && descriptor.configurable && true) {
|
||||
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, f);
|
||||
}
|
||||
callCount++;
|
||||
}
|
||||
|
||||
f()
|
||||
.then(() => {
|
||||
assert.sameValue(callCount, 1, 'function body evaluated');
|
||||
}, $DONE).then($DONE, $DONE);
|
|
@ -0,0 +1,64 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-value.case
|
||||
// - src/function-forms/forbidden-extensions/bullet-two/async-func-expr-nameless.template
|
||||
/*---
|
||||
description: Forbidden extension, o.caller (async function nameless expression)
|
||||
esid: sec-async-definitions
|
||||
features: [arrow-function, async-functions]
|
||||
flags: [generated, noStrict, async]
|
||||
info: |
|
||||
AsyncFunctionExpression :
|
||||
async function ( FormalParameters ) { AsyncFunctionBody }
|
||||
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
var f;
|
||||
f = async function() {
|
||||
"use strict";
|
||||
// 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 && true) {
|
||||
Object.defineProperty(inner, "caller", {value: 1});
|
||||
}
|
||||
var result = inner();
|
||||
if (descriptor && descriptor.configurable && true) {
|
||||
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, f);
|
||||
}
|
||||
callCount++;
|
||||
}
|
||||
|
||||
f()
|
||||
.then(() => {
|
||||
assert.sameValue(callCount, 1, 'function body evaluated');
|
||||
}, $DONE).then($DONE, $DONE);
|
|
@ -4,34 +4,61 @@
|
|||
/*---
|
||||
description: Forbidden extension, o.caller (async function nameless expression)
|
||||
esid: sec-async-definitions
|
||||
features: [async-functions]
|
||||
features: [arrow-function, async-functions]
|
||||
flags: [generated, noStrict, async]
|
||||
info: |
|
||||
AsyncFunctionExpression :
|
||||
async function ( FormalParameters ) { AsyncFunctionBody }
|
||||
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
var f = async function() {
|
||||
var f;
|
||||
f = async function() {
|
||||
"use strict";
|
||||
inner().toString();
|
||||
// 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 && false) {
|
||||
Object.defineProperty(inner, "caller", {});
|
||||
}
|
||||
var result = inner();
|
||||
if (descriptor && descriptor.configurable && false) {
|
||||
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, f);
|
||||
}
|
||||
callCount++;
|
||||
}
|
||||
|
||||
f()
|
||||
.then(_ => {
|
||||
throw new Test262Error('function should not be resolved');
|
||||
}, error => assert.sameValue(error.constructor, TypeError))
|
||||
.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);
|
||||
|
|
|
@ -4,14 +4,23 @@
|
|||
/*---
|
||||
description: Forbidden extension, f.arguments (async generator function expression)
|
||||
esid: sec-asyncgenerator-definitions-evaluation
|
||||
features: [async-iteration]
|
||||
features: [arrow-function, async-functions, async-iteration]
|
||||
flags: [generated, noStrict, async]
|
||||
info: |
|
||||
AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) {
|
||||
AsyncGeneratorBody }
|
||||
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
|
||||
|
@ -19,15 +28,11 @@ info: |
|
|||
var callCount = 0;
|
||||
var f;
|
||||
f = async function*() {
|
||||
f.arguments;
|
||||
assert.sameValue(f.hasOwnProperty("arguments"), false);
|
||||
callCount++;
|
||||
};
|
||||
|
||||
f().next()
|
||||
.then(_ => {
|
||||
throw new Test262Error('function should not be resolved');
|
||||
}, error => assert.sameValue(error.constructor, TypeError))
|
||||
.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);
|
||||
|
|
|
@ -4,14 +4,23 @@
|
|||
/*---
|
||||
description: Forbidden extension, o.caller (async generator function expression)
|
||||
esid: sec-asyncgenerator-definitions-evaluation
|
||||
features: [async-iteration]
|
||||
features: [arrow-function, async-functions, async-iteration]
|
||||
flags: [generated, noStrict, async]
|
||||
info: |
|
||||
AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) {
|
||||
AsyncGeneratorBody }
|
||||
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
|
||||
|
@ -19,15 +28,11 @@ info: |
|
|||
var callCount = 0;
|
||||
var f;
|
||||
f = async function*() {
|
||||
f.caller;
|
||||
assert.sameValue(f.hasOwnProperty("caller"), false);
|
||||
callCount++;
|
||||
};
|
||||
|
||||
f().next()
|
||||
.then(_ => {
|
||||
throw new Test262Error('function should not be resolved');
|
||||
}, error => assert.sameValue(error.constructor, TypeError))
|
||||
.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);
|
||||
|
|
|
@ -4,14 +4,23 @@
|
|||
/*---
|
||||
description: Forbidden extension, f.arguments (async generator named function expression)
|
||||
esid: sec-asyncgenerator-definitions-evaluation
|
||||
features: [async-iteration]
|
||||
features: [arrow-function, async-functions, async-iteration]
|
||||
flags: [generated, noStrict, async]
|
||||
info: |
|
||||
AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier
|
||||
( FormalParameters ) { AsyncGeneratorBody }
|
||||
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
|
||||
|
@ -19,15 +28,11 @@ info: |
|
|||
var callCount = 0;
|
||||
var f;
|
||||
f = async function* g() {
|
||||
f.arguments;
|
||||
assert.sameValue(f.hasOwnProperty("arguments"), false);
|
||||
callCount++;
|
||||
};
|
||||
|
||||
f().next()
|
||||
.then(_ => {
|
||||
throw new Test262Error('function should not be resolved');
|
||||
}, error => assert.sameValue(error.constructor, TypeError))
|
||||
.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);
|
||||
|
|
|
@ -4,14 +4,23 @@
|
|||
/*---
|
||||
description: Forbidden extension, o.caller (async generator named function expression)
|
||||
esid: sec-asyncgenerator-definitions-evaluation
|
||||
features: [async-iteration]
|
||||
features: [arrow-function, async-functions, async-iteration]
|
||||
flags: [generated, noStrict, async]
|
||||
info: |
|
||||
AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier
|
||||
( FormalParameters ) { AsyncGeneratorBody }
|
||||
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
|
||||
|
@ -19,15 +28,11 @@ info: |
|
|||
var callCount = 0;
|
||||
var f;
|
||||
f = async function* g() {
|
||||
f.caller;
|
||||
assert.sameValue(f.hasOwnProperty("caller"), false);
|
||||
callCount++;
|
||||
};
|
||||
|
||||
f().next()
|
||||
.then(_ => {
|
||||
throw new Test262Error('function should not be resolved');
|
||||
}, error => assert.sameValue(error.constructor, TypeError))
|
||||
.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);
|
||||
|
|
|
@ -0,0 +1,64 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-get.case
|
||||
// - src/function-forms/forbidden-extensions/bullet-two/async-gen-func-expr.template
|
||||
/*---
|
||||
description: Forbidden extension, o.caller (async generator function expression)
|
||||
esid: sec-asyncgenerator-definitions-evaluation
|
||||
features: [arrow-function, async-functions, async-iteration]
|
||||
flags: [generated, noStrict, async]
|
||||
info: |
|
||||
AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) {
|
||||
AsyncGeneratorBody }
|
||||
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
var f;
|
||||
f = async function*() {
|
||||
"use strict";
|
||||
// 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 && true) {
|
||||
Object.defineProperty(inner, "caller", {get(){return 1}});
|
||||
}
|
||||
var result = inner();
|
||||
if (descriptor && descriptor.configurable && true) {
|
||||
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, f);
|
||||
}
|
||||
callCount++;
|
||||
};
|
||||
|
||||
f().next()
|
||||
.then(() => {
|
||||
assert.sameValue(callCount, 1, 'function body evaluated');
|
||||
}, $DONE).then($DONE, $DONE);
|
|
@ -0,0 +1,64 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-value.case
|
||||
// - src/function-forms/forbidden-extensions/bullet-two/async-gen-func-expr.template
|
||||
/*---
|
||||
description: Forbidden extension, o.caller (async generator function expression)
|
||||
esid: sec-asyncgenerator-definitions-evaluation
|
||||
features: [arrow-function, async-functions, async-iteration]
|
||||
flags: [generated, noStrict, async]
|
||||
info: |
|
||||
AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) {
|
||||
AsyncGeneratorBody }
|
||||
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
var f;
|
||||
f = async function*() {
|
||||
"use strict";
|
||||
// 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 && true) {
|
||||
Object.defineProperty(inner, "caller", {value: 1});
|
||||
}
|
||||
var result = inner();
|
||||
if (descriptor && descriptor.configurable && true) {
|
||||
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, f);
|
||||
}
|
||||
callCount++;
|
||||
};
|
||||
|
||||
f().next()
|
||||
.then(() => {
|
||||
assert.sameValue(callCount, 1, 'function body evaluated');
|
||||
}, $DONE).then($DONE, $DONE);
|
|
@ -4,19 +4,25 @@
|
|||
/*---
|
||||
description: Forbidden extension, o.caller (async generator function expression)
|
||||
esid: sec-asyncgenerator-definitions-evaluation
|
||||
features: [async-iteration]
|
||||
features: [arrow-function, async-functions, async-iteration]
|
||||
flags: [generated, noStrict, async]
|
||||
info: |
|
||||
AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) {
|
||||
AsyncGeneratorBody }
|
||||
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
@ -24,15 +30,35 @@ var callCount = 0;
|
|||
var f;
|
||||
f = async function*() {
|
||||
"use strict";
|
||||
inner().toString();
|
||||
// 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 && false) {
|
||||
Object.defineProperty(inner, "caller", {});
|
||||
}
|
||||
var result = inner();
|
||||
if (descriptor && descriptor.configurable && false) {
|
||||
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, f);
|
||||
}
|
||||
callCount++;
|
||||
};
|
||||
|
||||
f().next()
|
||||
.then(_ => {
|
||||
throw new Test262Error('function should not be resolved');
|
||||
}, error => assert.sameValue(error.constructor, TypeError))
|
||||
.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);
|
||||
|
|
|
@ -0,0 +1,64 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-get.case
|
||||
// - src/function-forms/forbidden-extensions/bullet-two/async-gen-named-func-expr.template
|
||||
/*---
|
||||
description: Forbidden extension, o.caller (async generator named function expression)
|
||||
esid: sec-asyncgenerator-definitions-evaluation
|
||||
features: [arrow-function, async-functions, async-iteration]
|
||||
flags: [generated, noStrict, async]
|
||||
info: |
|
||||
AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier
|
||||
( FormalParameters ) { AsyncGeneratorBody }
|
||||
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
var f;
|
||||
f = async function* g() {
|
||||
"use strict";
|
||||
// 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 && true) {
|
||||
Object.defineProperty(inner, "caller", {get(){return 1}});
|
||||
}
|
||||
var result = inner();
|
||||
if (descriptor && descriptor.configurable && true) {
|
||||
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, f);
|
||||
}
|
||||
callCount++;
|
||||
};
|
||||
|
||||
f().next()
|
||||
.then(() => {
|
||||
assert.sameValue(callCount, 1, 'function body evaluated');
|
||||
}, $DONE).then($DONE, $DONE);
|
|
@ -0,0 +1,64 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-value.case
|
||||
// - src/function-forms/forbidden-extensions/bullet-two/async-gen-named-func-expr.template
|
||||
/*---
|
||||
description: Forbidden extension, o.caller (async generator named function expression)
|
||||
esid: sec-asyncgenerator-definitions-evaluation
|
||||
features: [arrow-function, async-functions, async-iteration]
|
||||
flags: [generated, noStrict, async]
|
||||
info: |
|
||||
AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier
|
||||
( FormalParameters ) { AsyncGeneratorBody }
|
||||
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
var f;
|
||||
f = async function* g() {
|
||||
"use strict";
|
||||
// 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 && true) {
|
||||
Object.defineProperty(inner, "caller", {value: 1});
|
||||
}
|
||||
var result = inner();
|
||||
if (descriptor && descriptor.configurable && true) {
|
||||
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, f);
|
||||
}
|
||||
callCount++;
|
||||
};
|
||||
|
||||
f().next()
|
||||
.then(() => {
|
||||
assert.sameValue(callCount, 1, 'function body evaluated');
|
||||
}, $DONE).then($DONE, $DONE);
|
|
@ -4,19 +4,25 @@
|
|||
/*---
|
||||
description: Forbidden extension, o.caller (async generator named function expression)
|
||||
esid: sec-asyncgenerator-definitions-evaluation
|
||||
features: [async-iteration]
|
||||
features: [arrow-function, async-functions, async-iteration]
|
||||
flags: [generated, noStrict, async]
|
||||
info: |
|
||||
AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier
|
||||
( FormalParameters ) { AsyncGeneratorBody }
|
||||
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
@ -24,15 +30,35 @@ var callCount = 0;
|
|||
var f;
|
||||
f = async function* g() {
|
||||
"use strict";
|
||||
inner().toString();
|
||||
// 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 && false) {
|
||||
Object.defineProperty(inner, "caller", {});
|
||||
}
|
||||
var result = inner();
|
||||
if (descriptor && descriptor.configurable && false) {
|
||||
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, f);
|
||||
}
|
||||
callCount++;
|
||||
};
|
||||
|
||||
f().next()
|
||||
.then(_ => {
|
||||
throw new Test262Error('function should not be resolved');
|
||||
}, error => assert.sameValue(error.constructor, TypeError))
|
||||
.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);
|
||||
|
|
|
@ -4,29 +4,34 @@
|
|||
/*---
|
||||
description: Forbidden extension, f.arguments (static class expression async generator method)
|
||||
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||
features: [async-iteration]
|
||||
features: [arrow-function, async-functions, async-iteration, class]
|
||||
flags: [generated, noStrict, async]
|
||||
info: |
|
||||
ClassExpression : class BindingIdentifieropt ClassTail
|
||||
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
var C = class {
|
||||
static async *method() {
|
||||
this.method.arguments;
|
||||
assert.sameValue(this.method.hasOwnProperty("arguments"), false);
|
||||
callCount++;
|
||||
}
|
||||
};
|
||||
|
||||
C.method().next()
|
||||
.then(_ => {
|
||||
throw new Test262Error('function should not be resolved');
|
||||
}, error => assert.sameValue(error.constructor, TypeError))
|
||||
.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);
|
||||
|
|
|
@ -4,29 +4,34 @@
|
|||
/*---
|
||||
description: Forbidden extension, o.caller (static class expression async generator method)
|
||||
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||
features: [async-iteration]
|
||||
features: [arrow-function, async-functions, async-iteration, class]
|
||||
flags: [generated, noStrict, async]
|
||||
info: |
|
||||
ClassExpression : class BindingIdentifieropt ClassTail
|
||||
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
var C = class {
|
||||
static async *method() {
|
||||
this.method.caller;
|
||||
assert.sameValue(this.method.hasOwnProperty("caller"), false);
|
||||
callCount++;
|
||||
}
|
||||
};
|
||||
|
||||
C.method().next()
|
||||
.then(_ => {
|
||||
throw new Test262Error('function should not be resolved');
|
||||
}, error => assert.sameValue(error.constructor, TypeError))
|
||||
.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);
|
||||
|
|
|
@ -0,0 +1,63 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-get.case
|
||||
// - src/function-forms/forbidden-extensions/bullet-two/cls-expr-async-gen-meth-static.template
|
||||
/*---
|
||||
description: Forbidden extension, o.caller (static class expression async generator method)
|
||||
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||
features: [arrow-function, async-functions, async-iteration, class]
|
||||
flags: [generated, noStrict, async]
|
||||
info: |
|
||||
ClassExpression : class BindingIdentifieropt ClassTail
|
||||
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
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;
|
||||
}
|
||||
|
||||
var callCount = 0;
|
||||
var C = class {
|
||||
static async *method() {
|
||||
/* implicit strict */
|
||||
// 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 && true) {
|
||||
Object.defineProperty(inner, "caller", {get(){return 1}});
|
||||
}
|
||||
var result = inner();
|
||||
if (descriptor && descriptor.configurable && true) {
|
||||
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, this.method);
|
||||
}
|
||||
callCount++;
|
||||
}
|
||||
};
|
||||
|
||||
C.method().next()
|
||||
.then(() => {
|
||||
assert.sameValue(callCount, 1, 'function body evaluated');
|
||||
}, $DONE).then($DONE, $DONE);
|
|
@ -0,0 +1,63 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-value.case
|
||||
// - src/function-forms/forbidden-extensions/bullet-two/cls-expr-async-gen-meth-static.template
|
||||
/*---
|
||||
description: Forbidden extension, o.caller (static class expression async generator method)
|
||||
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||
features: [arrow-function, async-functions, async-iteration, class]
|
||||
flags: [generated, noStrict, async]
|
||||
info: |
|
||||
ClassExpression : class BindingIdentifieropt ClassTail
|
||||
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
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;
|
||||
}
|
||||
|
||||
var callCount = 0;
|
||||
var C = class {
|
||||
static async *method() {
|
||||
/* implicit strict */
|
||||
// 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 && true) {
|
||||
Object.defineProperty(inner, "caller", {value: 1});
|
||||
}
|
||||
var result = inner();
|
||||
if (descriptor && descriptor.configurable && true) {
|
||||
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, this.method);
|
||||
}
|
||||
callCount++;
|
||||
}
|
||||
};
|
||||
|
||||
C.method().next()
|
||||
.then(() => {
|
||||
assert.sameValue(callCount, 1, 'function body evaluated');
|
||||
}, $DONE).then($DONE, $DONE);
|
|
@ -4,34 +4,60 @@
|
|||
/*---
|
||||
description: Forbidden extension, o.caller (static class expression async generator method)
|
||||
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||
features: [async-iteration]
|
||||
features: [arrow-function, async-functions, async-iteration, class]
|
||||
flags: [generated, noStrict, async]
|
||||
info: |
|
||||
ClassExpression : class BindingIdentifieropt ClassTail
|
||||
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
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;
|
||||
}
|
||||
|
||||
var callCount = 0;
|
||||
var C = class {
|
||||
static async *method() {
|
||||
/* implicit strict */
|
||||
inner().toString();
|
||||
// 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 && false) {
|
||||
Object.defineProperty(inner, "caller", {});
|
||||
}
|
||||
var result = inner();
|
||||
if (descriptor && descriptor.configurable && false) {
|
||||
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, this.method);
|
||||
}
|
||||
callCount++;
|
||||
}
|
||||
};
|
||||
|
||||
C.method().next()
|
||||
.then(_ => {
|
||||
throw new Test262Error('function should not be resolved');
|
||||
}, error => assert.sameValue(error.constructor, TypeError))
|
||||
.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);
|
||||
|
|
|
@ -4,29 +4,34 @@
|
|||
/*---
|
||||
description: Forbidden extension, f.arguments (class expression async generator method)
|
||||
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||
features: [async-iteration]
|
||||
features: [arrow-function, async-functions, async-iteration, class]
|
||||
flags: [generated, noStrict, async]
|
||||
info: |
|
||||
ClassExpression : class BindingIdentifieropt ClassTail
|
||||
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
var C = class {
|
||||
async *method() {
|
||||
this.method.arguments;
|
||||
assert.sameValue(this.method.hasOwnProperty("arguments"), false);
|
||||
callCount++;
|
||||
}
|
||||
};
|
||||
|
||||
C.prototype.method().next()
|
||||
.then(_ => {
|
||||
throw new Test262Error('function should not be resolved');
|
||||
}, error => assert.sameValue(error.constructor, TypeError))
|
||||
.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);
|
||||
|
|
|
@ -4,29 +4,34 @@
|
|||
/*---
|
||||
description: Forbidden extension, o.caller (class expression async generator method)
|
||||
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||
features: [async-iteration]
|
||||
features: [arrow-function, async-functions, async-iteration, class]
|
||||
flags: [generated, noStrict, async]
|
||||
info: |
|
||||
ClassExpression : class BindingIdentifieropt ClassTail
|
||||
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
var C = class {
|
||||
async *method() {
|
||||
this.method.caller;
|
||||
assert.sameValue(this.method.hasOwnProperty("caller"), false);
|
||||
callCount++;
|
||||
}
|
||||
};
|
||||
|
||||
C.prototype.method().next()
|
||||
.then(_ => {
|
||||
throw new Test262Error('function should not be resolved');
|
||||
}, error => assert.sameValue(error.constructor, TypeError))
|
||||
.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);
|
||||
|
|
|
@ -0,0 +1,63 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-get.case
|
||||
// - src/function-forms/forbidden-extensions/bullet-two/cls-expr-async-gen-meth.template
|
||||
/*---
|
||||
description: Forbidden extension, o.caller (class expression async generator method)
|
||||
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||
features: [arrow-function, async-functions, async-iteration, class]
|
||||
flags: [generated, noStrict, async]
|
||||
info: |
|
||||
ClassExpression : class BindingIdentifieropt ClassTail
|
||||
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
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;
|
||||
}
|
||||
|
||||
var callCount = 0;
|
||||
var C = class {
|
||||
async *method() {
|
||||
/* implicit strict */
|
||||
// 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 && true) {
|
||||
Object.defineProperty(inner, "caller", {get(){return 1}});
|
||||
}
|
||||
var result = inner();
|
||||
if (descriptor && descriptor.configurable && true) {
|
||||
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, this.method);
|
||||
}
|
||||
callCount++;
|
||||
}
|
||||
};
|
||||
|
||||
C.prototype.method().next()
|
||||
.then(() => {
|
||||
assert.sameValue(callCount, 1, 'function body evaluated');
|
||||
}, $DONE).then($DONE, $DONE);
|
|
@ -0,0 +1,63 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-value.case
|
||||
// - src/function-forms/forbidden-extensions/bullet-two/cls-expr-async-gen-meth.template
|
||||
/*---
|
||||
description: Forbidden extension, o.caller (class expression async generator method)
|
||||
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||
features: [arrow-function, async-functions, async-iteration, class]
|
||||
flags: [generated, noStrict, async]
|
||||
info: |
|
||||
ClassExpression : class BindingIdentifieropt ClassTail
|
||||
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
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;
|
||||
}
|
||||
|
||||
var callCount = 0;
|
||||
var C = class {
|
||||
async *method() {
|
||||
/* implicit strict */
|
||||
// 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 && true) {
|
||||
Object.defineProperty(inner, "caller", {value: 1});
|
||||
}
|
||||
var result = inner();
|
||||
if (descriptor && descriptor.configurable && true) {
|
||||
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, this.method);
|
||||
}
|
||||
callCount++;
|
||||
}
|
||||
};
|
||||
|
||||
C.prototype.method().next()
|
||||
.then(() => {
|
||||
assert.sameValue(callCount, 1, 'function body evaluated');
|
||||
}, $DONE).then($DONE, $DONE);
|
|
@ -4,34 +4,60 @@
|
|||
/*---
|
||||
description: Forbidden extension, o.caller (class expression async generator method)
|
||||
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||
features: [async-iteration]
|
||||
features: [arrow-function, async-functions, async-iteration, class]
|
||||
flags: [generated, noStrict, async]
|
||||
info: |
|
||||
ClassExpression : class BindingIdentifieropt ClassTail
|
||||
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
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;
|
||||
}
|
||||
|
||||
var callCount = 0;
|
||||
var C = class {
|
||||
async *method() {
|
||||
/* implicit strict */
|
||||
inner().toString();
|
||||
// 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 && false) {
|
||||
Object.defineProperty(inner, "caller", {});
|
||||
}
|
||||
var result = inner();
|
||||
if (descriptor && descriptor.configurable && false) {
|
||||
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, this.method);
|
||||
}
|
||||
callCount++;
|
||||
}
|
||||
};
|
||||
|
||||
C.prototype.method().next()
|
||||
.then(_ => {
|
||||
throw new Test262Error('function should not be resolved');
|
||||
}, error => assert.sameValue(error.constructor, TypeError))
|
||||
.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);
|
||||
|
|
|
@ -4,13 +4,22 @@
|
|||
/*---
|
||||
description: Forbidden extension, f.arguments (static class expression async method)
|
||||
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||
features: [async-functions]
|
||||
features: [arrow-function, async-functions, class]
|
||||
flags: [generated, noStrict, async]
|
||||
info: |
|
||||
ClassExpression : class BindingIdentifieropt ClassTail
|
||||
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
|
||||
|
@ -19,16 +28,12 @@ var callCount = 0;
|
|||
|
||||
var C = class {
|
||||
static async method() {
|
||||
this.method.arguments;
|
||||
assert.sameValue(this.method.hasOwnProperty("arguments"), false);
|
||||
callCount++;
|
||||
}
|
||||
};
|
||||
|
||||
C.method()
|
||||
.then(_ => {
|
||||
throw new Test262Error('function should not be resolved');
|
||||
}, error => assert.sameValue(error.constructor, TypeError))
|
||||
.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);
|
||||
|
|
|
@ -4,13 +4,22 @@
|
|||
/*---
|
||||
description: Forbidden extension, o.caller (static class expression async method)
|
||||
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||
features: [async-functions]
|
||||
features: [arrow-function, async-functions, class]
|
||||
flags: [generated, noStrict, async]
|
||||
info: |
|
||||
ClassExpression : class BindingIdentifieropt ClassTail
|
||||
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
|
||||
|
@ -19,16 +28,12 @@ var callCount = 0;
|
|||
|
||||
var C = class {
|
||||
static async method() {
|
||||
this.method.caller;
|
||||
assert.sameValue(this.method.hasOwnProperty("caller"), false);
|
||||
callCount++;
|
||||
}
|
||||
};
|
||||
|
||||
C.method()
|
||||
.then(_ => {
|
||||
throw new Test262Error('function should not be resolved');
|
||||
}, error => assert.sameValue(error.constructor, TypeError))
|
||||
.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);
|
||||
|
|
|
@ -0,0 +1,65 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-get.case
|
||||
// - src/function-forms/forbidden-extensions/bullet-two/cls-expr-async-meth-static.template
|
||||
/*---
|
||||
description: Forbidden extension, o.caller (static class expression async method)
|
||||
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||
features: [arrow-function, async-functions, class]
|
||||
flags: [generated, noStrict, async]
|
||||
info: |
|
||||
ClassExpression : class BindingIdentifieropt ClassTail
|
||||
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var C = class {
|
||||
static async method() {
|
||||
/* implicit strict */
|
||||
// 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 && true) {
|
||||
Object.defineProperty(inner, "caller", {get(){return 1}});
|
||||
}
|
||||
var result = inner();
|
||||
if (descriptor && descriptor.configurable && true) {
|
||||
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, this.method);
|
||||
}
|
||||
callCount++;
|
||||
}
|
||||
};
|
||||
|
||||
C.method()
|
||||
.then(() => {
|
||||
assert.sameValue(callCount, 1, 'function body evaluated');
|
||||
}, $DONE).then($DONE, $DONE);
|
|
@ -0,0 +1,65 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-value.case
|
||||
// - src/function-forms/forbidden-extensions/bullet-two/cls-expr-async-meth-static.template
|
||||
/*---
|
||||
description: Forbidden extension, o.caller (static class expression async method)
|
||||
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||
features: [arrow-function, async-functions, class]
|
||||
flags: [generated, noStrict, async]
|
||||
info: |
|
||||
ClassExpression : class BindingIdentifieropt ClassTail
|
||||
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var C = class {
|
||||
static async method() {
|
||||
/* implicit strict */
|
||||
// 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 && true) {
|
||||
Object.defineProperty(inner, "caller", {value: 1});
|
||||
}
|
||||
var result = inner();
|
||||
if (descriptor && descriptor.configurable && true) {
|
||||
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, this.method);
|
||||
}
|
||||
callCount++;
|
||||
}
|
||||
};
|
||||
|
||||
C.method()
|
||||
.then(() => {
|
||||
assert.sameValue(callCount, 1, 'function body evaluated');
|
||||
}, $DONE).then($DONE, $DONE);
|
|
@ -4,18 +4,24 @@
|
|||
/*---
|
||||
description: Forbidden extension, o.caller (static class expression async method)
|
||||
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||
features: [async-functions]
|
||||
features: [arrow-function, async-functions, class]
|
||||
flags: [generated, noStrict, async]
|
||||
info: |
|
||||
ClassExpression : class BindingIdentifieropt ClassTail
|
||||
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
@ -24,16 +30,36 @@ var callCount = 0;
|
|||
var C = class {
|
||||
static async method() {
|
||||
/* implicit strict */
|
||||
inner().toString();
|
||||
// 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 && false) {
|
||||
Object.defineProperty(inner, "caller", {});
|
||||
}
|
||||
var result = inner();
|
||||
if (descriptor && descriptor.configurable && false) {
|
||||
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, this.method);
|
||||
}
|
||||
callCount++;
|
||||
}
|
||||
};
|
||||
|
||||
C.method()
|
||||
.then(_ => {
|
||||
throw new Test262Error('function should not be resolved');
|
||||
}, error => assert.sameValue(error.constructor, TypeError))
|
||||
.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);
|
||||
|
|
|
@ -4,13 +4,22 @@
|
|||
/*---
|
||||
description: Forbidden extension, f.arguments (class expression async method)
|
||||
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||
features: [async-functions]
|
||||
features: [arrow-function, async-functions, class]
|
||||
flags: [generated, noStrict, async]
|
||||
info: |
|
||||
ClassExpression : class BindingIdentifieropt ClassTail
|
||||
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
|
||||
|
@ -18,16 +27,12 @@ info: |
|
|||
var callCount = 0;
|
||||
var C = class {
|
||||
async method() {
|
||||
this.method.arguments;
|
||||
assert.sameValue(this.method.hasOwnProperty("arguments"), false);
|
||||
callCount++;
|
||||
}
|
||||
};
|
||||
|
||||
C.prototype.method()
|
||||
.then(_ => {
|
||||
throw new Test262Error('function should not be resolved');
|
||||
}, error => assert.sameValue(error.constructor, TypeError))
|
||||
.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);
|
||||
|
|
|
@ -4,13 +4,22 @@
|
|||
/*---
|
||||
description: Forbidden extension, o.caller (class expression async method)
|
||||
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||
features: [async-functions]
|
||||
features: [arrow-function, async-functions, class]
|
||||
flags: [generated, noStrict, async]
|
||||
info: |
|
||||
ClassExpression : class BindingIdentifieropt ClassTail
|
||||
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
|
||||
|
@ -18,16 +27,12 @@ info: |
|
|||
var callCount = 0;
|
||||
var C = class {
|
||||
async method() {
|
||||
this.method.caller;
|
||||
assert.sameValue(this.method.hasOwnProperty("caller"), false);
|
||||
callCount++;
|
||||
}
|
||||
};
|
||||
|
||||
C.prototype.method()
|
||||
.then(_ => {
|
||||
throw new Test262Error('function should not be resolved');
|
||||
}, error => assert.sameValue(error.constructor, TypeError))
|
||||
.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);
|
||||
|
|
|
@ -0,0 +1,64 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-get.case
|
||||
// - src/function-forms/forbidden-extensions/bullet-two/cls-expr-async-meth.template
|
||||
/*---
|
||||
description: Forbidden extension, o.caller (class expression async method)
|
||||
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||
features: [arrow-function, async-functions, class]
|
||||
flags: [generated, noStrict, async]
|
||||
info: |
|
||||
ClassExpression : class BindingIdentifieropt ClassTail
|
||||
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
var C = class {
|
||||
async method() {
|
||||
/* implicit strict */
|
||||
// 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 && true) {
|
||||
Object.defineProperty(inner, "caller", {get(){return 1}});
|
||||
}
|
||||
var result = inner();
|
||||
if (descriptor && descriptor.configurable && true) {
|
||||
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, this.method);
|
||||
}
|
||||
callCount++;
|
||||
}
|
||||
};
|
||||
|
||||
C.prototype.method()
|
||||
.then(() => {
|
||||
assert.sameValue(callCount, 1, 'function body evaluated');
|
||||
}, $DONE).then($DONE, $DONE);
|
|
@ -0,0 +1,64 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-value.case
|
||||
// - src/function-forms/forbidden-extensions/bullet-two/cls-expr-async-meth.template
|
||||
/*---
|
||||
description: Forbidden extension, o.caller (class expression async method)
|
||||
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||
features: [arrow-function, async-functions, class]
|
||||
flags: [generated, noStrict, async]
|
||||
info: |
|
||||
ClassExpression : class BindingIdentifieropt ClassTail
|
||||
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
var C = class {
|
||||
async method() {
|
||||
/* implicit strict */
|
||||
// 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 && true) {
|
||||
Object.defineProperty(inner, "caller", {value: 1});
|
||||
}
|
||||
var result = inner();
|
||||
if (descriptor && descriptor.configurable && true) {
|
||||
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, this.method);
|
||||
}
|
||||
callCount++;
|
||||
}
|
||||
};
|
||||
|
||||
C.prototype.method()
|
||||
.then(() => {
|
||||
assert.sameValue(callCount, 1, 'function body evaluated');
|
||||
}, $DONE).then($DONE, $DONE);
|
|
@ -4,18 +4,24 @@
|
|||
/*---
|
||||
description: Forbidden extension, o.caller (class expression async method)
|
||||
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||
features: [async-functions]
|
||||
features: [arrow-function, async-functions, class]
|
||||
flags: [generated, noStrict, async]
|
||||
info: |
|
||||
ClassExpression : class BindingIdentifieropt ClassTail
|
||||
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
@ -23,16 +29,36 @@ var callCount = 0;
|
|||
var C = class {
|
||||
async method() {
|
||||
/* implicit strict */
|
||||
inner().toString();
|
||||
// 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 && false) {
|
||||
Object.defineProperty(inner, "caller", {});
|
||||
}
|
||||
var result = inner();
|
||||
if (descriptor && descriptor.configurable && false) {
|
||||
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, this.method);
|
||||
}
|
||||
callCount++;
|
||||
}
|
||||
};
|
||||
|
||||
C.prototype.method()
|
||||
.then(_ => {
|
||||
throw new Test262Error('function should not be resolved');
|
||||
}, error => assert.sameValue(error.constructor, TypeError))
|
||||
.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);
|
||||
|
|
|
@ -4,25 +4,32 @@
|
|||
/*---
|
||||
description: Forbidden extension, f.arguments (static class expression generator method)
|
||||
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||
features: [generators]
|
||||
features: [class, generators]
|
||||
flags: [generated, noStrict]
|
||||
info: |
|
||||
ClassExpression : class BindingIdentifieropt ClassTail
|
||||
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
var C = class {
|
||||
static *method() {
|
||||
this.method.arguments;
|
||||
assert.sameValue(this.method.hasOwnProperty("arguments"), false);
|
||||
callCount++;
|
||||
}
|
||||
};
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
C.method().next();
|
||||
});
|
||||
assert.sameValue(callCount, 0, 'method body not evaluated');
|
||||
C.method().next();
|
||||
assert.sameValue(callCount, 1, 'method body evaluated');
|
||||
|
|
|
@ -4,25 +4,32 @@
|
|||
/*---
|
||||
description: Forbidden extension, o.caller (static class expression generator method)
|
||||
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||
features: [generators]
|
||||
features: [class, generators]
|
||||
flags: [generated, noStrict]
|
||||
info: |
|
||||
ClassExpression : class BindingIdentifieropt ClassTail
|
||||
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
var C = class {
|
||||
static *method() {
|
||||
this.method.caller;
|
||||
assert.sameValue(this.method.hasOwnProperty("caller"), false);
|
||||
callCount++;
|
||||
}
|
||||
};
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
C.method().next();
|
||||
});
|
||||
assert.sameValue(callCount, 0, 'method body not evaluated');
|
||||
C.method().next();
|
||||
assert.sameValue(callCount, 1, 'method body evaluated');
|
||||
|
|
|
@ -0,0 +1,61 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-get.case
|
||||
// - src/function-forms/forbidden-extensions/bullet-two/cls-expr-gen-meth-static.template
|
||||
/*---
|
||||
description: Forbidden extension, o.caller (static class expression generator method)
|
||||
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||
features: [class, generators]
|
||||
flags: [generated, noStrict]
|
||||
info: |
|
||||
ClassExpression : class BindingIdentifieropt ClassTail
|
||||
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
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;
|
||||
}
|
||||
|
||||
var callCount = 0;
|
||||
var C = class {
|
||||
static *method() {
|
||||
/* implicit strict */
|
||||
// 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 && true) {
|
||||
Object.defineProperty(inner, "caller", {get(){return 1}});
|
||||
}
|
||||
var result = inner();
|
||||
if (descriptor && descriptor.configurable && true) {
|
||||
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, this.method);
|
||||
}
|
||||
callCount++;
|
||||
}
|
||||
};
|
||||
|
||||
C.method().next();
|
||||
assert.sameValue(callCount, 1, 'method body evaluated');
|
|
@ -0,0 +1,61 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-value.case
|
||||
// - src/function-forms/forbidden-extensions/bullet-two/cls-expr-gen-meth-static.template
|
||||
/*---
|
||||
description: Forbidden extension, o.caller (static class expression generator method)
|
||||
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||
features: [class, generators]
|
||||
flags: [generated, noStrict]
|
||||
info: |
|
||||
ClassExpression : class BindingIdentifieropt ClassTail
|
||||
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
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;
|
||||
}
|
||||
|
||||
var callCount = 0;
|
||||
var C = class {
|
||||
static *method() {
|
||||
/* implicit strict */
|
||||
// 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 && true) {
|
||||
Object.defineProperty(inner, "caller", {value: 1});
|
||||
}
|
||||
var result = inner();
|
||||
if (descriptor && descriptor.configurable && true) {
|
||||
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, this.method);
|
||||
}
|
||||
callCount++;
|
||||
}
|
||||
};
|
||||
|
||||
C.method().next();
|
||||
assert.sameValue(callCount, 1, 'method body evaluated');
|
|
@ -4,30 +4,58 @@
|
|||
/*---
|
||||
description: Forbidden extension, o.caller (static class expression generator method)
|
||||
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||
features: [generators]
|
||||
features: [class, generators]
|
||||
flags: [generated, noStrict]
|
||||
info: |
|
||||
ClassExpression : class BindingIdentifieropt ClassTail
|
||||
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
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;
|
||||
}
|
||||
|
||||
var callCount = 0;
|
||||
var C = class {
|
||||
static *method() {
|
||||
/* implicit strict */
|
||||
inner().toString();
|
||||
// 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 && false) {
|
||||
Object.defineProperty(inner, "caller", {});
|
||||
}
|
||||
var result = inner();
|
||||
if (descriptor && descriptor.configurable && false) {
|
||||
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, this.method);
|
||||
}
|
||||
callCount++;
|
||||
}
|
||||
};
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
C.method().next();
|
||||
});
|
||||
assert.sameValue(callCount, 0, 'method body not evaluated');
|
||||
C.method().next();
|
||||
assert.sameValue(callCount, 1, 'method body evaluated');
|
||||
|
|
|
@ -4,25 +4,32 @@
|
|||
/*---
|
||||
description: Forbidden extension, f.arguments (class expression method)
|
||||
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||
features: [generators]
|
||||
features: [class, generators]
|
||||
flags: [generated, noStrict]
|
||||
info: |
|
||||
ClassExpression : class BindingIdentifieropt ClassTail
|
||||
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
var C = class {
|
||||
*method() {
|
||||
this.method.arguments;
|
||||
assert.sameValue(this.method.hasOwnProperty("arguments"), false);
|
||||
callCount++;
|
||||
}
|
||||
};
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
C.prototype.method().next();
|
||||
});
|
||||
assert.sameValue(callCount, 0, 'method body not evaluated');
|
||||
C.prototype.method().next();
|
||||
assert.sameValue(callCount, 1, 'method body evaluated');
|
||||
|
|
|
@ -4,25 +4,32 @@
|
|||
/*---
|
||||
description: Forbidden extension, o.caller (class expression method)
|
||||
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||
features: [generators]
|
||||
features: [class, generators]
|
||||
flags: [generated, noStrict]
|
||||
info: |
|
||||
ClassExpression : class BindingIdentifieropt ClassTail
|
||||
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
var C = class {
|
||||
*method() {
|
||||
this.method.caller;
|
||||
assert.sameValue(this.method.hasOwnProperty("caller"), false);
|
||||
callCount++;
|
||||
}
|
||||
};
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
C.prototype.method().next();
|
||||
});
|
||||
assert.sameValue(callCount, 0, 'method body not evaluated');
|
||||
C.prototype.method().next();
|
||||
assert.sameValue(callCount, 1, 'method body evaluated');
|
||||
|
|
|
@ -0,0 +1,62 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-get.case
|
||||
// - src/function-forms/forbidden-extensions/bullet-two/cls-expr-gen-meth.template
|
||||
/*---
|
||||
description: Forbidden extension, o.caller (class expression method)
|
||||
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||
features: [class, generators]
|
||||
flags: [generated, noStrict]
|
||||
info: |
|
||||
ClassExpression : class BindingIdentifieropt ClassTail
|
||||
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
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;
|
||||
}
|
||||
|
||||
var callCount = 0;
|
||||
var C = class {
|
||||
*method() {
|
||||
/* implicit strict */
|
||||
// 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 && true) {
|
||||
Object.defineProperty(inner, "caller", {get(){return 1}});
|
||||
}
|
||||
var result = inner();
|
||||
if (descriptor && descriptor.configurable && true) {
|
||||
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, this.method);
|
||||
}
|
||||
|
||||
callCount++;
|
||||
}
|
||||
};
|
||||
|
||||
C.prototype.method().next();
|
||||
assert.sameValue(callCount, 1, 'method body evaluated');
|
|
@ -0,0 +1,62 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-value.case
|
||||
// - src/function-forms/forbidden-extensions/bullet-two/cls-expr-gen-meth.template
|
||||
/*---
|
||||
description: Forbidden extension, o.caller (class expression method)
|
||||
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||
features: [class, generators]
|
||||
flags: [generated, noStrict]
|
||||
info: |
|
||||
ClassExpression : class BindingIdentifieropt ClassTail
|
||||
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
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;
|
||||
}
|
||||
|
||||
var callCount = 0;
|
||||
var C = class {
|
||||
*method() {
|
||||
/* implicit strict */
|
||||
// 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 && true) {
|
||||
Object.defineProperty(inner, "caller", {value: 1});
|
||||
}
|
||||
var result = inner();
|
||||
if (descriptor && descriptor.configurable && true) {
|
||||
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, this.method);
|
||||
}
|
||||
|
||||
callCount++;
|
||||
}
|
||||
};
|
||||
|
||||
C.prototype.method().next();
|
||||
assert.sameValue(callCount, 1, 'method body evaluated');
|
|
@ -4,30 +4,59 @@
|
|||
/*---
|
||||
description: Forbidden extension, o.caller (class expression method)
|
||||
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||
features: [generators]
|
||||
features: [class, generators]
|
||||
flags: [generated, noStrict]
|
||||
info: |
|
||||
ClassExpression : class BindingIdentifieropt ClassTail
|
||||
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
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;
|
||||
}
|
||||
|
||||
var callCount = 0;
|
||||
var C = class {
|
||||
*method() {
|
||||
/* implicit strict */
|
||||
inner().toString();
|
||||
// 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 && false) {
|
||||
Object.defineProperty(inner, "caller", {});
|
||||
}
|
||||
var result = inner();
|
||||
if (descriptor && descriptor.configurable && false) {
|
||||
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, this.method);
|
||||
}
|
||||
|
||||
callCount++;
|
||||
}
|
||||
};
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
C.prototype.method().next();
|
||||
});
|
||||
assert.sameValue(callCount, 0, 'method body not evaluated');
|
||||
C.prototype.method().next();
|
||||
assert.sameValue(callCount, 1, 'method body evaluated');
|
||||
|
|
|
@ -4,23 +4,32 @@
|
|||
/*---
|
||||
description: Forbidden extension, f.arguments (static class expression method)
|
||||
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||
features: [class]
|
||||
flags: [generated, noStrict]
|
||||
info: |
|
||||
ClassExpression : class BindingIdentifieropt ClassTail
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
var C = class {
|
||||
static method() {
|
||||
this.method.arguments;
|
||||
assert.sameValue(this.method.hasOwnProperty("arguments"), false);
|
||||
callCount++;
|
||||
}
|
||||
};
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
C.method();
|
||||
});
|
||||
assert.sameValue(callCount, 0, 'method body not evaluated');
|
||||
C.method();
|
||||
assert.sameValue(callCount, 1, 'method body evaluated');
|
||||
|
|
|
@ -4,23 +4,32 @@
|
|||
/*---
|
||||
description: Forbidden extension, o.caller (static class expression method)
|
||||
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||
features: [class]
|
||||
flags: [generated, noStrict]
|
||||
info: |
|
||||
ClassExpression : class BindingIdentifieropt ClassTail
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
var C = class {
|
||||
static method() {
|
||||
this.method.caller;
|
||||
assert.sameValue(this.method.hasOwnProperty("caller"), false);
|
||||
callCount++;
|
||||
}
|
||||
};
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
C.method();
|
||||
});
|
||||
assert.sameValue(callCount, 0, 'method body not evaluated');
|
||||
C.method();
|
||||
assert.sameValue(callCount, 1, 'method body evaluated');
|
||||
|
|
|
@ -0,0 +1,62 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-get.case
|
||||
// - src/function-forms/forbidden-extensions/bullet-two/cls-expr-meth-static.template
|
||||
/*---
|
||||
description: Forbidden extension, o.caller (static class expression method)
|
||||
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||
features: [class]
|
||||
flags: [generated, noStrict]
|
||||
info: |
|
||||
ClassExpression : class BindingIdentifieropt ClassTail
|
||||
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
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;
|
||||
}
|
||||
|
||||
var callCount = 0;
|
||||
var C = class {
|
||||
static method() {
|
||||
/* implicit strict */
|
||||
// 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 && true) {
|
||||
Object.defineProperty(inner, "caller", {get(){return 1}});
|
||||
}
|
||||
var result = inner();
|
||||
if (descriptor && descriptor.configurable && true) {
|
||||
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, this.method);
|
||||
}
|
||||
|
||||
callCount++;
|
||||
}
|
||||
};
|
||||
|
||||
C.method();
|
||||
assert.sameValue(callCount, 1, 'method body evaluated');
|
|
@ -0,0 +1,62 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-value.case
|
||||
// - src/function-forms/forbidden-extensions/bullet-two/cls-expr-meth-static.template
|
||||
/*---
|
||||
description: Forbidden extension, o.caller (static class expression method)
|
||||
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||
features: [class]
|
||||
flags: [generated, noStrict]
|
||||
info: |
|
||||
ClassExpression : class BindingIdentifieropt ClassTail
|
||||
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
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;
|
||||
}
|
||||
|
||||
var callCount = 0;
|
||||
var C = class {
|
||||
static method() {
|
||||
/* implicit strict */
|
||||
// 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 && true) {
|
||||
Object.defineProperty(inner, "caller", {value: 1});
|
||||
}
|
||||
var result = inner();
|
||||
if (descriptor && descriptor.configurable && true) {
|
||||
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, this.method);
|
||||
}
|
||||
|
||||
callCount++;
|
||||
}
|
||||
};
|
||||
|
||||
C.method();
|
||||
assert.sameValue(callCount, 1, 'method body evaluated');
|
|
@ -4,28 +4,59 @@
|
|||
/*---
|
||||
description: Forbidden extension, o.caller (static class expression method)
|
||||
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||
features: [class]
|
||||
flags: [generated, noStrict]
|
||||
info: |
|
||||
ClassExpression : class BindingIdentifieropt ClassTail
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
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;
|
||||
}
|
||||
|
||||
var callCount = 0;
|
||||
var C = class {
|
||||
static method() {
|
||||
/* implicit strict */
|
||||
inner().toString();
|
||||
// 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 && false) {
|
||||
Object.defineProperty(inner, "caller", {});
|
||||
}
|
||||
var result = inner();
|
||||
if (descriptor && descriptor.configurable && false) {
|
||||
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, this.method);
|
||||
}
|
||||
|
||||
callCount++;
|
||||
}
|
||||
};
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
C.method();
|
||||
});
|
||||
assert.sameValue(callCount, 0, 'method body not evaluated');
|
||||
C.method();
|
||||
assert.sameValue(callCount, 1, 'method body evaluated');
|
||||
|
|
|
@ -4,23 +4,32 @@
|
|||
/*---
|
||||
description: Forbidden extension, f.arguments (class expression method)
|
||||
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||
features: [class]
|
||||
flags: [generated, noStrict]
|
||||
info: |
|
||||
ClassExpression : class BindingIdentifieropt ClassTail
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
var C = class {
|
||||
method() {
|
||||
this.method.arguments;
|
||||
assert.sameValue(this.method.hasOwnProperty("arguments"), false);
|
||||
callCount++;
|
||||
}
|
||||
};
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
C.prototype.method();
|
||||
});
|
||||
assert.sameValue(callCount, 0, 'method body not evaluated');
|
||||
C.prototype.method();
|
||||
assert.sameValue(callCount, 1, 'method body evaluated');
|
||||
|
|
|
@ -4,23 +4,32 @@
|
|||
/*---
|
||||
description: Forbidden extension, o.caller (class expression method)
|
||||
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||
features: [class]
|
||||
flags: [generated, noStrict]
|
||||
info: |
|
||||
ClassExpression : class BindingIdentifieropt ClassTail
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
var C = class {
|
||||
method() {
|
||||
this.method.caller;
|
||||
assert.sameValue(this.method.hasOwnProperty("caller"), false);
|
||||
callCount++;
|
||||
}
|
||||
};
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
C.prototype.method();
|
||||
});
|
||||
assert.sameValue(callCount, 0, 'method body not evaluated');
|
||||
C.prototype.method();
|
||||
assert.sameValue(callCount, 1, 'method body evaluated');
|
||||
|
|
|
@ -0,0 +1,62 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-get.case
|
||||
// - src/function-forms/forbidden-extensions/bullet-two/cls-expr-meth.template
|
||||
/*---
|
||||
description: Forbidden extension, o.caller (class expression method)
|
||||
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||
features: [class]
|
||||
flags: [generated, noStrict]
|
||||
info: |
|
||||
ClassExpression : class BindingIdentifieropt ClassTail
|
||||
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
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;
|
||||
}
|
||||
|
||||
var callCount = 0;
|
||||
var C = class {
|
||||
method() {
|
||||
/* implicit strict */
|
||||
// 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 && true) {
|
||||
Object.defineProperty(inner, "caller", {get(){return 1}});
|
||||
}
|
||||
var result = inner();
|
||||
if (descriptor && descriptor.configurable && true) {
|
||||
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, this.method);
|
||||
}
|
||||
|
||||
callCount++;
|
||||
}
|
||||
};
|
||||
|
||||
C.prototype.method();
|
||||
assert.sameValue(callCount, 1, 'method body evaluated');
|
|
@ -0,0 +1,62 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-value.case
|
||||
// - src/function-forms/forbidden-extensions/bullet-two/cls-expr-meth.template
|
||||
/*---
|
||||
description: Forbidden extension, o.caller (class expression method)
|
||||
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||
features: [class]
|
||||
flags: [generated, noStrict]
|
||||
info: |
|
||||
ClassExpression : class BindingIdentifieropt ClassTail
|
||||
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
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;
|
||||
}
|
||||
|
||||
var callCount = 0;
|
||||
var C = class {
|
||||
method() {
|
||||
/* implicit strict */
|
||||
// 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 && true) {
|
||||
Object.defineProperty(inner, "caller", {value: 1});
|
||||
}
|
||||
var result = inner();
|
||||
if (descriptor && descriptor.configurable && true) {
|
||||
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, this.method);
|
||||
}
|
||||
|
||||
callCount++;
|
||||
}
|
||||
};
|
||||
|
||||
C.prototype.method();
|
||||
assert.sameValue(callCount, 1, 'method body evaluated');
|
|
@ -4,28 +4,59 @@
|
|||
/*---
|
||||
description: Forbidden extension, o.caller (class expression method)
|
||||
esid: sec-class-definitions-runtime-semantics-evaluation
|
||||
features: [class]
|
||||
flags: [generated, noStrict]
|
||||
info: |
|
||||
ClassExpression : class BindingIdentifieropt ClassTail
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
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;
|
||||
}
|
||||
|
||||
var callCount = 0;
|
||||
var C = class {
|
||||
method() {
|
||||
/* implicit strict */
|
||||
inner().toString();
|
||||
// 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 && false) {
|
||||
Object.defineProperty(inner, "caller", {});
|
||||
}
|
||||
var result = inner();
|
||||
if (descriptor && descriptor.configurable && false) {
|
||||
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, this.method);
|
||||
}
|
||||
|
||||
callCount++;
|
||||
}
|
||||
};
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
C.prototype.method();
|
||||
});
|
||||
assert.sameValue(callCount, 0, 'method body not evaluated');
|
||||
C.prototype.method();
|
||||
assert.sameValue(callCount, 1, 'method body evaluated');
|
||||
|
|
|
@ -1,26 +0,0 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/function-forms/forbidden-ext-direct-access-prop-arguments.case
|
||||
// - src/function-forms/forbidden-extensions/bullet-one/func-expr.template
|
||||
/*---
|
||||
description: Forbidden extension, f.arguments (function expression)
|
||||
esid: sec-function-definitions-runtime-semantics-evaluation
|
||||
flags: [generated, noStrict]
|
||||
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:
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
var f;
|
||||
f = function() {
|
||||
f.arguments;
|
||||
callCount++;
|
||||
};
|
||||
f();
|
||||
|
||||
assert.sameValue(callCount, 1, 'function was evaluated');
|
|
@ -1,26 +0,0 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/function-forms/forbidden-ext-direct-access-prop-caller.case
|
||||
// - src/function-forms/forbidden-extensions/bullet-one/func-expr.template
|
||||
/*---
|
||||
description: Forbidden extension, o.caller (function expression)
|
||||
esid: sec-function-definitions-runtime-semantics-evaluation
|
||||
flags: [generated, noStrict]
|
||||
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:
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
var f;
|
||||
f = function() {
|
||||
f.caller;
|
||||
callCount++;
|
||||
};
|
||||
f();
|
||||
|
||||
assert.sameValue(callCount, 1, 'function was evaluated');
|
|
@ -8,7 +8,16 @@ flags: [generated, noStrict]
|
|||
info: |
|
||||
FunctionExpression : function ( FormalParameters ) { FunctionBody }
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
|
||||
|
@ -16,10 +25,9 @@ var callCount = 0;
|
|||
var f;
|
||||
f = function() {
|
||||
"use strict";
|
||||
f.arguments;
|
||||
assert.sameValue(f.hasOwnProperty("arguments"), false);
|
||||
callCount++;
|
||||
};
|
||||
assert.throws(TypeError, function() {
|
||||
f();
|
||||
});
|
||||
assert.sameValue(callCount, 0, 'function body not evaluated');
|
||||
|
||||
f();
|
||||
assert.sameValue(callCount, 1, 'function body evaluated');
|
||||
|
|
|
@ -8,7 +8,16 @@ flags: [generated, noStrict]
|
|||
info: |
|
||||
FunctionExpression : function ( FormalParameters ) { FunctionBody }
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
|
||||
|
@ -16,10 +25,9 @@ var callCount = 0;
|
|||
var f;
|
||||
f = function() {
|
||||
"use strict";
|
||||
f.caller;
|
||||
assert.sameValue(f.hasOwnProperty("caller"), false);
|
||||
callCount++;
|
||||
};
|
||||
assert.throws(TypeError, function() {
|
||||
f();
|
||||
});
|
||||
assert.sameValue(callCount, 0, 'function body not evaluated');
|
||||
|
||||
f();
|
||||
assert.sameValue(callCount, 1, 'function body evaluated');
|
||||
|
|
|
@ -0,0 +1,59 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-get.case
|
||||
// - src/function-forms/forbidden-extensions/bullet-two/func-expr.template
|
||||
/*---
|
||||
description: Forbidden extension, o.caller (function expression)
|
||||
esid: sec-definitions-runtime-semantics-evaluation
|
||||
flags: [generated, noStrict]
|
||||
info: |
|
||||
FunctionExpression : function ( FormalParameters ) { FunctionBody }
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
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;
|
||||
}
|
||||
|
||||
var callCount = 0;
|
||||
var f;
|
||||
f = function() {
|
||||
"use strict";
|
||||
// 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 && true) {
|
||||
Object.defineProperty(inner, "caller", {get(){return 1}});
|
||||
}
|
||||
var result = inner();
|
||||
if (descriptor && descriptor.configurable && true) {
|
||||
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, f);
|
||||
}
|
||||
|
||||
callCount++;
|
||||
};
|
||||
f();
|
||||
assert.sameValue(callCount, 1, 'body evaluated');
|
|
@ -0,0 +1,59 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-value.case
|
||||
// - src/function-forms/forbidden-extensions/bullet-two/func-expr.template
|
||||
/*---
|
||||
description: Forbidden extension, o.caller (function expression)
|
||||
esid: sec-definitions-runtime-semantics-evaluation
|
||||
flags: [generated, noStrict]
|
||||
info: |
|
||||
FunctionExpression : function ( FormalParameters ) { FunctionBody }
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
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;
|
||||
}
|
||||
|
||||
var callCount = 0;
|
||||
var f;
|
||||
f = function() {
|
||||
"use strict";
|
||||
// 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 && true) {
|
||||
Object.defineProperty(inner, "caller", {value: 1});
|
||||
}
|
||||
var result = inner();
|
||||
if (descriptor && descriptor.configurable && true) {
|
||||
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, f);
|
||||
}
|
||||
|
||||
callCount++;
|
||||
};
|
||||
f();
|
||||
assert.sameValue(callCount, 1, 'body evaluated');
|
|
@ -8,22 +8,52 @@ flags: [generated, noStrict]
|
|||
info: |
|
||||
FunctionExpression : function ( FormalParameters ) { FunctionBody }
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
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;
|
||||
}
|
||||
|
||||
var callCount = 0;
|
||||
var f;
|
||||
f = function() {
|
||||
"use strict";
|
||||
inner().toString();
|
||||
// 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 && false) {
|
||||
Object.defineProperty(inner, "caller", {});
|
||||
}
|
||||
var result = inner();
|
||||
if (descriptor && descriptor.configurable && false) {
|
||||
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, f);
|
||||
}
|
||||
|
||||
callCount++;
|
||||
};
|
||||
assert.throws(TypeError, function() {
|
||||
f();
|
||||
});
|
||||
assert.sameValue(callCount, 0, 'method body not evaluated');
|
||||
f();
|
||||
assert.sameValue(callCount, 1, 'body evaluated');
|
||||
|
|
|
@ -10,18 +10,26 @@ info: |
|
|||
GeneratorExpression : function * ( FormalParameters ) { GeneratorBody }
|
||||
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
var f;
|
||||
f = function*() {
|
||||
f.arguments;
|
||||
assert.sameValue(f.hasOwnProperty("arguments"), false);
|
||||
callCount++;
|
||||
};
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
f().next();
|
||||
});
|
||||
assert.sameValue(callCount, 0, 'generator function body not evaluated');
|
||||
f().next();
|
||||
assert.sameValue(callCount, 1, 'generator function body evaluated');
|
||||
|
||||
|
|
|
@ -10,18 +10,26 @@ info: |
|
|||
GeneratorExpression : function * ( FormalParameters ) { GeneratorBody }
|
||||
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
var f;
|
||||
f = function*() {
|
||||
f.caller;
|
||||
assert.sameValue(f.hasOwnProperty("caller"), false);
|
||||
callCount++;
|
||||
};
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
f().next();
|
||||
});
|
||||
assert.sameValue(callCount, 0, 'generator function body not evaluated');
|
||||
f().next();
|
||||
assert.sameValue(callCount, 1, 'generator function body evaluated');
|
||||
|
||||
|
|
|
@ -0,0 +1,62 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-get.case
|
||||
// - src/function-forms/forbidden-extensions/bullet-two/gen-func-expr.template
|
||||
/*---
|
||||
description: Forbidden extension, o.caller (generator function expression)
|
||||
esid: sec-generator-definitions-runtime-semantics-evaluation
|
||||
features: [generators]
|
||||
flags: [generated, noStrict]
|
||||
info: |
|
||||
GeneratorExpression : function * ( FormalParameters ) { GeneratorBody }
|
||||
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
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;
|
||||
}
|
||||
|
||||
var callCount = 0;
|
||||
var f;
|
||||
f = function*() {
|
||||
"use strict";
|
||||
// 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 && true) {
|
||||
Object.defineProperty(inner, "caller", {get(){return 1}});
|
||||
}
|
||||
var result = inner();
|
||||
if (descriptor && descriptor.configurable && true) {
|
||||
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, f);
|
||||
}
|
||||
|
||||
callCount++;
|
||||
};
|
||||
|
||||
f().next();
|
||||
assert.sameValue(callCount, 1, 'generator function body evaluated');
|
|
@ -0,0 +1,62 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-value.case
|
||||
// - src/function-forms/forbidden-extensions/bullet-two/gen-func-expr.template
|
||||
/*---
|
||||
description: Forbidden extension, o.caller (generator function expression)
|
||||
esid: sec-generator-definitions-runtime-semantics-evaluation
|
||||
features: [generators]
|
||||
flags: [generated, noStrict]
|
||||
info: |
|
||||
GeneratorExpression : function * ( FormalParameters ) { GeneratorBody }
|
||||
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
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;
|
||||
}
|
||||
|
||||
var callCount = 0;
|
||||
var f;
|
||||
f = function*() {
|
||||
"use strict";
|
||||
// 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 && true) {
|
||||
Object.defineProperty(inner, "caller", {value: 1});
|
||||
}
|
||||
var result = inner();
|
||||
if (descriptor && descriptor.configurable && true) {
|
||||
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, f);
|
||||
}
|
||||
|
||||
callCount++;
|
||||
};
|
||||
|
||||
f().next();
|
||||
assert.sameValue(callCount, 1, 'generator function body evaluated');
|
|
@ -10,23 +10,53 @@ info: |
|
|||
GeneratorExpression : function * ( FormalParameters ) { GeneratorBody }
|
||||
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
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;
|
||||
}
|
||||
|
||||
var callCount = 0;
|
||||
var f;
|
||||
f = function*() {
|
||||
"use strict";
|
||||
inner().toString();
|
||||
// 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 && false) {
|
||||
Object.defineProperty(inner, "caller", {});
|
||||
}
|
||||
var result = inner();
|
||||
if (descriptor && descriptor.configurable && false) {
|
||||
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, f);
|
||||
}
|
||||
|
||||
callCount++;
|
||||
};
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
f().next();
|
||||
});
|
||||
assert.sameValue(callCount, 0, 'generator function body not evaluated');
|
||||
f().next();
|
||||
assert.sameValue(callCount, 1, 'generator function body evaluated');
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
/*---
|
||||
description: Forbidden extension, f.arguments (async generator method)
|
||||
esid: sec-asyncgenerator-definitions-propertydefinitionevaluation
|
||||
features: [async-iteration]
|
||||
features: [arrow-function, async-iteration, generators]
|
||||
flags: [generated, noStrict, async]
|
||||
info: |
|
||||
AsyncGeneratorMethod :
|
||||
|
@ -12,23 +12,28 @@ info: |
|
|||
{ AsyncGeneratorBody }
|
||||
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
var obj = {
|
||||
async *method() {
|
||||
this.method.arguments;
|
||||
assert.sameValue(this.method.hasOwnProperty("arguments"), false);
|
||||
callCount++;
|
||||
}
|
||||
};
|
||||
|
||||
obj.method().next()
|
||||
.then(_ => {
|
||||
throw new Test262Error('function should not be resolved');
|
||||
}, error => assert.sameValue(error.constructor, TypeError))
|
||||
.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);
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
/*---
|
||||
description: Forbidden extension, o.caller (async generator method)
|
||||
esid: sec-asyncgenerator-definitions-propertydefinitionevaluation
|
||||
features: [async-iteration]
|
||||
features: [arrow-function, async-iteration, generators]
|
||||
flags: [generated, noStrict, async]
|
||||
info: |
|
||||
AsyncGeneratorMethod :
|
||||
|
@ -12,23 +12,28 @@ info: |
|
|||
{ AsyncGeneratorBody }
|
||||
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
var obj = {
|
||||
async *method() {
|
||||
this.method.caller;
|
||||
assert.sameValue(this.method.hasOwnProperty("caller"), false);
|
||||
callCount++;
|
||||
}
|
||||
};
|
||||
|
||||
obj.method().next()
|
||||
.then(_ => {
|
||||
throw new Test262Error('function should not be resolved');
|
||||
}, error => assert.sameValue(error.constructor, TypeError))
|
||||
.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);
|
||||
|
|
|
@ -4,14 +4,23 @@
|
|||
/*---
|
||||
description: Forbidden extension, f.arguments (async method)
|
||||
esid: sec-async-function-definitions
|
||||
features: [async-functions]
|
||||
features: [arrow-function, async-functions]
|
||||
flags: [generated, noStrict, async]
|
||||
info: |
|
||||
AsyncMethod :
|
||||
async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
|
||||
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
|
||||
|
@ -20,16 +29,12 @@ var callCount = 0;
|
|||
|
||||
var obj = {
|
||||
async method() {
|
||||
this.method.arguments;
|
||||
assert.sameValue(this.method.hasOwnProperty("arguments"), false);
|
||||
callCount++;
|
||||
}
|
||||
};
|
||||
|
||||
obj.method()
|
||||
.then(_ => {
|
||||
throw new Test262Error('function should not be resolved');
|
||||
}, error => assert.sameValue(error.constructor, TypeError))
|
||||
.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);
|
||||
|
|
|
@ -4,14 +4,23 @@
|
|||
/*---
|
||||
description: Forbidden extension, o.caller (async method)
|
||||
esid: sec-async-function-definitions
|
||||
features: [async-functions]
|
||||
features: [arrow-function, async-functions]
|
||||
flags: [generated, noStrict, async]
|
||||
info: |
|
||||
AsyncMethod :
|
||||
async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
|
||||
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
|
||||
|
@ -20,16 +29,12 @@ var callCount = 0;
|
|||
|
||||
var obj = {
|
||||
async method() {
|
||||
this.method.caller;
|
||||
assert.sameValue(this.method.hasOwnProperty("caller"), false);
|
||||
callCount++;
|
||||
}
|
||||
};
|
||||
|
||||
obj.method()
|
||||
.then(_ => {
|
||||
throw new Test262Error('function should not be resolved');
|
||||
}, error => assert.sameValue(error.constructor, TypeError))
|
||||
.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);
|
||||
|
|
|
@ -11,19 +11,26 @@ info: |
|
|||
* PropertyName ( StrictFormalParameters ) { GeneratorBody }
|
||||
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
var obj = {
|
||||
*method() {
|
||||
this.method.arguments;
|
||||
assert.sameValue(this.method.hasOwnProperty("arguments"), false);
|
||||
callCount++;
|
||||
}
|
||||
};
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
obj.method().next();
|
||||
});
|
||||
assert.sameValue(callCount, 0, 'generator method body not evaluated');
|
||||
obj.method().next();
|
||||
assert.sameValue(callCount, 1, 'generator method body evaluated');
|
||||
|
|
|
@ -11,19 +11,26 @@ info: |
|
|||
* PropertyName ( StrictFormalParameters ) { GeneratorBody }
|
||||
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
var obj = {
|
||||
*method() {
|
||||
this.method.caller;
|
||||
assert.sameValue(this.method.hasOwnProperty("caller"), false);
|
||||
callCount++;
|
||||
}
|
||||
};
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
obj.method().next();
|
||||
});
|
||||
assert.sameValue(callCount, 0, 'generator method body not evaluated');
|
||||
obj.method().next();
|
||||
assert.sameValue(callCount, 1, 'generator method body evaluated');
|
||||
|
|
|
@ -8,19 +8,26 @@ flags: [generated, noStrict]
|
|||
info: |
|
||||
MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
var obj = {
|
||||
method() {
|
||||
this.method.arguments;
|
||||
assert.sameValue(this.method.hasOwnProperty("arguments"), false);
|
||||
callCount++;
|
||||
}
|
||||
};
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
obj.method();
|
||||
});
|
||||
assert.sameValue(callCount, 0, 'method body not evaluated');
|
||||
obj.method();
|
||||
assert.sameValue(callCount, 1, 'method body evaluated');
|
||||
|
|
|
@ -8,19 +8,26 @@ flags: [generated, noStrict]
|
|||
info: |
|
||||
MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
|
||||
var callCount = 0;
|
||||
var obj = {
|
||||
method() {
|
||||
this.method.caller;
|
||||
assert.sameValue(this.method.hasOwnProperty("caller"), false);
|
||||
callCount++;
|
||||
}
|
||||
};
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
obj.method();
|
||||
});
|
||||
assert.sameValue(callCount, 0, 'method body not evaluated');
|
||||
obj.method();
|
||||
assert.sameValue(callCount, 1, 'method body evaluated');
|
||||
|
|
|
@ -0,0 +1,65 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-get.case
|
||||
// - src/function-forms/forbidden-extensions/bullet-two/async-gen-meth.template
|
||||
/*---
|
||||
description: Forbidden extension, o.caller (async generator method)
|
||||
esid: sec-asyncgenerator-definitions-propertydefinitionevaluation
|
||||
features: [arrow-function, async-iteration, generators]
|
||||
flags: [generated, noStrict, async]
|
||||
info: |
|
||||
AsyncGeneratorMethod :
|
||||
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
|
||||
{ AsyncGeneratorBody }
|
||||
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
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;
|
||||
}
|
||||
|
||||
var callCount = 0;
|
||||
var obj = {
|
||||
async *method() {
|
||||
"use strict";
|
||||
// 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 && true) {
|
||||
Object.defineProperty(inner, "caller", {get(){return 1}});
|
||||
}
|
||||
var result = inner();
|
||||
if (descriptor && descriptor.configurable && true) {
|
||||
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, this.method);
|
||||
}
|
||||
callCount++;
|
||||
}
|
||||
};
|
||||
|
||||
obj.method().next()
|
||||
.then(() => {
|
||||
assert.sameValue(callCount, 1, 'function body evaluated');
|
||||
}, $DONE).then($DONE, $DONE);
|
|
@ -0,0 +1,65 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-value.case
|
||||
// - src/function-forms/forbidden-extensions/bullet-two/async-gen-meth.template
|
||||
/*---
|
||||
description: Forbidden extension, o.caller (async generator method)
|
||||
esid: sec-asyncgenerator-definitions-propertydefinitionevaluation
|
||||
features: [arrow-function, async-iteration, generators]
|
||||
flags: [generated, noStrict, async]
|
||||
info: |
|
||||
AsyncGeneratorMethod :
|
||||
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
|
||||
{ AsyncGeneratorBody }
|
||||
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
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;
|
||||
}
|
||||
|
||||
var callCount = 0;
|
||||
var obj = {
|
||||
async *method() {
|
||||
"use strict";
|
||||
// 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 && true) {
|
||||
Object.defineProperty(inner, "caller", {value: 1});
|
||||
}
|
||||
var result = inner();
|
||||
if (descriptor && descriptor.configurable && true) {
|
||||
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, this.method);
|
||||
}
|
||||
callCount++;
|
||||
}
|
||||
};
|
||||
|
||||
obj.method().next()
|
||||
.then(() => {
|
||||
assert.sameValue(callCount, 1, 'function body evaluated');
|
||||
}, $DONE).then($DONE, $DONE);
|
|
@ -4,7 +4,7 @@
|
|||
/*---
|
||||
description: Forbidden extension, o.caller (async generator method)
|
||||
esid: sec-asyncgenerator-definitions-propertydefinitionevaluation
|
||||
features: [async-iteration]
|
||||
features: [arrow-function, async-iteration, generators]
|
||||
flags: [generated, noStrict, async]
|
||||
info: |
|
||||
AsyncGeneratorMethod :
|
||||
|
@ -12,28 +12,54 @@ info: |
|
|||
{ AsyncGeneratorBody }
|
||||
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
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;
|
||||
}
|
||||
|
||||
var callCount = 0;
|
||||
var obj = {
|
||||
async *method() {
|
||||
"use strict";
|
||||
inner().toString();
|
||||
// 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 && false) {
|
||||
Object.defineProperty(inner, "caller", {});
|
||||
}
|
||||
var result = inner();
|
||||
if (descriptor && descriptor.configurable && false) {
|
||||
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, this.method);
|
||||
}
|
||||
callCount++;
|
||||
}
|
||||
};
|
||||
|
||||
obj.method().next()
|
||||
.then(_ => {
|
||||
throw new Test262Error('function should not be resolved');
|
||||
}, error => assert.sameValue(error.constructor, TypeError))
|
||||
.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);
|
||||
|
|
|
@ -0,0 +1,66 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-get.case
|
||||
// - src/function-forms/forbidden-extensions/bullet-two/async-meth.template
|
||||
/*---
|
||||
description: Forbidden extension, o.caller (async method)
|
||||
esid: sec-async-definitions
|
||||
features: [arrow-function, async-functions]
|
||||
flags: [generated, noStrict, async]
|
||||
info: |
|
||||
AsyncMethod :
|
||||
async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
|
||||
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var obj = {
|
||||
async method() {
|
||||
"use strict";
|
||||
// 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 && true) {
|
||||
Object.defineProperty(inner, "caller", {get(){return 1}});
|
||||
}
|
||||
var result = inner();
|
||||
if (descriptor && descriptor.configurable && true) {
|
||||
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, this.method);
|
||||
}
|
||||
callCount++;
|
||||
}
|
||||
};
|
||||
|
||||
obj.method()
|
||||
.then(() => {
|
||||
assert.sameValue(callCount, 1, 'function body evaluated');
|
||||
}, $DONE).then($DONE, $DONE);
|
|
@ -0,0 +1,66 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-value.case
|
||||
// - src/function-forms/forbidden-extensions/bullet-two/async-meth.template
|
||||
/*---
|
||||
description: Forbidden extension, o.caller (async method)
|
||||
esid: sec-async-definitions
|
||||
features: [arrow-function, async-functions]
|
||||
flags: [generated, noStrict, async]
|
||||
info: |
|
||||
AsyncMethod :
|
||||
async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
|
||||
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
var callCount = 0;
|
||||
|
||||
var obj = {
|
||||
async method() {
|
||||
"use strict";
|
||||
// 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 && true) {
|
||||
Object.defineProperty(inner, "caller", {value: 1});
|
||||
}
|
||||
var result = inner();
|
||||
if (descriptor && descriptor.configurable && true) {
|
||||
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, this.method);
|
||||
}
|
||||
callCount++;
|
||||
}
|
||||
};
|
||||
|
||||
obj.method()
|
||||
.then(() => {
|
||||
assert.sameValue(callCount, 1, 'function body evaluated');
|
||||
}, $DONE).then($DONE, $DONE);
|
|
@ -4,19 +4,25 @@
|
|||
/*---
|
||||
description: Forbidden extension, o.caller (async method)
|
||||
esid: sec-async-definitions
|
||||
features: [async-functions]
|
||||
features: [arrow-function, async-functions]
|
||||
flags: [generated, noStrict, async]
|
||||
info: |
|
||||
AsyncMethod :
|
||||
async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
|
||||
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
@ -25,16 +31,36 @@ var callCount = 0;
|
|||
var obj = {
|
||||
async method() {
|
||||
"use strict";
|
||||
inner().toString();
|
||||
// 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 && false) {
|
||||
Object.defineProperty(inner, "caller", {});
|
||||
}
|
||||
var result = inner();
|
||||
if (descriptor && descriptor.configurable && false) {
|
||||
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, this.method);
|
||||
}
|
||||
callCount++;
|
||||
}
|
||||
};
|
||||
|
||||
obj.method()
|
||||
.then(_ => {
|
||||
throw new Test262Error('function should not be resolved');
|
||||
}, error => assert.sameValue(error.constructor, TypeError))
|
||||
.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);
|
||||
|
|
|
@ -0,0 +1,62 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-get.case
|
||||
// - src/function-forms/forbidden-extensions/bullet-two/gen-meth.template
|
||||
/*---
|
||||
description: Forbidden extension, o.caller (generator method)
|
||||
esid: sec-generator-definitions-runtime-semantics-propertydefinitionevaluation
|
||||
features: [generators]
|
||||
flags: [generated, noStrict]
|
||||
info: |
|
||||
GeneratorMethod :
|
||||
* PropertyName ( StrictFormalParameters ) { GeneratorBody }
|
||||
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
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;
|
||||
}
|
||||
|
||||
var callCount = 0;
|
||||
var obj = {
|
||||
*method() {
|
||||
"use strict";
|
||||
// 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 && true) {
|
||||
Object.defineProperty(inner, "caller", {get(){return 1}});
|
||||
}
|
||||
var result = inner();
|
||||
if (descriptor && descriptor.configurable && true) {
|
||||
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, this.method);
|
||||
}
|
||||
callCount++;
|
||||
}
|
||||
};
|
||||
|
||||
obj.method().next().value;
|
||||
assert.sameValue(callCount, 1, 'generator method body was evaluated');
|
|
@ -0,0 +1,62 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-value.case
|
||||
// - src/function-forms/forbidden-extensions/bullet-two/gen-meth.template
|
||||
/*---
|
||||
description: Forbidden extension, o.caller (generator method)
|
||||
esid: sec-generator-definitions-runtime-semantics-propertydefinitionevaluation
|
||||
features: [generators]
|
||||
flags: [generated, noStrict]
|
||||
info: |
|
||||
GeneratorMethod :
|
||||
* PropertyName ( StrictFormalParameters ) { GeneratorBody }
|
||||
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
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;
|
||||
}
|
||||
|
||||
var callCount = 0;
|
||||
var obj = {
|
||||
*method() {
|
||||
"use strict";
|
||||
// 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 && true) {
|
||||
Object.defineProperty(inner, "caller", {value: 1});
|
||||
}
|
||||
var result = inner();
|
||||
if (descriptor && descriptor.configurable && true) {
|
||||
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, this.method);
|
||||
}
|
||||
callCount++;
|
||||
}
|
||||
};
|
||||
|
||||
obj.method().next().value;
|
||||
assert.sameValue(callCount, 1, 'generator method body was evaluated');
|
|
@ -11,24 +11,52 @@ info: |
|
|||
* PropertyName ( StrictFormalParameters ) { GeneratorBody }
|
||||
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
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;
|
||||
}
|
||||
|
||||
var callCount = 0;
|
||||
var obj = {
|
||||
*method() {
|
||||
"use strict";
|
||||
inner().toString();
|
||||
// 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 && false) {
|
||||
Object.defineProperty(inner, "caller", {});
|
||||
}
|
||||
var result = inner();
|
||||
if (descriptor && descriptor.configurable && false) {
|
||||
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, this.method);
|
||||
}
|
||||
callCount++;
|
||||
}
|
||||
};
|
||||
|
||||
assert.throws(TypeError, function() {
|
||||
obj.method().next();
|
||||
});
|
||||
assert.sameValue(callCount, 0, 'generator method body not evaluated');
|
||||
obj.method().next().value;
|
||||
assert.sameValue(callCount, 1, 'generator method body was evaluated');
|
||||
|
|
|
@ -0,0 +1,60 @@
|
|||
// This file was procedurally generated from the following sources:
|
||||
// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-get.case
|
||||
// - src/function-forms/forbidden-extensions/bullet-two/meth.template
|
||||
/*---
|
||||
description: Forbidden extension, o.caller (method)
|
||||
esid: sec-runtime-semantics-definemethod
|
||||
flags: [generated, noStrict]
|
||||
info: |
|
||||
MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
|
||||
|
||||
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.
|
||||
|
||||
---*/
|
||||
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;
|
||||
}
|
||||
|
||||
var callCount = 0;
|
||||
var obj = {
|
||||
method() {
|
||||
"use strict";
|
||||
// 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 && true) {
|
||||
Object.defineProperty(inner, "caller", {get(){return 1}});
|
||||
}
|
||||
var result = inner();
|
||||
if (descriptor && descriptor.configurable && true) {
|
||||
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, this.method);
|
||||
}
|
||||
|
||||
callCount++;
|
||||
}
|
||||
};
|
||||
|
||||
obj.method();
|
||||
assert.sameValue(callCount, 1, 'method body evaluated');
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue