Loading netwerk/base/NetUtil.jsm +7 −31 Original line number Diff line number Diff line Loading @@ -203,8 +203,9 @@ this.NetUtil = { * the following properties: * { * uri: * The full URI spec string or nsIURI to create the channel for. * Note that this cannot be an nsIFile and you cannot specify a * The full URI spec string, nsIURI or nsIFile to create the * channel for. * Note that this cannot be an nsIFile if you have to specify a * non-default charset or base URI. Call NetUtil.newURI first if * you need to construct an URI using those options. * loadingNode: Loading Loading @@ -266,37 +267,12 @@ this.NetUtil = { * The contentPolicyType of the channel. * Any of the content types defined in nsIContentPolicy.idl. * } * @param aOriginCharset [deprecated] * The character set for the URI. Only used if aWhatToLoad is a * string, which is a deprecated API. Must be undefined otherwise. * Use NetUtil.newURI if you need to use this option. * @param aBaseURI [deprecated] * The base URI for the spec. Only used if aWhatToLoad is a string, * which is a deprecated API. Must be undefined otherwise. Use * NetUtil.newURI if you need to use this option. * * @return an nsIChannel object. */ newChannel: function NetUtil_newChannel(aWhatToLoad, aOriginCharset, aBaseURI) newChannel: function NetUtil_newChannel(aWhatToLoad) { // Check for the deprecated API first. if (typeof aWhatToLoad == "string" || (aWhatToLoad instanceof Ci.nsIFile) || (aWhatToLoad instanceof Ci.nsIURI)) { let uri = (aWhatToLoad instanceof Ci.nsIURI) ? aWhatToLoad : this.newURI(aWhatToLoad, aOriginCharset, aBaseURI); return this.ioService.newChannelFromURI(uri); } // We are using the updated API, that requires only the options object. if (typeof aWhatToLoad != "object" || aOriginCharset !== undefined || aBaseURI !== undefined) { // Make sure the API is called using only the options object. if (typeof aWhatToLoad != "object" || arguments.length != 1) { throw new Components.Exception( "newChannel requires a single object argument", Cr.NS_ERROR_INVALID_ARG, Loading @@ -320,7 +296,7 @@ this.NetUtil = { ); } if (typeof uri == "string") { if (typeof uri == "string" || uri instanceof Ci.nsIFile) { uri = this.newURI(uri); } Loading Loading
netwerk/base/NetUtil.jsm +7 −31 Original line number Diff line number Diff line Loading @@ -203,8 +203,9 @@ this.NetUtil = { * the following properties: * { * uri: * The full URI spec string or nsIURI to create the channel for. * Note that this cannot be an nsIFile and you cannot specify a * The full URI spec string, nsIURI or nsIFile to create the * channel for. * Note that this cannot be an nsIFile if you have to specify a * non-default charset or base URI. Call NetUtil.newURI first if * you need to construct an URI using those options. * loadingNode: Loading Loading @@ -266,37 +267,12 @@ this.NetUtil = { * The contentPolicyType of the channel. * Any of the content types defined in nsIContentPolicy.idl. * } * @param aOriginCharset [deprecated] * The character set for the URI. Only used if aWhatToLoad is a * string, which is a deprecated API. Must be undefined otherwise. * Use NetUtil.newURI if you need to use this option. * @param aBaseURI [deprecated] * The base URI for the spec. Only used if aWhatToLoad is a string, * which is a deprecated API. Must be undefined otherwise. Use * NetUtil.newURI if you need to use this option. * * @return an nsIChannel object. */ newChannel: function NetUtil_newChannel(aWhatToLoad, aOriginCharset, aBaseURI) newChannel: function NetUtil_newChannel(aWhatToLoad) { // Check for the deprecated API first. if (typeof aWhatToLoad == "string" || (aWhatToLoad instanceof Ci.nsIFile) || (aWhatToLoad instanceof Ci.nsIURI)) { let uri = (aWhatToLoad instanceof Ci.nsIURI) ? aWhatToLoad : this.newURI(aWhatToLoad, aOriginCharset, aBaseURI); return this.ioService.newChannelFromURI(uri); } // We are using the updated API, that requires only the options object. if (typeof aWhatToLoad != "object" || aOriginCharset !== undefined || aBaseURI !== undefined) { // Make sure the API is called using only the options object. if (typeof aWhatToLoad != "object" || arguments.length != 1) { throw new Components.Exception( "newChannel requires a single object argument", Cr.NS_ERROR_INVALID_ARG, Loading @@ -320,7 +296,7 @@ this.NetUtil = { ); } if (typeof uri == "string") { if (typeof uri == "string" || uri instanceof Ci.nsIFile) { uri = this.newURI(uri); } Loading