test_bug429785.xhtml (1644B)
1 <?xml version="1.0"?> 2 <?xml-stylesheet href="chrome://global/skin" type="text/css"?> 3 <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?> 4 <!-- 5 https://bugzilla.mozilla.org/show_bug.cgi?id=429785 6 --> 7 <window title="Mozilla Bug 429785" 8 xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> 9 <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/> 10 11 <!-- test results are displayed in the html:body --> 12 <body xmlns="http://www.w3.org/1999/xhtml"> 13 <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=429785" 14 target="_blank">Mozilla Bug 429785</a> 15 </body> 16 17 <!-- test code goes here --> 18 <script type="application/javascript"><![CDATA[ 19 /** Test for Bug 429785 */ 20 SimpleTest.waitForExplicitFinish(); 21 var errorLogged = false; 22 var listener = { 23 QueryInterface: ChromeUtils.generateQI(["nsIConsoleListener"]), 24 observe() { errorLogged = true; } 25 }; 26 27 function step2() { 28 is(errorLogged, false, "Should be no errors"); 29 30 Services.console.logStringMessage("This is a test"); 31 32 setTimeout(step3, 0); 33 34 } 35 36 function step3() { 37 is(errorLogged, true, "Should see errors when they happen"); 38 Services.console.unregisterListener(listener); 39 SimpleTest.finish(); 40 } 41 42 Services.console.registerListener(listener); 43 44 var p = new DOMParser(); 45 p.parseFromString("<root/>", "application/xml"); 46 47 // nsConsoleService notifies its listeners via async proxies, so we need 48 // to wait to see whether there was an error reported. 49 setTimeout(step2, 0); 50 51 52 ]]></script> 53 </window>