1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/content/base/test/test_sync_xhr_timer.xhtml Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,52 @@ 1.4 +<?xml version="1.0"?> 1.5 +<html xmlns="http://www.w3.org/1999/xhtml"> 1.6 +<!-- 1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id= 1.8 +--> 1.9 +<head> 1.10 + <title>Test for Bug </title> 1.11 + <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> 1.12 + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 1.13 +</head> 1.14 +<body> 1.15 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=">Mozilla Bug </a> 1.16 +<p id="display"></p> 1.17 +<div id="content" style="display: none"> 1.18 + 1.19 +</div> 1.20 +<pre id="test"> 1.21 +<script type="application/javascript"> 1.22 +<![CDATA[ 1.23 + 1.24 +var counter = 0; 1.25 +var xhr; 1.26 + 1.27 +function syncXHR() { 1.28 + xhr = new XMLHttpRequest(); 1.29 + xhr.open("GET", window.location, false); 1.30 + xhr.send(null); 1.31 +} 1.32 + 1.33 +function increaseCounter() { 1.34 + ++counter; 1.35 + ok(counter <= 2, "Too many increaseCounter() calls!"); 1.36 + if (counter == 2) { 1.37 + ok(true, "increaseCounter() should be called twice!"); 1.38 + SimpleTest.finish(); 1.39 + } 1.40 +} 1.41 + 1.42 +function runTest() { 1.43 + setTimeout(syncXHR, 0); 1.44 + setTimeout(increaseCounter, 0); 1.45 + setTimeout(increaseCounter, 0); 1.46 +} 1.47 + 1.48 +SimpleTest.waitForExplicitFinish(); 1.49 +addLoadEvent(runTest); 1.50 + 1.51 +]]> 1.52 +</script> 1.53 +</pre> 1.54 +</body> 1.55 +</html>