|
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 type="application/javascript" 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 const serv = Components.classes["@mozilla.org/consoleservice;1"] |
|
23 .getService(Components.interfaces.nsIConsoleService); |
|
24 var listener = { |
|
25 QueryInteface : function(iid) { |
|
26 if (!iid.equals(Components.interfaces.nsISupports) && |
|
27 !iid.equals(Components.interfaces.nsIConsoleListener)) { |
|
28 throw Components.results.NS_NOINTERFACE; |
|
29 } |
|
30 return this; |
|
31 }, |
|
32 observe : function (msg) { errorLogged = true; } |
|
33 }; |
|
34 |
|
35 function step2() { |
|
36 is(errorLogged, false, "Should be no errors"); |
|
37 |
|
38 serv.logStringMessage("This is a test"); |
|
39 |
|
40 setTimeout(step3, 0); |
|
41 |
|
42 } |
|
43 |
|
44 function step3() { |
|
45 is(errorLogged, true, "Should see errors when they happen"); |
|
46 serv.unregisterListener(listener); |
|
47 SimpleTest.finish(); |
|
48 } |
|
49 |
|
50 serv.registerListener(listener); |
|
51 |
|
52 var p = new DOMParser(); |
|
53 p.parseFromString("<root/>", "application/xml"); |
|
54 |
|
55 // nsConsoleService notifies its listeners via async proxies, so we need |
|
56 // to wait to see whether there was an error reported. |
|
57 setTimeout(step2, 0); |
|
58 |
|
59 |
|
60 ]]></script> |
|
61 </window> |