summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/AsyncGeneratorFunction
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /js/src/tests/test262/built-ins/AsyncGeneratorFunction
parentInitial commit. (diff)
downloadfirefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz
firefox-26a029d407be480d791972afb5975cf62c9360a6.zip
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/tests/test262/built-ins/AsyncGeneratorFunction')
-rw-r--r--js/src/tests/test262/built-ins/AsyncGeneratorFunction/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/AsyncGeneratorFunction/extensibility.js16
-rw-r--r--js/src/tests/test262/built-ins/AsyncGeneratorFunction/has-instance.js36
-rw-r--r--js/src/tests/test262/built-ins/AsyncGeneratorFunction/instance-await-expr-in-param.js43
-rw-r--r--js/src/tests/test262/built-ins/AsyncGeneratorFunction/instance-construct-throws.js33
-rw-r--r--js/src/tests/test262/built-ins/AsyncGeneratorFunction/instance-length.js47
-rw-r--r--js/src/tests/test262/built-ins/AsyncGeneratorFunction/instance-name.js30
-rw-r--r--js/src/tests/test262/built-ins/AsyncGeneratorFunction/instance-prototype.js39
-rw-r--r--js/src/tests/test262/built-ins/AsyncGeneratorFunction/instance-yield-expr-in-param.js43
-rw-r--r--js/src/tests/test262/built-ins/AsyncGeneratorFunction/invoked-as-constructor-no-arguments.js22
-rw-r--r--js/src/tests/test262/built-ins/AsyncGeneratorFunction/invoked-as-function-multiple-arguments.js28
-rw-r--r--js/src/tests/test262/built-ins/AsyncGeneratorFunction/invoked-as-function-no-arguments.js21
-rw-r--r--js/src/tests/test262/built-ins/AsyncGeneratorFunction/invoked-as-function-single-argument.js29
-rw-r--r--js/src/tests/test262/built-ins/AsyncGeneratorFunction/is-a-constructor.js30
-rw-r--r--js/src/tests/test262/built-ins/AsyncGeneratorFunction/length.js21
-rw-r--r--js/src/tests/test262/built-ins/AsyncGeneratorFunction/name.js31
-rw-r--r--js/src/tests/test262/built-ins/AsyncGeneratorFunction/proto-from-ctor-realm-prototype.js52
-rw-r--r--js/src/tests/test262/built-ins/AsyncGeneratorFunction/proto-from-ctor-realm.js65
-rw-r--r--js/src/tests/test262/built-ins/AsyncGeneratorFunction/prototype/Symbol.toStringTag.js27
-rw-r--r--js/src/tests/test262/built-ins/AsyncGeneratorFunction/prototype/browser.js0
-rw-r--r--js/src/tests/test262/built-ins/AsyncGeneratorFunction/prototype/constructor.js27
-rw-r--r--js/src/tests/test262/built-ins/AsyncGeneratorFunction/prototype/extensibility.js16
-rw-r--r--js/src/tests/test262/built-ins/AsyncGeneratorFunction/prototype/not-callable.js30
-rw-r--r--js/src/tests/test262/built-ins/AsyncGeneratorFunction/prototype/prop-desc.js21
-rw-r--r--js/src/tests/test262/built-ins/AsyncGeneratorFunction/prototype/prototype.js28
-rw-r--r--js/src/tests/test262/built-ins/AsyncGeneratorFunction/prototype/shell.js0
-rw-r--r--js/src/tests/test262/built-ins/AsyncGeneratorFunction/shell.js43
27 files changed, 778 insertions, 0 deletions
diff --git a/js/src/tests/test262/built-ins/AsyncGeneratorFunction/browser.js b/js/src/tests/test262/built-ins/AsyncGeneratorFunction/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/AsyncGeneratorFunction/browser.js
diff --git a/js/src/tests/test262/built-ins/AsyncGeneratorFunction/extensibility.js b/js/src/tests/test262/built-ins/AsyncGeneratorFunction/extensibility.js
new file mode 100644
index 0000000000..8110e021b5
--- /dev/null
+++ b/js/src/tests/test262/built-ins/AsyncGeneratorFunction/extensibility.js
@@ -0,0 +1,16 @@
+// Copyright (C) 2018 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-properties-of-asyncgeneratorfunction
+description: Object extensibility
+info: |
+ The value of the [[Extensible]] internal slot of the AsyncGeneratorFunction
+ constructor is true.
+features: [async-iteration]
+---*/
+
+var AsyncGeneratorFunction = Object.getPrototypeOf(async function* () {}).constructor;
+
+assert(Object.isExtensible(AsyncGeneratorFunction));
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/AsyncGeneratorFunction/has-instance.js b/js/src/tests/test262/built-ins/AsyncGeneratorFunction/has-instance.js
new file mode 100644
index 0000000000..4508320049
--- /dev/null
+++ b/js/src/tests/test262/built-ins/AsyncGeneratorFunction/has-instance.js
@@ -0,0 +1,36 @@
+// Copyright (C) 2018 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-properties-of-asyncgeneratorfunction
+description: >
+ AsyncGenerator function instances are correctly reported as instances of the
+ AsyncGeneratorFunction intrinsic.
+features: [async-iteration]
+---*/
+
+var AsyncGeneratorFunction = Object.getPrototypeOf(async function* () {}).constructor;
+
+async function* agDecl() {}
+var agExpr = async function* () {};
+
+assert(
+ agDecl instanceof AsyncGeneratorFunction,
+ 'AsyncGenerators created via AsyncGeneratorDeclaration syntax are proper instances of AsyncGeneratorFunction'
+);
+
+assert(
+ agExpr instanceof AsyncGeneratorFunction,
+ 'AsyncGenerators created via AsyncGeneratorExpression syntax are proper instances of AsyncGeneratorFunction'
+);
+
+assert(
+ new AsyncGeneratorFunction() instanceof AsyncGeneratorFunction,
+ 'AsyncGenerators created via constructor invocation of AsyncGeneratorFunction are proper instances of AsyncGeneratorFunction'
+);
+
+assert(
+ AsyncGeneratorFunction() instanceof AsyncGeneratorFunction,
+ 'AsyncGenerators created via function invocation of AsyncGeneratorFunction are proper instances of AsyncGeneratorFunction'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/AsyncGeneratorFunction/instance-await-expr-in-param.js b/js/src/tests/test262/built-ins/AsyncGeneratorFunction/instance-await-expr-in-param.js
new file mode 100644
index 0000000000..4d5937f42a
--- /dev/null
+++ b/js/src/tests/test262/built-ins/AsyncGeneratorFunction/instance-await-expr-in-param.js
@@ -0,0 +1,43 @@
+// |reftest| async
+// Copyright (C) 2018 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-asyncgeneratorfunction
+description: Definition of instance `length` property
+info: |
+ AsyncGeneratorFunction ( p1, p2, … , pn, body )
+ ...
+ 3. Return CreateDynamicFunction(C, NewTarget, "async generator", args).
+
+ Runtime Semantics: CreateDynamicFunction
+ ...
+ 29. If kind is "async" or "async generator", then
+ a. If parameters Contains AwaitExpression is true, throw a SyntaxError
+ exception.
+features: [async-iteration]
+flags: [async]
+---*/
+
+var AsyncGeneratorFunction = Object.getPrototypeOf(async function* () {}).constructor;
+
+// AwaitExpression is permitted in function body.
+AsyncGeneratorFunction('x = await 42');
+
+assert.throws(SyntaxError, function() {
+ AsyncGeneratorFunction('x = await 42', '');
+}, 'AwaitExpression not permitted in parameters');
+
+var withinAsyncGenerator = async function*() {
+ AsyncGeneratorFunction('x = await 42', '');
+};
+
+withinAsyncGenerator().next().then(
+ function () {
+ throw new Test262Error("AwaitExpression not permitted when calling context is a async generator");
+ },
+ function (e) {
+ if (!(e instanceof SyntaxError)) {
+ throw new Test262Error("Expected SyntaxError but got " + e);
+ }
+ }
+).then($DONE, $DONE);
diff --git a/js/src/tests/test262/built-ins/AsyncGeneratorFunction/instance-construct-throws.js b/js/src/tests/test262/built-ins/AsyncGeneratorFunction/instance-construct-throws.js
new file mode 100644
index 0000000000..4d71c5c3ab
--- /dev/null
+++ b/js/src/tests/test262/built-ins/AsyncGeneratorFunction/instance-construct-throws.js
@@ -0,0 +1,33 @@
+// Copyright 2018 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-asyncgeneratorfunction
+description: The instance created by AsyncGeneratorFunction is not a constructor
+info: |
+ AsyncGeneratorFunction ( p1, p2, … , pn, body )
+ ...
+ 3. Return ? CreateDynamicFunction(C, NewTarget, "async generator", args).
+
+ Runtime Semantics: CreateDynamicFunction( constructor, newTarget, kind, args )
+ ...
+ 32. Let F be FunctionAllocate(proto, strict, kind).
+ ...
+
+ FunctionAllocate ( functionPrototype, strict, functionKind )
+ // [[Construct]] and [[ConstructKind]] are not set for functionKind="async generators"
+
+features: [async-iteration]
+---*/
+
+var AsyncGeneratorFunction = Object.getPrototypeOf(async function* () {}).constructor;
+
+var instance = AsyncGeneratorFunction();
+
+assert.throws(TypeError, function() {
+ new instance();
+})
+
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/AsyncGeneratorFunction/instance-length.js b/js/src/tests/test262/built-ins/AsyncGeneratorFunction/instance-length.js
new file mode 100644
index 0000000000..c5de2941b7
--- /dev/null
+++ b/js/src/tests/test262/built-ins/AsyncGeneratorFunction/instance-length.js
@@ -0,0 +1,47 @@
+// Copyright (C) 2018 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-asyncgeneratorfunction
+description: Definition of instance `length` property
+info: |
+ AsyncGeneratorFunction ( p1, p2, … , pn, body )
+ ...
+ 3. Return CreateDynamicFunction(C, NewTarget, "async generator", args).
+
+ Runtime Semantics: CreateDynamicFunction
+ ...
+ // the parameter "args" is sliced into "parameters" and "body"
+ 26. Perform FunctionInitialize(F, Normal, parameters, body, scope).
+ ...
+
+ FunctionInitialize
+ ...
+ 2. Let len be the ExpectedArgumentCount of ParameterList.
+ 3. Perform ! DefinePropertyOrThrow(F, "length",
+ PropertyDescriptor{[[Value]]: len, [[Writable]]: false, [[Enumerable]]:
+ false, [[Configurable]]: true}).
+ ...
+includes: [propertyHelper.js]
+features: [async-iteration]
+---*/
+
+var AsyncGeneratorFunction = Object.getPrototypeOf(async function* () {}).constructor;
+
+var instance = AsyncGeneratorFunction()
+
+verifyProperty(AsyncGeneratorFunction(), "length", {
+ value: 0,
+ enumerable: false,
+ writable: false,
+ configurable: true,
+});
+
+assert.sameValue(AsyncGeneratorFunction('').length, 0, "test 1");
+assert.sameValue(AsyncGeneratorFunction('x').length, 0, "test 2");
+assert.sameValue(AsyncGeneratorFunction('x', '').length, 1, "test 3");
+assert.sameValue(AsyncGeneratorFunction('x', 'y', '').length, 2, "test 4");
+assert.sameValue(AsyncGeneratorFunction('x, y', '').length, 2, "test 5");
+
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/AsyncGeneratorFunction/instance-name.js b/js/src/tests/test262/built-ins/AsyncGeneratorFunction/instance-name.js
new file mode 100644
index 0000000000..ec26979e2b
--- /dev/null
+++ b/js/src/tests/test262/built-ins/AsyncGeneratorFunction/instance-name.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2018 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-asyncgeneratorfunction
+description: Assignment of function `name` attribute
+info: |
+ AsyncGeneratorFunction ( p1, p2, … , pn, body )
+ ...
+ 3. Return CreateDynamicFunction(C, NewTarget, "async generator", args).
+
+ RuntimeSemantics: CreateDynamicFunction(constructor, newTarget, kind, args)
+ ...
+ 29. Perform SetFunctionName(F, "anonymous").
+includes: [propertyHelper.js]
+features: [async-iteration]
+---*/
+
+var AsyncGeneratorFunction = Object.getPrototypeOf(async function* () {}).constructor;
+
+var instance = AsyncGeneratorFunction()
+
+verifyProperty(instance, "name", {
+ value: "anonymous",
+ enumerable: false,
+ writable: false,
+ configurable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/AsyncGeneratorFunction/instance-prototype.js b/js/src/tests/test262/built-ins/AsyncGeneratorFunction/instance-prototype.js
new file mode 100644
index 0000000000..85eab9ae00
--- /dev/null
+++ b/js/src/tests/test262/built-ins/AsyncGeneratorFunction/instance-prototype.js
@@ -0,0 +1,39 @@
+// Copyright (C) 2018 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-asyncgeneratorfunction
+description: Definition of instance `prototype` property
+info: |
+ AsyncGeneratorFunction ( p1, p2, … , pn, body )
+ ...
+ 3. Return CreateDynamicFunction(C, NewTarget, "async generator", args).
+
+ Runtime Semantics: CreateDynamicFunction
+ ...
+ 37. Else if kind is "async generator", then
+ a. Let prototype be ObjectCreate(%AsyncGeneratorPrototype%).
+ b. Perform DefinePropertyOrThrow(F, "prototype",
+ PropertyDescriptor{[[Value]]: prototype, [[Writable]]: true,
+ [[Enumerable]]: false, [[Configurable]]: false}).
+ ...
+includes: [propertyHelper.js]
+features: [async-iteration]
+---*/
+
+var AsyncGeneratorFunction = Object.getPrototypeOf(async function* () {}).constructor;
+
+var instance = AsyncGeneratorFunction();
+
+assert.sameValue(typeof instance.prototype, 'object');
+assert.sameValue(
+ Object.getPrototypeOf(instance.prototype),
+ Object.getPrototypeOf(instance).prototype
+);
+
+verifyProperty(instance, "prototype", {
+ enumerable: false,
+ writable: true,
+ configurable: false,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/AsyncGeneratorFunction/instance-yield-expr-in-param.js b/js/src/tests/test262/built-ins/AsyncGeneratorFunction/instance-yield-expr-in-param.js
new file mode 100644
index 0000000000..06a877cf93
--- /dev/null
+++ b/js/src/tests/test262/built-ins/AsyncGeneratorFunction/instance-yield-expr-in-param.js
@@ -0,0 +1,43 @@
+// |reftest| async
+// Copyright (C) 2018 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-asyncgeneratorfunction
+description: Definition of instance `length` property
+info: |
+ AsyncGeneratorFunction ( p1, p2, … , pn, body )
+ ...
+ 3. Return CreateDynamicFunction(C, NewTarget, "async generator", args).
+
+ Runtime Semantics: CreateDynamicFunction
+ ...
+ 28. If kind is "generator" or "async generator", then
+ a. If parameters Contains YieldExpression is true, throw a SyntaxError
+ exception.
+features: [async-iteration]
+flags: [async]
+---*/
+
+var AsyncGeneratorFunction = Object.getPrototypeOf(async function* () {}).constructor;
+
+// YieldExpression is permitted in function body.
+AsyncGeneratorFunction('x = yield');
+
+assert.throws(SyntaxError, function() {
+ AsyncGeneratorFunction('x = yield', '');
+}, 'YieldExpression not permitted generally');
+
+var withinAsyncGenerator = async function*() {
+ AsyncGeneratorFunction('x = yield', '');
+};
+
+withinAsyncGenerator().next().then(
+ function () {
+ throw new Test262Error("YieldExpression not permitted when calling context is a async generator");
+ },
+ function (e) {
+ if (!(e instanceof SyntaxError)) {
+ throw new Test262Error("Expected SyntaxError but got " + e);
+ }
+ }
+).then($DONE, $DONE);
diff --git a/js/src/tests/test262/built-ins/AsyncGeneratorFunction/invoked-as-constructor-no-arguments.js b/js/src/tests/test262/built-ins/AsyncGeneratorFunction/invoked-as-constructor-no-arguments.js
new file mode 100644
index 0000000000..3ee7df2169
--- /dev/null
+++ b/js/src/tests/test262/built-ins/AsyncGeneratorFunction/invoked-as-constructor-no-arguments.js
@@ -0,0 +1,22 @@
+// |reftest| async
+// Copyright (C) 2018 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-asyncgeneratorfunction
+description: >
+ When invoked via the constructor invocation pattern without arguments, the
+ GeneratorFunction intrinsic returns a valid async generator with an empty body.
+features: [async-iteration]
+flags: [async]
+---*/
+
+var AsyncGeneratorFunction = Object.getPrototypeOf(async function* () {}).constructor;
+
+var g = new AsyncGeneratorFunction();
+var iter = g();
+
+iter.next().then(function(result) {
+ assert.sameValue(result.value, undefined, 'Result `value`');
+ assert.sameValue(result.done, true, 'Result `done` flag');
+}).then($DONE, $DONE)
+
diff --git a/js/src/tests/test262/built-ins/AsyncGeneratorFunction/invoked-as-function-multiple-arguments.js b/js/src/tests/test262/built-ins/AsyncGeneratorFunction/invoked-as-function-multiple-arguments.js
new file mode 100644
index 0000000000..f36557f9cc
--- /dev/null
+++ b/js/src/tests/test262/built-ins/AsyncGeneratorFunction/invoked-as-function-multiple-arguments.js
@@ -0,0 +1,28 @@
+// |reftest| async
+// Copyright (C) 2018 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-asyncgeneratorfunction
+description: >
+ When invoked via the function invocation pattern with multiple arguments,
+ the AsyncGeneratorFunction intrinsic creates a valid generator whose body is the
+ last argument evaluated as source code and whose formal parameters are
+ defined by the preceding arguments.
+features: [async-iteration]
+flags: [async]
+---*/
+
+var AsyncGeneratorFunction = Object.getPrototypeOf(async function* () {}).constructor;
+
+var g = AsyncGeneratorFunction('x', 'y', 'yield x + y;');
+var iter = g(2, 3);
+
+iter.next().then(function(result) {
+ assert.sameValue(result.value, 5, 'First result `value`');
+ assert.sameValue(result.done, false, 'First result `done` flag');
+}).then(undefined, $DONE)
+
+iter.next().then(function(result) {
+ assert.sameValue(result.value, undefined, 'Final result `value`');
+ assert.sameValue(result.done, true, 'Final result `done` flag');
+}).then($DONE, $DONE)
diff --git a/js/src/tests/test262/built-ins/AsyncGeneratorFunction/invoked-as-function-no-arguments.js b/js/src/tests/test262/built-ins/AsyncGeneratorFunction/invoked-as-function-no-arguments.js
new file mode 100644
index 0000000000..0e0676b239
--- /dev/null
+++ b/js/src/tests/test262/built-ins/AsyncGeneratorFunction/invoked-as-function-no-arguments.js
@@ -0,0 +1,21 @@
+// |reftest| async
+// Copyright (C) 2018 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-asyncgeneratorfunction
+description: >
+ When invoked via the function invocation pattern without arguments, the
+ AsyncGeneratorFunction intrinsic returns a valid generator with an empty body.
+features: [async-iteration]
+flags: [async]
+---*/
+
+var AsyncGeneratorFunction = Object.getPrototypeOf(async function* () {}).constructor;
+
+var g = AsyncGeneratorFunction();
+var iter = g();
+
+iter.next().then(function(result) {
+ assert.sameValue(result.value, undefined, 'Result `value`');
+ assert.sameValue(result.done, true, 'Result `done` flag');
+}).then($DONE, $DONE)
diff --git a/js/src/tests/test262/built-ins/AsyncGeneratorFunction/invoked-as-function-single-argument.js b/js/src/tests/test262/built-ins/AsyncGeneratorFunction/invoked-as-function-single-argument.js
new file mode 100644
index 0000000000..a249a7a93c
--- /dev/null
+++ b/js/src/tests/test262/built-ins/AsyncGeneratorFunction/invoked-as-function-single-argument.js
@@ -0,0 +1,29 @@
+// |reftest| async
+// Copyright (C) 2018 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-asyncgeneratorfunction
+description: >
+ When invoked via the function invocation pattern with a single argument,
+ the AsyncGeneratorFunction intrinsic creates a valid async generator whose body is the
+ first argument evaluated as source code.
+features: [async-iteration]
+flags: [async]
+---*/
+
+var AsyncGeneratorFunction = Object.getPrototypeOf(async function* () {}).constructor;
+
+var g = AsyncGeneratorFunction('yield 1;');
+var iter = g();
+var result;
+
+
+iter.next().then(function(result) {
+ assert.sameValue(result.value, 1, 'First result `value`');
+ assert.sameValue(result.done, false, 'First result `done` flag');
+}).then(undefined, $DONE)
+
+iter.next().then(function(result) {
+ assert.sameValue(result.value, undefined, 'Final result `value`');
+ assert.sameValue(result.done, true, 'Final result `done` flag');
+}).then($DONE, $DONE)
diff --git a/js/src/tests/test262/built-ins/AsyncGeneratorFunction/is-a-constructor.js b/js/src/tests/test262/built-ins/AsyncGeneratorFunction/is-a-constructor.js
new file mode 100644
index 0000000000..9c9764fb9a
--- /dev/null
+++ b/js/src/tests/test262/built-ins/AsyncGeneratorFunction/is-a-constructor.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-ecmascript-standard-built-in-objects
+description: >
+ The AsyncGeneratorFunction constructor implements [[Construct]]
+info: |
+ IsConstructor ( argument )
+
+ The abstract operation IsConstructor takes argument argument (an ECMAScript language value).
+ It determines if argument is a function object with a [[Construct]] internal method.
+ It performs the following steps when called:
+
+ If Type(argument) is not Object, return false.
+ If argument has a [[Construct]] internal method, return true.
+ Return false.
+includes: [isConstructor.js, hidden-constructors.js]
+features: [Reflect.construct]
+---*/
+
+assert.sameValue(
+ isConstructor(AsyncGeneratorFunction),
+ true,
+ 'isConstructor(AsyncGeneratorFunction) must return true'
+);
+new AsyncGeneratorFunction();
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/AsyncGeneratorFunction/length.js b/js/src/tests/test262/built-ins/AsyncGeneratorFunction/length.js
new file mode 100644
index 0000000000..28b18ef3ae
--- /dev/null
+++ b/js/src/tests/test262/built-ins/AsyncGeneratorFunction/length.js
@@ -0,0 +1,21 @@
+// Copyright (C) 2018 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-asyncgeneratorfunction-length
+description: >
+ This is a data property with a value of 1. This property has the attributes
+ { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }.
+includes: [propertyHelper.js]
+features: [async-iteration]
+---*/
+
+var AsyncGeneratorFunction = Object.getPrototypeOf(async function* () {}).constructor;
+
+verifyProperty(AsyncGeneratorFunction, "length", {
+ value: 1,
+ enumerable: false,
+ writable: false,
+ configurable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/AsyncGeneratorFunction/name.js b/js/src/tests/test262/built-ins/AsyncGeneratorFunction/name.js
new file mode 100644
index 0000000000..7fddb5eabb
--- /dev/null
+++ b/js/src/tests/test262/built-ins/AsyncGeneratorFunction/name.js
@@ -0,0 +1,31 @@
+// Copyright (C) 2018 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-properties-of-asyncgeneratorfunction
+description: Function "name" property
+info: |
+ The value of the name property of the AsyncGeneratorFunction
+ is "AsyncGeneratorFunction".
+
+ 17 ECMAScript Standard Built-in Objects:
+ Every built-in Function object, including constructors, that is not
+ identified as an anonymous function has a name property whose value is a
+ String.
+
+ Unless otherwise specified, the name property of a built-in Function object,
+ if it exists, has the attributes { [[Writable]]: false, [[Enumerable]]:
+ false, [[Configurable]]: true }.
+includes: [propertyHelper.js]
+features: [async-iteration]
+---*/
+
+var AsyncGeneratorFunction = Object.getPrototypeOf(async function* () {}).constructor;
+
+verifyProperty(AsyncGeneratorFunction, "name", {
+ value: "AsyncGeneratorFunction",
+ enumerable: false,
+ writable: false,
+ configurable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/AsyncGeneratorFunction/proto-from-ctor-realm-prototype.js b/js/src/tests/test262/built-ins/AsyncGeneratorFunction/proto-from-ctor-realm-prototype.js
new file mode 100644
index 0000000000..a930e38275
--- /dev/null
+++ b/js/src/tests/test262/built-ins/AsyncGeneratorFunction/proto-from-ctor-realm-prototype.js
@@ -0,0 +1,52 @@
+// Copyright (C) 2020 Alexey Shvayka. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-createdynamicfunction
+description: >
+ While default [[Prototype]] value derives from realm of the newTarget,
+ "prototype" object inherits from %Object.prototype% of constructor's realm.
+info: |
+ AsyncGeneratorFunction ( p1, p2, … , pn, body )
+
+ [...]
+ 3. Return ? CreateDynamicFunction(C, NewTarget, asyncGenerator, args).
+
+ CreateDynamicFunction ( constructor, newTarget, kind, args )
+
+ [...]
+ 18. Let proto be ? GetPrototypeFromConstructor(newTarget, fallbackProto).
+ 19. Let realmF be the current Realm Record.
+ 20. Let scope be realmF.[[GlobalEnv]].
+ 21. Let F be ! OrdinaryFunctionCreate(proto, parameters, body, non-lexical-this, scope).
+ [...]
+ 24. Else if kind is asyncGenerator, then
+ a. Let prototype be OrdinaryObjectCreate(%AsyncGenerator.prototype%).
+ b. Perform DefinePropertyOrThrow(F, "prototype", PropertyDescriptor { [[Value]]:
+ prototype, [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: false }).
+ [...]
+ 30. Return F.
+features: [async-iteration, cross-realm, Reflect]
+---*/
+
+var realmA = $262.createRealm().global;
+realmA.calls = 0;
+var aAsyncGeneratorFunction = realmA.eval("(async function* () {})").constructor;
+var aAsyncGeneratorPrototype = Object.getPrototypeOf(
+ realmA.eval("(async function* () {})").prototype
+);
+
+var realmB = $262.createRealm().global;
+var bAsyncGeneratorFunction = realmB.eval("(async function* () {})").constructor;
+var newTarget = new realmB.Function();
+newTarget.prototype = null;
+
+var fn = Reflect.construct(aAsyncGeneratorFunction, ["calls += 1;"], newTarget);
+assert.sameValue(Object.getPrototypeOf(fn), bAsyncGeneratorFunction.prototype);
+assert.sameValue(Object.getPrototypeOf(fn.prototype), aAsyncGeneratorPrototype);
+
+var gen = fn();
+assert(gen instanceof realmA.Object);
+gen.next();
+assert.sameValue(realmA.calls, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/AsyncGeneratorFunction/proto-from-ctor-realm.js b/js/src/tests/test262/built-ins/AsyncGeneratorFunction/proto-from-ctor-realm.js
new file mode 100644
index 0000000000..4c9e3cd853
--- /dev/null
+++ b/js/src/tests/test262/built-ins/AsyncGeneratorFunction/proto-from-ctor-realm.js
@@ -0,0 +1,65 @@
+// Copyright (C) 2019 Alexey Shvayka. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-asyncgeneratorfunction
+description: Default [[Prototype]] value derived from realm of the NewTarget.
+info: |
+ AsyncGeneratorFunction ( p1, p2, … , pn, body )
+
+ ...
+ 3. Return ? CreateDynamicFunction(C, NewTarget, "async generator", args).
+
+ Runtime Semantics: CreateDynamicFunction ( constructor, newTarget, kind, args )
+
+ ...
+ 10. Else,
+ a. Assert: kind is "async generator".
+ ...
+ d. Let fallbackProto be "%AsyncGenerator%".
+ ...
+ 18. Let proto be ? GetPrototypeFromConstructor(newTarget, fallbackProto).
+ ...
+
+ GetPrototypeFromConstructor ( constructor, intrinsicDefaultProto )
+
+ ...
+ 3. Let proto be ? Get(constructor, "prototype").
+ 4. If Type(proto) is not Object, then
+ a. Let realm be ? GetFunctionRealm(constructor).
+ b. Set proto to realm's intrinsic object named intrinsicDefaultProto.
+ 5. Return proto.
+features: [async-iteration, cross-realm, Reflect, Symbol]
+---*/
+
+var AsyncGeneratorFunction = Object.getPrototypeOf(async function* () {}).constructor;
+var other = $262.createRealm().global;
+var OtherAsyncGeneratorFunction = Object.getPrototypeOf(other.eval('(0, async function* () {})')).constructor;
+var newTarget = new other.Function();
+var fn;
+
+newTarget.prototype = undefined;
+fn = Reflect.construct(AsyncGeneratorFunction, [], newTarget);
+assert.sameValue(Object.getPrototypeOf(fn), OtherAsyncGeneratorFunction.prototype, 'newTarget.prototype is undefined');
+
+newTarget.prototype = null;
+fn = Reflect.construct(AsyncGeneratorFunction, [], newTarget);
+assert.sameValue(Object.getPrototypeOf(fn), OtherAsyncGeneratorFunction.prototype, 'newTarget.prototype is null');
+
+newTarget.prototype = true;
+fn = Reflect.construct(AsyncGeneratorFunction, [], newTarget);
+assert.sameValue(Object.getPrototypeOf(fn), OtherAsyncGeneratorFunction.prototype, 'newTarget.prototype is a Boolean');
+
+newTarget.prototype = '';
+fn = Reflect.construct(AsyncGeneratorFunction, [], newTarget);
+assert.sameValue(Object.getPrototypeOf(fn), OtherAsyncGeneratorFunction.prototype, 'newTarget.prototype is a String');
+
+newTarget.prototype = Symbol();
+fn = Reflect.construct(AsyncGeneratorFunction, [], newTarget);
+assert.sameValue(Object.getPrototypeOf(fn), OtherAsyncGeneratorFunction.prototype, 'newTarget.prototype is a Symbol');
+
+newTarget.prototype = 1;
+fn = Reflect.construct(AsyncGeneratorFunction, [], newTarget);
+assert.sameValue(Object.getPrototypeOf(fn), OtherAsyncGeneratorFunction.prototype, 'newTarget.prototype is a Number');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/AsyncGeneratorFunction/prototype/Symbol.toStringTag.js b/js/src/tests/test262/built-ins/AsyncGeneratorFunction/prototype/Symbol.toStringTag.js
new file mode 100644
index 0000000000..971eb46991
--- /dev/null
+++ b/js/src/tests/test262/built-ins/AsyncGeneratorFunction/prototype/Symbol.toStringTag.js
@@ -0,0 +1,27 @@
+// Copyright (C) 2018 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-asyncgeneratorfunction-prototype-tostringtag
+description: >
+ `Symbol.toStringTag` property descriptor
+info: |
+ The initial value of the @@toStringTag property is the String
+ value "AsyncGeneratorFunction".
+
+ This property has the attributes { [[Writable]]: false,
+ [[Enumerable]]: false, [[Configurable]]: true }.
+includes: [propertyHelper.js]
+features: [async-iteration, Symbol.toStringTag]
+---*/
+
+var AsyncGeneratorFunctionPrototype = Object.getPrototypeOf(async function*() {});
+
+verifyProperty(AsyncGeneratorFunctionPrototype, Symbol.toStringTag, {
+ value: 'AsyncGeneratorFunction',
+ enumerable: false,
+ writable: false,
+ configurable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/AsyncGeneratorFunction/prototype/browser.js b/js/src/tests/test262/built-ins/AsyncGeneratorFunction/prototype/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/AsyncGeneratorFunction/prototype/browser.js
diff --git a/js/src/tests/test262/built-ins/AsyncGeneratorFunction/prototype/constructor.js b/js/src/tests/test262/built-ins/AsyncGeneratorFunction/prototype/constructor.js
new file mode 100644
index 0000000000..a8cc755656
--- /dev/null
+++ b/js/src/tests/test262/built-ins/AsyncGeneratorFunction/prototype/constructor.js
@@ -0,0 +1,27 @@
+// Copyright (C) 2018 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-asyncgeneratorfunction-prototype-constructor
+description: >
+ `constructor` property of the AsyncGeneratorFunction.prototype object
+info: |
+ The initial value of AsyncGeneratorFunction.prototype.constructor is the intrinsic
+ object %AsyncGeneratorFunction%.
+
+ This property has the attributes { [[Writable]]: false, [[Enumerable]]:
+ false, [[Configurable]]: true }.
+includes: [propertyHelper.js]
+features: [async-iteration]
+---*/
+
+var AsyncGeneratorFunction = Object.getPrototypeOf(async function* () {}).constructor;
+
+assert.sameValue(AsyncGeneratorFunction.prototype.constructor, AsyncGeneratorFunction);
+
+verifyProperty(AsyncGeneratorFunction.prototype, "constructor", {
+ enumerable: false,
+ writable: false,
+ configurable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/AsyncGeneratorFunction/prototype/extensibility.js b/js/src/tests/test262/built-ins/AsyncGeneratorFunction/prototype/extensibility.js
new file mode 100644
index 0000000000..ccc93092b1
--- /dev/null
+++ b/js/src/tests/test262/built-ins/AsyncGeneratorFunction/prototype/extensibility.js
@@ -0,0 +1,16 @@
+// Copyright (C) 2018 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-properties-of-asyncgenerator-prototype
+description: Object extensibility
+info: |
+ The initial value of the [[Extensible]] internal slot of the
+ AsyncGeneratorFunction prototype object is true.
+features: [async-iteration]
+---*/
+
+var AsyncGeneratorFunction = Object.getPrototypeOf(async function* () {}).constructor;
+
+assert(Object.isExtensible(AsyncGeneratorFunction.prototype));
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/AsyncGeneratorFunction/prototype/not-callable.js b/js/src/tests/test262/built-ins/AsyncGeneratorFunction/prototype/not-callable.js
new file mode 100644
index 0000000000..812d1d2f71
--- /dev/null
+++ b/js/src/tests/test262/built-ins/AsyncGeneratorFunction/prototype/not-callable.js
@@ -0,0 +1,30 @@
+// Copyright (C) 2020 Alexey Shvayka. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-properties-of-asyncgeneratorfunction-prototype
+description: >
+ %AsyncGeneratorFunction.prototype% is an ordinary non-callable object.
+info: |
+ Properties of the AsyncGeneratorFunction Prototype Object
+
+ The AsyncGeneratorFunction prototype object:
+
+ [...]
+ * is an ordinary object.
+ * is not a function object and does not have an [[ECMAScriptCode]] internal slot
+ or any other of the internal slots listed in Table 28 or Table 75.
+features: [async-iteration]
+---*/
+
+var AsyncGeneratorFunctionPrototype = Object.getPrototypeOf(async function* () {});
+
+assert.sameValue(typeof AsyncGeneratorFunctionPrototype, "object");
+assert.throws(TypeError, function() {
+ AsyncGeneratorFunctionPrototype();
+});
+
+assert(!AsyncGeneratorFunctionPrototype.hasOwnProperty("length"), "length");
+assert(!AsyncGeneratorFunctionPrototype.hasOwnProperty("name"), "name");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/AsyncGeneratorFunction/prototype/prop-desc.js b/js/src/tests/test262/built-ins/AsyncGeneratorFunction/prototype/prop-desc.js
new file mode 100644
index 0000000000..eed1bb1934
--- /dev/null
+++ b/js/src/tests/test262/built-ins/AsyncGeneratorFunction/prototype/prop-desc.js
@@ -0,0 +1,21 @@
+// Copyright (C) 2018 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: AsyncGeneratorFunction.prototype property descriptor
+esid: sec-asyncgeneratorfunction-prototype
+info: |
+ This property has the attributes { [[Writable]]: false, [[Enumerable]]:
+ false, [[Configurable]]: false }.
+includes: [propertyHelper.js]
+features: [async-iteration]
+---*/
+
+var AsyncGeneratorFunction = Object.getPrototypeOf(async function* () {}).constructor;
+
+verifyProperty(AsyncGeneratorFunction, "prototype", {
+ enumerable: false,
+ writable: false,
+ configurable: false,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/AsyncGeneratorFunction/prototype/prototype.js b/js/src/tests/test262/built-ins/AsyncGeneratorFunction/prototype/prototype.js
new file mode 100644
index 0000000000..b551a6c255
--- /dev/null
+++ b/js/src/tests/test262/built-ins/AsyncGeneratorFunction/prototype/prototype.js
@@ -0,0 +1,28 @@
+// Copyright (C) 2018 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-asyncgeneratorfunction-prototype-prototype
+description: >
+ The value of AsyncGeneratorFunction.prototype.prototype is the
+ %AsyncGeneratorPrototype% intrinsic object.
+
+ This property has the attributes { [[Writable]]: false,
+ [[Enumerable]]: false, [[Configurable]]: true }.
+includes: [propertyHelper.js]
+features: [async-iteration]
+---*/
+
+var AsyncGeneratorFunctionPrototype = Object.getPrototypeOf(async function*() {});
+
+assert.sameValue(
+ AsyncGeneratorFunctionPrototype.prototype,
+ Object.getPrototypeOf(async function*() {}.prototype)
+);
+
+verifyProperty(AsyncGeneratorFunctionPrototype, "prototype", {
+ enumerable: false,
+ writable: false,
+ configurable: true,
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/built-ins/AsyncGeneratorFunction/prototype/shell.js b/js/src/tests/test262/built-ins/AsyncGeneratorFunction/prototype/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/built-ins/AsyncGeneratorFunction/prototype/shell.js
diff --git a/js/src/tests/test262/built-ins/AsyncGeneratorFunction/shell.js b/js/src/tests/test262/built-ins/AsyncGeneratorFunction/shell.js
new file mode 100644
index 0000000000..7af18bddd7
--- /dev/null
+++ b/js/src/tests/test262/built-ins/AsyncGeneratorFunction/shell.js
@@ -0,0 +1,43 @@
+// GENERATED, DO NOT EDIT
+// file: hidden-constructors.js
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: |
+ Provides uniform access to built-in constructors that are not exposed to the global object.
+defines:
+ - AsyncArrowFunction
+ - AsyncFunction
+ - AsyncGeneratorFunction
+ - GeneratorFunction
+---*/
+
+var AsyncArrowFunction = Object.getPrototypeOf(async () => {}).constructor;
+var AsyncFunction = Object.getPrototypeOf(async function () {}).constructor;
+var AsyncGeneratorFunction = Object.getPrototypeOf(async function* () {}).constructor;
+var GeneratorFunction = Object.getPrototypeOf(function* () {}).constructor;
+
+// file: isConstructor.js
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: |
+ Test if a given function is a constructor function.
+defines: [isConstructor]
+features: [Reflect.construct]
+---*/
+
+function isConstructor(f) {
+ if (typeof f !== "function") {
+ throw new Test262Error("isConstructor invoked with a non-function value");
+ }
+
+ try {
+ Reflect.construct(function(){}, [], f);
+ } catch (e) {
+ return false;
+ }
+ return true;
+}