Browse Source

Promise lets go again (#889)

Simon 4 years ago
parent
commit
426acedb9b
100 changed files with 2705 additions and 462 deletions
  1. 15 0
      Jint.Tests.Test262/BuiltIns/PromiseTests.cs
  2. 39 29
      Jint.Tests.Test262/Test262Test.cs
  3. 81 58
      Jint.Tests.Test262/harness/assert.js
  4. 11 6
      Jint.Tests.Test262/harness/sta.js
  5. 0 16
      Jint.Tests.Test262/test/built-ins/Promise/S25.4.3.1_A1.1_T1.js
  6. 0 14
      Jint.Tests.Test262/test/built-ins/Promise/S25.4.3.1_A2.1_T1.js
  7. 0 16
      Jint.Tests.Test262/test/built-ins/Promise/S25.4.3.1_A2.2_T1.js
  8. 0 25
      Jint.Tests.Test262/test/built-ins/Promise/S25.4.3.1_A2.3_T1.js
  9. 0 25
      Jint.Tests.Test262/test/built-ins/Promise/S25.4.3.1_A2.4_T1.js
  10. 0 14
      Jint.Tests.Test262/test/built-ins/Promise/S25.4.3.1_A3.1_T1.js
  11. 0 25
      Jint.Tests.Test262/test/built-ins/Promise/S25.4.3.1_A4.1_T1.js
  12. 0 23
      Jint.Tests.Test262/test/built-ins/Promise/S25.4.3.1_A5.1_T1.js
  13. 0 23
      Jint.Tests.Test262/test/built-ins/Promise/S25.4.3.1_A5.1_T2.js
  14. 1 0
      Jint.Tests.Test262/test/built-ins/Promise/all/S25.4.4.1_A2.2_T1.js
  15. 0 16
      Jint.Tests.Test262/test/built-ins/Promise/all/S25.4.4.1_A6.1_T1.js
  16. 0 23
      Jint.Tests.Test262/test/built-ins/Promise/all/S25.4.4.1_A6.1_T2.js
  17. 3 0
      Jint.Tests.Test262/test/built-ins/Promise/all/S25.4.4.1_A7.2_T1.js
  18. 3 0
      Jint.Tests.Test262/test/built-ins/Promise/all/S25.4.4.1_A8.1_T1.js
  19. 1 1
      Jint.Tests.Test262/test/built-ins/Promise/all/call-resolve-element-after-return.js
  20. 1 1
      Jint.Tests.Test262/test/built-ins/Promise/all/call-resolve-element-items.js
  21. 1 1
      Jint.Tests.Test262/test/built-ins/Promise/all/call-resolve-element.js
  22. 54 31
      Jint.Tests.Test262/test/built-ins/Promise/all/capability-executor-called-twice.js
  23. 57 33
      Jint.Tests.Test262/test/built-ins/Promise/all/capability-executor-not-callable.js
  24. 5 1
      Jint.Tests.Test262/test/built-ins/Promise/all/capability-resolve-throws-no-close.js
  25. 2 1
      Jint.Tests.Test262/test/built-ins/Promise/all/capability-resolve-throws-reject.js
  26. 1 1
      Jint.Tests.Test262/test/built-ins/Promise/all/ctx-ctor.js
  27. 1 2
      Jint.Tests.Test262/test/built-ins/Promise/all/invoke-resolve-error-close.js
  28. 0 1
      Jint.Tests.Test262/test/built-ins/Promise/all/invoke-resolve-error-reject.js
  29. 0 51
      Jint.Tests.Test262/test/built-ins/Promise/all/invoke-resolve-get-error-close.js
  30. 8 7
      Jint.Tests.Test262/test/built-ins/Promise/all/invoke-resolve-get-error-reject.js
  31. 40 0
      Jint.Tests.Test262/test/built-ins/Promise/all/invoke-resolve-get-error.js
  32. 45 0
      Jint.Tests.Test262/test/built-ins/Promise/all/invoke-resolve-get-once-multiple-calls.js
  33. 41 0
      Jint.Tests.Test262/test/built-ins/Promise/all/invoke-resolve-get-once-no-calls.js
  34. 43 0
      Jint.Tests.Test262/test/built-ins/Promise/all/invoke-resolve-on-promises-every-iteration-of-custom.js
  35. 34 0
      Jint.Tests.Test262/test/built-ins/Promise/all/invoke-resolve-on-promises-every-iteration-of-promise.js
  36. 34 0
      Jint.Tests.Test262/test/built-ins/Promise/all/invoke-resolve-on-values-every-iteration-of-promise.js
  37. 0 1
      Jint.Tests.Test262/test/built-ins/Promise/all/invoke-then-error-close.js
  38. 0 1
      Jint.Tests.Test262/test/built-ins/Promise/all/invoke-then-error-reject.js
  39. 0 1
      Jint.Tests.Test262/test/built-ins/Promise/all/invoke-then-get-error-close.js
  40. 0 1
      Jint.Tests.Test262/test/built-ins/Promise/all/invoke-then-get-error-reject.js
  41. 0 1
      Jint.Tests.Test262/test/built-ins/Promise/all/iter-next-val-err-no-close.js
  42. 0 1
      Jint.Tests.Test262/test/built-ins/Promise/all/iter-next-val-err-reject.js
  43. 0 1
      Jint.Tests.Test262/test/built-ins/Promise/all/iter-step-err-no-close.js
  44. 0 1
      Jint.Tests.Test262/test/built-ins/Promise/all/iter-step-err-reject.js
  45. 1 1
      Jint.Tests.Test262/test/built-ins/Promise/all/new-resolve-function.js
  46. 29 0
      Jint.Tests.Test262/test/built-ins/Promise/all/not-a-constructor.js
  47. 1 1
      Jint.Tests.Test262/test/built-ins/Promise/all/resolve-before-loop-exit-from-same.js
  48. 1 1
      Jint.Tests.Test262/test/built-ins/Promise/all/resolve-before-loop-exit.js
  49. 12 5
      Jint.Tests.Test262/test/built-ins/Promise/all/resolve-element-function-name.js
  50. 30 0
      Jint.Tests.Test262/test/built-ins/Promise/all/resolve-element-function-property-order.js
  51. 1 1
      Jint.Tests.Test262/test/built-ins/Promise/all/resolve-from-same-thenable.js
  52. 42 0
      Jint.Tests.Test262/test/built-ins/Promise/all/resolve-ignores-late-rejection-deferred.js
  53. 38 0
      Jint.Tests.Test262/test/built-ins/Promise/all/resolve-ignores-late-rejection.js
  54. 36 0
      Jint.Tests.Test262/test/built-ins/Promise/all/resolve-non-callable.js
  55. 28 0
      Jint.Tests.Test262/test/built-ins/Promise/all/resolve-not-callable-reject-with-typeerror.js
  56. 1 1
      Jint.Tests.Test262/test/built-ins/Promise/all/same-reject-function.js
  57. 2 0
      Jint.Tests.Test262/test/built-ins/Promise/all/species-get-error.js
  58. 55 0
      Jint.Tests.Test262/test/built-ins/Promise/allSettled/call-resolve-element-after-return.js
  59. 59 0
      Jint.Tests.Test262/test/built-ins/Promise/allSettled/call-resolve-element-items.js
  60. 49 0
      Jint.Tests.Test262/test/built-ins/Promise/allSettled/call-resolve-element.js
  61. 106 0
      Jint.Tests.Test262/test/built-ins/Promise/allSettled/capability-executor-called-twice.js
  62. 107 0
      Jint.Tests.Test262/test/built-ins/Promise/allSettled/capability-executor-not-callable.js
  63. 64 0
      Jint.Tests.Test262/test/built-ins/Promise/allSettled/capability-resolve-throws-no-close.js
  64. 59 0
      Jint.Tests.Test262/test/built-ins/Promise/allSettled/capability-resolve-throws-reject.js
  65. 24 0
      Jint.Tests.Test262/test/built-ins/Promise/allSettled/ctx-ctor-throws.js
  66. 34 0
      Jint.Tests.Test262/test/built-ins/Promise/allSettled/ctx-ctor.js
  67. 20 0
      Jint.Tests.Test262/test/built-ins/Promise/allSettled/ctx-non-ctor.js
  68. 36 0
      Jint.Tests.Test262/test/built-ins/Promise/allSettled/ctx-non-object.js
  69. 46 0
      Jint.Tests.Test262/test/built-ins/Promise/allSettled/does-not-invoke-array-setters.js
  70. 44 0
      Jint.Tests.Test262/test/built-ins/Promise/allSettled/invoke-resolve-error-close.js
  71. 34 0
      Jint.Tests.Test262/test/built-ins/Promise/allSettled/invoke-resolve-error-reject.js
  72. 34 0
      Jint.Tests.Test262/test/built-ins/Promise/allSettled/invoke-resolve-get-error-reject.js
  73. 40 0
      Jint.Tests.Test262/test/built-ins/Promise/allSettled/invoke-resolve-get-error.js
  74. 47 0
      Jint.Tests.Test262/test/built-ins/Promise/allSettled/invoke-resolve-get-once-multiple-calls.js
  75. 43 0
      Jint.Tests.Test262/test/built-ins/Promise/allSettled/invoke-resolve-get-once-no-calls.js
  76. 43 0
      Jint.Tests.Test262/test/built-ins/Promise/allSettled/invoke-resolve-on-promises-every-iteration-of-custom.js
  77. 34 0
      Jint.Tests.Test262/test/built-ins/Promise/allSettled/invoke-resolve-on-promises-every-iteration-of-promise.js
  78. 34 0
      Jint.Tests.Test262/test/built-ins/Promise/allSettled/invoke-resolve-on-values-every-iteration-of-promise.js
  79. 42 0
      Jint.Tests.Test262/test/built-ins/Promise/allSettled/invoke-resolve-return.js
  80. 52 0
      Jint.Tests.Test262/test/built-ins/Promise/allSettled/invoke-resolve.js
  81. 43 0
      Jint.Tests.Test262/test/built-ins/Promise/allSettled/invoke-then-error-close.js
  82. 32 0
      Jint.Tests.Test262/test/built-ins/Promise/allSettled/invoke-then-error-reject.js
  83. 45 0
      Jint.Tests.Test262/test/built-ins/Promise/allSettled/invoke-then-get-error-close.js
  84. 33 0
      Jint.Tests.Test262/test/built-ins/Promise/allSettled/invoke-then-get-error-reject.js
  85. 53 0
      Jint.Tests.Test262/test/built-ins/Promise/allSettled/invoke-then.js
  86. 10 0
      Jint.Tests.Test262/test/built-ins/Promise/allSettled/is-function.js
  87. 36 0
      Jint.Tests.Test262/test/built-ins/Promise/allSettled/iter-arg-is-false-reject.js
  88. 36 0
      Jint.Tests.Test262/test/built-ins/Promise/allSettled/iter-arg-is-null-reject.js
  89. 36 0
      Jint.Tests.Test262/test/built-ins/Promise/allSettled/iter-arg-is-number-reject.js
  90. 42 0
      Jint.Tests.Test262/test/built-ins/Promise/allSettled/iter-arg-is-poisoned.js
  91. 35 0
      Jint.Tests.Test262/test/built-ins/Promise/allSettled/iter-arg-is-string-resolve.js
  92. 49 0
      Jint.Tests.Test262/test/built-ins/Promise/allSettled/iter-arg-is-symbol-reject.js
  93. 49 0
      Jint.Tests.Test262/test/built-ins/Promise/allSettled/iter-arg-is-true-reject.js
  94. 49 0
      Jint.Tests.Test262/test/built-ins/Promise/allSettled/iter-arg-is-undefined-reject.js
  95. 53 0
      Jint.Tests.Test262/test/built-ins/Promise/allSettled/iter-assigned-false-reject.js
  96. 51 0
      Jint.Tests.Test262/test/built-ins/Promise/allSettled/iter-assigned-null-reject.js
  97. 51 0
      Jint.Tests.Test262/test/built-ins/Promise/allSettled/iter-assigned-number-reject.js
  98. 51 0
      Jint.Tests.Test262/test/built-ins/Promise/allSettled/iter-assigned-string-reject.js
  99. 51 0
      Jint.Tests.Test262/test/built-ins/Promise/allSettled/iter-assigned-symbol-reject.js
  100. 51 0
      Jint.Tests.Test262/test/built-ins/Promise/allSettled/iter-assigned-true-reject.js

+ 15 - 0
Jint.Tests.Test262/BuiltIns/PromiseTests.cs

@@ -0,0 +1,15 @@
+using Xunit;
+
+namespace Jint.Tests.Test262.BuiltIns
+{
+    public class PromiseTests : Test262Test
+    {
+        [Theory(DisplayName = "built-ins\\Promise")]
+        [MemberData(nameof(SourceFiles), "built-ins\\Promise", false)]
+        [MemberData(nameof(SourceFiles), "built-ins\\Promise", true, Skip = "Skipped")]
+        protected void Promise(SourceFile sourceFile)
+        {
+            RunTestInternal(sourceFile);
+        }
+    }
+}

+ 39 - 29
Jint.Tests.Test262/Test262Test.cs

@@ -28,7 +28,7 @@ namespace Jint.Tests.Test262
 
         private static readonly HashSet<string> _strictSkips =
             new HashSet<string>(StringComparer.OrdinalIgnoreCase);
-        
+
         static Test262Test()
         {
             //NOTE: The Date tests in test262 assume the local timezone is Pacific Standard Time
@@ -54,6 +54,7 @@ namespace Jint.Tests.Test262
                 "assert.js",
                 "arrayContains.js",
                 "isConstructor.js",
+                "promiseHelper.js",
                 "propertyHelper.js",
                 "compareArray.js",
                 "decimalToHexString.js",
@@ -96,26 +97,28 @@ namespace Jint.Tests.Test262
 
             engine.Execute(Sources["sta.js"], CreateParserOptions("sta.js"));
             engine.Execute(Sources["assert.js"], CreateParserOptions("assert.js"));
-            engine.SetValue("print", new ClrFunctionInstance(engine, "print", (thisObj, args) => TypeConverter.ToString(args.At(0))));
+            engine.SetValue("print",
+                new ClrFunctionInstance(engine, "print", (thisObj, args) => TypeConverter.ToString(args.At(0))));
 
             var o = engine.Object.Construct(Arguments.Empty);
-            o.FastSetProperty("evalScript", new PropertyDescriptor(new ClrFunctionInstance(engine, "evalScript", (thisObj, args) =>
-            {
-                if (args.Length > 1)
+            o.FastSetProperty("evalScript", new PropertyDescriptor(new ClrFunctionInstance(engine, "evalScript",
+                (thisObj, args) =>
                 {
-                    throw new Exception("only script parsing supported");
-                }
+                    if (args.Length > 1)
+                    {
+                        throw new Exception("only script parsing supported");
+                    }
+
+                    var options = new ParserOptions {AdaptRegexp = true, Tolerant = false};
+                    var parser = new JavaScriptParser(args.At(0).AsString(), options);
+                    var script = parser.ParseScript(strict);
 
-                var options = new ParserOptions { AdaptRegexp = true, Tolerant = false };
-                var parser = new JavaScriptParser(args.At(0).AsString(), options);
-                var script = parser.ParseScript(strict);
+                    var value = engine.Execute(script).GetCompletionValue();
 
-                var value = engine.Execute(script).GetCompletionValue();
-                
-                return value;
-            }), true, true, true));
+                    return value;
+                }), true, true, true));
             engine.SetValue("$262", o);
-            
+
             var includes = Regex.Match(code, @"includes: \[(.+?)\]");
             if (includes.Success)
             {
@@ -130,7 +133,7 @@ namespace Jint.Tests.Test262
             {
                 engine.Execute(Sources["propertyHelper.js"], CreateParserOptions("propertyHelper.js"));
             }
-            
+
             string lastError = null;
 
             bool negative = code.IndexOf("negative:", StringComparison.Ordinal) > -1;
@@ -277,7 +280,7 @@ namespace Jint.Tests.Test262
                         }
                     }
                 }
-                
+
                 if (code.IndexOf("SpecialCasing.txt") > -1)
                 {
                     skip = true;
@@ -307,49 +310,57 @@ namespace Jint.Tests.Test262
                     skip = true;
                     reason = "Promise not implemented";
                 }
-                
+
                 if (name.StartsWith("language/statements/class/subclass/builtin-objects/TypedArray"))
                 {
                     skip = true;
                     reason = "TypedArray not implemented";
                 }
-                
+
                 if (name.StartsWith("language/statements/class/subclass/builtin-objects/WeakMap"))
                 {
                     skip = true;
                     reason = "WeakMap not implemented";
                 }
-                
+
                 if (name.StartsWith("language/statements/class/subclass/builtin-objects/WeakSet"))
                 {
                     skip = true;
                     reason = "WeakSet not implemented";
                 }
-                
+
                 if (name.StartsWith("language/statements/class/subclass/builtin-objects/ArrayBuffer/"))
                 {
                     skip = true;
                     reason = "ArrayBuffer not implemented";
                 }
-                
+
                 if (name.StartsWith("language/statements/class/subclass/builtin-objects/DataView"))
                 {
                     skip = true;
                     reason = "DataView not implemented";
                 }
-                                
+
                 if (name.StartsWith("language/statements/class/subclass/builtins.js"))
                 {
                     skip = true;
                     reason = "Uint8Array not implemented";
                 }
-                
+
                 if (name.StartsWith("built-ins/RegExp/CharacterClassEscapes/"))
                 {
                     skip = true;
                     reason = "for-of not implemented";
                 }
 
+                // Promises
+                if (name.StartsWith("built-ins/Promise/allSettled") ||
+                    name.StartsWith("built-ins/Promise/any"))
+                {
+                    skip = true;
+                    reason = "Promise.any and Promise.allSettled are not implemented yet";
+                }
+
                 if (file.EndsWith("tv-line-continuation.js")
                     || file.EndsWith("tv-line-terminator-sequence.js")
                     || file.EndsWith("special-characters.js"))
@@ -376,20 +387,19 @@ namespace Jint.Tests.Test262
 
             return results;
         }
-        
-        private static ParserOptions CreateParserOptions(string fileName) => 
+
+        private static ParserOptions CreateParserOptions(string fileName) =>
             new ParserOptions(fileName)
             {
                 AdaptRegexp = true,
                 Tolerant = true
             };
     }
-    
+
     public class SourceFile : IXunitSerializable
     {
         public SourceFile()
         {
-
         }
 
         public SourceFile(
@@ -435,4 +445,4 @@ namespace Jint.Tests.Test262
             return Source;
         }
     }
-}
+}

+ 81 - 58
Jint.Tests.Test262/harness/assert.js

@@ -3,86 +3,109 @@
 /*---
 description: |
     Collection of assertion functions used throughout test262
+defines: [assert]
 ---*/
 
+
 function assert(mustBeTrue, message) {
-  if (mustBeTrue === true) {
-    return;
-  }
-
-  if (message === undefined) {
-    message = 'Expected true but got ' + String(mustBeTrue);
-  }
-  $ERROR(message);
+    if (mustBeTrue === true) {
+        return;
+    }
+
+    if (message === undefined) {
+        message = 'Expected true but got ' + assert._toString(mustBeTrue);
+    }
+    $ERROR(message);
 }
 
 assert._isSameValue = function (a, b) {
-  if (a === b) {
-    // Handle +/-0 vs. -/+0
-    return a !== 0 || 1 / a === 1 / b;
-  }
+    if (a === b) {
+        // Handle +/-0 vs. -/+0
+        return a !== 0 || 1 / a === 1 / b;
+    }
 
-  // Handle NaN vs. NaN
-  return a !== a && b !== b;
+    // Handle NaN vs. NaN
+    return a !== a && b !== b;
 };
 
 assert.sameValue = function (actual, expected, message) {
-  if (assert._isSameValue(actual, expected)) {
-    return;
-  }
+    try {
+        if (assert._isSameValue(actual, expected)) {
+            return;
+        }
+    } catch (error) {
+        $ERROR(message + ' (_isSameValue operation threw) ' + error);
+        return;
+    }
 
-  if (message === undefined) {
-    message = '';
-  } else {
-    message += ' ';
-  }
+    if (message === undefined) {
+        message = '';
+    } else {
+        message += ' ';
+    }
 
-  message += 'Expected SameValue(«' + String(actual) + '», «' + String(expected) + '») to be true';
+    message += 'Expected SameValue(«' + assert._toString(actual) + '», «' + assert._toString(expected) + '») to be true';
 
-  $ERROR(message);
+    $ERROR(message);
 };
 
 assert.notSameValue = function (actual, unexpected, message) {
-  if (!assert._isSameValue(actual, unexpected)) {
-    return;
-  }
+    if (!assert._isSameValue(actual, unexpected)) {
+        return;
+    }
 
-  if (message === undefined) {
-    message = '';
-  } else {
-    message += ' ';
-  }
+    if (message === undefined) {
+        message = '';
+    } else {
+        message += ' ';
+    }
 
-  message += 'Expected SameValue(«' + String(actual) + '», «' + String(unexpected) + '») to be false';
+    message += 'Expected SameValue(«' + assert._toString(actual) + '», «' + assert._toString(unexpected) + '») to be false';
 
-  $ERROR(message);
+    $ERROR(message);
 };
 
 assert.throws = function (expectedErrorConstructor, func, message) {
-  if (typeof func !== "function") {
-    $ERROR('assert.throws requires two arguments: the error constructor ' +
-      'and a function to run');
-    return;
-  }
-  if (message === undefined) {
-    message = '';
-  } else {
-    message += ' ';
-  }
-
-  try {
-    func();
-  } catch (thrown) {
-    if (typeof thrown !== 'object' || thrown === null) {
-      message += 'Thrown value was not an object!';
-      $ERROR(message);
-    } else if (thrown.constructor !== expectedErrorConstructor) {
-      message += 'Expected a ' + expectedErrorConstructor.name + ' but got a ' + thrown.constructor.name;
-      $ERROR(message);
+    if (typeof func !== "function") {
+        $ERROR('assert.throws requires two arguments: the error constructor ' +
+            'and a function to run');
+        return;
+    }
+    if (message === undefined) {
+        message = '';
+    } else {
+        message += ' ';
+    }
+
+    try {
+        func();
+    } catch (thrown) {
+        if (typeof thrown !== 'object' || thrown === null) {
+            message += 'Thrown value was not an object!';
+            $ERROR(message);
+        } else if (thrown.constructor !== expectedErrorConstructor) {
+            message += 'Expected a ' + expectedErrorConstructor.name + ' but got a ' + thrown.constructor.name;
+            $ERROR(message);
+        }
+        return;
     }
-    return;
-  }
 
-  message += 'Expected a ' + expectedErrorConstructor.name + ' to be thrown but no exception was thrown at all';
-  $ERROR(message);
+    message += 'Expected a ' + expectedErrorConstructor.name + ' to be thrown but no exception was thrown at all';
+    $ERROR(message);
 };
+
+assert._toString = function (value) {
+    try {
+        if (value === 0 && 1 / value === -Infinity) {
+            return '-0';
+        }
+
+        return String(value);
+    } catch (err) {
+        if (err.name === 'TypeError') {
+            return Object.prototype.toString.call(value);
+        }
+
+        throw err;
+    }
+};

+ 11 - 6
Jint.Tests.Test262/harness/sta.js

@@ -3,21 +3,26 @@
 /*---
 description: |
     Provides both:
-
     - An error class to avoid false positives when testing for thrown exceptions
     - A function to explicitly throw an exception using the Test262Error class
+defines: [Test262Error, $ERROR, $DONOTEVALUATE]
 ---*/
 
 
 function Test262Error(message) {
-  this.message = message || "";
+    this.message = message || "";
 }
 
 Test262Error.prototype.toString = function () {
-  return "Test262Error: " + this.message;
+    return "Test262Error: " + this.message;
 };
 
-var $ERROR;
-$ERROR = function $ERROR(message) {
-  throw new Test262Error(message);
+Test262Error.thrower = (...args) => {
+    throw new Test262Error(...args);
 };
+
+var $ERROR = Test262Error.thrower;
+
+function $DONOTEVALUATE() {
+    throw "Test262: This statement should not be evaluated.";
+}

+ 0 - 16
Jint.Tests.Test262/test/built-ins/Promise/S25.4.3.1_A1.1_T1.js

@@ -1,16 +0,0 @@
-// Copyright 2014 Cubane Canada, Inc.  All rights reserved.
-// See LICENSE for details.
-
-/*---
-info: |
-    Promise is the Promise property of the global object
-es6id: S25.4.3.1_A1.1_T1
-author: Sam Mikes
-description: Promise === global.Promise
----*/
-
-var global = this;
-
-if (Promise !== global.Promise) {
-  $ERROR("Expected Promise === global.Promise.");
-}

+ 0 - 14
Jint.Tests.Test262/test/built-ins/Promise/S25.4.3.1_A2.1_T1.js

@@ -1,14 +0,0 @@
-// Copyright 2014 Cubane Canada, Inc.  All rights reserved.
-// See LICENSE for details.
-
-/*---
-info: |
-    Promise throws TypeError when 'this' is not Object
-es6id: S25.4.3.1_A2.1_T1
-author: Sam Mikes
-description: Promise.call("non-object") throws TypeError
----*/
-
-assert.throws(TypeError, function() {
-  Promise.call("non-object", function() {});
-});

+ 0 - 16
Jint.Tests.Test262/test/built-ins/Promise/S25.4.3.1_A2.2_T1.js

@@ -1,16 +0,0 @@
-// Copyright 2014 Cubane Canada, Inc.  All rights reserved.
-// See LICENSE for details.
-
-/*---
-info: |
-    Promise throws TypeError when 'this' is constructed but unsettled promise
-es6id: S25.4.3.1_A2.2_T1
-author: Sam Mikes
-description: Promise.call(new Promise()) throws TypeError
----*/
-
-var p = new Promise(function() {});
-
-assert.throws(TypeError, function() {
-  Promise.call(p, function() {});
-});

+ 0 - 25
Jint.Tests.Test262/test/built-ins/Promise/S25.4.3.1_A2.3_T1.js

@@ -1,25 +0,0 @@
-// Copyright 2014 Cubane Canada, Inc.  All rights reserved.
-// See LICENSE for details.
-
-/*---
-info: |
-    Promise throws TypeError when 'this' is resolved promise
-es6id: S25.4.3.1_A2.3_T1
-author: Sam Mikes
-description: Promise.call(resolved Promise) throws TypeError
-flags: [async]
----*/
-
-var p = new Promise(function(resolve) {
-  resolve(1);
-});
-
-p.then(function() {
-  Promise.call(p, function() {});
-}).then(function() {
-  $ERROR("Unexpected resolution - expected TypeError");
-}, function(err) {
-  if (!(err instanceof TypeError)) {
-    $ERROR("Expected TypeError, got " + err);
-  }
-}).then($DONE, $DONE);

+ 0 - 25
Jint.Tests.Test262/test/built-ins/Promise/S25.4.3.1_A2.4_T1.js

@@ -1,25 +0,0 @@
-// Copyright 2014 Cubane Canada, Inc.  All rights reserved.
-// See LICENSE for details.
-
-/*---
-info: |
-    Promise throws TypeError when 'this' is rejected promise
-es6id: S25.4.3.1_A2.4_T1
-author: Sam Mikes
-description: Promise.call(rejected Promise) throws TypeError
-flags: [async]
----*/
-
-var p = new Promise(function(resolve, reject) {
-  reject(1)
-});
-
-p.catch(function() {
-  Promise.call(p, function() {});
-}).then(function() {
-  $ERROR("Unexpected resolution - expected TypeError");
-}, function(err) {
-  if (!(err instanceof TypeError)) {
-    $ERROR("Expected TypeError, got " + err);
-  }
-}).then($DONE, $DONE);

+ 0 - 14
Jint.Tests.Test262/test/built-ins/Promise/S25.4.3.1_A3.1_T1.js

@@ -1,14 +0,0 @@
-// Copyright 2014 Cubane Canada, Inc.  All rights reserved.
-// See LICENSE for details.
-
-/*---
-info: |
-    Promise throws TypeError when executor is not callable
-es6id: S25.4.3.1_A3.1_T1
-author: Sam Mikes
-description: new Promise("not callable") throws TypeError
----*/
-
-assert.throws(TypeError, function() {
-  new Promise("not callable");
-});

+ 0 - 25
Jint.Tests.Test262/test/built-ins/Promise/S25.4.3.1_A4.1_T1.js

@@ -1,25 +0,0 @@
-// Copyright 2014 Cubane Canada, Inc.  All rights reserved.
-// See LICENSE for details.
-
-/*---
-info: |
-    Promise catches exceptions thrown from executor and turns
-    them into reject
-es6id: S25.4.3.1_A4.1_T1
-author: Sam Mikes
-description: new Promise(function () { throw }) should reject
-flags: [async]
----*/
-
-var errorObject = {},
-  p = new Promise(function() {
-    throw errorObject;
-  });
-
-p.then(function() {
-  $ERROR("Unexpected fulfill -- promise should reject.");
-}, function(err) {
-  if (err !== errorObject) {
-    $ERROR("Expected promise rejection reason to be thrown errorObject, actually " + err);
-  }
-}).then($DONE, $DONE);

+ 0 - 23
Jint.Tests.Test262/test/built-ins/Promise/S25.4.3.1_A5.1_T1.js

@@ -1,23 +0,0 @@
-// Copyright 2014 Cubane Canada, Inc.  All rights reserved.
-// See LICENSE for details.
-
-/*---
-info: |
-    Promise executor has predictable environment
-    'this' should be global object in sloppy mode,
-    undefined in strict mode
-es6id: S25.4.3.1_A5.1_T1
-author: Sam Mikes
-description: Promise executor gets default handling for 'this'
-flags: [async, noStrict]
----*/
-
-var expectedThis = this;
-
-var p = new Promise(function(resolve) {
-  if (this !== expectedThis) {
-    $ERROR("'this' must be global object, got " + this);
-  }
-
-  resolve();
-}).then($DONE, $DONE);

+ 0 - 23
Jint.Tests.Test262/test/built-ins/Promise/S25.4.3.1_A5.1_T2.js

@@ -1,23 +0,0 @@
-// Copyright 2014 Cubane Canada, Inc.  All rights reserved.
-// See LICENSE for details.
-
-/*---
-info: |
-    Promise executor has predictable environment
-    'this' should be global object in sloppy mode,
-    undefined in strict mode
-es6id: S25.4.3.1_A5.1_T2
-author: Sam Mikes
-description: Promise executor gets default handling for 'this'
-flags: [async, onlyStrict]
----*/
-
-var expectedThis = undefined;
-
-var p = new Promise(function(resolve) {
-  if (this !== expectedThis) {
-    $ERROR("'this' must be undefined, got " + this);
-  }
-
-  resolve();
-}).then($DONE, $DONE);

+ 1 - 0
Jint.Tests.Test262/test/built-ins/Promise/all/S25.4.4.1_A2.2_T1.js

@@ -20,6 +20,7 @@ Promise.resolve().then(function() {
   sequence.push(3);
 }).then(function() {
   sequence.push(4);
+  assert.sameValue(sequence.length, 4);
   checkSequence(sequence, "Promises resolved in unexpected sequence");
 }).then($DONE, $DONE);
 

+ 0 - 16
Jint.Tests.Test262/test/built-ins/Promise/all/S25.4.4.1_A6.1_T1.js

@@ -1,16 +0,0 @@
-// Copyright 2014 Cubane Canada, Inc.  All rights reserved.
-// See LICENSE for details.
-
-/*---
-info: |
-    Promise.all with 0-element array
-es6id: S25.4.4.1_A5.1_T1
-author: Sam Mikes
-description: Promise.all([]) produces a promise
----*/
-
-var p = Promise.all([]);
-
-if (!(p instanceof Promise)) {
-  $ERROR('Expected Promise.all([]) to be instanceof Promise' + err);
-}

+ 0 - 23
Jint.Tests.Test262/test/built-ins/Promise/all/S25.4.4.1_A6.1_T2.js

@@ -1,23 +0,0 @@
-// Copyright 2014 Cubane Canada, Inc.  All rights reserved.
-// See LICENSE for details.
-
-/*---
-info: |
-    Promise.all with 0-element array
-    should accept an empty array
-es6id: S25.4.4.1_A6.1_T2
-author: Sam Mikes
-description: Promise.all([]) returns a promise for an empty array
-flags: [async]
----*/
-
-var p = Promise.all([]);
-
-p.then(function(result) {
-  if (!(result instanceof Array)) {
-    $ERROR("Expected Promise.all([]) to be Array, actually " + result);
-  }
-  if (result.length !== 0) {
-    $ERROR("Expected Promise.all([]) to be empty Array, actually " + result);
-  }
-}).then($DONE, $DONE);

+ 3 - 0
Jint.Tests.Test262/test/built-ins/Promise/all/S25.4.4.1_A7.2_T1.js

@@ -22,14 +22,17 @@ sequence.push(1);
 
 Promise.all([p1]).then(function(resolved) {
   sequence.push(4);
+  assert.sameValue(sequence.length, 4);
   checkSequence(sequence, "Expected Promise.all().then to queue second");
 }).catch($DONE);
 
 p1.then(function() {
   sequence.push(3);
+  assert.sameValue(sequence.length, 3);
   checkSequence(sequence, "Expected p1.then to queue first");
 }).then(function() {
   sequence.push(5);
+  assert.sameValue(sequence.length, 5);
   checkSequence(sequence, "Expected final then to queue last");
 }).then($DONE, $DONE);
 

+ 3 - 0
Jint.Tests.Test262/test/built-ins/Promise/all/S25.4.4.1_A8.1_T1.js

@@ -22,16 +22,19 @@ sequence.push(1);
 
 p1.then(function() {
   sequence.push(3);
+  assert.sameValue(sequence.length, 3);
   checkSequence(sequence, "Expected to be called first.");
 }).catch($DONE);
 
 Promise.all([p1, p2]).then(function() {
   sequence.push(5);
+  assert.sameValue(sequence.length, 5);
   checkSequence(sequence, "Expected to be called third.");
 }).then($DONE, $DONE);
 
 p2.then(function() {
   sequence.push(4);
+  assert.sameValue(sequence.length, 4);
   checkSequence(sequence, "Expected to be called second.");
 }).catch($DONE);
 

+ 1 - 1
Jint.Tests.Test262/test/built-ins/Promise/all/call-resolve-element-after-return.js

@@ -25,7 +25,7 @@ function Constructor(executor) {
     assert.sameValue(values.length, 1, "values.length");
     assert.sameValue(values[0], "expectedValue", "values[0]");
   }
-  executor(resolve, $ERROR);
+  executor(resolve, Test262Error.thrower);
 }
 Constructor.resolve = function(v) {
   return v;

+ 1 - 1
Jint.Tests.Test262/test/built-ins/Promise/all/call-resolve-element-items.js

@@ -24,7 +24,7 @@ function Constructor(executor) {
     assert.sameValue(values[0], "expectedValue-p1", "values[0]");
     assert.sameValue(values[1], "expectedValue-p2", "values[1]");
   }
-  executor(resolve, $ERROR);
+  executor(resolve, Test262Error.thrower);
 }
 Constructor.resolve = function(v) {
   return v;

+ 1 - 1
Jint.Tests.Test262/test/built-ins/Promise/all/call-resolve-element.js

@@ -23,7 +23,7 @@ function Constructor(executor) {
     assert.sameValue(values.length, 1, "values length");
     assert.sameValue(values[0], "expectedValue", "values[0]");
   }
-  executor(resolve, $ERROR);
+  executor(resolve, Test262Error.thrower);
 }
 Constructor.resolve = function(v) {
   return v;

+ 54 - 31
Jint.Tests.Test262/test/built-ins/Promise/all/capability-executor-called-twice.js

@@ -2,7 +2,7 @@
 // This code is governed by the BSD license found in the LICENSE file.
 
 /*---
-es6id: 25.4.4.1
+esid: sec-promise.all
 description: >
   Throws a TypeError if capabilities executor already called with non-undefined values.
 info: |
@@ -13,67 +13,90 @@ info: |
   7. ReturnIfAbrupt(promiseCapability).
   ...
 
-  25.4.1.5.1 GetCapabilitiesExecutor Functions
+  GetCapabilitiesExecutor Functions
     ...
     3. If promiseCapability.[[Resolve]] is not undefined, throw a TypeError exception.
     4. If promiseCapability.[[Reject]] is not undefined, throw a TypeError exception.
     5. Set promiseCapability.[[Resolve]] to resolve.
     6. Set promiseCapability.[[Reject]] to reject.
     ...
+
+  PerformPromiseAll ( iteratorRecord, constructor, resultCapability )
+
+  ...
+  1. Let promiseResolve be ? Get(constructor, `"resolve"`).
+  1. If IsCallable(promiseResolve) is *false*, throw a *TypeError* exception.
+  ...
 ---*/
 
 var checkPoint = "";
-Promise.all.call(function(executor) {
+function fn1(executor) {
   checkPoint += "a";
   executor();
   checkPoint += "b";
   executor(function() {}, function() {});
   checkPoint += "c";
-}, []);
+}
+fn1.resolve = function() {};
+Promise.all.call(fn1, []);
 assert.sameValue(checkPoint, "abc", "executor initially called with no arguments");
 
-var checkPoint = "";
-Promise.all.call(function(executor) {
+checkPoint = "";
+function fn2(executor) {
   checkPoint += "a";
   executor(undefined, undefined);
   checkPoint += "b";
   executor(function() {}, function() {});
   checkPoint += "c";
-}, []);
+}
+fn2.resolve = function() {};
+Promise.all.call(fn2, []);
 assert.sameValue(checkPoint, "abc", "executor initially called with (undefined, undefined)");
 
-var checkPoint = "";
+checkPoint = "";
+function fn3(executor) {
+  checkPoint += "a";
+  executor(undefined, function() {});
+  checkPoint += "b";
+  executor(function() {}, function() {});
+  checkPoint += "c";
+}
+Object.defineProperty(fn3, 'resolve', {
+  get() { throw new Test262Error; }
+});
 assert.throws(TypeError, function() {
-  Promise.all.call(function(executor) {
-    checkPoint += "a";
-    executor(undefined, function() {});
-    checkPoint += "b";
-    executor(function() {}, function() {});
-    checkPoint += "c";
-  }, []);
+  Promise.all.call(fn3, []);
 }, "executor initially called with (undefined, function)");
 assert.sameValue(checkPoint, "ab", "executor initially called with (undefined, function)");
 
-var checkPoint = "";
+checkPoint = "";
+function fn4(executor) {
+  checkPoint += "a";
+  executor(function() {}, undefined);
+  checkPoint += "b";
+  executor(function() {}, function() {});
+  checkPoint += "c";
+}
+Object.defineProperty(fn4, 'resolve', {
+  get() { throw new Test262Error; }
+});
 assert.throws(TypeError, function() {
-  Promise.all.call(function(executor) {
-    checkPoint += "a";
-    executor(function() {}, undefined);
-    checkPoint += "b";
-    executor(function() {}, function() {});
-    checkPoint += "c";
-  }, []);
+  Promise.all.call(fn4, []);
 }, "executor initially called with (function, undefined)");
 assert.sameValue(checkPoint, "ab", "executor initially called with (function, undefined)");
 
-var checkPoint = "";
+checkPoint = "";
+function fn5(executor) {
+  checkPoint += "a";
+  executor("invalid value", 123);
+  checkPoint += "b";
+  executor(function() {}, function() {});
+  checkPoint += "c";
+}
+Object.defineProperty(fn5, 'resolve', {
+  get() { throw new Test262Error; }
+});
 assert.throws(TypeError, function() {
-  Promise.all.call(function(executor) {
-    checkPoint += "a";
-    executor("invalid value", 123);
-    checkPoint += "b";
-    executor(function() {}, function() {});
-    checkPoint += "c";
-  }, []);
+  Promise.all.call(fn5, []);
 }, "executor initially called with (String, Number)");
 assert.sameValue(checkPoint, "ab", "executor initially called with (String, Number)");

+ 57 - 33
Jint.Tests.Test262/test/built-ins/Promise/all/capability-executor-not-callable.js

@@ -25,59 +25,83 @@ info: |
 ---*/
 
 var checkPoint = "";
+function fn1(executor) {
+  checkPoint += "a";
+}
+Object.defineProperty(fn1, 'resolve', {
+  get() { throw new Test262Error; }
+});
 assert.throws(TypeError, function() {
-  Promise.all.call(function(executor) {
-    checkPoint += "a";
-  }, []);
+  Promise.all.call(fn1, []);
 }, "executor not called at all");
 assert.sameValue(checkPoint, "a", "executor not called at all");
 
-var checkPoint = "";
+checkPoint = "";
+function fn2(executor) {
+  checkPoint += "a";
+  executor();
+  checkPoint += "b";
+}
+Object.defineProperty(fn2, 'resolve', {
+  get() { throw new Test262Error; }
+});
 assert.throws(TypeError, function() {
-  Promise.all.call(function(executor) {
-    checkPoint += "a";
-    executor();
-    checkPoint += "b";
-  }, []);
+  Promise.all.call(fn2, []);
 }, "executor called with no arguments");
 assert.sameValue(checkPoint, "ab", "executor called with no arguments");
 
-var checkPoint = "";
+checkPoint = "";
+function fn3(executor) {
+  checkPoint += "a";
+  executor(undefined, undefined);
+  checkPoint += "b";
+}
+Object.defineProperty(fn3, 'resolve', {
+  get() { throw new Test262Error; }
+});
 assert.throws(TypeError, function() {
-  Promise.all.call(function(executor) {
-    checkPoint += "a";
-    executor(undefined, undefined);
-    checkPoint += "b";
-  }, []);
+  Promise.all.call(fn3, []);
 }, "executor called with (undefined, undefined)");
 assert.sameValue(checkPoint, "ab", "executor called with (undefined, undefined)");
 
-var checkPoint = "";
+checkPoint = "";
+function fn4(executor) {
+  checkPoint += "a";
+  executor(undefined, function() {});
+  checkPoint += "b";
+}
+Object.defineProperty(fn4, 'resolve', {
+  get() { throw new Test262Error; }
+});
 assert.throws(TypeError, function() {
-  Promise.all.call(function(executor) {
-    checkPoint += "a";
-    executor(undefined, function() {});
-    checkPoint += "b";
-  }, []);
+  Promise.all.call(fn4, []);
 }, "executor called with (undefined, function)");
 assert.sameValue(checkPoint, "ab", "executor called with (undefined, function)");
 
-var checkPoint = "";
+checkPoint = "";
+function fn5(executor) {
+  checkPoint += "a";
+  executor(function() {}, undefined);
+  checkPoint += "b";
+}
+Object.defineProperty(fn5, 'resolve', {
+  get() { throw new Test262Error; }
+});
 assert.throws(TypeError, function() {
-  Promise.all.call(function(executor) {
-    checkPoint += "a";
-    executor(function() {}, undefined);
-    checkPoint += "b";
-  }, []);
+  Promise.all.call(fn5, []);
 }, "executor called with (function, undefined)");
 assert.sameValue(checkPoint, "ab", "executor called with (function, undefined)");
 
-var checkPoint = "";
+checkPoint = "";
+function fn6(executor) {
+  checkPoint += "a";
+  executor(123, "invalid value");
+  checkPoint += "b";
+}
+Object.defineProperty(fn6, 'resolve', {
+  get() { throw new Test262Error; }
+});
 assert.throws(TypeError, function() {
-  Promise.all.call(function(executor) {
-    checkPoint += "a";
-    executor(123, "invalid value");
-    checkPoint += "b";
-  }, []);
+  Promise.all.call(fn6, []);
 }, "executor called with (Number, String)");
 assert.sameValue(checkPoint, "ab", "executor called with (Number, String)");

+ 5 - 1
Jint.Tests.Test262/test/built-ins/Promise/all/capability-resolve-throws-no-close.js

@@ -2,7 +2,6 @@
 // This code is governed by the BSD license found in the LICENSE file.
 /*---
 esid: sec-promise.all
-es6id: 25.4.4.1
 description: >
   Iterator is not closed when the "resolve" capability returns an abrupt
   completion.
@@ -45,11 +44,13 @@ info: |
 features: [Symbol.iterator]
 ---*/
 
+var nextCount = 0;
 var returnCount = 0;
 var iter = {};
 iter[Symbol.iterator] = function() {
   return {
     next: function() {
+      nextCount += 1;
       return {
         done: true
       };
@@ -68,6 +69,9 @@ var P = function(executor) {
   });
 };
 
+P.resolve = Promise.resolve;
+
 Promise.all.call(P, iter);
 
+assert.sameValue(nextCount, 1);
 assert.sameValue(returnCount, 0);

+ 2 - 1
Jint.Tests.Test262/test/built-ins/Promise/all/capability-resolve-throws-reject.js

@@ -2,7 +2,6 @@
 // This code is governed by the BSD license found in the LICENSE file.
 /*---
 esid: sec-promise.all
-es6id: 25.4.4.1
 description: >
   Promise is rejected when the "resolve" capability returns an abrupt
   completion.
@@ -54,6 +53,8 @@ var P = function(executor) {
   });
 };
 
+P.resolve = Promise.resolve;
+
 Promise.all.call(P, [])
   .then(function() {
     $DONE('Promise incorrectly fulfilled.');

+ 1 - 1
Jint.Tests.Test262/test/built-ins/Promise/all/ctx-ctor.js

@@ -28,7 +28,7 @@ class SubPromise extends Promise {
   }
 }
 
-var instance = Promise.all.call(SubPromise);
+var instance = Promise.all.call(SubPromise, []);
 
 assert.sameValue(instance.constructor, SubPromise);
 assert.sameValue(instance instanceof SubPromise, true);

+ 1 - 2
Jint.Tests.Test262/test/built-ins/Promise/all/invoke-resolve-error-close.js

@@ -5,7 +5,6 @@
 description: >
     Explicit iterator closing in response to error
 esid: sec-promise.all
-es6id: 25.4.4.1
 info: |
     11. Let result be PerformPromiseAll(iteratorRecord, C, promiseCapability).
     12. If result is an abrupt completion,
@@ -42,7 +41,7 @@ iterDoneSpy[Symbol.iterator] = function() {
 };
 
 Promise.resolve = function() {
-  throw new Error();
+  throw new Test262Error();
 };
 
 Promise.all(iterDoneSpy);

+ 0 - 1
Jint.Tests.Test262/test/built-ins/Promise/all/invoke-resolve-error-reject.js

@@ -4,7 +4,6 @@
 /*---
 description: Promise rejection in response to error
 esid: sec-promise.all
-es6id: 25.4.4.1
 info: |
     11. Let result be PerformPromiseAll(iteratorRecord, C, promiseCapability).
     12. If result is an abrupt completion,

+ 0 - 51
Jint.Tests.Test262/test/built-ins/Promise/all/invoke-resolve-get-error-close.js

@@ -1,51 +0,0 @@
-// Copyright (C) 2015 the V8 project authors. All rights reserved.
-// This code is governed by the BSD license found in the LICENSE file.
-
-/*---
-description: >
-  Error retrieving the constructor's `resolve` method (closing iterator)
-esid: sec-performpromiseall
-es6id: 25.4.4.1
-info: |
-    11. Let result be PerformPromiseAll(iteratorRecord, C, promiseCapability).
-    12. If result is an abrupt completion,
-        a. If iteratorRecord.[[done]] is false, let result be
-           IteratorClose(iterator, result).
-        b. IfAbruptRejectPromise(result, promiseCapability).
-
-    [...]
-
-    25.4.4.1.1 Runtime Semantics: PerformPromiseAll
-
-    [...]
-    6. Repeat
-        [...]
-        i. Let nextPromise be Invoke(constructor, "resolve", «nextValue»).
-        j. ReturnIfAbrupt(nextPromise ).
-features: [Symbol.iterator]
----*/
-
-var iter = {};
-var returnCount = 0;
-iter[Symbol.iterator] = function() {
-  return {
-    next: function() {
-      return {
-        done: false
-      };
-    },
-    return: function() {
-      returnCount += 1;
-      return {};
-    }
-  };
-};
-Object.defineProperty(Promise, 'resolve', {
-  get: function() {
-    throw new Test262Error();
-  }
-});
-
-Promise.all(iter);
-
-assert.sameValue(returnCount, 1);

+ 8 - 7
Jint.Tests.Test262/test/built-ins/Promise/all/invoke-resolve-get-error-reject.js

@@ -5,7 +5,6 @@
 description: >
   Error retrieving the constructor's `resolve` method (rejecting promise)
 esid: sec-performpromiseall
-es6id: 25.4.4.1
 info: |
     11. Let result be PerformPromiseAll(iteratorRecord, C, promiseCapability).
     12. If result is an abrupt completion,
@@ -15,13 +14,15 @@ info: |
 
     [...]
 
-    25.4.4.1.1 Runtime Semantics: PerformPromiseAll
+    Runtime Semantics: PerformPromiseAll
 
-    [...]
-    6. Repeat
-        [...]
-        i. Let nextPromise be Invoke(constructor, "resolve", «nextValue»).
-        j. ReturnIfAbrupt(nextPromise ).
+    ...
+    1. Let promiseResolve be ? Get(constructor, `"resolve"`).
+    ...
+    1. Repeat,
+      1. Let next be IteratorStep(iteratorRecord).
+      ...
+      1. Let nextPromise be ? Call(promiseResolve, constructor, < nextValue >).
 flags: [async]
 ---*/
 

+ 40 - 0
Jint.Tests.Test262/test/built-ins/Promise/all/invoke-resolve-get-error.js

@@ -0,0 +1,40 @@
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-promise.all
+description: >
+  Promise.resolve is retrieved before GetIterator call (abrupt lookup).
+info: |
+  Promise.all ( iterable )
+
+  [...]
+  3. Let promiseResolve be GetPromiseResolve(C).
+  4. IfAbruptRejectPromise(promiseResolve, promiseCapability).
+
+  GetPromiseResolve ( promiseConstructor )
+
+  [...]
+  2. Let promiseResolve be ? Get(promiseConstructor, "resolve").
+flags: [async]
+features: [Symbol.iterator]
+---*/
+
+const iter = {
+  get [Symbol.iterator]() {
+    throw new Test262Error('unreachable');
+  },
+};
+
+const resolveError = { name: 'MyError' };
+Object.defineProperty(Promise, 'resolve', {
+  get() {
+    throw resolveError;
+  },
+});
+
+Promise.all(iter).then(() => {
+  throw new Test262Error('The promise should be rejected, but it was resolved');
+}, (reason) => {
+  assert.sameValue(reason, resolveError);
+}).then($DONE, $DONE);

+ 45 - 0
Jint.Tests.Test262/test/built-ins/Promise/all/invoke-resolve-get-once-multiple-calls.js

@@ -0,0 +1,45 @@
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+  Gets constructor's `resolve` method once from zero to many invocations.
+esid: sec-promise.all
+info: |
+  Runtime Semantics: PerformPromiseAll
+
+  1. Let promiseResolve be ? Get(constructor, `"resolve"`).
+  1. If IsCallable(promiseResolve) is false, throw a TypeError exception.
+  ...
+  1. Repeat,
+    ...
+    1. Let nextPromise be ? Call(promiseResolve, constructor, &laquo; nextValue &raquo;).
+---*/
+
+var p1 = Promise.resolve(1);
+var p2 = Promise.resolve(1);
+var p3 = Promise.reject(1);
+var p4 = Promise.resolve(1);
+var resolve = Promise.resolve;
+var getCount = 0;
+var callCount = 0;
+
+Object.defineProperty(Promise, 'resolve', {
+  configurable: true,
+  get() {
+    getCount += 1;
+    return function() {
+      callCount += 1;
+      return resolve.apply(Promise, arguments);
+    };
+  }
+});
+
+Promise.all([p1, p2, p3, p4]);
+
+assert.sameValue(
+  getCount, 1, 'Got `resolve` only once for each iterated value'
+);
+assert.sameValue(
+  callCount, 4, '`resolve` invoked once for each iterated value'
+);

+ 41 - 0
Jint.Tests.Test262/test/built-ins/Promise/all/invoke-resolve-get-once-no-calls.js

@@ -0,0 +1,41 @@
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+  Gets constructor's `resolve` method once from zero to many invocations.
+esid: sec-promise.all
+info: |
+  Runtime Semantics: PerformPromiseAll
+
+  1. Let promiseResolve be ? Get(constructor, `"resolve"`).
+  1. If IsCallable(promiseResolve) is false, throw a TypeError exception.
+  ...
+  1. Repeat,
+    ...
+    1. Let nextPromise be ? Call(promiseResolve, constructor, &laquo; nextValue &raquo;).
+---*/
+
+var resolve = Promise.resolve;
+var getCount = 0;
+var callCount = 0;
+
+Object.defineProperty(Promise, 'resolve', {
+  configurable: true,
+  get() {
+    getCount += 1;
+    return function() {
+      callCount += 1;
+      return resolve.apply(Promise, arguments);
+    };
+  }
+});
+
+Promise.all([]);
+
+assert.sameValue(
+  getCount, 1, 'Got `resolve` only once for each iterated value'
+);
+assert.sameValue(
+  callCount, 0, '`resolve` not called for empty iterator'
+);

+ 43 - 0
Jint.Tests.Test262/test/built-ins/Promise/all/invoke-resolve-on-promises-every-iteration-of-custom.js

@@ -0,0 +1,43 @@
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+  Invocation of the constructor's `resolve` method for iterable with promise values
+esid: sec-promise.all
+info: |
+  Let result be PerformPromiseAll(iteratorRecord, C, promiseCapability).
+
+  Runtime Semantics: PerformPromiseAll
+
+  Repeat
+    ...
+    Let nextPromise be ? Call(promiseResolve, constructor, « nextValue »).
+
+flags: [async]
+features: [class, arrow-function]
+---*/
+class Custom extends Promise {}
+
+let values = [1, 1, 1];
+let cresolveCallCount = 0;
+let presolveCallCount = 0;
+let boundCustomResolve = Custom.resolve.bind(Custom);
+let boundPromiseResolve = Promise.resolve.bind(Promise);
+
+Custom.resolve = function(...args) {
+  cresolveCallCount += 1;
+  return boundCustomResolve(...args);
+};
+
+Promise.resolve = function(...args) {
+  presolveCallCount += 1;
+  return boundPromiseResolve(...args);
+};
+
+Promise.all.call(Custom, values)
+  .then(() => {
+      assert.sameValue(presolveCallCount, 0, '`Promise.resolve` is never invoked');
+      assert.sameValue(cresolveCallCount, 3, '`Custom.resolve` invoked once for every iterated promise');
+    }).then($DONE, $DONE);
+

+ 34 - 0
Jint.Tests.Test262/test/built-ins/Promise/all/invoke-resolve-on-promises-every-iteration-of-promise.js

@@ -0,0 +1,34 @@
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+  Invocation of the constructor's `resolve` method for iterable with promise values
+esid: sec-promise.all
+info: |
+  Let result be PerformPromiseAll(iteratorRecord, C, promiseCapability).
+
+  Runtime Semantics: PerformPromiseAll
+
+  Repeat
+    ...
+    i. Let nextPromise be ? Call(promiseResolve, constructor, « nextValue »).
+
+flags: [async]
+features: [arrow-function]
+---*/
+
+let values = [1,1,1];
+let callCount = 0;
+let boundPromiseResolve = Promise.resolve.bind(Promise);
+
+Promise.resolve = function(...args) {
+  callCount += 1;
+  return boundPromiseResolve(...args);
+};
+
+Promise.all(values)
+  .then(() => {
+      assert.sameValue(callCount, 3, '`then` invoked once for every iterated promise');
+    }).then($DONE, $DONE);
+

+ 34 - 0
Jint.Tests.Test262/test/built-ins/Promise/all/invoke-resolve-on-values-every-iteration-of-promise.js

@@ -0,0 +1,34 @@
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+  Invocation of the constructor's `resolve` method for iterable with non-promise values
+esid: sec-promise.all
+info: |
+  Let result be PerformPromiseAll(iteratorRecord, C, promiseCapability).
+
+  Runtime Semantics: PerformPromiseAll
+
+  Repeat
+    ...
+    i. Let nextPromise be ? Call(promiseResolve, constructor, « nextValue »).
+
+flags: [async]
+features: [arrow-function]
+---*/
+
+let values = [1, 2, 3];
+let callCount = 0;
+let boundPromiseResolve = Promise.resolve.bind(Promise);
+
+Promise.resolve = function(...args) {
+  callCount += 1;
+  return boundPromiseResolve(...args);
+};
+
+Promise.all(values)
+  .then(() => {
+      assert.sameValue(callCount, 3, '`Promise.resolve` invoked once for every iterated value');
+    }).then($DONE, $DONE);
+

+ 0 - 1
Jint.Tests.Test262/test/built-ins/Promise/all/invoke-then-error-close.js

@@ -4,7 +4,6 @@
 description: >
   Error thrown when invoking the instance's `then` method (closing iterator)
 esid: sec-performpromiseall
-es6id: 25.4.4.1
 info: |
     11. Let result be PerformPromiseAll(iteratorRecord, C, promiseCapability).
     12. If result is an abrupt completion,

+ 0 - 1
Jint.Tests.Test262/test/built-ins/Promise/all/invoke-then-error-reject.js

@@ -5,7 +5,6 @@
 description: >
   Error thrown when invoking the instance's `then` method (rejecting Promise)
 esid: sec-performpromiseall
-es6id: 25.4.4.1
 info: |
     11. Let result be PerformPromiseAll(iteratorRecord, C, promiseCapability).
     12. If result is an abrupt completion,

+ 0 - 1
Jint.Tests.Test262/test/built-ins/Promise/all/invoke-then-get-error-close.js

@@ -4,7 +4,6 @@
 description: >
   Error thrown when accesing the instance's `then` method (closing iterator)
 esid: sec-performpromiseall
-es6id: 25.4.4.1
 info: |
     11. Let result be PerformPromiseAll(iteratorRecord, C, promiseCapability).
     12. If result is an abrupt completion,

+ 0 - 1
Jint.Tests.Test262/test/built-ins/Promise/all/invoke-then-get-error-reject.js

@@ -4,7 +4,6 @@
 description: >
   Error thrown when accessing the instance's `then` method (rejecting Promise)
 esid: sec-performpromiseall
-es6id: 25.4.4.1
 info: |
     11. Let result be PerformPromiseAll(iteratorRecord, C, promiseCapability).
     12. If result is an abrupt completion,

+ 0 - 1
Jint.Tests.Test262/test/built-ins/Promise/all/iter-next-val-err-no-close.js

@@ -3,7 +3,6 @@
 
 /*---
 esid: sec-promise.all
-es6id: 25.4.4.1
 description: >
   Error when accessing an iterator result's `value` property (not closing
   iterator)

+ 0 - 1
Jint.Tests.Test262/test/built-ins/Promise/all/iter-next-val-err-reject.js

@@ -3,7 +3,6 @@
 
 /*---
 esid: sec-promise.all
-es6id: 25.4.4.1
 description: >
   Error when accessing an iterator result's `value` property (rejecting
   promise)

+ 0 - 1
Jint.Tests.Test262/test/built-ins/Promise/all/iter-step-err-no-close.js

@@ -3,7 +3,6 @@
 
 /*---
 esid: sec-promise.all
-es6id: 25.4.4.1
 description: >
   Error when advancing the provided iterable (not closing iterator)
 info: |

+ 0 - 1
Jint.Tests.Test262/test/built-ins/Promise/all/iter-step-err-reject.js

@@ -3,7 +3,6 @@
 
 /*---
 esid: sec-promise.all
-es6id: 25.4.4.1
 description: >
   Error when advancing the provided iterable (rejecting promise)
 info: |

+ 1 - 1
Jint.Tests.Test262/test/built-ins/Promise/all/new-resolve-function.js

@@ -18,7 +18,7 @@ info: |
 function resolveFunction() {}
 
 function Constructor(executor) {
-  executor(resolveFunction, $ERROR);
+  executor(resolveFunction, Test262Error.thrower);
 }
 Constructor.resolve = function(v) {
   return v;

+ 29 - 0
Jint.Tests.Test262/test/built-ins/Promise/all/not-a-constructor.js

@@ -0,0 +1,29 @@
+// 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: >
+  Promise.all does not implement [[Construct]], is not new-able
+info: |
+  ECMAScript Function Objects
+
+  Built-in function objects that are not identified as constructors do not
+  implement the [[Construct]] internal method unless otherwise specified in
+  the description of a particular function.
+
+  sec-evaluatenew
+
+  ...
+  7. If IsConstructor(constructor) is false, throw a TypeError exception.
+  ...
+includes: [isConstructor.js]
+features: [Reflect.construct, arrow-function]
+---*/
+
+assert.sameValue(isConstructor(Promise.all), false, 'isConstructor(Promise.all) must return false');
+
+assert.throws(TypeError, () => {
+  new Promise.all([]);
+}, '`new Promise.all([])` throws TypeError');
+

+ 1 - 1
Jint.Tests.Test262/test/built-ins/Promise/all/resolve-before-loop-exit-from-same.js

@@ -37,7 +37,7 @@ function Constructor(executor) {
     assert.sameValue(values[1], "p2-fulfill", "values[1]");
     assert.sameValue(values[2], "p3-fulfill", "values[2]");
   }
-  executor(resolve, $ERROR);
+  executor(resolve, Test262Error.thrower);
 }
 Constructor.resolve = function(v) {
   return v;

+ 1 - 1
Jint.Tests.Test262/test/built-ins/Promise/all/resolve-before-loop-exit.js

@@ -37,7 +37,7 @@ function Constructor(executor) {
     assert.sameValue(values[1], "p2-fulfill", "values[1]");
     assert.sameValue(values[2], "p3-fulfill", "values[2]");
   }
-  executor(resolve, $ERROR);
+  executor(resolve, Test262Error.thrower);
 }
 Constructor.resolve = function(v) {
   return v;

+ 12 - 5
Jint.Tests.Test262/test/built-ins/Promise/all/resolve-element-function-name.js

@@ -2,15 +2,20 @@
 // This code is governed by the BSD license found in the LICENSE file.
 
 /*---
-es6id: 25.4.4.1.2
+esid: sec-promise.all-resolve-element-functions
 description: The `name` property of Promise.all Resolve Element functions
 info: |
   A promise resolve function is an anonymous built-in function.
 
   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.
+    Every built-in function object, including constructors, has a `name`
+    property whose value is a String. Functions that are identified as
+    anonymous functions use the empty string as the value of the `name`
+    property.
+    Unless otherwise specified, the `name` property of a built-in function
+    object has the attributes { [[Writable]]: *false*, [[Enumerable]]: *false*,
+    [[Configurable]]: *true* }.
+includes: [propertyHelper.js]
 ---*/
 
 var resolveElementFunction;
@@ -28,4 +33,6 @@ NotPromise.resolve = function(v) {
 };
 Promise.all.call(NotPromise, [thenable]);
 
-assert.sameValue(Object.prototype.hasOwnProperty.call(resolveElementFunction, "name"), false);
+verifyProperty(resolveElementFunction, "name", {
+  value: "", writable: false, enumerable: false, configurable: true
+});

+ 30 - 0
Jint.Tests.Test262/test/built-ins/Promise/all/resolve-element-function-property-order.js

@@ -0,0 +1,30 @@
+// Copyright (C) 2020 ExE Boss. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-createbuiltinfunction
+description: Promise.all resolve element function property order
+info: |
+  Set order: "length", "name"
+---*/
+
+var resolveElementFunction;
+var thenable = {
+  then: function(fulfill) {
+    resolveElementFunction = fulfill;
+  }
+};
+
+function NotPromise(executor) {
+  executor(function() {}, function() {});
+}
+NotPromise.resolve = function(v) {
+  return v;
+};
+Promise.all.call(NotPromise, [thenable]);
+
+var propNames = Object.getOwnPropertyNames(resolveElementFunction);
+var lengthIndex = propNames.indexOf("length");
+var nameIndex = propNames.indexOf("name");
+
+assert(lengthIndex >= 0 && nameIndex === lengthIndex + 1,
+  "The `length` property comes before the `name` property on built-in functions");

+ 1 - 1
Jint.Tests.Test262/test/built-ins/Promise/all/resolve-from-same-thenable.js

@@ -37,7 +37,7 @@ function Constructor(executor) {
     assert.sameValue(values[1], "p2-fulfill", "values[1]");
     assert.sameValue(values[2], "p3-fulfill", "values[2]");
   }
-  executor(resolve, $ERROR);
+  executor(resolve, Test262Error.thrower);
 }
 Constructor.resolve = function(v) {
   return v;

+ 42 - 0
Jint.Tests.Test262/test/built-ins/Promise/all/resolve-ignores-late-rejection-deferred.js

@@ -0,0 +1,42 @@
+// Copyright (C) 2019 Leo Balter, 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+  Resolved promises ignore rejections through deferred invocation of the
+    provided resolving function
+esid: sec-promise.any
+info: |
+  Let result be PerformPromiseAll(iteratorRecord, C, promiseCapability).
+
+  Runtime Semantics: PerformPromiseAll
+
+  Repeat
+    ...
+    r. Perform ? Invoke(nextPromise, "then", « resultCapability.[[Resolve]], rejectElement »).
+
+flags: [async]
+features: [arrow-function]
+---*/
+
+var resolver = {
+  then(resolve) {
+    new Promise((resolve) => resolve())
+      .then(() => resolve(42));
+  }
+};
+var lateRejector = {
+  then(resolve, reject) {
+    new Promise((resolve) => resolve())
+      .then(() => {
+        resolve(9);
+        reject();
+      });
+  }
+};
+
+Promise.all([resolver, lateRejector])
+  .then(resolution => {
+    assert.sameValue(resolution[0], 42);
+    assert.sameValue(resolution[1], 9);
+  }).then($DONE, $DONE);

+ 38 - 0
Jint.Tests.Test262/test/built-ins/Promise/all/resolve-ignores-late-rejection.js

@@ -0,0 +1,38 @@
+// Copyright (C) 2019 Leo Balter, 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+  Resolved promises ignore rejections through immediate invocation of the
+    provided resolving function
+esid: sec-promise.all
+info: |
+  Let result be PerformPromiseAll(iteratorRecord, C, promiseCapability).
+
+  Runtime Semantics: PerformPromiseAll
+
+  Repeat
+    ...
+    r. Perform ? Invoke(nextPromise, "then", « resultCapability.[[Resolve]], rejectElement »).
+
+flags: [async]
+features: [arrow-function]
+---*/
+
+var resolver = {
+  then(resolve) {
+    resolve(42);
+  }
+};
+var lateRejector = {
+  then(resolve, reject) {
+    resolve(33);
+    reject();
+  }
+};
+
+Promise.all([resolver, lateRejector])
+  .then(resolution => {
+    assert.sameValue(resolution[0], 42);
+    assert.sameValue(resolution[1], 33);
+  }).then($DONE, $DONE);

+ 36 - 0
Jint.Tests.Test262/test/built-ins/Promise/all/resolve-non-callable.js

@@ -0,0 +1,36 @@
+// Copyright (C) 2020 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-promise.all
+description: >
+  Promise.resolve is retrieved before GetIterator call (non-callable).
+info: |
+  Promise.all ( iterable )
+
+  [...]
+  3. Let promiseResolve be GetPromiseResolve(C).
+  4. IfAbruptRejectPromise(promiseResolve, promiseCapability).
+
+  GetPromiseResolve ( promiseConstructor )
+
+  [...]
+  2. Let promiseResolve be ? Get(promiseConstructor, "resolve").
+  3. If IsCallable(promiseResolve) is false, throw a TypeError exception.
+flags: [async]
+features: [Symbol.iterator]
+---*/
+
+const iter = { 
+  get [Symbol.iterator]() {
+    throw new Test262Error("unreachable");
+  },
+};
+
+Promise.resolve = "certainly not callable";
+
+Promise.all(iter).then(() => {
+  throw new Test262Error("The promise should be rejected, but it was resolved");
+}, (reason) => {
+  assert(reason instanceof TypeError);
+}).then($DONE, $DONE);

+ 28 - 0
Jint.Tests.Test262/test/built-ins/Promise/all/resolve-not-callable-reject-with-typeerror.js

@@ -0,0 +1,28 @@
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-promise.all
+description: >
+  If the constructor's `resolve` method is not callable, reject with a TypeError.
+info: |
+  Let result be PerformPromiseAny(iteratorRecord, C, promiseCapability).
+
+  Runtime Semantics: PerformPromiseAny
+
+  Let promiseResolve be ? Get(constructor, "resolve").
+  If ! IsCallable(promiseResolve) is false, throw a TypeError exception.
+
+flags: [async]
+features: [arrow-function]
+---*/
+
+Promise.resolve = null;
+
+Promise.all([1])
+  .then(
+    () => $DONE('The promise should not be resolved.'),
+    error => {
+      assert(error instanceof TypeError);
+    }
+  ).then($DONE, $DONE);

+ 1 - 1
Jint.Tests.Test262/test/built-ins/Promise/all/same-reject-function.js

@@ -16,7 +16,7 @@ info: |
 function rejectFunction() {}
 
 function Constructor(executor) {
-  executor($ERROR, rejectFunction);
+  executor(Test262Error.thrower, rejectFunction);
 }
 Constructor.resolve = function(v) {
   return v;

+ 2 - 0
Jint.Tests.Test262/test/built-ins/Promise/all/species-get-error.js

@@ -16,6 +16,8 @@ features: [Symbol.species]
 function C(executor) {
   executor(function() {}, function() {});
 }
+
+C.resolve = function() {};
 Object.defineProperty(C, Symbol.species, {
   get: function() {
     $ERROR("Getter for Symbol.species called");

+ 55 - 0
Jint.Tests.Test262/test/built-ins/Promise/allSettled/call-resolve-element-after-return.js

@@ -0,0 +1,55 @@
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-promise.allsettled-resolve-element-functions
+description: >
+  Cannot change result value of resolved Promise.allSettled element after Promise.allSettled() returned.
+info: |
+  Promise.allSettled Resolve Element Functions
+
+  1. Let F be the active function object.
+  2. Let alreadyCalled be F.[[AlreadyCalled]].
+  3. If alreadyCalled.[[Value]] is true, return undefined.
+  4. Set alreadyCalled.[[Value]] to true.
+  ...
+includes: [promiseHelper.js]
+features: [Promise.allSettled]
+---*/
+
+var callCount = 0;
+var valuesArray;
+var expected = [{ status: 'fulfilled', value: 'expectedValue' }];
+
+function Constructor(executor) {
+  function resolve(values) {
+    callCount += 1;
+    valuesArray = values;
+    checkSettledPromises(values, expected, 'values');
+  }
+  executor(resolve, Test262Error.thrower);
+}
+Constructor.resolve = function(v) {
+  return v;
+};
+
+var p1OnFulfilled;
+
+var p1 = {
+  then(onFulfilled, onRejected) {
+    p1OnFulfilled = onFulfilled;
+    onFulfilled('expectedValue');
+  }
+};
+
+assert.sameValue(callCount, 0, 'callCount before call to all()');
+
+Promise.allSettled.call(Constructor, [p1]);
+
+assert.sameValue(callCount, 1, 'callCount after call to all()');
+checkSettledPromises(valuesArray, expected, 'valuesArray after call to all()');
+
+p1OnFulfilled('unexpectedValue');
+
+assert.sameValue(callCount, 1, 'callCount after call to onFulfilled()');
+checkSettledPromises(valuesArray, expected, 'valuesArray after call to onFulfilled()');

+ 59 - 0
Jint.Tests.Test262/test/built-ins/Promise/allSettled/call-resolve-element-items.js

@@ -0,0 +1,59 @@
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-promise.allsettled-resolve-element-functions
+description: >
+  Cannot change result value of resolved Promise.allSettled elements.
+info: |
+  Promise.allSettled Resolve Element Functions
+
+  1. Let F be the active function object.
+  2. Let alreadyCalled be F.[[AlreadyCalled]].
+  3. If alreadyCalled.[[Value]] is true, return undefined.
+  4. Set alreadyCalled.[[Value]] to true.
+  ...
+includes: [promiseHelper.js]
+features: [Promise.allSettled]
+---*/
+
+var callCount = 0;
+
+function Constructor(executor) {
+  function resolve(values) {
+    callCount += 1;
+    checkSettledPromises(values, [
+      {
+        status: 'fulfilled',
+        value: 'expectedValue-p1'
+      },
+      {
+        status: 'fulfilled',
+        value: 'expectedValue-p2'
+      }
+    ], 'values');
+  }
+  executor(resolve, Test262Error.thrower);
+}
+Constructor.resolve = function(v) {
+  return v;
+};
+
+var p1 = {
+  then(onFulfilled, onRejected) {
+    onFulfilled('expectedValue-p1');
+    onFulfilled('unexpectedValue-p1');
+  }
+};
+var p2 = {
+  then(onFulfilled, onRejected) {
+    onFulfilled('expectedValue-p2');
+    onFulfilled('unexpectedValue-p2');
+  }
+};
+
+assert.sameValue(callCount, 0, 'callCount before call to all()');
+
+Promise.allSettled.call(Constructor, [p1, p2]);
+
+assert.sameValue(callCount, 1, 'callCount after call to all()');

+ 49 - 0
Jint.Tests.Test262/test/built-ins/Promise/allSettled/call-resolve-element.js

@@ -0,0 +1,49 @@
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-promise.allsettled-resolve-element-functions
+description: >
+  Cannot change result value of resolved Promise.allSettled element.
+info: |
+  Promise.allSettled Resolve Element Functions
+
+  1. Let F be the active function object.
+  2. Let alreadyCalled be F.[[AlreadyCalled]].
+  3. If alreadyCalled.[[Value]] is true, return undefined.
+  4. Set alreadyCalled.[[Value]] to true.
+  ...
+includes: [promiseHelper.js]
+features: [Promise.allSettled]
+---*/
+
+var callCount = 0;
+
+function Constructor(executor) {
+  function resolve(values) {
+    callCount += 1;
+    checkSettledPromises(values, [
+      {
+        status: 'fulfilled',
+        value: 'expectedValue'
+      }
+    ], 'values');
+  }
+  executor(resolve, Test262Error.thrower);
+}
+Constructor.resolve = function(v) {
+  return v;
+};
+
+var p1 = {
+  then(onFulfilled, onRejected) {
+    onFulfilled('expectedValue');
+    onFulfilled('unexpectedValue');
+  }
+};
+
+assert.sameValue(callCount, 0, 'callCount before call to all()');
+
+Promise.allSettled.call(Constructor, [p1]);
+
+assert.sameValue(callCount, 1, 'callCount after call to all()');

+ 106 - 0
Jint.Tests.Test262/test/built-ins/Promise/allSettled/capability-executor-called-twice.js

@@ -0,0 +1,106 @@
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-promise.allsettled
+description: >
+  Throws a TypeError if capabilities executor already called with non-undefined values.
+info: |
+  Promise.allSettled ( iterable )
+
+  ...
+  3. Let promiseCapability be ? NewPromiseCapability(C).
+  ...
+
+  GetCapabilitiesExecutor Functions
+
+  ...
+  4. If promiseCapability.[[Resolve]] is not undefined, throw a TypeError exception.
+  5. If promiseCapability.[[Reject]] is not undefined, throw a TypeError exception.
+  6. Set promiseCapability.[[Resolve]] to resolve.
+  7. Set promiseCapability.[[Reject]] to reject.
+  ...
+features: [Promise.allSettled]
+---*/
+
+var checkPoint = '';
+function fn1(executor) {
+  checkPoint += 'a';
+  executor();
+  checkPoint += 'b';
+  executor(function() {}, function() {});
+  checkPoint += 'c';
+}
+fn1.resolve = function() {
+  throw new Test262Error();
+};
+Promise.allSettled.call(fn1, []);
+assert.sameValue(checkPoint, 'abc', 'executor initially called with no arguments');
+
+checkPoint = '';
+function fn2(executor) {
+  checkPoint += 'a';
+  executor(undefined, undefined);
+  checkPoint += 'b';
+  executor(function() {}, function() {});
+  checkPoint += 'c';
+}
+fn2.resolve = function() {
+  throw new Test262Error();
+};
+Promise.allSettled.call(fn2, []);
+assert.sameValue(checkPoint, 'abc', 'executor initially called with (undefined, undefined)');
+
+checkPoint = '';
+function fn3(executor) {
+  checkPoint += 'a';
+  executor(undefined, function() {});
+  checkPoint += 'b';
+  executor(function() {}, function() {});
+  checkPoint += 'c';
+}
+Object.defineProperty(fn3, 'resolve', {
+  get() {
+    throw new Test262Error();
+  }
+});
+assert.throws(TypeError, function() {
+  Promise.allSettled.call(fn3, []);
+}, 'executor initially called with (undefined, function)');
+assert.sameValue(checkPoint, 'ab', 'executor initially called with (undefined, function)');
+
+checkPoint = '';
+function fn4(executor) {
+  checkPoint += 'a';
+  executor(function() {}, undefined);
+  checkPoint += 'b';
+  executor(function() {}, function() {});
+  checkPoint += 'c';
+}
+Object.defineProperty(fn4, 'resolve', {
+  get() {
+    throw new Test262Error();
+  }
+});
+assert.throws(TypeError, function() {
+  Promise.allSettled.call(fn4, []);
+}, 'executor initially called with (function, undefined)');
+assert.sameValue(checkPoint, 'ab', 'executor initially called with (function, undefined)');
+
+checkPoint = '';
+function fn5(executor) {
+  checkPoint += 'a';
+  executor('invalid value', 123);
+  checkPoint += 'b';
+  executor(function() {}, function() {});
+  checkPoint += 'c';
+}
+Object.defineProperty(fn5, 'resolve', {
+  get() {
+    throw new Test262Error();
+  }
+});
+assert.throws(TypeError, function() {
+  Promise.allSettled.call(fn5, []);
+}, 'executor initially called with (String, Number)');
+assert.sameValue(checkPoint, 'ab', 'executor initially called with (String, Number)');

+ 107 - 0
Jint.Tests.Test262/test/built-ins/Promise/allSettled/capability-executor-not-callable.js

@@ -0,0 +1,107 @@
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-promise.allsettled
+description: >
+  Throws a TypeError if either resolve or reject capability is not callable.
+info: |
+  Promise.allSettled ( iterable )
+
+  ...
+  3. Let promiseCapability be ? NewPromiseCapability(C).
+  ...
+
+  NewPromiseCapability ( C )
+
+  ...
+  5. Let executor be CreateBuiltinFunction(steps, « [[Capability]] »).
+  6. Set executor.[[Capability]] to promiseCapability.
+  7. Let promise be ? Construct(C, « executor »).
+  8. If IsCallable(promiseCapability.[[Resolve]]) is false, throw a TypeError exception.
+  9. If IsCallable(promiseCapability.[[Reject]]) is false, throw a TypeError exception.
+  ...
+features: [Promise.allSettled]
+---*/
+
+var checkPoint = '';
+function fn1(executor) {
+  checkPoint += 'a';
+}
+Object.defineProperty(fn1, 'resolve', {
+  get() { throw new Test262Error(); }
+});
+assert.throws(TypeError, function() {
+  Promise.allSettled.call(fn1, []);
+}, 'executor not called at all');
+assert.sameValue(checkPoint, 'a', 'executor not called at all');
+
+checkPoint = '';
+function fn2(executor) {
+  checkPoint += 'a';
+  executor();
+  checkPoint += 'b';
+}
+Object.defineProperty(fn2, 'resolve', {
+  get() { throw new Test262Error(); }
+});
+assert.throws(TypeError, function() {
+  Promise.allSettled.call(fn2, []);
+}, 'executor called with no arguments');
+assert.sameValue(checkPoint, 'ab', 'executor called with no arguments');
+
+checkPoint = '';
+function fn3(executor) {
+  checkPoint += 'a';
+  executor(undefined, undefined);
+  checkPoint += 'b';
+}
+Object.defineProperty(fn3, 'resolve', {
+  get() { throw new Test262Error(); }
+});
+assert.throws(TypeError, function() {
+  Promise.allSettled.call(fn3, []);
+}, 'executor called with (undefined, undefined)');
+assert.sameValue(checkPoint, 'ab', 'executor called with (undefined, undefined)');
+
+checkPoint = '';
+function fn4(executor) {
+  checkPoint += 'a';
+  executor(undefined, function() {});
+  checkPoint += 'b';
+}
+Object.defineProperty(fn4, 'resolve', {
+  get() { throw new Test262Error(); }
+});
+assert.throws(TypeError, function() {
+  Promise.allSettled.call(fn4, []);
+}, 'executor called with (undefined, function)');
+assert.sameValue(checkPoint, 'ab', 'executor called with (undefined, function)');
+
+checkPoint = '';
+function fn5(executor) {
+  checkPoint += 'a';
+  executor(function() {}, undefined);
+  checkPoint += 'b';
+}
+Object.defineProperty(fn5, 'resolve', {
+  get() { throw new Test262Error(); }
+});
+assert.throws(TypeError, function() {
+  Promise.allSettled.call(fn5, []);
+}, 'executor called with (function, undefined)');
+assert.sameValue(checkPoint, 'ab', 'executor called with (function, undefined)');
+
+checkPoint = '';
+function fn6(executor) {
+  checkPoint += 'a';
+  executor(123, 'invalid value');
+  checkPoint += 'b';
+}
+Object.defineProperty(fn6, 'resolve', {
+  get() { throw new Test262Error(); }
+});
+assert.throws(TypeError, function() {
+  Promise.allSettled.call(fn6, []);
+}, 'executor called with (Number, String)');
+assert.sameValue(checkPoint, 'ab', 'executor called with (Number, String)');

+ 64 - 0
Jint.Tests.Test262/test/built-ins/Promise/allSettled/capability-resolve-throws-no-close.js

@@ -0,0 +1,64 @@
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-promise.allsettled
+description: >
+  Iterator is not closed when the "resolve" capability returns an abrupt
+  completion.
+info: |
+  ...
+  3. Let promiseCapability be ? NewPromiseCapability(C).
+  ...
+  6. Let result be PerformPromiseAllSettled(iteratorRecord, C, promiseCapability).
+  7. If result is an abrupt completion, then
+    a. If iteratorRecord.[[Done]] is false, set result to IteratorClose(iteratorRecord, result).
+    b. IfAbruptRejectPromise(result, promiseCapability).
+  8. Return Completion(result).
+
+  Runtime Semantics: PerformPromiseAllSettled
+
+  ...
+  6. Repeat
+    ...
+    d. If next is false, then
+      ...
+      iii. If remainingElementsCount.[[Value]] is 0, then
+        1. Let valuesArray be CreateArrayFromList(values).
+        2. Perform ? Call(resultCapability.[[Resolve]], undefined, « valuesArray »).
+
+  IfAbruptRejectPromise
+
+  1. IfAbruptRejectPromise(value, capability).
+features: [Promise.allSettled, Symbol.iterator]
+---*/
+
+var returnCount = 0;
+var iter = {};
+iter[Symbol.iterator] = function() {
+  return {
+    next() {
+      return {
+        done: true
+      };
+    },
+    return() {
+      returnCount += 1;
+      return {};
+    }
+  };
+};
+var P = function(executor) {
+  return new Promise(function(_, reject) {
+    executor(function() {
+      throw new Test262Error();
+    }, reject);
+  });
+};
+
+P.resolve = function() {
+  throw new Test262Error();
+};
+
+Promise.allSettled.call(P, iter);
+
+assert.sameValue(returnCount, 0);

+ 59 - 0
Jint.Tests.Test262/test/built-ins/Promise/allSettled/capability-resolve-throws-reject.js

@@ -0,0 +1,59 @@
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-promise.allsettled
+description: >
+  Promise is rejected when the "resolve" capability returns an abrupt
+  completion.
+info: |
+  ...
+  3. Let promiseCapability be ? NewPromiseCapability(C).
+  ...
+  6. Let result be PerformPromiseAllSettled(iteratorRecord, C, promiseCapability).
+  7. If result is an abrupt completion, then
+    a. If iteratorRecord.[[Done]] is false, set result to IteratorClose(iteratorRecord, result).
+    b. IfAbruptRejectPromise(result, promiseCapability).
+  8. Return Completion(result).
+
+  Runtime Semantics: PerformPromiseAllSettled
+
+  ...
+  6. Repeat
+    ...
+    d. If next is false, then
+      ...
+      iii. If remainingElementsCount.[[Value]] is 0, then
+        1. Let valuesArray be CreateArrayFromList(values).
+        2. Perform ? Call(resultCapability.[[Resolve]], undefined, « valuesArray »).
+
+
+  IfAbruptRejectPromise
+
+  1. IfAbruptRejectPromise(value, capability).
+flags: [async]
+features: [Promise.allSettled]
+---*/
+
+var thrown = new Test262Error();
+var P = function(executor) {
+  return new Promise(function(_, reject) {
+    executor(function() {
+      throw thrown;
+    }, reject);
+  });
+};
+
+P.resolve = function() {
+  throw new Test262Error();
+};
+
+Promise.allSettled.call(P, [])
+  .then(function() {
+    $DONE('Promise incorrectly fulfilled.');
+  }, function(reason) {
+    if (reason !== thrown) {
+      $DONE('Promise rejected with incorrect "reason."');
+      return;
+    }
+    $DONE();
+  });

+ 24 - 0
Jint.Tests.Test262/test/built-ins/Promise/allSettled/ctx-ctor-throws.js

@@ -0,0 +1,24 @@
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+  Promise.allSettled invoked on a constructor value that throws an error
+esid: sec-promise.allsettled
+info: |
+  3. Let promiseCapability be ? NewPromiseCapability(C).
+
+  NewPromiseCapability
+
+  ...
+  7. Let promise be ? Construct(C, « executor »).
+features: [Promise.allSettled]
+---*/
+
+var CustomPromise = function() {
+  throw new Test262Error();
+};
+
+assert.throws(Test262Error, function() {
+  Promise.allSettled.call(CustomPromise);
+});

+ 34 - 0
Jint.Tests.Test262/test/built-ins/Promise/allSettled/ctx-ctor.js

@@ -0,0 +1,34 @@
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+  Promise.allSettled invoked on a constructor value
+esid: sec-promise.allsettled
+info: |
+  3. Let promiseCapability be ? NewPromiseCapability(C).
+  ...
+  6. Let result be PerformPromiseAllSettled(iteratorRecord, C, promiseCapability).
+  ...
+  8. Return Completion(result).
+features: [Promise.allSettled, class]
+---*/
+
+var executor = null;
+var callCount = 0;
+
+class SubPromise extends Promise {
+  constructor(a) {
+    super(a);
+    executor = a;
+    callCount += 1;
+  }
+}
+
+var instance = Promise.allSettled.call(SubPromise, []);
+
+assert.sameValue(instance.constructor, SubPromise);
+assert.sameValue(instance instanceof SubPromise, true);
+
+assert.sameValue(callCount, 1);
+assert.sameValue(typeof executor, 'function');

+ 20 - 0
Jint.Tests.Test262/test/built-ins/Promise/allSettled/ctx-non-ctor.js

@@ -0,0 +1,20 @@
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+  Promise.allSettled invoked on a non-constructor value
+esid: sec-promise.allsettled
+info: |
+  ...
+  3. Let promiseCapability be ? NewPromiseCapability(C).
+
+  NewPromiseCapability ( C )
+
+  1. If IsConstructor(C) is false, throw a TypeError exception.
+features: [Promise.allSettled]
+---*/
+
+assert.throws(TypeError, function() {
+  Promise.allSettled.call(eval);
+});

+ 36 - 0
Jint.Tests.Test262/test/built-ins/Promise/allSettled/ctx-non-object.js

@@ -0,0 +1,36 @@
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+  Promise.allSettled invoked on a non-object value
+esid: sec-promise.allsettled
+info: |
+  1. Let C be the this value.
+  2. If Type(C) is not Object, throw a TypeError exception.
+features: [Promise.allSettled, Symbol]
+---*/
+
+assert.throws(TypeError, function() {
+  Promise.allSettled.call(undefined, []);
+});
+
+assert.throws(TypeError, function() {
+  Promise.allSettled.call(null, []);
+});
+
+assert.throws(TypeError, function() {
+  Promise.allSettled.call(86, []);
+});
+
+assert.throws(TypeError, function() {
+  Promise.allSettled.call('string', []);
+});
+
+assert.throws(TypeError, function() {
+  Promise.allSettled.call(true, []);
+});
+
+assert.throws(TypeError, function() {
+  Promise.allSettled.call(Symbol(), []);
+});

+ 46 - 0
Jint.Tests.Test262/test/built-ins/Promise/allSettled/does-not-invoke-array-setters.js

@@ -0,0 +1,46 @@
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-performpromiseallsettled
+description: >
+  Indexed setter properties on Array.prototype are not invoked.
+info: |
+  Promise.allSettled ( iterable )
+
+  6. Let result be PerformPromiseAllSettled(iteratorRecord, C, promiseCapability).
+  7. If result is an abrupt completion, then
+    a. If iteratorRecord.[[Done]] is false, set result to IteratorClose(iteratorRecord, result).
+    b, IfAbruptRejectPromise(result, promiseCapability).
+
+  Runtime Semantics: PerformPromiseAllSettled ( iteratorRecord, constructor, resultCapability )
+
+  ...
+  4. Let remainingElementsCount be a new Record { [[value]]: 1 }.
+  ...
+  6.d ...
+    ii. Set remainingElementsCount.[[value]] to remainingElementsCount.[[value]] − 1.
+    iii. If remainingElementsCount.[[value]] is 0,
+      1. Let valuesArray be CreateArrayFromList(values).
+      ...
+  ...
+
+  7.3.16 CreateArrayFromList (elements)
+    ...
+    4. For each element e of elements
+      a. Let status be CreateDataProperty(array, ToString(n), e).
+      b. Assert: status is true.
+    ...
+flags: [async]
+features: [Promise.allSettled]
+---*/
+
+Object.defineProperty(Array.prototype, 0, {
+  set() {
+    throw new Test262Error('Setter on Array.prototype called');
+  }
+});
+
+Promise.allSettled([42]).then(function() {
+  $DONE();
+}, $DONE);

+ 44 - 0
Jint.Tests.Test262/test/built-ins/Promise/allSettled/invoke-resolve-error-close.js

@@ -0,0 +1,44 @@
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+  Explicit iterator closing in response to error
+esid: sec-promise.allsettled
+info: |
+  6. Let result be PerformPromiseAllSettled(iteratorRecord, C, promiseCapability).
+  7. If result is an abrupt completion, then
+    a. If iteratorRecord.[[Done]] is false, set result to IteratorClose(iteratorRecord, result).
+    b. IfAbruptRejectPromise(result, promiseCapability).
+
+  Runtime Semantics: PerformPromiseAllSettled
+
+  6. Repeat
+    ...
+    i. Let nextPromise be ? Invoke(constructor, "resolve", « nextValue »).
+features: [Promise.allSettled, Symbol.iterator]
+---*/
+
+var iterDoneSpy = {};
+var callCount = 0;
+iterDoneSpy[Symbol.iterator] = function() {
+  return {
+    next() {
+      return {
+        value: null,
+        done: false
+      };
+    },
+    return() {
+      callCount += 1;
+    }
+  };
+};
+
+Promise.resolve = function() {
+  throw new Error();
+};
+
+Promise.allSettled(iterDoneSpy);
+
+assert.sameValue(callCount, 1);

+ 34 - 0
Jint.Tests.Test262/test/built-ins/Promise/allSettled/invoke-resolve-error-reject.js

@@ -0,0 +1,34 @@
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Promise rejection in response to error
+esid: sec-promise.allsettled
+info: |
+  6. Let result be PerformPromiseAllSettled(iteratorRecord, C, promiseCapability).
+  7. If result is an abrupt completion, then
+    a. If iteratorRecord.[[Done]] is false, set result to IteratorClose(iteratorRecord, result).
+    b. IfAbruptRejectPromise(result, promiseCapability).
+
+  Runtime Semantics: PerformPromiseAllSettled
+
+  6. Repeat
+    ...
+    i. Let nextPromise be ? Invoke(constructor, "resolve", « nextValue »).
+flags: [async]
+features: [Promise.allSettled]
+---*/
+
+var thrown = new Test262Error();
+Promise.resolve = function() {
+  throw thrown;
+};
+
+Promise.allSettled([1])
+  .then(function() {
+    $ERROR('The promise should not be fulfilled.');
+  }, function(reason) {
+    if (reason !== thrown) {
+      $ERROR('The promise should be rejected with the thrown error object');
+    }
+  }).then($DONE, $DONE);

+ 34 - 0
Jint.Tests.Test262/test/built-ins/Promise/allSettled/invoke-resolve-get-error-reject.js

@@ -0,0 +1,34 @@
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+  Error retrieving the constructor's `resolve` method (rejecting promise)
+esid: sec-promise.allsettled
+info: |
+  6. Let result be PerformPromiseAllSettled(iteratorRecord, C, promiseCapability).
+  7. If result is an abrupt completion, then
+    a. If iteratorRecord.[[Done]] is false, set result to IteratorClose(iteratorRecord, result).
+    b. IfAbruptRejectPromise(result, promiseCapability).
+
+  Runtime Semantics: PerformPromiseAllSettled
+
+  6. Repeat
+    ...
+    i. Let nextPromise be ? Invoke(constructor, "resolve", « nextValue »).
+flags: [async]
+features: [Promise.allSettled]
+---*/
+
+var error = new Test262Error();
+Object.defineProperty(Promise, 'resolve', {
+  get() {
+    throw error;
+  }
+});
+
+Promise.allSettled([new Promise(function() {})]).then(function() {
+  $ERROR('The promise should be rejected');
+}, function(reason) {
+  assert.sameValue(reason, error);
+}).then($DONE, $DONE);

+ 40 - 0
Jint.Tests.Test262/test/built-ins/Promise/allSettled/invoke-resolve-get-error.js

@@ -0,0 +1,40 @@
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-promise.allsettled
+description: >
+  Promise.resolve is retrieved before GetIterator call (abrupt lookup).
+info: |
+  Promise.allSettled ( iterable )
+
+  [...]
+  3. Let promiseResolve be GetPromiseResolve(C).
+  4. IfAbruptRejectPromise(promiseResolve, promiseCapability).
+
+  GetPromiseResolve ( promiseConstructor )
+
+  [...]
+  2. Let promiseResolve be ? Get(promiseConstructor, "resolve").
+flags: [async]
+features: [Promise.allSettled, Symbol.iterator]
+---*/
+
+const iter = {
+  get [Symbol.iterator]() {
+    throw new Test262Error('unreachable');
+  },
+};
+
+const resolveError = { name: 'MyError' };
+Object.defineProperty(Promise, 'resolve', {
+  get() {
+    throw resolveError;
+  },
+});
+
+Promise.allSettled(iter).then(() => {
+  throw new Test262Error('The promise should be rejected, but it was resolved');
+}, (reason) => {
+  assert.sameValue(reason, resolveError);
+}).then($DONE, $DONE);

+ 47 - 0
Jint.Tests.Test262/test/built-ins/Promise/allSettled/invoke-resolve-get-once-multiple-calls.js

@@ -0,0 +1,47 @@
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+  Gets constructor's `resolve` method once from zero to many invocations.
+esid: sec-promise.allsettled
+info: |
+  6. Let result be PerformPromiseAllSettled(iteratorRecord, C, promiseCapability).
+
+  Runtime Semantics: PerformPromiseAllSettled
+
+  6. Let promiseResolve be ? Get(constructor, `"resolve"`).
+  7. 1. If IsCallable(promiseResolve) is false, throw a TypeError exception.
+  8. Repeat
+    ...
+    i. Let nextPromise be ? Call(promiseResolve, constructor, « nextValue »).
+features: [Promise.allSettled]
+---*/
+
+var p1 = Promise.resolve(1);
+var p2 = Promise.resolve(1);
+var p3 = Promise.reject(1);
+var p4 = Promise.resolve(1);
+var resolve = Promise.resolve;
+var getCount = 0;
+var callCount = 0;
+
+Object.defineProperty(Promise, 'resolve', {
+  configurable: true,
+  get() {
+    getCount += 1;
+    return function() {
+      callCount += 1;
+      return resolve.apply(Promise, arguments);
+    };
+  }
+});
+
+Promise.allSettled([p1, p2, p3, p4]);
+
+assert.sameValue(
+  getCount, 1, 'Got `resolve` only once for each iterated value'
+);
+assert.sameValue(
+  callCount, 4, '`resolve` invoked once for each iterated value'
+);

+ 43 - 0
Jint.Tests.Test262/test/built-ins/Promise/allSettled/invoke-resolve-get-once-no-calls.js

@@ -0,0 +1,43 @@
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+  Gets constructor's `resolve` method once from zero to many invocations.
+esid: sec-promise.allsettled
+info: |
+  6. Let result be PerformPromiseAllSettled(iteratorRecord, C, promiseCapability).
+
+  Runtime Semantics: PerformPromiseAllSettled
+
+  6. Let promiseResolve be ? Get(constructor, `"resolve"`).
+  7. 1. If IsCallable(promiseResolve) is false, throw a TypeError exception.
+  8. Repeat
+    ...
+    i. Let nextPromise be ? Call(promiseResolve, constructor, « nextValue »).
+features: [Promise.allSettled]
+---*/
+
+var resolve = Promise.resolve;
+var getCount = 0;
+var callCount = 0;
+
+Object.defineProperty(Promise, 'resolve', {
+  configurable: true,
+  get() {
+    getCount += 1;
+    return function() {
+      callCount += 1;
+      return resolve.apply(Promise, arguments);
+    };
+  }
+});
+
+Promise.allSettled([]);
+
+assert.sameValue(
+  getCount, 1, 'Got `resolve` only once for each iterated value'
+);
+assert.sameValue(
+  callCount, 0, '`resolve` not called for empty iterator'
+);

+ 43 - 0
Jint.Tests.Test262/test/built-ins/Promise/allSettled/invoke-resolve-on-promises-every-iteration-of-custom.js

@@ -0,0 +1,43 @@
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+  Invocation of the constructor's `resolve` method for iterable with promise values
+esid: sec-promise.allSettled
+info: |
+  7. Let result be PerformPromiseAllSettled(iteratorRecord, C, promiseCapability).
+
+  Runtime Semantics: PerformPromiseAllSettled
+
+  7. Repeat
+    ...
+    i. Let nextPromise be ? Call(promiseResolve, constructor, « nextValue »).
+
+flags: [async]
+features: [Promise.allSettled, class, arrow-function]
+---*/
+class Custom extends Promise {}
+
+let values = [1, 1, 1];
+let cresolveCallCount = 0;
+let presolveCallCount = 0;
+let boundCustomResolve = Custom.resolve.bind(Custom);
+let boundPromiseResolve = Promise.resolve.bind(Promise);
+
+Custom.resolve = function(...args) {
+  cresolveCallCount += 1;
+  return boundCustomResolve(...args);
+};
+
+Promise.resolve = function(...args) {
+  presolveCallCount += 1;
+  return boundPromiseResolve(...args);
+};
+
+Promise.allSettled.call(Custom, values)
+  .then(() => {
+      assert.sameValue(presolveCallCount, 0, '`Promise.resolve` is never invoked');
+      assert.sameValue(cresolveCallCount, 3, '`Custom.resolve` invoked once for every iterated promise');
+    }).then($DONE, $DONE);
+

+ 34 - 0
Jint.Tests.Test262/test/built-ins/Promise/allSettled/invoke-resolve-on-promises-every-iteration-of-promise.js

@@ -0,0 +1,34 @@
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+  Invocation of the constructor's `resolve` method for iterable with promise values
+esid: sec-promise.allSettled
+info: |
+  7. Let result be PerformPromiseAllSettled(iteratorRecord, C, promiseCapability).
+
+  Runtime Semantics: PerformPromiseAllSettled
+
+  7. Repeat
+    ...
+    i. Let nextPromise be ? Call(promiseResolve, constructor, « nextValue »).
+
+flags: [async]
+features: [Promise.allSettled, arrow-function]
+---*/
+
+let values = [1,1,1];
+let callCount = 0;
+let boundPromiseResolve = Promise.resolve.bind(Promise);
+
+Promise.resolve = function(...args) {
+  callCount += 1;
+  return boundPromiseResolve(...args);
+};
+
+Promise.allSettled(values)
+  .then(() => {
+      assert.sameValue(callCount, 3, '`then` invoked once for every iterated promise');
+    }).then($DONE, $DONE);
+

+ 34 - 0
Jint.Tests.Test262/test/built-ins/Promise/allSettled/invoke-resolve-on-values-every-iteration-of-promise.js

@@ -0,0 +1,34 @@
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+  Invocation of the constructor's `resolve` method for iterable with non-promise values
+esid: sec-promise.allSettled
+info: |
+  5. Let result be PerformPromiseAllSettled(iteratorRecord, C, promiseCapability).
+
+  Runtime Semantics: PerformPromiseAllSettled
+
+  8. Repeat
+    ...
+    i. Let nextPromise be ? Call(promiseResolve, constructor, « nextValue »).
+
+flags: [async]
+features: [Promise.allSettled, arrow-function]
+---*/
+
+let values = [1, 2, 3];
+let callCount = 0;
+let boundPromiseResolve = Promise.resolve.bind(Promise);
+
+Promise.resolve = function(...args) {
+  callCount += 1;
+  return boundPromiseResolve(...args);
+};
+
+Promise.allSettled(values)
+  .then(() => {
+      assert.sameValue(callCount, 3, '`Promise.resolve` invoked once for every iterated value');
+    }).then($DONE, $DONE);
+

+ 42 - 0
Jint.Tests.Test262/test/built-ins/Promise/allSettled/invoke-resolve-return.js

@@ -0,0 +1,42 @@
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Use of the value returned by the constructor's `resolve` method.
+esid: sec-promise.allsettled
+info: |
+  6. Let result be PerformPromiseAllSettled(iteratorRecord, C, promiseCapability).
+
+  Runtime Semantics: PerformPromiseAllSettled
+
+  6. Repeat
+    ...
+    i. Let nextPromise be ? Invoke(constructor, "resolve", « nextValue »).
+    ...
+    z. Perform ? Invoke(nextPromise, "then", « resolveElement, rejectElement »).
+features: [Promise.allSettled]
+---*/
+
+var originalCallCount = 0;
+var newCallCount = 0;
+var P = function(executor) {
+  executor(function() {}, function() {});
+};
+P.resolve = function() {
+  return newThenable;
+};
+
+var originalThenable = {
+  then() {
+    originalCallCount += 1;
+  }
+};
+var newThenable = {
+  then() {
+    newCallCount += 1;
+  }
+};
+
+Promise.allSettled.call(P, [originalThenable]);
+
+assert.sameValue(originalCallCount, 0, 'original `then` method not invoked');
+assert.sameValue(newCallCount, 1, 'new `then` method invoked exactly once');

+ 52 - 0
Jint.Tests.Test262/test/built-ins/Promise/allSettled/invoke-resolve.js

@@ -0,0 +1,52 @@
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+  Invocation of the constructor's `resolve` method
+esid: sec-promise.allsettled
+info: |
+  6. Let result be PerformPromiseAllSettled(iteratorRecord, C, promiseCapability).
+
+  Runtime Semantics: PerformPromiseAllSettled
+
+  6. Repeat
+    ...
+    i. Let nextPromise be ? Invoke(constructor, "resolve", « nextValue »).
+    ...
+    z. Perform ? Invoke(nextPromise, "then", « resolveElement, rejectElement »).
+features: [Promise.allSettled]
+---*/
+
+var p1 = new Promise(function() {});
+var p2 = new Promise(function() {});
+var p3 = new Promise(function() {});
+var resolve = Promise.resolve;
+var callCount = 0;
+var current = p1;
+var next = p2;
+var afterNext = p3;
+
+Promise.resolve = function(nextValue) {
+  assert.sameValue(
+    nextValue, current, '`resolve` invoked with next iterated value'
+  );
+  assert.sameValue(
+    arguments.length, 1, '`resolve` invoked with a single argument'
+  );
+  assert.sameValue(this, Promise, '`this` value is the constructor');
+
+  current = next;
+  next = afterNext;
+  afterNext = null;
+
+  callCount += 1;
+
+  return resolve.apply(Promise, arguments);
+};
+
+Promise.allSettled([p1, p2, p3]);
+
+assert.sameValue(
+  callCount, 3, '`resolve` invoked once for each iterated value'
+);

+ 43 - 0
Jint.Tests.Test262/test/built-ins/Promise/allSettled/invoke-then-error-close.js

@@ -0,0 +1,43 @@
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+  Error thrown when invoking the instance's `then` method (closing iterator)
+esid: sec-promise.allsettled
+info: |
+  6. Let result be PerformPromiseAllSettled(iteratorRecord, C, promiseCapability).
+  7. If result is an abrupt completion, then
+    a. If iteratorRecord.[[Done]] is false, set result to IteratorClose(iteratorRecord, result).
+    b. IfAbruptRejectPromise(result, promiseCapability).
+
+  Runtime Semantics: PerformPromiseAllSettled
+
+  z. Perform ? Invoke(nextPromise, "then", « resolveElement, rejectElement »).
+features: [Promise.allSettled, Symbol.iterator]
+---*/
+
+var promise = new Promise(function() {});
+var returnCount = 0;
+var iter = {};
+iter[Symbol.iterator] = function() {
+  return {
+    next() {
+      return {
+        done: false,
+        value: promise
+      };
+    },
+    return() {
+      returnCount += 1;
+      return {};
+    }
+  };
+};
+
+promise.then = function() {
+  throw new Test262Error();
+};
+
+Promise.allSettled(iter);
+
+assert.sameValue(returnCount, 1);

+ 32 - 0
Jint.Tests.Test262/test/built-ins/Promise/allSettled/invoke-then-error-reject.js

@@ -0,0 +1,32 @@
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+  Error thrown when invoking the instance's `then` method (rejecting Promise)
+esid: sec-promise.allsettled
+info: |
+  6. Let result be PerformPromiseAllSettled(iteratorRecord, C, promiseCapability).
+  7. If result is an abrupt completion, then
+    a. If iteratorRecord.[[Done]] is false, set result to IteratorClose(iteratorRecord, result).
+    b. IfAbruptRejectPromise(result, promiseCapability).
+
+  Runtime Semantics: PerformPromiseAllSettled
+
+  z. Perform ? Invoke(nextPromise, "then", « resolveElement, rejectElement »).
+flags: [async]
+features: [Promise.allSettled]
+---*/
+
+var promise = new Promise(function() {});
+var error = new Test262Error();
+
+promise.then = function() {
+  throw error;
+};
+
+Promise.allSettled([promise]).then(function() {
+  throw new Test262Error('The promise should be rejected');
+}, function(reason) {
+  assert.sameValue(reason, error);
+}).then($DONE, $DONE);

+ 45 - 0
Jint.Tests.Test262/test/built-ins/Promise/allSettled/invoke-then-get-error-close.js

@@ -0,0 +1,45 @@
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+  Error thrown when accesing the instance's `then` method (closing iterator)
+esid: sec-promise.allsettled
+info: |
+  6. Let result be PerformPromiseAllSettled(iteratorRecord, C, promiseCapability).
+  7. If result is an abrupt completion, then
+    a. If iteratorRecord.[[Done]] is false, set result to IteratorClose(iteratorRecord, result).
+    b. IfAbruptRejectPromise(result, promiseCapability).
+
+  Runtime Semantics: PerformPromiseAllSettled
+
+  z. Perform ? Invoke(nextPromise, "then", « resolveElement, rejectElement »).
+features: [Promise.allSettled, Symbol.iterator]
+---*/
+
+var promise = new Promise(function() {});
+var returnCount = 0;
+var iter = {};
+iter[Symbol.iterator] = function() {
+  return {
+    next() {
+      return {
+        done: false,
+        value: promise
+      };
+    },
+    return() {
+      returnCount += 1;
+      return {};
+    }
+  };
+};
+
+Object.defineProperty(promise, 'then', {
+  get() {
+    throw new Test262Error();
+  }
+});
+
+Promise.allSettled(iter);
+
+assert.sameValue(returnCount, 1);

+ 33 - 0
Jint.Tests.Test262/test/built-ins/Promise/allSettled/invoke-then-get-error-reject.js

@@ -0,0 +1,33 @@
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+  Error thrown when accessing the instance's `then` method (rejecting Promise)
+esid: sec-promise.allsettled
+info: |
+  6. Let result be PerformPromiseAllSettled(iteratorRecord, C, promiseCapability).
+  7. If result is an abrupt completion, then
+    a. If iteratorRecord.[[Done]] is false, set result to IteratorClose(iteratorRecord, result).
+    b. IfAbruptRejectPromise(result, promiseCapability).
+
+  Runtime Semantics: PerformPromiseAllSettled
+
+  z. Perform ? Invoke(nextPromise, "then", « resolveElement, rejectElement »).
+flags: [async]
+features: [Promise.allSettled]
+---*/
+
+var promise = new Promise(function() {});
+var error = new Test262Error();
+
+Object.defineProperty(promise, 'then', {
+  get() {
+    throw error;
+  }
+});
+
+Promise.allSettled([promise]).then(function() {
+  $ERROR('The promise should be rejected');
+}, function(reason) {
+  assert.sameValue(reason, error);
+}).then($DONE, $DONE);

+ 53 - 0
Jint.Tests.Test262/test/built-ins/Promise/allSettled/invoke-then.js

@@ -0,0 +1,53 @@
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+  Invocation of the instance's `then` method
+esid: sec-promise.allsettled
+info: |
+  6. Let result be PerformPromiseAllSettled(iteratorRecord, C, promiseCapability).
+  7. If result is an abrupt completion, then
+    a. If iteratorRecord.[[Done]] is false, set result to IteratorClose(iteratorRecord, result).
+    b. IfAbruptRejectPromise(result, promiseCapability).
+
+  Runtime Semantics: PerformPromiseAllSettled
+
+  z. Perform ? Invoke(nextPromise, "then", « resolveElement, rejectElement »).
+features: [Promise.allSettled]
+---*/
+
+var p1 = new Promise(function() {});
+var p2 = new Promise(function() {});
+var p3 = new Promise(function() {});
+var callCount = 0;
+var currentThis = p1;
+var nextThis = p2;
+var afterNextThis = p3;
+
+p1.then = p2.then = p3.then = function(a, b) {
+  assert.sameValue(typeof a, 'function', 'type of first argument');
+  assert.sameValue(
+    a.length,
+    1,
+    'The length property of a promise resolve function is 1.'
+  );
+  assert.sameValue(typeof b, 'function', 'type of second argument');
+  assert.sameValue(
+    b.length,
+    1,
+    'The length property of a promise reject function is 1.'
+  );
+  assert.sameValue(arguments.length, 2, '`then` invoked with two arguments');
+  assert.sameValue(this, currentThis, '`this` value');
+
+  currentThis = nextThis;
+  nextThis = afterNextThis;
+  afterNextThis = null;
+
+  callCount += 1;
+};
+
+Promise.allSettled([p1, p2, p3]);
+
+assert.sameValue(callCount, 3, '`then` invoked once for every iterated value');

+ 10 - 0
Jint.Tests.Test262/test/built-ins/Promise/allSettled/is-function.js

@@ -0,0 +1,10 @@
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-promise.allsettled
+description: Promise.allSettled is callable
+features: [Promise.allSettled]
+---*/
+
+assert.sameValue(typeof Promise.allSettled, 'function');

+ 36 - 0
Jint.Tests.Test262/test/built-ins/Promise/allSettled/iter-arg-is-false-reject.js

@@ -0,0 +1,36 @@
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-promise.allsettled
+description: >
+  Reject when argument is `false`
+info: |
+  Promise.allSettled ( iterable )
+
+  ...
+  4. Let iteratorRecord be GetIterator(iterable).
+  5. IfAbruptRejectPromise(iteratorRecord, promiseCapability).
+  ...
+
+  #sec-getiterator
+  GetIterator ( obj [ , hint [ , method ] ] )
+
+  ...
+  Let iterator be ? Call(method, obj).
+  If Type(iterator) is not Object, throw a TypeError exception.
+  ...
+features: [Promise.allSettled, Symbol.iterator]
+flags: [async]
+---*/
+
+try {
+  Promise.allSettled(false).then(function() {
+    $DONE('The promise should be rejected, but was resolved');
+  }, function(error) {
+    assert.sameValue(Object.getPrototypeOf(error), TypeError.prototype);
+    assert(error instanceof TypeError);
+  }).then($DONE, $DONE);
+} catch (error) {
+  $DONE(`The promise should be rejected, but threw an exception: ${error.message}`);
+}

+ 36 - 0
Jint.Tests.Test262/test/built-ins/Promise/allSettled/iter-arg-is-null-reject.js

@@ -0,0 +1,36 @@
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-promise.allsettled
+description: >
+  Reject when argument is `null`
+info: |
+  Promise.allSettled ( iterable )
+
+  ...
+  4. Let iteratorRecord be GetIterator(iterable).
+  5. IfAbruptRejectPromise(iteratorRecord, promiseCapability).
+  ...
+
+  #sec-getiterator
+  GetIterator ( obj [ , hint [ , method ] ] )
+
+  ...
+  Let iterator be ? Call(method, obj).
+  If Type(iterator) is not Object, throw a TypeError exception.
+  ...
+features: [Promise.allSettled, Symbol.iterator]
+flags: [async]
+---*/
+
+try {
+  Promise.allSettled(null).then(function() {
+    $DONE('The promise should be rejected, but was resolved');
+  }, function(error) {
+    assert.sameValue(Object.getPrototypeOf(error), TypeError.prototype);
+    assert(error instanceof TypeError);
+  }).then($DONE, $DONE);
+} catch (error) {
+  $DONE(`The promise should be rejected, but threw an exception: ${error.message}`);
+}

+ 36 - 0
Jint.Tests.Test262/test/built-ins/Promise/allSettled/iter-arg-is-number-reject.js

@@ -0,0 +1,36 @@
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-promise.allsettled
+description: >
+  Reject when argument is a number
+info: |
+  Promise.allSettled ( iterable )
+
+  ...
+  4. Let iteratorRecord be GetIterator(iterable).
+  5. IfAbruptRejectPromise(iteratorRecord, promiseCapability).
+  ...
+
+  #sec-getiterator
+  GetIterator ( obj [ , hint [ , method ] ] )
+
+  ...
+  Let iterator be ? Call(method, obj).
+  If Type(iterator) is not Object, throw a TypeError exception.
+  ...
+features: [Promise.allSettled, Symbol.iterator]
+flags: [async]
+---*/
+
+try {
+  Promise.allSettled(1).then(function() {
+    $DONE('The promise should be rejected, but was resolved');
+  }, function(error) {
+    assert.sameValue(Object.getPrototypeOf(error), TypeError.prototype);
+    assert(error instanceof TypeError);
+  }).then($DONE, $DONE);
+} catch (error) {
+  $DONE(`The promise should be rejected, but threw an exception: ${error.message}`);
+}

+ 42 - 0
Jint.Tests.Test262/test/built-ins/Promise/allSettled/iter-arg-is-poisoned.js

@@ -0,0 +1,42 @@
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-promise.allsettled
+description: >
+  Reject with abrupt completion from GetIterator
+info: |
+  Promise.allSettled ( iterable )
+
+  ...
+  4. Let iteratorRecord be GetIterator(iterable).
+  5. IfAbruptRejectPromise(iteratorRecord, promiseCapability).
+  ...
+
+  #sec-getiterator
+  GetIterator ( obj [ , hint [ , method ] ] )
+
+  ...
+  Let iterator be ? Call(method, obj).
+  ...
+features: [Promise.allSettled, Symbol.iterator]
+flags: [async]
+---*/
+
+var poison = [];
+var error = new Test262Error();
+Object.defineProperty(poison, Symbol.iterator, {
+  get() {
+    throw error;
+  }
+});
+
+try {
+  Promise.allSettled(poison).then(function() {
+    $DONE('The promise should be rejected, but was resolved');
+  }, function(err) {
+    assert.sameValue(err, error);
+  }).then($DONE, $DONE);
+} catch (error) {
+  $DONE(`The promise should be rejected, but threw an exception: ${error.message}`);
+}

+ 35 - 0
Jint.Tests.Test262/test/built-ins/Promise/allSettled/iter-arg-is-string-resolve.js

@@ -0,0 +1,35 @@
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-promise.allsettled
+description: >
+  Resolve when argument is a string
+info: |
+  Promise.allSettled ( iterable )
+
+  ...
+  4. Let iteratorRecord be GetIterator(iterable).
+  5. IfAbruptRejectPromise(iteratorRecord, promiseCapability).
+  ...
+
+  #sec-getiterator
+  GetIterator ( obj [ , hint [ , method ] ] )
+
+  ...
+  Let iterator be ? Call(method, obj).
+  If Type(iterator) is not Object, throw a TypeError exception.
+  ...
+features: [Promise.allSettled, Symbol.iterator]
+flags: [async]
+---*/
+
+try {
+  Promise.allSettled('').then(function(v) {
+    assert.sameValue(v.length, 0);
+  }, function() {
+    $DONE('The promise should be resolved, but was rejected');
+  }).then($DONE, $DONE);
+} catch (error) {
+  $DONE(`The promise should be resolved, but threw an exception: ${error.message}`);
+}

+ 49 - 0
Jint.Tests.Test262/test/built-ins/Promise/allSettled/iter-arg-is-symbol-reject.js

@@ -0,0 +1,49 @@
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-promise.allsettled
+description: >
+  Reject when argument is a symbol
+info: |
+  Promise.allSettled ( iterable )
+
+  ...
+  4. Let iteratorRecord be GetIterator(iterable).
+  5. IfAbruptRejectPromise(iteratorRecord, promiseCapability).
+  ...
+
+  GetIterator ( obj [ , hint [ , method ] ] )
+
+  ...
+  3. If method is not present, then
+    a. If hint is async, then
+      ...
+    b. Otherwise, set method to ? GetMethod(obj, @@iterator).
+  4. Let iterator be ? Call(method, obj).
+  5. If Type(iterator) is not Object, throw a TypeError exception.
+  ...
+
+  GetMethod
+
+  2. Let func be ? GetV(V, P).
+  3. If func is either undefined or null, return undefined.
+  4. If IsCallable(func) is false, throw a TypeError exception.
+
+  Call ( F, V [ , argumentsList ] )
+
+  2. If IsCallable(F) is false, throw a TypeError exception.
+features: [Promise.allSettled, Symbol.iterator]
+flags: [async]
+---*/
+
+try {
+  Promise.allSettled(Symbol()).then(function() {
+    $DONE('The promise should be rejected, but was resolved');
+  }, function(error) {
+    assert.sameValue(Object.getPrototypeOf(error), TypeError.prototype);
+    assert(error instanceof TypeError);
+  }).then($DONE, $DONE);
+} catch (error) {
+  $DONE(`The promise should be rejected, but threw an exception: ${error.message}`);
+}

+ 49 - 0
Jint.Tests.Test262/test/built-ins/Promise/allSettled/iter-arg-is-true-reject.js

@@ -0,0 +1,49 @@
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-promise.allsettled
+description: >
+  Reject when argument is `true`
+info: |
+  Promise.allSettled ( iterable )
+
+  ...
+  4. Let iteratorRecord be GetIterator(iterable).
+  5. IfAbruptRejectPromise(iteratorRecord, promiseCapability).
+  ...
+
+  GetIterator ( obj [ , hint [ , method ] ] )
+
+  ...
+  3. If method is not present, then
+    a. If hint is async, then
+      ...
+    b. Otherwise, set method to ? GetMethod(obj, @@iterator).
+  4. Let iterator be ? Call(method, obj).
+  5. If Type(iterator) is not Object, throw a TypeError exception.
+  ...
+
+  GetMethod
+
+  2. Let func be ? GetV(V, P).
+  3. If func is either undefined or null, return undefined.
+  4. If IsCallable(func) is false, throw a TypeError exception.
+
+  Call ( F, V [ , argumentsList ] )
+
+  2. If IsCallable(F) is false, throw a TypeError exception.
+features: [Promise.allSettled, Symbol.iterator]
+flags: [async]
+---*/
+
+try {
+  Promise.allSettled(true).then(function() {
+    $DONE('The promise should be rejected, but was resolved');
+  }, function(error) {
+    assert.sameValue(Object.getPrototypeOf(error), TypeError.prototype);
+    assert(error instanceof TypeError);
+  }).then($DONE, $DONE);
+} catch (error) {
+  $DONE(`The promise should be rejected, but threw an exception: ${error.message}`);
+}

+ 49 - 0
Jint.Tests.Test262/test/built-ins/Promise/allSettled/iter-arg-is-undefined-reject.js

@@ -0,0 +1,49 @@
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-promise.allsettled
+description: >
+  Reject when argument is `undefined`
+info: |
+  Promise.allSettled ( iterable )
+
+  ...
+  4. Let iteratorRecord be GetIterator(iterable).
+  5. IfAbruptRejectPromise(iteratorRecord, promiseCapability).
+  ...
+
+  GetIterator ( obj [ , hint [ , method ] ] )
+
+  ...
+  3. If method is not present, then
+    a. If hint is async, then
+      ...
+    b. Otherwise, set method to ? GetMethod(obj, @@iterator).
+  4. Let iterator be ? Call(method, obj).
+  5. If Type(iterator) is not Object, throw a TypeError exception.
+  ...
+
+  GetMethod
+
+  2. Let func be ? GetV(V, P).
+  3. If func is either undefined or null, return undefined.
+  4. If IsCallable(func) is false, throw a TypeError exception.
+
+  Call ( F, V [ , argumentsList ] )
+
+  2. If IsCallable(F) is false, throw a TypeError exception.
+features: [Promise.allSettled, Symbol.iterator]
+flags: [async]
+---*/
+
+try {
+  Promise.allSettled(undefined).then(function() {
+    $DONE('The promise should be rejected, but was resolved');
+  }, function(error) {
+    assert.sameValue(Object.getPrototypeOf(error), TypeError.prototype);
+    assert(error instanceof TypeError);
+  }).then($DONE, $DONE);
+} catch (error) {
+  $DONE(`The promise should be rejected, but threw an exception: ${error.message}`);
+}

+ 53 - 0
Jint.Tests.Test262/test/built-ins/Promise/allSettled/iter-assigned-false-reject.js

@@ -0,0 +1,53 @@
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-promise.allsettled
+description: >
+  Reject when argument's Symbol.iterator property has the value false
+info: |
+  Promise.allSettled ( iterable )
+
+  ...
+  4. Let iteratorRecord be GetIterator(iterable).
+  5. IfAbruptRejectPromise(iteratorRecord, promiseCapability).
+  ...
+
+  GetIterator ( obj [ , hint [ , method ] ] )
+
+  ...
+  3. If method is not present, then
+    a. If hint is async, then
+      i. Set method to ? GetMethod(obj, @@asyncIterator).
+      ii. If method is undefined, then
+        1. Let syncMethod be ? GetMethod(obj, @@iterator).
+        2. Let syncIteratorRecord be ? GetIterator(obj, sync, syncMethod).
+        ...
+  4. Let iterator be ? Call(method, obj).
+  ...
+
+  GetMethod
+
+  2. Let func be ? GetV(V, P).
+  3. If func is either undefined or null, return undefined.
+  4. If IsCallable(func) is false, throw a TypeError exception.
+
+  Call ( F, V [ , argumentsList ] )
+
+  2. If IsCallable(F) is false, throw a TypeError exception.
+features: [Promise.allSettled, Symbol.iterator]
+flags: [async]
+---*/
+
+try {
+  Promise.allSettled({
+    [Symbol.iterator]: false
+  }).then(function() {
+    $DONE('The promise should be rejected, but was resolved');
+  }, function(error) {
+    assert.sameValue(Object.getPrototypeOf(error), TypeError.prototype);
+    assert(error instanceof TypeError);
+  }).then($DONE, $DONE);
+} catch (error) {
+  $DONE(`The promise should be rejected, but threw an exception: ${error.message}`);
+}

+ 51 - 0
Jint.Tests.Test262/test/built-ins/Promise/allSettled/iter-assigned-null-reject.js

@@ -0,0 +1,51 @@
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-promise.allsettled
+description: >
+  Reject when argument's Symbol.iterator property has the value null
+info: |
+  Promise.allSettled ( iterable )
+
+  ...
+  4. Let iteratorRecord be GetIterator(iterable).
+  5. IfAbruptRejectPromise(iteratorRecord, promiseCapability).
+  ...
+
+  GetIterator ( obj [ , hint [ , method ] ] )
+
+  ...
+  3. If method is not present, then
+    a. If hint is async, then
+      ...
+    b. Otherwise, set method to ? GetMethod(obj, @@iterator).
+  4. Let iterator be ? Call(method, obj).
+  5. If Type(iterator) is not Object, throw a TypeError exception.
+  ...
+
+  GetMethod
+
+  2. Let func be ? GetV(V, P).
+  3. If func is either undefined or null, return undefined.
+  4. If IsCallable(func) is false, throw a TypeError exception.
+
+  Call ( F, V [ , argumentsList ] )
+
+  2. If IsCallable(F) is false, throw a TypeError exception.
+features: [Promise.allSettled, Symbol.iterator]
+flags: [async]
+---*/
+
+try {
+  Promise.allSettled({
+    [Symbol.iterator]: null
+  }).then(function() {
+    $DONE('The promise should be rejected, but was resolved');
+  }, function(error) {
+    assert.sameValue(Object.getPrototypeOf(error), TypeError.prototype);
+    assert(error instanceof TypeError);
+  }).then($DONE, $DONE);
+} catch (error) {
+  $DONE(`The promise should be rejected, but threw an exception: ${error.message}`);
+}

+ 51 - 0
Jint.Tests.Test262/test/built-ins/Promise/allSettled/iter-assigned-number-reject.js

@@ -0,0 +1,51 @@
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-promise.allsettled
+description: >
+  Reject when argument's Symbol.iterator property has the value 1
+info: |
+  Promise.allSettled ( iterable )
+
+  ...
+  4. Let iteratorRecord be GetIterator(iterable).
+  5. IfAbruptRejectPromise(iteratorRecord, promiseCapability).
+  ...
+
+  GetIterator ( obj [ , hint [ , method ] ] )
+
+  ...
+  3. If method is not present, then
+    a. If hint is async, then
+      ...
+    b. Otherwise, set method to ? GetMethod(obj, @@iterator).
+  4. Let iterator be ? Call(method, obj).
+  5. If Type(iterator) is not Object, throw a TypeError exception.
+  ...
+
+  GetMethod
+
+  2. Let func be ? GetV(V, P).
+  3. If func is either undefined or null, return undefined.
+  4. If IsCallable(func) is false, throw a TypeError exception.
+
+  Call ( F, V [ , argumentsList ] )
+
+  2. If IsCallable(F) is false, throw a TypeError exception.
+features: [Promise.allSettled, Symbol.iterator]
+flags: [async]
+---*/
+
+try {
+  Promise.allSettled({
+    [Symbol.iterator]: 1
+  }).then(function() {
+    $DONE('The promise should be rejected, but was resolved');
+  }, function(error) {
+    assert.sameValue(Object.getPrototypeOf(error), TypeError.prototype);
+    assert(error instanceof TypeError);
+  }).then($DONE, $DONE);
+} catch (error) {
+  $DONE(`The promise should be rejected, but threw an exception: ${error.message}`);
+}

+ 51 - 0
Jint.Tests.Test262/test/built-ins/Promise/allSettled/iter-assigned-string-reject.js

@@ -0,0 +1,51 @@
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-promise.allsettled
+description: >
+  Reject when argument's Symbol.iterator property has the value ""
+info: |
+  Promise.allSettled ( iterable )
+
+  ...
+  4. Let iteratorRecord be GetIterator(iterable).
+  5. IfAbruptRejectPromise(iteratorRecord, promiseCapability).
+  ...
+
+  GetIterator ( obj [ , hint [ , method ] ] )
+
+  ...
+  3. If method is not present, then
+    a. If hint is async, then
+      ...
+    b. Otherwise, set method to ? GetMethod(obj, @@iterator).
+  4. Let iterator be ? Call(method, obj).
+  5. If Type(iterator) is not Object, throw a TypeError exception.
+  ...
+
+  GetMethod
+
+  2. Let func be ? GetV(V, P).
+  3. If func is either undefined or null, return undefined.
+  4. If IsCallable(func) is false, throw a TypeError exception.
+
+  Call ( F, V [ , argumentsList ] )
+
+  2. If IsCallable(F) is false, throw a TypeError exception.
+features: [Promise.allSettled, Symbol.iterator]
+flags: [async]
+---*/
+
+try {
+  Promise.allSettled({
+    [Symbol.iterator]: ''
+  }).then(function() {
+    $DONE('The promise should be rejected, but was resolved');
+  }, function(error) {
+    assert.sameValue(Object.getPrototypeOf(error), TypeError.prototype);
+    assert(error instanceof TypeError);
+  }).then($DONE, $DONE);
+} catch (error) {
+  $DONE(`The promise should be rejected, but threw an exception: ${error.message}`);
+}

+ 51 - 0
Jint.Tests.Test262/test/built-ins/Promise/allSettled/iter-assigned-symbol-reject.js

@@ -0,0 +1,51 @@
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-promise.allsettled
+description: >
+  Reject when argument's Symbol.iterator property has the value Symbol()
+info: |
+  Promise.allSettled ( iterable )
+
+  ...
+  4. Let iteratorRecord be GetIterator(iterable).
+  5. IfAbruptRejectPromise(iteratorRecord, promiseCapability).
+  ...
+
+  GetIterator ( obj [ , hint [ , method ] ] )
+
+  ...
+  3. If method is not present, then
+    a. If hint is async, then
+      ...
+    b. Otherwise, set method to ? GetMethod(obj, @@iterator).
+  4. Let iterator be ? Call(method, obj).
+  5. If Type(iterator) is not Object, throw a TypeError exception.
+  ...
+
+  GetMethod
+
+  2. Let func be ? GetV(V, P).
+  3. If func is either undefined or null, return undefined.
+  4. If IsCallable(func) is false, throw a TypeError exception.
+
+  Call ( F, V [ , argumentsList ] )
+
+  2. If IsCallable(F) is false, throw a TypeError exception.
+features: [Promise.allSettled, Symbol.iterator]
+flags: [async]
+---*/
+
+try {
+  Promise.allSettled({
+    [Symbol.iterator]: Symbol()
+  }).then(function() {
+    $DONE('The promise should be rejected, but was resolved');
+  }, function(error) {
+    assert.sameValue(Object.getPrototypeOf(error), TypeError.prototype);
+    assert(error instanceof TypeError);
+  }).then($DONE, $DONE);
+} catch (error) {
+  $DONE(`The promise should be rejected, but threw an exception: ${error.message}`);
+}

+ 51 - 0
Jint.Tests.Test262/test/built-ins/Promise/allSettled/iter-assigned-true-reject.js

@@ -0,0 +1,51 @@
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-promise.allsettled
+description: >
+  Reject when argument's Symbol.iterator property has the value true
+info: |
+  Promise.allSettled ( iterable )
+
+  ...
+  4. Let iteratorRecord be GetIterator(iterable).
+  5. IfAbruptRejectPromise(iteratorRecord, promiseCapability).
+  ...
+
+  GetIterator ( obj [ , hint [ , method ] ] )
+
+  ...
+  3. If method is not present, then
+    a. If hint is async, then
+      ...
+    b. Otherwise, set method to ? GetMethod(obj, @@iterator).
+  4. Let iterator be ? Call(method, obj).
+  5. If Type(iterator) is not Object, throw a TypeError exception.
+  ...
+
+  GetMethod
+
+  2. Let func be ? GetV(V, P).
+  3. If func is either undefined or null, return undefined.
+  4. If IsCallable(func) is false, throw a TypeError exception.
+
+  Call ( F, V [ , argumentsList ] )
+
+  2. If IsCallable(F) is false, throw a TypeError exception.
+features: [Promise.allSettled, Symbol.iterator]
+flags: [async]
+---*/
+
+try {
+  Promise.allSettled({
+    [Symbol.iterator]: true
+  }).then(function() {
+    $DONE('The promise should be rejected, but was resolved');
+  }, function(error) {
+    assert.sameValue(Object.getPrototypeOf(error), TypeError.prototype);
+    assert(error instanceof TypeError);
+  }).then($DONE, $DONE);
+} catch (error) {
+  $DONE(`The promise should be rejected, but threw an exception: ${error.message}`);
+}

Some files were not shown because too many files changed in this diff