Changeset 161538 in webkit
- Timestamp:
- Jan 8, 2014 6:37:58 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r161532 r161538 1 2014-01-08 Sam Weinig <sam@webkit.org> 2 3 [JS] Should be able to create a promise by calling the Promise constructor as a function 4 https://bugs.webkit.org/show_bug.cgi?id=126561 5 6 Reviewed by Geoffrey Garen. 7 8 * js/dom/Promise-types-expected.txt: 9 * js/dom/Promise-types.html: 10 Add test for using calling a Promise constructor as a function. 11 1 12 2014-01-08 Youenn Fablet <youennf@gmail.com> 2 13 -
trunk/LayoutTests/js/dom/Promise-types-expected.txt
r161241 r161538 16 16 PASS aPromise.catch is an instance of Function 17 17 PASS aPromise.catch.length is 1 18 aPromise2 = Promise(...) 19 PASS aPromise2 is an instance of Promise 20 PASS String(aPromise2) is '[object Promise]' 18 21 19 22 Promise constructor … … 21 24 PASS Promise.length is 1 22 25 PASS new Promise() threw exception TypeError: Promise constructor takes a function argument. 26 PASS Promise() threw exception TypeError: Promise constructor takes a function argument. 23 27 PASS new Promise(1) threw exception TypeError: Promise constructor takes a function argument. 24 28 PASS new Promise('hello') threw exception TypeError: Promise constructor takes a function argument. … … 27 31 PASS new Promise(null) threw exception TypeError: Promise constructor takes a function argument. 28 32 PASS new Promise(undefined) threw exception TypeError: Promise constructor takes a function argument. 33 PASS Promise(1) threw exception TypeError: Promise constructor takes a function argument. 34 PASS Promise('hello') threw exception TypeError: Promise constructor takes a function argument. 35 PASS Promise([]) threw exception TypeError: Promise constructor takes a function argument. 36 PASS Promise({}) threw exception TypeError: Promise constructor takes a function argument. 37 PASS Promise(null) threw exception TypeError: Promise constructor takes a function argument. 38 PASS Promise(undefined) threw exception TypeError: Promise constructor takes a function argument. 29 39 30 40 Promise statics -
trunk/LayoutTests/js/dom/Promise-types.html
r161241 r161538 20 20 // Promises should be of type Promise. 21 21 22 var aPromise = new Promise(function(resolve r) { resolver.resolve(1); });22 var aPromise = new Promise(function(resolve, reject) { resolve(1); }); 23 23 24 24 debug("aPromise = new Promise(...)") … … 33 33 shouldBe("aPromise.catch.length", "1"); 34 34 35 var aPromise2 = Promise(function(resolve, reject) { resolve(1); }); 36 37 debug("aPromise2 = Promise(...)") 38 shouldBeType("aPromise2", "Promise"); 39 shouldBe("String(aPromise2)", "'[object Promise]'"); 35 40 36 41 // Promise constructor … … 42 47 shouldBe("Promise.length", "1"); 43 48 shouldThrow("new Promise()"); 49 shouldThrow("Promise()"); 44 50 45 51 // Parameter must be a function. … … 50 56 shouldThrow("new Promise(null)", "'TypeError: Promise constructor takes a function argument'"); 51 57 shouldThrow("new Promise(undefined)", "'TypeError: Promise constructor takes a function argument'"); 58 59 shouldThrow("Promise(1)", "'TypeError: Promise constructor takes a function argument'"); 60 shouldThrow("Promise('hello')", "'TypeError: Promise constructor takes a function argument'"); 61 shouldThrow("Promise([])", "'TypeError: Promise constructor takes a function argument'"); 62 shouldThrow("Promise({})", "'TypeError: Promise constructor takes a function argument'"); 63 shouldThrow("Promise(null)", "'TypeError: Promise constructor takes a function argument'"); 64 shouldThrow("Promise(undefined)", "'TypeError: Promise constructor takes a function argument'"); 52 65 53 66 // Promise statics -
trunk/Source/JavaScriptCore/ChangeLog
r161498 r161538 1 2014-01-08 Sam Weinig <sam@webkit.org> 2 3 [JS] Should be able to create a promise by calling the Promise constructor as a function 4 https://bugs.webkit.org/show_bug.cgi?id=126561 5 6 Reviewed by Geoffrey Garen. 7 8 * runtime/JSPromiseConstructor.cpp: 9 (JSC::JSPromiseConstructor::getCallData): 10 Add support for calling the Promise constructor as a function (e.g. var p = Promise(...), note 11 the missing "new"). 12 1 13 2014-01-08 Dániel Bátyai <dbatyai.u-szeged@partner.samsung.com> 2 14 -
trunk/Source/JavaScriptCore/runtime/JSPromiseConstructor.cpp
r161365 r161538 154 154 } 155 155 156 CallType JSPromiseConstructor::getCallData(JSCell*, CallData& )157 { 158 // FIXME: Implement159 return CallType None;156 CallType JSPromiseConstructor::getCallData(JSCell*, CallData& callData) 157 { 158 callData.native.function = constructPromise; 159 return CallTypeHost; 160 160 } 161 161
Note: See TracChangeset
for help on using the changeset viewer.