diff --git a/content/base/test/file_CrossSiteXHR_inner.html b/content/base/test/file_CrossSiteXHR_inner.html index d68a37abbf96..6a9284381a9d 100644 --- a/content/base/test/file_CrossSiteXHR_inner.html +++ b/content/base/test/file_CrossSiteXHR_inner.html @@ -25,7 +25,7 @@ window.addEventListener("message", function(e) { }; var xhr = new XMLHttpRequest(); - for each(type in ["load", "abort", "error", "loadstart"]) { + for each(type in ["load", "abort", "error", "loadstart", "loadend"]) { xhr.addEventListener(type, function(e) { res.events.push(e.type); }, false); @@ -48,10 +48,10 @@ window.addEventListener("message", function(e) { }, false); } } - xhr.onload = xhr.onerror = function (event) { - if (event.type == "error") { - res.didFail = true; - } + xhr.onerror = function(e) { + res.didFail = true; + }; + xhr.onloadend = function (event) { res.status = xhr.status; try { res.statusText = xhr.statusText; diff --git a/content/base/test/file_CrossSiteXHR_inner.jar b/content/base/test/file_CrossSiteXHR_inner.jar index 87bf9568d05b..9fc85c29c082 100644 Binary files a/content/base/test/file_CrossSiteXHR_inner.jar and b/content/base/test/file_CrossSiteXHR_inner.jar differ diff --git a/content/base/test/file_CrossSiteXHR_inner_data.sjs b/content/base/test/file_CrossSiteXHR_inner_data.sjs index 7f51bdb2a1fe..080827c5784d 100644 --- a/content/base/test/file_CrossSiteXHR_inner_data.sjs +++ b/content/base/test/file_CrossSiteXHR_inner_data.sjs @@ -14,7 +14,7 @@ window.addEventListener("message", function(e) {\n\ };\n\ \n\ var xhr = new XMLHttpRequest();\n\ - for each(type in ["load", "abort", "error", "loadstart"]) {\n\ + for each(type in ["load", "abort", "error", "loadstart", "loadend"]) {\n\ xhr.addEventListener(type, function(e) {\n\ res.events.push(e.type);\n\ }, false);\n\ @@ -37,26 +37,27 @@ window.addEventListener("message", function(e) {\n\ }, false);\n\ }\n\ }\n\ - xhr.onload = function () {\n\ - res.status = xhr.status;\n\ - res.statusText = xhr.statusText;\n\ - res.responseXML = xhr.responseXML ?\n\ - (new XMLSerializer()).serializeToString(xhr.responseXML) :\n\ - null;\n\ - res.responseText = xhr.responseText;\n\ - post(e, res);\n\ - };\n\ - xhr.onerror = function () {\n\ + xhr.onerror = function(e) {\n\ res.didFail = true;\n\ + };\n\ + xhr.onloadend = function (event) {\n\ res.status = xhr.status;\n\ try {\n\ res.statusText = xhr.statusText;\n\ } catch (e) {\n\ + delete(res.statusText);\n\ }\n\ res.responseXML = xhr.responseXML ?\n\ (new XMLSerializer()).serializeToString(xhr.responseXML) :\n\ null;\n\ res.responseText = xhr.responseText;\n\ +\n\ + res.responseHeaders = {};\n\ + for (responseHeader in req.responseHeaders) {\n\ + res.responseHeaders[responseHeader] =\n\ + xhr.getResponseHeader(responseHeader);\n\ + }\n\ +\n\ post(e, res);\n\ }\n\ \n\ diff --git a/content/base/test/test_CrossSiteXHR.html b/content/base/test/test_CrossSiteXHR.html index a4728f3d4d60..fd8ea554819d 100644 --- a/content/base/test/test_CrossSiteXHR.html +++ b/content/base/test/test_CrossSiteXHR.html @@ -656,7 +656,7 @@ function runTest() { is(res.responseText, "hello pass\n", "wrong responseText in test for " + test.toSource()); is(res.events.join(","), - "opening,rs1,sending,rs1,loadstart,rs2,rs3,rs4,load", + "opening,rs1,sending,rs1,loadstart,rs2,rs3,rs4,load,loadend", "wrong responseText in test for " + test.toSource()); } else { @@ -665,7 +665,7 @@ function runTest() { is(res.responseText, "", "wrong responseText in test for " + test.toSource()); is(res.events.join(","), - "opening,rs1,sending,rs1,loadstart,rs2,rs4,load", + "opening,rs1,sending,rs1,loadstart,rs2,rs4,load,loadend", "wrong responseText in test for " + test.toSource()); } if (test.responseHeaders) { @@ -694,7 +694,7 @@ function runTest() { "wrong responseText in test for " + test.toSource()); if (!res.sendThrew) { is(res.events.join(","), - "opening,rs1,sending,rs1,loadstart,rs2,rs4,error", + "opening,rs1,sending,rs1,loadstart,rs2,rs4,error,loadend", "wrong events in test for " + test.toSource()); } is(res.progressEvents, 0, @@ -822,7 +822,7 @@ function runTest() { is(res.responseText, "hello pass\n", "wrong responseText in test for " + test.toSource()); is(res.events.join(","), - "opening,rs1,sending,rs1,loadstart,rs2,rs3,rs4,load", + "opening,rs1,sending,rs1,loadstart,rs2,rs3,rs4,load,loadend", "wrong responseText in test for " + test.toSource()); } else { @@ -835,7 +835,7 @@ function runTest() { is(res.responseText, "", "wrong responseText in test for " + test.toSource()); is(res.events.join(","), - "opening,rs1,sending,rs1,loadstart,rs2,rs4,error", + "opening,rs1,sending,rs1,loadstart,rs2,rs4,error,loadend", "wrong events in test for " + test.toSource()); is(res.progressEvents, 0, "wrong events in test for " + test.toSource()); @@ -1091,7 +1091,7 @@ function runTest() { is(res.responseText, "hello pass\n", "wrong responseText in test for " + test.toSource()); is(res.events.join(","), - "opening,rs1,sending,rs1,loadstart,rs2,rs3,rs4,load", + "opening,rs1,sending,rs1,loadstart,rs2,rs3,rs4,load,loadend", "wrong responseText in test for " + test.toSource()); } else { @@ -1104,7 +1104,7 @@ function runTest() { is(res.responseText, "", "wrong responseText in test for " + test.toSource()); is(res.events.join(","), - "opening,rs1,sending,rs1,loadstart,rs2,rs4,error", + "opening,rs1,sending,rs1,loadstart,rs2,rs4,error,loadend", "wrong events in test for " + test.toSource()); is(res.progressEvents, 0, "wrong progressevents in test for " + test.toSource()); diff --git a/content/base/test/test_CrossSiteXHR_cache.html b/content/base/test/test_CrossSiteXHR_cache.html index 6cc2aaa0039d..9e3f1fe42a41 100644 --- a/content/base/test/test_CrossSiteXHR_cache.html +++ b/content/base/test/test_CrossSiteXHR_cache.html @@ -464,7 +464,7 @@ function runTest() { is(res.responseText, "hello pass\n", "wrong responseText in test for " + testName); is(res.events.join(","), - "opening,rs1,sending,rs1,loadstart,rs2,rs3,rs4,load", + "opening,rs1,sending,rs1,loadstart,rs2,rs3,rs4,load,loadend", "wrong events in test for " + testName); } else { @@ -476,15 +476,13 @@ function runTest() { is(res.responseText, "", "wrong responseText in test for " + testName); is(res.events.join(","), - "opening,rs1,sending,rs1,loadstart,rs2,rs4,error", + "opening,rs1,sending,rs1,loadstart,rs2,rs4,error,loadend", "wrong events in test for " + testName); is(res.progressEvents, 0, "wrong events in test for " + testName); } } - - SimpleTest.finish(); yield; diff --git a/content/base/test/test_CrossSiteXHR_origin.html b/content/base/test/test_CrossSiteXHR_origin.html index 885baccaca9d..70883bf0afa6 100644 --- a/content/base/test/test_CrossSiteXHR_origin.html +++ b/content/base/test/test_CrossSiteXHR_origin.html @@ -133,7 +133,7 @@ function runTest() { is(res.responseText, "hello pass\n", "wrong responseText in test for " + allowOrigin); is(res.events.join(","), - "opening,rs1,sending,rs1,loadstart,rs2,rs3,rs4,load", + "opening,rs1,sending,rs1,loadstart,rs2,rs3,rs4,load,loadend", "wrong responseText in test for " + allowOrigin); } @@ -151,7 +151,7 @@ function runTest() { is(res.statusText, "", "wrong status text for " + allowOrigin); is(res.responseXML, null, "should have no XML for " + allowOrigin); is(res.events.join(","), - "opening,rs1,sending,rs1,loadstart,rs2,rs4,error", + "opening,rs1,sending,rs1,loadstart,rs2,rs4,error,loadend", "wrong events in test for " + allowOrigin); is(res.progressEvents, 0, "wrong events in test for " + allowOrigin);