[Pkg-mozext-commits] [firebug] 14/68: FBTest: yet fix for 2285 (and keep compat with Fx21)

David Prévot taffit at moszumanska.debian.org
Mon Mar 31 22:45:50 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 5df833950213be2a4993b6c3ddf1262390f39703
Author: Jan Odvarko <odvarko at gmail.com>
Date:   Thu Mar 7 19:39:53 2013 +0100

    FBTest: yet fix for 2285 (and keep compat with Fx21)
---
 .../spy/2285/{issue2285.php => issue2285-1.php}    |   3 +-
 tests/content/console/spy/2285/issue2285.html      |  40 +++++++-
 tests/content/console/spy/2285/issue2285.js        | 106 +++++++++++----------
 tests/content/console/spy/2285/issue2285.php       |   6 +-
 4 files changed, 98 insertions(+), 57 deletions(-)

diff --git a/tests/content/console/spy/2285/issue2285.php b/tests/content/console/spy/2285/issue2285-1.php
similarity index 90%
copy from tests/content/console/spy/2285/issue2285.php
copy to tests/content/console/spy/2285/issue2285-1.php
index 8300084..c7b38fd 100644
--- a/tests/content/console/spy/2285/issue2285.php
+++ b/tests/content/console/spy/2285/issue2285-1.php
@@ -1,11 +1,10 @@
 <?php
 set_time_limit(300);
-header('Content-type: multipart/x-mixed-replace;boundary=NEXTPART');  
+header('Content-type: multipart/x-mixed-replace;boundary=NEXTPART');
 for ($i = 0; $i < 4; $i++) {
   print "Part$i+";
   ob_flush();
   flush();
     sleep(1);
 }
-
 ?>
\ No newline at end of file
diff --git a/tests/content/console/spy/2285/issue2285.html b/tests/content/console/spy/2285/issue2285.html
index 01c1af3..0e0415b 100644
--- a/tests/content/console/spy/2285/issue2285.html
+++ b/tests/content/console/spy/2285/issue2285.html
@@ -19,7 +19,13 @@
 <ol>
 <li>Open Firebug and enable the Console panel.</li>
 <li>Make sure <i>Show XMLHttpRequests</i> option is on.</li>
-<li>Click on the <code style="color:green">Execute Test</code> button below.</li>
+
+<li>Firefox -21: Click on the <code style="color:green">Execute Test</code> button 
+<button id="testButton1" onclick="onMultipart1()">Execute Test</button></li>
+
+<li>Firefox 22+: Click on the <code style="color:green">Execute Test</code> button 
+<button id="testButton2" onclick="onMultipart2()">Execute Test</button></li>
+
 <li>Click button below and wait till you see number
     <span style="color:green">4</span> here:
     <span id="content" style="color:red">0</span>
@@ -30,10 +36,8 @@
 </li>
 </ol>
 
-<button id="testButton" onclick="onMultipart()">Execute Test</button>
-
 <script type="text/javascript">
-function onMultipart()
+function onMultipart1()
 {
     var content = document.getElementById("content");
 
@@ -46,6 +50,34 @@ function onMultipart()
     request.open("POST", "issue2285.php", true);
     request.onreadystatechange = function()
     {
+        if (request.readyState == 4 && request.status == 200)
+        {
+            content.innerHTML = ++counter;
+            if (counter == 4)
+            {
+                var event = document.createEvent("Events");
+                event.initEvent("test-done", true, false);
+                document.dispatchEvent(event);
+            }
+        }
+    }
+
+    request.send(null);
+}
+
+function onMultipart2()
+{
+    var content = document.getElementById("content");
+
+    var request = new XMLHttpRequest();
+    request.multipart = true;
+
+    var counter = 0;
+    content.innerHTML = counter;
+
+    request.open("POST", "issue2285-1.php", true);
+    request.onreadystatechange = function()
+    {
         if (request.readyState == 3 && request.status == 200)
             content.innerHTML = ++counter;
 
diff --git a/tests/content/console/spy/2285/issue2285.js b/tests/content/console/spy/2285/issue2285.js
index a9fcae1..e993b58 100644
--- a/tests/content/console/spy/2285/issue2285.js
+++ b/tests/content/console/spy/2285/issue2285.js
@@ -1,49 +1,57 @@
-function runTest()
-{
-    FBTest.sysout("issue2285.START");
-
-    FBTest.openNewTab(basePath + "console/spy/2285/issue2285.html", function(win)
-    {
-        FBTest.enableConsolePanel(function()
-        {
-            var panel = FW.Firebug.chrome.selectPanel("console");
-
-            // Run test implemented on the page.
-            function testDone(event)
-            {
-                win.document.removeEventListener("test-done", testDone, false);
-
-                // Expand XHR log in the Console panel.
-                var rows = FW.FBL.getElementsByClass(panel.panelNode,
-                    "logRow", "logRow-spy", "loaded");
-
-                FBTest.compare(1, rows.length, "There must be just on XHR.");
-
-                if (rows.length > 0)
-                {
-                    var logRow = rows[0];
-                    var clickTarget = FW.FBL.getElementByClass(logRow, "spyTitleCol", "spyCol");
-                    FBTest.click(clickTarget);
-                    FBTest.expandElements(clickTarget, "netInfoResponseTab");
-
-                    var responseBody = FW.FBL.getElementByClass(logRow, "netInfoResponseText", "netInfoText");
-                    FBTest.ok(responseBody, "Response tab must exist in");
-                    if (responseBody)
-                    {
-                        // If the activity-observer is available the response is correct.
-                        // Otherwise only the first part of the multipart XHR is displayed.
-                        var response = Cc["@mozilla.org/network/http-activity-distributor;1"]
-                            ? "Part0+Part1+Part2+Part3+" : "Part0+";
-                        FBTest.compare(response, responseBody.textContent, "Response text must match."); 
-                    }
-                }
-
-                // Finish test
-                FBTest.testDone("issue2285.DONE");
-            };
-
-            win.document.addEventListener("test-done", testDone, false);
-            FBTest.click(win.document.getElementById("testButton"));
-        });
-    });
-}
+var versionChecker = Cc["@mozilla.org/xpcom/version-comparator;1"].getService(Ci.nsIVersionComparator);
+var appInfo = Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULAppInfo);
+var FF22OrHigher = versionChecker.compare(appInfo.version, "21.*") >= 0;
+
+function runTest()
+{
+    FBTest.sysout("issue2285.START");
+
+    FBTest.openNewTab(basePath + "console/spy/2285/issue2285.html", function(win)
+    {
+        FBTest.enableConsolePanel(function()
+        {
+            var panel = FW.Firebug.chrome.selectPanel("console");
+
+            // Run test implemented on the page.
+            function testDone(event)
+            {
+                win.document.removeEventListener("test-done", testDone, false);
+
+                // Expand XHR log in the Console panel.
+                var rows = FW.FBL.getElementsByClass(panel.panelNode,
+                    "logRow", "logRow-spy", "loaded");
+
+                FBTest.compare(1, rows.length, "There must be just on XHR.");
+
+                if (rows.length > 0)
+                {
+                    var logRow = rows[0];
+                    var clickTarget = FW.FBL.getElementByClass(logRow, "spyTitleCol", "spyCol");
+                    FBTest.click(clickTarget);
+                    FBTest.expandElements(clickTarget, "netInfoResponseTab");
+
+                    var responseBody = FW.FBL.getElementByClass(logRow, "netInfoResponseText", "netInfoText");
+                    FBTest.ok(responseBody, "Response tab must exist in");
+                    if (responseBody)
+                    {
+                        // If the activity-observer is available the response is correct.
+                        // Otherwise only the first part of the multipart XHR is displayed.
+                        var response = Cc["@mozilla.org/network/http-activity-distributor;1"]
+                            ? "Part0+Part1+Part2+Part3+" : "Part0+";
+                        FBTest.compare(response, responseBody.textContent, "Response text must match."); 
+                    }
+                }
+
+                // Finish test
+                FBTest.testDone("issue2285.DONE");
+            };
+
+            win.document.addEventListener("test-done", testDone, false);
+
+            if (FF22OrHigher)
+                FBTest.click(win.document.getElementById("testButton2"));
+            else
+                FBTest.click(win.document.getElementById("testButton1"));
+        });
+    });
+}
diff --git a/tests/content/console/spy/2285/issue2285.php b/tests/content/console/spy/2285/issue2285.php
index 8300084..56ff8e3 100644
--- a/tests/content/console/spy/2285/issue2285.php
+++ b/tests/content/console/spy/2285/issue2285.php
@@ -1,11 +1,13 @@
 <?php
 set_time_limit(300);
-header('Content-type: multipart/x-mixed-replace;boundary=NEXTPART');  
+header('Content-type: multipart/x-mixed-replace;boundary=NEXTPART');
+print "\n--NEXTPART\n";
 for ($i = 0; $i < 4; $i++) {
+  print "Content-type: text/plain\n\n";
   print "Part$i+";
+  print "--NEXTPART\n";
   ob_flush();
   flush();
     sleep(1);
 }
-
 ?>
\ No newline at end of file

-- 
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