diff options
author | Matt A. Tobin <email@mattatobin.com> | 2018-02-10 10:48:27 -0500 |
---|---|---|
committer | Matt A. Tobin <email@mattatobin.com> | 2018-02-10 10:48:27 -0500 |
commit | 2ef95493bd6c9d9b04f2a59f0d9fe9feeb704d6e (patch) | |
tree | ef5b15907001535cedb0ee5dba2ed1513a4e4842 | |
parent | ceb5709ba1666a4f4200314e495d1260591d4e5c (diff) | |
download | UXP-2ef95493bd6c9d9b04f2a59f0d9fe9feeb704d6e.tar UXP-2ef95493bd6c9d9b04f2a59f0d9fe9feeb704d6e.tar.gz UXP-2ef95493bd6c9d9b04f2a59f0d9fe9feeb704d6e.tar.lz UXP-2ef95493bd6c9d9b04f2a59f0d9fe9feeb704d6e.tar.xz UXP-2ef95493bd6c9d9b04f2a59f0d9fe9feeb704d6e.zip |
Add newChannel2 back to NetUtil.jsm
-rw-r--r-- | netwerk/base/NetUtil.jsm | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/netwerk/base/NetUtil.jsm b/netwerk/base/NetUtil.jsm index e970c8ad8..93025e97e 100644 --- a/netwerk/base/NetUtil.jsm +++ b/netwerk/base/NetUtil.jsm @@ -363,6 +363,41 @@ this.NetUtil = { }, /** + * @deprecated Use newChannel({ ...options... }) instead. + */ + newChannel2: function NetUtil_newChannel2(aWhatToLoad, + aOriginCharset, + aBaseURI, + aLoadingNode, + aLoadingPrincipal, + aTriggeringPrincipal, + aSecurityFlags, + aContentPolicyType) + { + if (!aWhatToLoad) { + let exception = new Components.Exception( + "Must have a non-null string spec, nsIURI, or nsIFile object", + Cr.NS_ERROR_INVALID_ARG, + Components.stack.caller + ); + throw exception; + } + + let uri = aWhatToLoad; + if (!(aWhatToLoad instanceof Ci.nsIURI)) { + // We either have a string or an nsIFile that we'll need a URI for. + uri = this.newURI(aWhatToLoad, aOriginCharset, aBaseURI); + } + + return this.ioService.newChannelFromURI2(uri, + aLoadingNode, + aLoadingPrincipal, + aTriggeringPrincipal, + aSecurityFlags, + aContentPolicyType); + }, + + /** * Reads aCount bytes from aInputStream into a string. * * @param aInputStream |