1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/content/base/test/chrome/test_bug429785.xul Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,61 @@ 1.4 +<?xml version="1.0"?> 1.5 +<?xml-stylesheet href="chrome://global/skin" type="text/css"?> 1.6 +<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?> 1.7 +<!-- 1.8 +https://bugzilla.mozilla.org/show_bug.cgi?id=429785 1.9 +--> 1.10 +<window title="Mozilla Bug 429785" 1.11 + xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> 1.12 + <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/> 1.13 + 1.14 + <!-- test results are displayed in the html:body --> 1.15 + <body xmlns="http://www.w3.org/1999/xhtml"> 1.16 + <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=429785" 1.17 + target="_blank">Mozilla Bug 429785</a> 1.18 + </body> 1.19 + 1.20 + <!-- test code goes here --> 1.21 + <script type="application/javascript"><![CDATA[ 1.22 + /** Test for Bug 429785 **/ 1.23 + SimpleTest.waitForExplicitFinish(); 1.24 + var errorLogged = false; 1.25 + const serv = Components.classes["@mozilla.org/consoleservice;1"] 1.26 + .getService(Components.interfaces.nsIConsoleService); 1.27 + var listener = { 1.28 + QueryInteface : function(iid) { 1.29 + if (!iid.equals(Components.interfaces.nsISupports) && 1.30 + !iid.equals(Components.interfaces.nsIConsoleListener)) { 1.31 + throw Components.results.NS_NOINTERFACE; 1.32 + } 1.33 + return this; 1.34 + }, 1.35 + observe : function (msg) { errorLogged = true; } 1.36 + }; 1.37 + 1.38 + function step2() { 1.39 + is(errorLogged, false, "Should be no errors"); 1.40 + 1.41 + serv.logStringMessage("This is a test"); 1.42 + 1.43 + setTimeout(step3, 0); 1.44 + 1.45 + } 1.46 + 1.47 + function step3() { 1.48 + is(errorLogged, true, "Should see errors when they happen"); 1.49 + serv.unregisterListener(listener); 1.50 + SimpleTest.finish(); 1.51 + } 1.52 + 1.53 + serv.registerListener(listener); 1.54 + 1.55 + var p = new DOMParser(); 1.56 + p.parseFromString("<root/>", "application/xml"); 1.57 + 1.58 + // nsConsoleService notifies its listeners via async proxies, so we need 1.59 + // to wait to see whether there was an error reported. 1.60 + setTimeout(step2, 0); 1.61 + 1.62 + 1.63 + ]]></script> 1.64 +</window>