diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /js/src/jit-test/tests/promise | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'js/src/jit-test/tests/promise')
5 files changed, 31 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/promise/bug-1298776.js b/js/src/jit-test/tests/promise/bug-1298776.js new file mode 100644 index 000000000..313b47bc6 --- /dev/null +++ b/js/src/jit-test/tests/promise/bug-1298776.js @@ -0,0 +1,2 @@ +if (typeof oomTest === 'function') + oomTest(Function(`new Promise(res=>res)`)); diff --git a/js/src/jit-test/tests/promise/getwaitforallpromise-error-handling.js b/js/src/jit-test/tests/promise/getwaitforallpromise-error-handling.js new file mode 100644 index 000000000..476e6c7d0 --- /dev/null +++ b/js/src/jit-test/tests/promise/getwaitforallpromise-error-handling.js @@ -0,0 +1,8 @@ +load(libdir + "asserts.js"); + +assertThrowsInstanceOf(_=>getWaitForAllPromise(42), Error); +assertThrowsInstanceOf(_=>getWaitForAllPromise([42]), Error); +assertThrowsInstanceOf(_=>getWaitForAllPromise([{}]), Error); + +// Shouldn't throw. +getWaitForAllPromise([Promise.resolve()]); diff --git a/js/src/jit-test/tests/promise/no-reentrant-drainjobqueue.js b/js/src/jit-test/tests/promise/no-reentrant-drainjobqueue.js new file mode 100644 index 000000000..7db07bdc7 --- /dev/null +++ b/js/src/jit-test/tests/promise/no-reentrant-drainjobqueue.js @@ -0,0 +1,10 @@ +let thenCalled = false; +let p1 = new Promise(res => res('result')).then(val => { + Promise.resolve(1).then(_=>{thenCalled = true;}); + // This reentrant call is ignored. + drainJobQueue(); + assertEq(thenCalled, false); +}); + +drainJobQueue(); +assertEq(thenCalled, true); diff --git a/js/src/jit-test/tests/promise/primitives-handling-in-promise-all.js b/js/src/jit-test/tests/promise/primitives-handling-in-promise-all.js new file mode 100644 index 000000000..061daaa8b --- /dev/null +++ b/js/src/jit-test/tests/promise/primitives-handling-in-promise-all.js @@ -0,0 +1,3 @@ +// This just shouldn't crash. +Promise.resolve = () => 42; +Promise.all([1]); diff --git a/js/src/jit-test/tests/promise/promise-cross-compartment-subclassing.js b/js/src/jit-test/tests/promise/promise-cross-compartment-subclassing.js new file mode 100644 index 000000000..dc77b3956 --- /dev/null +++ b/js/src/jit-test/tests/promise/promise-cross-compartment-subclassing.js @@ -0,0 +1,8 @@ +const global = newGlobal(); +const OtherPromise = global.Promise; +class SubPromise extends OtherPromise {} + +assertEq(true, new SubPromise(()=>{}) instanceof OtherPromise); +assertEq(true, SubPromise.resolve({}) instanceof OtherPromise); +assertEq(true, SubPromise.reject({}) instanceof OtherPromise); +assertEq(true, SubPromise.resolve({}).then(()=>{}, ()=>{}) instanceof OtherPromise); |