Bug 649133 followup. Remove the 'moz' prefix on response/responseType, since Chrome has already shipped these unprefixed. r=sicking

This commit is contained in:
Masatoshi Kimura 2011-05-19 01:11:51 -04:00
parent f41c05a7d6
commit ded3a051e0
4 changed files with 26 additions and 26 deletions

View File

@ -110,7 +110,7 @@ interface nsIXMLHttpRequestUpload : nsIXMLHttpRequestEventTarget {
* you're aware of all the security implications. And then think twice about
* it.
*/
[scriptable, uuid(a05a6424-a644-461a-a1ff-c7bbe96ea9e2)]
[scriptable, uuid(5cf8d518-51d0-4cd6-a69a-c3674c2de599)]
interface nsIXMLHttpRequest : nsISupports
{
/**
@ -148,14 +148,14 @@ interface nsIXMLHttpRequest : nsISupports
* "blob": as a File API Blob.
* "document": as a DOM Document object.
*/
attribute AString mozResponseType;
attribute AString responseType;
/**
* The response to the request as a specified format by responseType.
* NULL if the request is unsuccessful or
* has not yet been sent.
*/
[implicit_jscontext] readonly attribute jsval /* any */ mozResponse;
[implicit_jscontext] readonly attribute jsval /* any */ response;
/**
* The status of the response to the request for HTTP requests.

View File

@ -868,7 +868,7 @@ nsresult nsXMLHttpRequest::GetResponseArrayBuffer(jsval *aResult)
}
/* attribute AString responseType; */
NS_IMETHODIMP nsXMLHttpRequest::GetMozResponseType(nsAString& aResponseType)
NS_IMETHODIMP nsXMLHttpRequest::GetResponseType(nsAString& aResponseType)
{
switch (mResponseType) {
case XML_HTTP_RESPONSE_TYPE_DEFAULT:
@ -894,7 +894,7 @@ NS_IMETHODIMP nsXMLHttpRequest::GetMozResponseType(nsAString& aResponseType)
}
/* attribute AString responseType; */
NS_IMETHODIMP nsXMLHttpRequest::SetMozResponseType(const nsAString& aResponseType)
NS_IMETHODIMP nsXMLHttpRequest::SetResponseType(const nsAString& aResponseType)
{
// If the state is not OPENED or HEADERS_RECEIVED raise an
// INVALID_STATE_ERR exception and terminate these steps.
@ -933,7 +933,7 @@ NS_IMETHODIMP nsXMLHttpRequest::SetMozResponseType(const nsAString& aResponseTyp
}
/* readonly attribute jsval response; */
NS_IMETHODIMP nsXMLHttpRequest::GetMozResponse(JSContext *aCx, jsval *aResult)
NS_IMETHODIMP nsXMLHttpRequest::GetResponse(JSContext *aCx, jsval *aResult)
{
nsresult rv = NS_OK;

View File

@ -29,7 +29,7 @@ var failFiles = [['//example.com' + path + 'file_XHR_pass1.xml', 'GET'],
for (i = 0; i < passFiles.length; ++i) {
xhr = new XMLHttpRequest();
is(xhr.mozResponseType, "", "wrong initial responseType");
is(xhr.responseType, "", "wrong initial responseType");
xhr.open(passFiles[i][1], passFiles[i][0], false);
xhr.send(null);
is(xhr.status, 200, "wrong status");
@ -37,11 +37,11 @@ for (i = 0; i < passFiles.length; ++i) {
is((new XMLSerializer()).serializeToString(xhr.responseXML.documentElement),
"<res>hello</res>",
"wrong responseXML");
is(xhr.mozResponse, "<res>hello</res>\n", "wrong response");
is(xhr.response, "<res>hello</res>\n", "wrong response");
}
else {
is(xhr.responseText, "hello pass\n", "wrong responseText");
is(xhr.mozResponse, "hello pass\n", "wrong response");
is(xhr.response, "hello pass\n", "wrong response");
}
}
@ -77,30 +77,30 @@ function checkResponseXMLAccessThrows(xhr) {
}
function checkSetResponseTypeThrows(xhr) {
var didthrow = false;
try { xhr.mozResponseType = 'document'; } catch (e) { didthrow = true; }
try { xhr.responseType = 'document'; } catch (e) { didthrow = true; }
ok(didthrow, "should have thrown when accessing responseType");
}
xhr = new XMLHttpRequest();
checkSetResponseTypeThrows(xhr);
xhr.open("GET", 'file_XHR_pass1.xml', false);
xhr.mozResponseType = 'document';
xhr.responseType = 'document';
xhr.send(null);
checkSetResponseTypeThrows(xhr);
is(xhr.status, 200, "wrong status");
checkResponseTextAccessThrows(xhr);
is((new XMLSerializer()).serializeToString(xhr.mozResponse.documentElement),
is((new XMLSerializer()).serializeToString(xhr.response.documentElement),
"<res>hello</res>",
"wrong response");
// test response (responseType='text')
xhr = new XMLHttpRequest();
xhr.open("GET", 'file_XHR_pass2.txt', false);
xhr.mozResponseType = 'text';
xhr.responseType = 'text';
xhr.send(null);
is(xhr.status, 200, "wrong status");
checkResponseXMLAccessThrows(xhr);
is(xhr.mozResponse, "hello pass\n", "wrong response");
is(xhr.response, "hello pass\n", "wrong response");
// test response (responseType='arraybuffer')
function arraybuffer_equals_to(ab, s) {
@ -113,24 +113,24 @@ function arraybuffer_equals_to(ab, s) {
// with a simple text file
xhr = new XMLHttpRequest();
xhr.open("GET", 'file_XHR_pass2.txt', false);
xhr.mozResponseType = 'arraybuffer';
xhr.responseType = 'arraybuffer';
xhr.send(null);
is(xhr.status, 200, "wrong status");
checkResponseTextAccessThrows(xhr);
checkResponseXMLAccessThrows(xhr);
ab = xhr.mozResponse;
ab = xhr.response;
ok(ab != null, "should have a non-null arraybuffer");
arraybuffer_equals_to(ab, "hello pass\n");
// with a binary file
xhr = new XMLHttpRequest();
xhr.open("GET", 'file_XHR_binary1.bin', false);
xhr.mozResponseType = 'arraybuffer';
xhr.responseType = 'arraybuffer';
xhr.send(null)
is(xhr.status, 200, "wrong status");
checkResponseTextAccessThrows(xhr);
checkResponseXMLAccessThrows(xhr);
ab = xhr.mozResponse;
ab = xhr.response;
ok(ab != null, "should have a non-null arraybuffer");
arraybuffer_equals_to(ab, "\xaa\xee\0\x03\xff\xff\xff\xff\xbb\xbb\xbb\xbb");
@ -143,12 +143,12 @@ function checkOnloadCount() {
// with a simple text file
xhr = new XMLHttpRequest();
xhr.open("GET", 'file_XHR_pass2.txt', false);
xhr.mozResponseType = 'blob';
xhr.responseType = 'blob';
xhr.send(null);
is(xhr.status, 200, "wrong status");
checkResponseTextAccessThrows(xhr);
checkResponseXMLAccessThrows(xhr);
b = xhr.mozResponse;
b = xhr.response;
ok(b, "should have a non-null blob");
is(b.size, "hello pass\n".length, "wrong blob size");
@ -165,10 +165,10 @@ xhr.onreadystatechange = function() {
switch (xhr.readyState) {
case 2:
is(xhr.status, 200, "wrong status");
xhr.mozResponseType = 'blob';
xhr.responseType = 'blob';
break;
case 4:
b = xhr.mozResponse;
b = xhr.response;
ok(b != null, "should have a non-null blob");
is(b.size, 12, "wrong blob size");
@ -192,7 +192,7 @@ client.onreadystatechange = function() {
try {
is(client.responseXML, null, "responseXML should be null.");
is(client.responseText, "", "responseText should be empty string.");
is(client.mozResponse, "", "response should be empty string.");
is(client.response, "", "response should be empty string.");
is(client.status, 0, "status should be 0.");
is(client.statusText, "", "statusText should be empty string.");
is(client.getAllResponseHeaders(), "",

View File

@ -903,20 +903,20 @@ nsDOMWorkerXHR::SetWithCredentials(PRBool aWithCredentials)
}
NS_IMETHODIMP
nsDOMWorkerXHR::GetMozResponseType(nsAString& aResponseText)
nsDOMWorkerXHR::GetResponseType(nsAString& aResponseText)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsDOMWorkerXHR::SetMozResponseType(const nsAString& aResponseText)
nsDOMWorkerXHR::SetResponseType(const nsAString& aResponseText)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* readonly attribute jsval response; */
NS_IMETHODIMP
nsDOMWorkerXHR::GetMozResponse(JSContext *aCx, jsval *aResult)
nsDOMWorkerXHR::GetResponse(JSContext *aCx, jsval *aResult)
{
return NS_ERROR_NOT_IMPLEMENTED;
}