content/base/test/chrome/test_bug429785.xul

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     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"/>
    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>
    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     };
    35     function step2() {
    36       is(errorLogged, false, "Should be no errors");
    38       serv.logStringMessage("This is a test");
    40       setTimeout(step3, 0);
    42     }
    44     function step3() {
    45       is(errorLogged, true, "Should see errors when they happen");
    46       serv.unregisterListener(listener);
    47       SimpleTest.finish();
    48     }
    50     serv.registerListener(listener);    
    52     var p = new DOMParser();
    53     p.parseFromString("<root/>", "application/xml");
    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);
    60   ]]></script>
    61 </window>

mercurial