Changeset 245869 in webkit
- Timestamp:
- May 29, 2019, 2:28:09 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
-
JSTests/ChangeLog (modified) (1 diff)
-
JSTests/test262/config.yaml (modified) (1 diff)
-
JSTests/test262/expectations.yaml (modified) (1 diff)
-
Source/JavaScriptCore/ChangeLog (modified) (1 diff)
-
Source/JavaScriptCore/builtins/PromiseConstructor.js (modified) (1 diff)
-
Source/JavaScriptCore/runtime/JSPromiseConstructor.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/JSTests/ChangeLog
r245815 r245869 1 2019-05-28 Dean Jackson <dino@apple.com> 2 3 Implement Promise.allSettled 4 https://bugs.webkit.org/show_bug.cgi?id=197600 5 <rdar://problem/50483885> 6 7 Reviewed by Keith Miller. 8 9 Start testing Promise.allSettled. We pass most of the tests. 10 The ones that fail are similar to the Promise.all tests we already fail. 11 12 * test262/config.yaml: Remove Promise.allSettled from skipped tests. 13 * test262/expectations.yaml: Add new expectations for allSettled tests. 14 1 15 2019-05-28 Michael Saboff <msaboff@apple.com> 2 16 -
trunk/JSTests/test262/config.yaml
r245201 r245869 32 32 - Intl.RelativeTimeFormat 33 33 - Intl.Segmenter 34 # https://bugs.webkit.org/show_bug.cgi?id=19633235 - Promise.allSettled36 34 files: 37 35 - test/built-ins/Array/prototype/reverse/length-exceeding-integer-limit-with-object.js -
trunk/JSTests/test262/expectations.yaml
r245655 r245869 1087 1087 default: 'Test262Error: Got `resolve` only once for each iterated value Expected SameValue(«4», «1») to be true' 1088 1088 strict mode: 'Test262Error: Got `resolve` only once for each iterated value Expected SameValue(«4», «1») to be true' 1089 test/built-ins/Promise/all/invoke-resolve-get-once-no-calls.js: 1090 default: 'Test262Error: Got `resolve` only once for each iterated value Expected SameValue(«0», «1») to be true' 1091 strict mode: 'Test262Error: Got `resolve` only once for each iterated value Expected SameValue(«0», «1») to be true' 1089 1092 test/built-ins/Promise/all/resolve-element-function-nonconstructor.js: 1093 default: 'Test262Error: Expected a TypeError to be thrown but no exception was thrown at all' 1094 strict mode: 'Test262Error: Expected a TypeError to be thrown but no exception was thrown at all' 1095 test/built-ins/Promise/allSettled/invoke-resolve-get-error-close.js: 1096 default: 'Test262Error: Expected SameValue(«1», «0») to be true' 1097 strict mode: 'Test262Error: Expected SameValue(«1», «0») to be true' 1098 test/built-ins/Promise/allSettled/invoke-resolve-get-once-multiple-calls.js: 1099 default: 'Test262Error: Got `resolve` only once for each iterated value Expected SameValue(«4», «1») to be true' 1100 strict mode: 'Test262Error: Got `resolve` only once for each iterated value Expected SameValue(«4», «1») to be true' 1101 test/built-ins/Promise/allSettled/invoke-resolve-get-once-no-calls.js: 1102 default: 'Test262Error: Got `resolve` only once for each iterated value Expected SameValue(«0», «1») to be true' 1103 strict mode: 'Test262Error: Got `resolve` only once for each iterated value Expected SameValue(«0», «1») to be true' 1104 test/built-ins/Promise/allSettled/reject-element-function-nonconstructor.js: 1105 default: 'Test262Error: Expected a TypeError to be thrown but no exception was thrown at all' 1106 strict mode: 'Test262Error: Expected a TypeError to be thrown but no exception was thrown at all' 1107 test/built-ins/Promise/allSettled/resolve-element-function-nonconstructor.js: 1090 1108 default: 'Test262Error: Expected a TypeError to be thrown but no exception was thrown at all' 1091 1109 strict mode: 'Test262Error: Expected a TypeError to be thrown but no exception was thrown at all' -
trunk/Source/JavaScriptCore/ChangeLog
r245815 r245869 1 2019-05-28 Dean Jackson <dino@apple.com> 2 3 Implement Promise.allSettled 4 https://bugs.webkit.org/show_bug.cgi?id=197600 5 <rdar://problem/50483885> 6 7 Reviewed by Keith Miller. 8 9 Implement Promise.allSettled 10 https://github.com/tc39/proposal-promise-allSettled/ 11 12 Shipping in Firefox since version 68. 13 Shipping in V8 since https://chromium.googlesource.com/v8/v8.git/+/1f6d27e8df819b448712dface6ad367fb8de426b 14 15 * builtins/PromiseConstructor.js: 16 (allSettled.newResolveRejectElements.resolveElement): 17 (allSettled.newResolveRejectElements.rejectElement): 18 (allSettled.newResolveRejectElements): 19 (allSettled): Added. 20 * runtime/JSPromiseConstructor.cpp: Add ref to allSettled. 21 1 22 2019-05-28 Michael Saboff <msaboff@apple.com> 2 23 -
trunk/Source/JavaScriptCore/builtins/PromiseConstructor.js
r221417 r245869 76 76 } 77 77 78 function allSettled(iterable) 79 { 80 "use strict"; 81 82 if (!@isObject(this)) 83 @throwTypeError("|this| is not a object"); 84 85 var promiseCapability = @newPromiseCapability(this); 86 87 var values = []; 88 var remainingElementsCount = 1; 89 var index = 0; 90 91 function newResolveRejectElements(index) 92 { 93 var alreadyCalled = false; 94 95 var resolveElement = function @resolve(x) 96 { 97 if (alreadyCalled) 98 return @undefined; 99 alreadyCalled = true; 100 101 var obj = { 102 status: "fulfilled", 103 value: x 104 }; 105 106 @putByValDirect(values, index, obj); 107 108 --remainingElementsCount; 109 if (remainingElementsCount === 0) 110 return promiseCapability.@resolve.@call(@undefined, values); 111 112 return @undefined; 113 }; 114 115 var rejectElement = function @reject(x) 116 { 117 if (alreadyCalled) 118 return @undefined; 119 alreadyCalled = true; 120 121 var obj = { 122 status: "rejected", 123 reason: x 124 }; 125 126 @putByValDirect(values, index, obj); 127 128 --remainingElementsCount; 129 if (remainingElementsCount === 0) 130 return promiseCapability.@resolve.@call(@undefined, values); 131 132 return @undefined; 133 }; 134 135 return [resolveElement, rejectElement]; 136 } 137 138 try { 139 for (var value of iterable) { 140 @putByValDirect(values, index, @undefined); 141 var nextPromise = this.resolve(value); 142 var [resolveElement, rejectElement] = newResolveRejectElements(index); 143 ++remainingElementsCount; 144 nextPromise.then(resolveElement, rejectElement); 145 ++index; 146 } 147 148 --remainingElementsCount; 149 if (remainingElementsCount === 0) 150 promiseCapability.@resolve.@call(@undefined, values); 151 } catch (error) { 152 promiseCapability.@reject.@call(@undefined, error); 153 } 154 155 return promiseCapability.@promise; 156 } 157 78 158 function race(iterable) 79 159 { -
trunk/Source/JavaScriptCore/runtime/JSPromiseConstructor.cpp
r242650 r245869 58 58 race JSBuiltin DontEnum|Function 1 59 59 all JSBuiltin DontEnum|Function 1 60 allSettled JSBuiltin DontEnum|Function 1 60 61 @end 61 62 */
Note:
See TracChangeset
for help on using the changeset viewer.