content/base/test/test_sync_xhr_timer.xhtml

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 <html xmlns="http://www.w3.org/1999/xhtml">
     3 <!--
     4 https://bugzilla.mozilla.org/show_bug.cgi?id=
     5 -->
     6 <head>
     7   <title>Test for Bug </title>
     8   <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
     9   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    10 </head>
    11 <body>
    12 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=">Mozilla Bug </a>
    13 <p id="display"></p>
    14 <div id="content" style="display: none">
    16 </div>
    17 <pre id="test">
    18 <script type="application/javascript">
    19 <![CDATA[
    21 var counter = 0;
    22 var xhr;
    24 function syncXHR() {
    25   xhr = new XMLHttpRequest();
    26   xhr.open("GET", window.location, false);
    27   xhr.send(null);
    28 }
    30 function increaseCounter() {
    31   ++counter;
    32   ok(counter <= 2, "Too many increaseCounter() calls!");
    33   if (counter == 2) {
    34     ok(true, "increaseCounter() should be called twice!");
    35     SimpleTest.finish();
    36   }
    37 }
    39 function runTest() {
    40   setTimeout(syncXHR, 0);
    41   setTimeout(increaseCounter, 0);
    42   setTimeout(increaseCounter, 0);
    43 }
    45 SimpleTest.waitForExplicitFinish();
    46 addLoadEvent(runTest);
    48 ]]>
    49 </script>
    50 </pre>
    51 </body>
    52 </html>

mercurial