tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

test_bug1098074_throw_from_ReceiveMessage.xhtml (1671B)


      1 <?xml version="1.0"?>
      2 <?xml-stylesheet type="text/css" href="chrome://global/skin"?>
      3 <?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
      4 <!--
      5 https://bugzilla.mozilla.org/show_bug.cgi?id=1098074
      6 -->
      7 <window title="Mozilla Bug 1098074"
      8    xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
      9    onload="start();">
     10  <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
     11 
     12  <!-- test code goes here -->
     13  <script type="application/javascript">
     14  <![CDATA[
     15  /** Test for Bug 1098074 */
     16  SimpleTest.waitForExplicitFinish();
     17  SimpleTest.expectUncaughtException();
     18 
     19  // Tell the test to expect exactly one console error with the given parameters,
     20  // with SimpleTest.finish as a continuation function.
     21  SimpleTest.monitorConsole(SimpleTest.finish, [{errorMessage: new RegExp('acopia')}]);
     22 
     23  var globalMM = Cc["@mozilla.org/globalmessagemanager;1"].getService();
     24  globalMM.addMessageListener("flimfniffle", function onMessage(msg) {
     25    globalMM.removeMessageListener("flimfniffle", onMessage);
     26    is(msg.data, "teufeltor", "correct message");
     27 
     28    // Cleanup the monitor after we throw.
     29    SimpleTest.executeSoon(SimpleTest.endMonitorConsole);
     30 
     31    // eslint-disable-next-line no-throw-literal
     32    throw "acopia";
     33  });
     34 
     35  function start() {
     36    globalMM.loadFrameScript("data:,sendAsyncMessage('flimfniffle', 'teufeltor')", true);
     37  }
     38 
     39  ]]>
     40  </script>
     41 
     42  <!-- test results are displayed in the html:body -->
     43  <body xmlns="http://www.w3.org/1999/xhtml">
     44  <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1098074"
     45     target="_blank">Mozilla Bug 1098074</a>
     46  </body>
     47 </window>