Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Manual port of: FBTest for issue 5049
- Loading branch information
1 parent
3cc23d8
commit 0563a3d
Showing
5 changed files
with
114 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Hello Firebug user! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Hello Firebug user 2! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Issue 5049: onreadystatechange fails for back-to-back XMLHTTP requests</title> | ||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> | ||
<link href="https://getfirebug.com/tests/head/_common/testcase.css" | ||
type="text/css" rel="stylesheet"/> | ||
</head> | ||
<body> | ||
<header> | ||
<h1><a href="http://code.google.com/p/fbug/issues/detail?id=5049">Issue 5049</a>: | ||
onreadystatechange fails for back-to-back XMLHTTP requests</h1> | ||
</header> | ||
<div> | ||
<section id="description"> | ||
<h3>Steps to reproduce</h3> | ||
<ol> | ||
<li>Open Firebug</li> | ||
<li>Enable and switch to the <em>Console</em> panel</li> | ||
<li>Click this button <button id="testButton" onclick="onExecuteTest()">Click Me!</button></li> | ||
<li>Two XMLHttpRequest logs to <code>issue5049.txt</code> should be displayed</li> | ||
<li>Both requests should have HTTP status and time (displayed at the end)</li> | ||
</ol> | ||
</section> | ||
<script type="text/javascript"> | ||
function onExecuteTest() | ||
{ | ||
var xhr = new XMLHttpRequest(); | ||
var url = "issue5049-1.txt"; | ||
xhr.onreadystatechange = function() | ||
{ | ||
if (xhr.readyState == 4 && xhr.status == 200) | ||
{ | ||
url = "issue5049-2.txt"; | ||
xhr.onreadystatechange = function() {}; | ||
xhr.open("GET", url); | ||
xhr.send(null); | ||
} | ||
} | ||
xhr.open("GET", url); | ||
xhr.send(null); | ||
} | ||
</script> | ||
<footer>Jan Odvarko <odvarko@gmail.com></footer> | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
function runTest() | ||
{ | ||
FBTest.sysout("issue5049.START"); | ||
FBTest.setPref("showXMLHttpRequests", true); | ||
FBTest.openNewTab(basePath + "console/spy/5049/issue5049.html", function(win) | ||
{ | ||
FBTest.openFirebug(); | ||
FBTest.enableConsolePanel(function(win) | ||
{ | ||
var options = { | ||
tagName: "div", | ||
classes: "logRow logRow-spy loaded", | ||
counter: 2 | ||
}; | ||
|
||
waitForDisplayedElementAsync("console", options, function(row) | ||
{ | ||
setTimeout(function() { | ||
var panel = FBTest.getPanel("console"); | ||
var root = panel.panelNode; | ||
|
||
var statuses = root.querySelectorAll(".spyRow .spyStatus"); | ||
if (FBTest.compare(2, statuses.length, "There must be two statuses")) | ||
{ | ||
FBTest.ok(statuses[0].textContent, "There must be a status info: " + | ||
statuses[0].textContent); | ||
FBTest.ok(statuses[1].textContent, "There must be a status info: " + | ||
statuses[1].textContent); | ||
|
||
FBTrace.sysout("statuses", statuses) | ||
} | ||
|
||
var times = root.querySelectorAll(".spyRow .spyTime"); | ||
FBTest.compare(2, times.length, "There must be two time fields"); | ||
{ | ||
FBTest.ok(times[0].textContent, "There must be a time info: " + | ||
times[0].textContent); | ||
FBTest.ok(times[1].textContent, "There must be a time info: " + | ||
times[1].textContent); | ||
|
||
FBTrace.sysout("times", times) | ||
} | ||
|
||
FBTest.testDone("issue5049.DONE"); | ||
}); | ||
}); | ||
|
||
// Execute test implemented on the test page. | ||
FBTest.click(win.document.getElementById("testButton")); | ||
}); | ||
}); | ||
} | ||
|
||
function waitForDisplayedElementAsync(panelName, config, callback) | ||
{ | ||
FBTest.waitForDisplayedElement(panelName, config, function(element) | ||
{ | ||
setTimeout(function(element) | ||
{ | ||
callback(element); | ||
}); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters