[Pkg-mozext-commits] [firebug] 35/68: Manual port of: FBTest for issue 5049

David Prévot taffit at moszumanska.debian.org
Mon Mar 31 22:45:52 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to tag fbtest-1.11.4
in repository firebug.

commit 0563a3d723e66e4b7461c7351bda2a40b6af1cc7
Author: Jan Odvarko <odvarko at gmail.com>
Date:   Thu Feb 14 15:13:34 2013 +0100

    Manual port of: FBTest for issue 5049
---
 tests/content/console/spy/5049/issue5049-1.txt |  1 +
 tests/content/console/spy/5049/issue5049-2.txt |  1 +
 tests/content/console/spy/5049/issue5049.html  | 47 +++++++++++++++++++
 tests/content/console/spy/5049/issue5049.js    | 63 ++++++++++++++++++++++++++
 tests/content/firebug.html                     |  3 +-
 5 files changed, 114 insertions(+), 1 deletion(-)

diff --git a/tests/content/console/spy/5049/issue5049-1.txt b/tests/content/console/spy/5049/issue5049-1.txt
new file mode 100644
index 0000000..c9c8ba6
--- /dev/null
+++ b/tests/content/console/spy/5049/issue5049-1.txt
@@ -0,0 +1 @@
+Hello Firebug user!
\ No newline at end of file
diff --git a/tests/content/console/spy/5049/issue5049-2.txt b/tests/content/console/spy/5049/issue5049-2.txt
new file mode 100644
index 0000000..36f9e83
--- /dev/null
+++ b/tests/content/console/spy/5049/issue5049-2.txt
@@ -0,0 +1 @@
+Hello Firebug user 2!
\ No newline at end of file
diff --git a/tests/content/console/spy/5049/issue5049.html b/tests/content/console/spy/5049/issue5049.html
new file mode 100644
index 0000000..f46f0af
--- /dev/null
+++ b/tests/content/console/spy/5049/issue5049.html
@@ -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 at gmail.com></footer>
+</div>
+</body>
+</html>
diff --git a/tests/content/console/spy/5049/issue5049.js b/tests/content/console/spy/5049/issue5049.js
new file mode 100644
index 0000000..3f9557a
--- /dev/null
+++ b/tests/content/console/spy/5049/issue5049.js
@@ -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);
+        });
+    });
+}
diff --git a/tests/content/firebug.html b/tests/content/firebug.html
index 58bf09c..14e9fe3 100644
--- a/tests/content/firebug.html
+++ b/tests/content/firebug.html
@@ -1,4 +1,4 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 <html>
 <head>
@@ -129,6 +129,7 @@ var testList = [
     {group: "console/spy",        uri: "console/spy/4085/issue4085.js",           desc: "Errors inside an XmlHttpRequest.onReadyStateChange still fail silently", testPage: "console/spy/4085/issue4085.html" },
     {group: "console/spy",        uri: "console/spy/4738/issue4738.js",           desc: "Open in new tab opens wrong url when reusing XMLHttpRequest objects", testPage: "console/spy/4738/issue4738.html" },
     {group: "console/spy",        uri: "console/spy/4171/issue4171.js",           desc: "Expanding an XMLHttpRequest in Console tab before it ends makes JSON tab disappear", testPage: "console/spy/4171/issue4171.html" },
+    {group: "console/spy",        uri: "console/spy/5049/issue5049.js",           desc: "onreadystatechange fails for back-to-back XMLHTTP requests", testPage: "console/spy/5049/issue5049.html" },
     {group: "console/api",        uri: "console/api/assert.js",                   desc: "Test for console.assert API.", testPage: "console/api/assert.html" },
     {group: "console/api",        uri: "console/api/clear.js",                    desc: "Test for console.clear API.", testPage: "console/api/clear.html" },
     {group: "console/api",        uri: "console/api/count.js",                    desc: "Test for console.count API.", testPage: "console/api/count.html" },

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/firebug.git



More information about the Pkg-mozext-commits mailing list