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 /dom/bindings/test/test_promise_rejections_from_jsimplemented.html | |
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 'dom/bindings/test/test_promise_rejections_from_jsimplemented.html')
-rw-r--r-- | dom/bindings/test/test_promise_rejections_from_jsimplemented.html | 143 |
1 files changed, 143 insertions, 0 deletions
diff --git a/dom/bindings/test/test_promise_rejections_from_jsimplemented.html b/dom/bindings/test/test_promise_rejections_from_jsimplemented.html new file mode 100644 index 000000000..5428030c5 --- /dev/null +++ b/dom/bindings/test/test_promise_rejections_from_jsimplemented.html @@ -0,0 +1,143 @@ +<!DOCTYPE HTML> +<html> +<!-- +https://bugzilla.mozilla.org/show_bug.cgi?id=1107592 +--> +<head> + <meta charset="utf-8"> + <title>Test for Bug 1107592</title> + <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> + <script type="application/javascript"> + + /** Test for Bug 1107592 **/ + + SimpleTest.waitForExplicitFinish(); + + function checkExn(lineNumber, name, message, code, filename, testNumber, stack, exn) { + is(exn.lineNumber, lineNumber, + "Should have the right line number in test " + testNumber); + is(exn.name, name, + "Should have the right exception name in test " + testNumber); + is("filename" in exn ? exn.filename : exn.fileName, filename, + "Should have the right file name in test " + testNumber); + is(exn.message, message, + "Should have the right message in test " + testNumber); + is(exn.code, code, "Should have the right .code in test " + testNumber); + if (message === "") { + is(exn.name, "InternalError", + "Should have one of our synthetic exceptions in test " + testNumber); + } + is(exn.stack, stack, "Should have the right stack in test " + testNumber); + } + + function ensurePromiseFail(testNumber, value) { + ok(false, "Test " + testNumber + " should not have a fulfilled promise"); + } + + function doTest() { + var t = new TestInterfaceJS(); + /* Async parent frames from pushPrefEnv don't show up in e10s. */ + var isE10S = !SpecialPowers.isMainProcess(); + var asyncStack = SpecialPowers.getBoolPref("javascript.options.asyncstack"); + var ourFile = location.href; + var unwrapError = "Promise rejection value is a non-unwrappable cross-compartment wrapper."; + var parentFrame = (asyncStack && !isE10S) ? `Async*@${ourFile}:130:3 +` : ""; + + Promise.all([ + t.testPromiseWithThrowingChromePromiseInit().then( + ensurePromiseFail.bind(null, 1), + checkExn.bind(null, 49, "InternalError", unwrapError, + undefined, ourFile, 1, + `doTest@${ourFile}:49:7 +` + + parentFrame)), + t.testPromiseWithThrowingContentPromiseInit(function() { + thereIsNoSuchContentFunction1(); + }).then( + ensurePromiseFail.bind(null, 2), + checkExn.bind(null, 57, "ReferenceError", + "thereIsNoSuchContentFunction1 is not defined", + undefined, ourFile, 2, + `doTest/<@${ourFile}:57:11 +doTest@${ourFile}:56:7 +` + + parentFrame)), + t.testPromiseWithThrowingChromeThenFunction().then( + ensurePromiseFail.bind(null, 3), + checkExn.bind(null, 0, "InternalError", unwrapError, undefined, "", 3, asyncStack ? (`Async*doTest@${ourFile}:67:7 +` + + parentFrame) : "")), + t.testPromiseWithThrowingContentThenFunction(function() { + thereIsNoSuchContentFunction2(); + }).then( + ensurePromiseFail.bind(null, 4), + checkExn.bind(null, 73, "ReferenceError", + "thereIsNoSuchContentFunction2 is not defined", + undefined, ourFile, 4, + `doTest/<@${ourFile}:73:11 +` + + (asyncStack ? `Async*doTest@${ourFile}:72:7 +` : "") + + parentFrame)), + t.testPromiseWithThrowingChromeThenable().then( + ensurePromiseFail.bind(null, 5), + checkExn.bind(null, 0, "InternalError", unwrapError, undefined, "", 5, asyncStack ? (`Async*doTest@${ourFile}:84:7 +` + + parentFrame) : "")), + t.testPromiseWithThrowingContentThenable({ + then: function() { thereIsNoSuchContentFunction3(); } + }).then( + ensurePromiseFail.bind(null, 6), + checkExn.bind(null, 90, "ReferenceError", + "thereIsNoSuchContentFunction3 is not defined", + undefined, ourFile, 6, + `doTest/<.then@${ourFile}:90:32 +` + (asyncStack ? `Async*doTest@${ourFile}:89:7\n` + parentFrame : ""))), + t.testPromiseWithDOMExceptionThrowingPromiseInit().then( + ensurePromiseFail.bind(null, 7), + checkExn.bind(null, 98, "NotFoundError", + "We are a second DOMException", + DOMException.NOT_FOUND_ERR, ourFile, 7, + `doTest@${ourFile}:98:7 +` + + parentFrame)), + t.testPromiseWithDOMExceptionThrowingThenFunction().then( + ensurePromiseFail.bind(null, 8), + checkExn.bind(null, asyncStack ? 106 : 0, "NetworkError", + "We are a third DOMException", + DOMException.NETWORK_ERR, asyncStack ? ourFile : "", 8, + (asyncStack ? `Async*doTest@${ourFile}:106:7 +` + + parentFrame : ""))), + t.testPromiseWithDOMExceptionThrowingThenable().then( + ensurePromiseFail.bind(null, 9), + checkExn.bind(null, asyncStack ? 114 : 0, "TypeMismatchError", + "We are a fourth DOMException", + DOMException.TYPE_MISMATCH_ERR, + asyncStack ? ourFile : "", 9, + (asyncStack ? `Async*doTest@${ourFile}:114:7 +` + + parentFrame : ""))), + ]).then(SimpleTest.finish, + function(err) { + ok(false, "One of our catch statements totally failed with err" + err + ', stack: ' + (err ? err.stack : '')); + SimpleTest.finish(); + }); + } + + SpecialPowers.pushPrefEnv({set: [['dom.expose_test_interfaces', true]]}, + doTest); + </script> +</head> +<body> +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1107592">Mozilla Bug 1107592</a> +<p id="display"></p> +<div id="content" style="display: none"> + +</div> +<pre id="test"> +</pre> +</body> +</html> |