Bug 1207499 - Part 6: Remove use of expression closure from netwerk/. r=jduell

This commit is contained in:
Tooru Fujisawa 2015-09-23 18:42:18 +09:00
parent 0fd4d136a3
commit a5f07b3dae
3 changed files with 49 additions and 22 deletions

View File

@ -42,7 +42,7 @@ function test_asyncFetchBadCert() {
channel.notificationCallbacks = {
QueryInterface: XPCOMUtils.generateQI([Ci.nsIProgressEventSink,
Ci.nsIInterfaceRequestor]),
getInterface: function (aIID) this.QueryInterface(aIID),
getInterface: function (aIID) { return this.QueryInterface(aIID); },
onProgress: function () {},
onStatus: function () {}
};

View File

@ -45,7 +45,7 @@ function checkFile(ch, cx, status, data)
actualFile.append("test_registerdirectory.js");
do_check_eq(ch.getResponseHeader("Content-Length"),
actualFile.fileSize.toString());
do_check_eq(data.map(function(v) String.fromCharCode(v)).join(""),
do_check_eq(data.map(v => String.fromCharCode(v)).join(""),
fileContents(actualFile));
}

View File

@ -18,32 +18,55 @@ function ProtocolHandler() {
ProtocolHandler.prototype = {
/** nsIProtocolHandler */
get scheme() "x-bug894586",
get defaultPort() -1,
get protocolFlags() Ci.nsIProtocolHandler.URI_NORELATIVE |
Ci.nsIProtocolHandler.URI_NOAUTH |
Ci.nsIProtocolHandler.URI_IS_UI_RESOURCE |
Ci.nsIProtocolHandler.URI_IS_LOCAL_RESOURCE |
Ci.nsIProtocolHandler.URI_NON_PERSISTABLE |
Ci.nsIProtocolHandler.URI_SYNC_LOAD_IS_OK,
newURI: function(aSpec, aOriginCharset, aBaseURI) this.uri,
get scheme() {
return "x-bug894586";
},
get defaultPort() {
return -1;
},
get protocolFlags() {
return Ci.nsIProtocolHandler.URI_NORELATIVE |
Ci.nsIProtocolHandler.URI_NOAUTH |
Ci.nsIProtocolHandler.URI_IS_UI_RESOURCE |
Ci.nsIProtocolHandler.URI_IS_LOCAL_RESOURCE |
Ci.nsIProtocolHandler.URI_NON_PERSISTABLE |
Ci.nsIProtocolHandler.URI_SYNC_LOAD_IS_OK;
},
newURI: function(aSpec, aOriginCharset, aBaseURI) {
return this.uri;
},
newChannel2: function(aURI, aLoadInfo) {
this.loadInfo = aLoadInfo;
return this;
},
newChannel: function(aURI) this,
allowPort: function(port, scheme) port != -1,
newChannel: function(aURI) {
return this;
},
allowPort: function(port, scheme) {
return port != -1;
},
/** nsIChannel */
get originalURI() this.uri,
get URI() this.uri,
get originalURI() {
return this.uri;
},
get URI() {
return this.uri;
},
owner: null,
notificationCallbacks: null,
get securityInfo() null,
get contentType() "text/css",
set contentType(val) void(0),
get securityInfo() {
return null;
},
get contentType() {
return "text/css";
},
set contentType(val) {
},
contentCharset: "UTF-8",
get contentLength() -1,
get contentLength() {
return -1;
},
set contentLength(val) {
throw Components.Exception("Setting content length", NS_ERROR_NOT_IMPLEMENTED);
},
@ -82,9 +105,13 @@ ProtocolHandler.prototype = {
},
/** nsIRequest */
get name() this.uri.spec,
isPending: function() false,
get status() Cr.NS_OK,
get name() {
return this.uri.spec;
},
isPending: () => false,
get status() {
return Cr.NS_OK;
},
cancel: function(status) {},
loadGroup: null,
loadFlags: Ci.nsIRequest.LOAD_NORMAL |