Bug 605296 followup: fix test to do the right thing on failure. a=orange
authorBoris Zbarsky <bzbarsky@mit.edu>
Tue, 30 Nov 2010 16:19:40 -0500
changeset 58396 8777ed85c5ac544eb8aa74b226bf710315ba5f14
parent 58395 78df45be19d18b39bc8ce68d3eb23ff46d7cfa7a
child 58397 824f8a023254f117c0f6bc54a95223d5a658c665
push id1
push usershaver@mozilla.com
push dateTue, 04 Jan 2011 17:58:04 +0000
reviewersorange
bugs605296
milestone2.0b8pre
Bug 605296 followup: fix test to do the right thing on failure. a=orange
content/base/test/file_CrossSiteXHR_inner.html
content/base/test/test_CrossSiteXHR.html
--- a/content/base/test/file_CrossSiteXHR_inner.html
+++ b/content/base/test/file_CrossSiteXHR_inner.html
@@ -14,16 +14,17 @@ window.addEventListener("message", funct
 
   req = eval(e.data);
   var res = {
     didFail: false,
     events: [],
     progressEvents: 0,
     status: 0,
     responseText: "",
+    statusText: "",
     responseXML: null,
     sendThrew: false
   };
   
   var xhr = new XMLHttpRequest();
   for each(type in ["load", "abort", "error", "loadstart"]) {
     xhr.addEventListener(type, function(e) {
       res.events.push(e.type);
@@ -50,16 +51,17 @@ window.addEventListener("message", funct
   xhr.onload = xhr.onerror = function (event) {
     if (event.type == "error") {
       res.didFail = true;
     }
     res.status = xhr.status;
     try {
       res.statusText = xhr.statusText;
     } catch (e) {
+      delete(res.statusText);
     }
     res.responseXML = xhr.responseXML ?
       (new XMLSerializer()).serializeToString(xhr.responseXML) :
       null;
     res.responseText = xhr.responseText;
 
     res.responseHeaders = {};
     for (responseHeader in req.responseHeaders) {
--- a/content/base/test/test_CrossSiteXHR.html
+++ b/content/base/test/test_CrossSiteXHR.html
@@ -682,17 +682,17 @@ function runTest() {
           }
         }
       }
     }
     else {
       is(res.didFail, true,
         "should have failed in test for " + test.toSource());
       is(res.status, 0, "wrong status in test for " + test.toSource());
-      is(res.statusText, "", "wrong status in test for " + test.toSource());
+      is(res.statusText, "", "wrong status text for " + test.toSource());
       is(res.responseXML, null,
          "wrong responseXML in test for " + test.toSource());
       is(res.responseText, "",
          "wrong responseText in test for " + test.toSource());
       if (!res.sendThrew) {
         is(res.events.join(","),
            "opening,rs1,sending,rs1,loadstart,rs2,rs4,error",
            "wrong events in test for " + test.toSource());
@@ -824,17 +824,17 @@ function runTest() {
       is(res.events.join(","),
          "opening,rs1,sending,rs1,loadstart,rs2,rs3,rs4,load",
          "wrong responseText in test for " + test.toSource());
     }
     else {
       is(res.didFail, true,
         "should have failed in test for " + test.toSource());
       is(res.status, 0, "wrong status in test for " + test.toSource());
-      is(res.statusText, "", "wrong status in test for " + test.toSource());
+      is(res.statusText, "", "wrong status text for " + test.toSource());
       is(res.responseXML, null,
          "wrong responseXML in test for " + test.toSource());
       is(res.responseText, "",
          "wrong responseText in test for " + test.toSource());
       is(res.events.join(","),
          "opening,rs1,sending,rs1,loadstart,rs2,rs4,error",
          "wrong events in test for " + test.toSource());
       is(res.progressEvents, 0,
@@ -1093,17 +1093,17 @@ function runTest() {
       is(res.events.join(","),
          "opening,rs1,sending,rs1,loadstart,rs2,rs3,rs4,load",
          "wrong responseText in test for " + test.toSource());
     }
     else {
       is(res.didFail, true,
         "should have failed in test for " + test.toSource());
       is(res.status, 0, "wrong status in test for " + test.toSource());
-      is(res.statusText, "", "wrong status in test for " + test.toSource());
+      is(res.statusText, "", "wrong status text for " + test.toSource());
       is(res.responseXML, null,
          "wrong responseXML in test for " + test.toSource());
       is(res.responseText, "",
          "wrong responseText in test for " + test.toSource());
       is(res.events.join(","),
          "opening,rs1,sending,rs1,loadstart,rs2,rs4,error",
          "wrong events in test for " + test.toSource());
       is(res.progressEvents, 0,