test_bug1041646.html (1303B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=1041646 5 --> 6 <head> 7 <meta charset="utf-8"> 8 <title>Test for Bug 1041646</title> 9 <script src="/tests/SimpleTest/SimpleTest.js"></script> 10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 11 <script type="application/javascript"> 12 13 /** Test for Bug 1041646 */ 14 // We need to reject the promise with a DOMException, so make sure we have 15 // something that produces one. 16 function throwException() { 17 document.createTextNode("").appendChild(document); 18 } 19 try { 20 throwException(); 21 } catch (e) { 22 ok(e instanceof DOMException, "This test won't test what it should be testing"); 23 } 24 25 SimpleTest.waitForExplicitFinish(); 26 27 // We want a new DOMException each time here. 28 for (var i = 0; i < 100; ++i) { 29 new Promise(throwException); 30 } 31 32 // Now make sure we wait for all those promises above to reject themselves 33 Promise.resolve(1).then(function() { 34 SpecialPowers.gc(); // This should not assert or crash 35 SimpleTest.finish(); 36 }); 37 38 </script> 39 </head> 40 <body> 41 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1041646">Mozilla Bug 1041646</a> 42 <p id="display"></p> 43 <div id="content" style="display: none"> 44 45 </div> 46 <pre id="test"> 47 </pre> 48 </body> 49 </html>