mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 21:01:08 +00:00
Bug 1536744 - Remove nsIProtocolHandler.newURI r=baku
Differential Revision: https://phabricator.services.mozilla.com/D30703 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
016cf57214
commit
b8bdfab7c9
@ -63,13 +63,6 @@ nsChromeProtocolHandler::GetProtocolFlags(uint32_t* result) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsChromeProtocolHandler::NewURI(const nsACString& aSpec, const char* aCharset,
|
||||
nsIURI* aBaseURI, nsIURI** result) {
|
||||
return nsChromeProtocolHandler::CreateNewURI(aSpec, aCharset, aBaseURI,
|
||||
result);
|
||||
}
|
||||
|
||||
/* static */ nsresult nsChromeProtocolHandler::CreateNewURI(
|
||||
const nsACString& aSpec, const char* aCharset, nsIURI* aBaseURI,
|
||||
nsIURI** result) {
|
||||
|
@ -20,16 +20,6 @@ ProtocolHandler.prototype =
|
||||
{
|
||||
defaultPort: -1,
|
||||
allowPort: () => false,
|
||||
newURI(aSpec, aCharset, aBaseURI) {
|
||||
let mutator = Cc["@mozilla.org/network/standard-url-mutator;1"]
|
||||
.createInstance(Ci.nsIURIMutator);
|
||||
if (aBaseURI) {
|
||||
mutator.setSpec(aBaseURI.resolve(aSpec));
|
||||
} else {
|
||||
mutator.setSpec(aSpec);
|
||||
}
|
||||
return mutator.finalize();
|
||||
},
|
||||
newChannel() { throw Cr.NS_ERROR_NOT_IMPLEMENTED; },
|
||||
QueryInterface: ChromeUtils.generateQI([
|
||||
Ci.nsIProtocolHandler,
|
||||
|
@ -18,6 +18,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=682305
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="application/javascript">
|
||||
|
||||
"use strict";
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
/*
|
||||
@ -107,12 +110,6 @@ CustomProtocol.prototype = {
|
||||
allowPort: function allowPort() {
|
||||
return false;
|
||||
},
|
||||
newURI: function newURI(spec, charset, baseURI) {
|
||||
return Cc["@mozilla.org/network/simple-uri-mutator;1"]
|
||||
.createInstance(Ci.nsIURIMutator)
|
||||
.setSpec(spec)
|
||||
.finalize();
|
||||
},
|
||||
newChannel: function newChannel(URI, loadInfo) {
|
||||
return new CustomChannel(URI, loadInfo);
|
||||
},
|
||||
|
@ -777,13 +777,6 @@ BlobURLProtocolHandler::GetFlagsForURI(nsIURI* aURI, uint32_t* aResult) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
BlobURLProtocolHandler::NewURI(const nsACString& aSpec, const char* aCharset,
|
||||
nsIURI* aBaseURI, nsIURI** aResult) {
|
||||
return BlobURLProtocolHandler::CreateNewURI(aSpec, aCharset, aBaseURI,
|
||||
aResult);
|
||||
}
|
||||
|
||||
/* static */ nsresult BlobURLProtocolHandler::CreateNewURI(
|
||||
const nsACString& aSpec, const char* aCharset, nsIURI* aBaseURI,
|
||||
nsIURI** aResult) {
|
||||
|
@ -77,35 +77,3 @@ FontTableURIProtocolHandler::GetScheme(nsACString& result) {
|
||||
result.AssignLiteral(FONTTABLEURI_SCHEME);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
FontTableURIProtocolHandler::NewURI(const nsACString& aSpec,
|
||||
const char* aCharset, nsIURI* aBaseURI,
|
||||
nsIURI** aResult) {
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
|
||||
// Either you got here via a ref or a fonttable: uri
|
||||
if (aSpec.Length() && aSpec.CharAt(0) == '#') {
|
||||
rv = NS_MutateURI(aBaseURI).SetRef(aSpec).Finalize(uri);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
} else {
|
||||
// Relative URIs (other than #ref) are not meaningful within the
|
||||
// fonttable: scheme.
|
||||
// If aSpec is a relative URI -other- than a bare #ref,
|
||||
// this will leave uri empty, and we'll return a failure code below.
|
||||
rv = NS_MutateURI(new mozilla::net::nsSimpleURI::Mutator())
|
||||
.SetSpec(aSpec)
|
||||
.Finalize(uri);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
bool schemeIs;
|
||||
if (NS_FAILED(uri->SchemeIs(FONTTABLEURI_SCHEME, &schemeIs)) || !schemeIs) {
|
||||
NS_WARNING("Non-fonttable spec in FontTableURIProtocolHandler");
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
uri.forget(aResult);
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -1106,11 +1106,6 @@ nsJSProtocolHandler::GetProtocolFlags(uint32_t* result) {
|
||||
URI_OPENING_EXECUTES_SCRIPT;
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP
|
||||
nsJSProtocolHandler::NewURI(const nsACString& aSpec, const char* aCharset,
|
||||
nsIURI* aBaseURI, nsIURI** result) {
|
||||
return nsJSProtocolHandler::CreateNewURI(aSpec, aCharset, aBaseURI, result);
|
||||
}
|
||||
|
||||
/* static */ nsresult nsJSProtocolHandler::CreateNewURI(const nsACString& aSpec,
|
||||
const char* aCharset,
|
||||
|
@ -37,18 +37,6 @@ NS_IMETHODIMP nsIndexedDBProtocolHandler::GetProtocolFlags(
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsIndexedDBProtocolHandler::NewURI(const nsACString& aSpec,
|
||||
const char* aOriginCharset,
|
||||
nsIURI* aBaseURI,
|
||||
nsIURI** _retval) {
|
||||
nsCOMPtr<nsIURI> baseURI(aBaseURI);
|
||||
return NS_MutateURI(new nsStandardURL::Mutator())
|
||||
.Apply(NS_MutatorMethod(
|
||||
&nsIStandardURLMutator::Init, nsIStandardURL::URLTYPE_AUTHORITY, 0,
|
||||
nsCString(aSpec), aOriginCharset, baseURI, nullptr))
|
||||
.Finalize(_retval);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsIndexedDBProtocolHandler::NewChannel(nsIURI* aURI, nsILoadInfo* aLoadInfo,
|
||||
nsIChannel** _retval) {
|
||||
|
@ -54,15 +54,6 @@ nsIconProtocolHandler::GetProtocolFlags(uint32_t* result) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsIconProtocolHandler::NewURI(const nsACString& aSpec,
|
||||
const char* aOriginCharset, // ignored
|
||||
nsIURI* aBaseURI, nsIURI** result) {
|
||||
return NS_MutateURI(new nsMozIconURI::Mutator())
|
||||
.SetSpec(aSpec)
|
||||
.Finalize(result);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsIconProtocolHandler::NewChannel(nsIURI* url, nsILoadInfo* aLoadInfo,
|
||||
nsIChannel** result) {
|
||||
|
@ -88,16 +88,6 @@ nsJARProtocolHandler::GetProtocolFlags(uint32_t* result) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARProtocolHandler::NewURI(const nsACString& aSpec, const char* aCharset,
|
||||
nsIURI* aBaseURI, nsIURI** result) {
|
||||
nsCOMPtr<nsIURI> base(aBaseURI);
|
||||
return NS_MutateURI(new nsJARURI::Mutator())
|
||||
.Apply(NS_MutatorMethod(&nsIJARURIMutator::SetSpecBaseCharset,
|
||||
nsCString(aSpec), base, aCharset))
|
||||
.Finalize(result);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARProtocolHandler::NewChannel(nsIURI* uri, nsILoadInfo* aLoadInfo,
|
||||
nsIChannel** result) {
|
||||
|
@ -720,7 +720,7 @@ nsIOService::GetProtocolHandler(const char* scheme,
|
||||
spec.Append(':');
|
||||
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
rv = (*result)->NewURI(spec, nullptr, nullptr, getter_AddRefs(uri));
|
||||
rv = NS_NewURI(getter_AddRefs(uri), spec);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
@ -80,35 +80,6 @@ interface nsIProtocolHandler : nsISupports
|
||||
}
|
||||
%}
|
||||
|
||||
/**
|
||||
* Makes a URI object that is suitable for loading by this protocol,
|
||||
* where the URI string is given as an UTF-8 string. The caller may
|
||||
* provide the charset from which the URI string originated, so that
|
||||
* the URI string can be translated back to that charset (if necessary)
|
||||
* before communicating with, for example, the origin server of the URI
|
||||
* string. (Many servers do not support UTF-8 IRIs at the present time,
|
||||
* so we must be careful about tracking the native charset of the origin
|
||||
* server.)
|
||||
*
|
||||
* @param aSpec - the URI string in UTF-8 encoding. depending
|
||||
* on the protocol implementation, unicode character
|
||||
* sequences may or may not be %xx escaped.
|
||||
* @param aOriginCharset - the charset of the document from which this URI
|
||||
* string originated. this corresponds to the
|
||||
* charset that should be used when communicating
|
||||
* this URI to an origin server, for example. if
|
||||
* null, then UTF-8 encoding is assumed (i.e.,
|
||||
* no charset transformation from aSpec).
|
||||
* @param aBaseURI - if null, aSpec must specify an absolute URI.
|
||||
* otherwise, aSpec may be resolved relative
|
||||
* to aBaseURI, depending on the protocol.
|
||||
* If the protocol has no concept of relative
|
||||
* URI aBaseURI will simply be ignored.
|
||||
*/
|
||||
nsIURI newURI(in AUTF8String aSpec,
|
||||
[optional] in string aOriginCharset,
|
||||
[optional] in nsIURI aBaseURI);
|
||||
|
||||
/**
|
||||
* Constructs a new channel from the given URI for this protocol handler and
|
||||
* sets the loadInfo for the constructed channel.
|
||||
|
@ -121,14 +121,6 @@ nsAboutProtocolHandler::GetFlagsForURI(nsIURI* aURI, uint32_t* aFlags) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAboutProtocolHandler::NewURI(const nsACString& aSpec,
|
||||
const char* aCharset, // ignore charset info
|
||||
nsIURI* aBaseURI, nsIURI** aResult) {
|
||||
return nsAboutProtocolHandler::CreateNewURI(aSpec, aCharset, aBaseURI,
|
||||
aResult);
|
||||
}
|
||||
|
||||
// static
|
||||
nsresult nsAboutProtocolHandler::CreateNewURI(const nsACString& aSpec,
|
||||
const char* aCharset,
|
||||
@ -309,19 +301,6 @@ nsSafeAboutProtocolHandler::GetProtocolFlags(uint32_t* result) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSafeAboutProtocolHandler::NewURI(const nsACString& aSpec,
|
||||
const char* aCharset, // ignore charset info
|
||||
nsIURI* aBaseURI, nsIURI** result) {
|
||||
nsresult rv =
|
||||
NS_MutateURI(new nsSimpleURI::Mutator()).SetSpec(aSpec).Finalize(result);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSafeAboutProtocolHandler::NewChannel(nsIURI* uri, nsILoadInfo* aLoadInfo,
|
||||
nsIChannel** result) {
|
||||
|
@ -47,13 +47,6 @@ nsDataHandler::GetProtocolFlags(uint32_t* result) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDataHandler::NewURI(const nsACString& aSpec,
|
||||
const char* aCharset, // ignore charset info
|
||||
nsIURI* aBaseURI, nsIURI** result) {
|
||||
return nsDataHandler::CreateNewURI(aSpec, aCharset, aBaseURI, result);
|
||||
}
|
||||
|
||||
/* static */ nsresult nsDataHandler::CreateNewURI(const nsACString& aSpec,
|
||||
const char* aCharset,
|
||||
nsIURI* aBaseURI,
|
||||
|
@ -143,26 +143,6 @@ nsFileProtocolHandler::GetProtocolFlags(uint32_t* result) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFileProtocolHandler::NewURI(const nsACString& spec, const char* charset,
|
||||
nsIURI* aBaseURI, nsIURI** result) {
|
||||
nsAutoCString buf(spec);
|
||||
#if defined(XP_WIN)
|
||||
buf.Truncate();
|
||||
if (!net_NormalizeFileURL(spec, buf)) {
|
||||
buf = spec;
|
||||
}
|
||||
#endif
|
||||
|
||||
nsCOMPtr<nsIURI> base(aBaseURI);
|
||||
return NS_MutateURI(new nsStandardURL::Mutator())
|
||||
.Apply(NS_MutatorMethod(&nsIFileURLMutator::MarkFileURL))
|
||||
.Apply(NS_MutatorMethod(&nsIStandardURLMutator::Init,
|
||||
nsIStandardURL::URLTYPE_NO_AUTHORITY, -1, buf,
|
||||
charset, base, nullptr))
|
||||
.Finalize(result);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFileProtocolHandler::NewChannel(nsIURI* uri, nsILoadInfo* aLoadInfo,
|
||||
nsIChannel** result) {
|
||||
|
@ -139,37 +139,6 @@ nsFtpProtocolHandler::GetProtocolFlags(uint32_t* result) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFtpProtocolHandler::NewURI(const nsACString& aSpec, const char* aCharset,
|
||||
nsIURI* aBaseURI, nsIURI** result) {
|
||||
if (!mEnabled) {
|
||||
return NS_ERROR_UNKNOWN_PROTOCOL;
|
||||
}
|
||||
nsAutoCString spec(aSpec);
|
||||
spec.Trim(" \t\n\r"); // Match NS_IsAsciiWhitespace instead of HTML5
|
||||
|
||||
char* fwdPtr = spec.BeginWriting();
|
||||
|
||||
// now unescape it... %xx reduced inline to resulting character
|
||||
|
||||
int32_t len = NS_UnescapeURL(fwdPtr);
|
||||
|
||||
// NS_UnescapeURL() modified spec's buffer, truncate to ensure
|
||||
// spec knows its new length.
|
||||
spec.Truncate(len);
|
||||
|
||||
// return an error if we find a NUL, CR, or LF in the path
|
||||
if (spec.FindCharInSet(CRLF) >= 0 || spec.FindChar('\0') >= 0)
|
||||
return NS_ERROR_MALFORMED_URI;
|
||||
|
||||
nsCOMPtr<nsIURI> base(aBaseURI);
|
||||
return NS_MutateURI(NS_STANDARDURLMUTATOR_CONTRACTID)
|
||||
.Apply(NS_MutatorMethod(&nsIStandardURLMutator::Init,
|
||||
nsIStandardURL::URLTYPE_AUTHORITY, 21,
|
||||
nsCString(aSpec), aCharset, base, nullptr))
|
||||
.Finalize(result);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFtpProtocolHandler::NewChannel(nsIURI* url, nsILoadInfo* aLoadInfo,
|
||||
nsIChannel** result) {
|
||||
|
@ -948,55 +948,6 @@ static bool IsValidGIOScheme(const nsACString& aScheme) {
|
||||
return false;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsGIOProtocolHandler::NewURI(const nsACString& aSpec,
|
||||
const char* aOriginCharset, nsIURI* aBaseURI,
|
||||
nsIURI** aResult) {
|
||||
const nsCString flatSpec(aSpec);
|
||||
LOG(("gio: NewURI [spec=%s]\n", flatSpec.get()));
|
||||
|
||||
if (!aBaseURI) {
|
||||
// XXX Is it good to support all GIO protocols?
|
||||
if (!IsSupportedProtocol(flatSpec)) return NS_ERROR_UNKNOWN_PROTOCOL;
|
||||
|
||||
int32_t colon_location = flatSpec.FindChar(':');
|
||||
if (colon_location <= 0) return NS_ERROR_UNKNOWN_PROTOCOL;
|
||||
|
||||
// Verify that GIO supports this URI scheme.
|
||||
bool uri_scheme_supported = false;
|
||||
|
||||
GVfs* gvfs = g_vfs_get_default();
|
||||
|
||||
if (!gvfs) {
|
||||
g_warning("Cannot get GVfs object.");
|
||||
return NS_ERROR_UNKNOWN_PROTOCOL;
|
||||
}
|
||||
|
||||
const gchar* const* uri_schemes = g_vfs_get_supported_uri_schemes(gvfs);
|
||||
|
||||
while (*uri_schemes != nullptr) {
|
||||
// While flatSpec ends with ':' the uri_scheme does not. Therefore do not
|
||||
// compare last character.
|
||||
if (StringHead(flatSpec, colon_location).Equals(*uri_schemes)) {
|
||||
uri_scheme_supported = true;
|
||||
break;
|
||||
}
|
||||
uri_schemes++;
|
||||
}
|
||||
|
||||
if (!uri_scheme_supported) {
|
||||
return NS_ERROR_UNKNOWN_PROTOCOL;
|
||||
}
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIURI> base(aBaseURI);
|
||||
return NS_MutateURI(NS_STANDARDURLMUTATOR_CONTRACTID)
|
||||
.Apply(NS_MutatorMethod(&nsIStandardURLMutator::Init,
|
||||
nsIStandardURL::URLTYPE_STANDARD, -1, flatSpec,
|
||||
aOriginCharset, base, nullptr))
|
||||
.Finalize(aResult);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsGIOProtocolHandler::NewChannel(nsIURI* aURI, nsILoadInfo* aLoadInfo,
|
||||
nsIChannel** aResult) {
|
||||
|
@ -140,16 +140,6 @@ namespace net {
|
||||
|
||||
LazyLogModule gHttpLog("nsHttp");
|
||||
|
||||
static nsresult NewURI(const nsACString& aSpec, const char* aCharset,
|
||||
nsIURI* aBaseURI, int32_t aDefaultPort, nsIURI** aURI) {
|
||||
nsCOMPtr<nsIURI> base(aBaseURI);
|
||||
return NS_MutateURI(new nsStandardURL::Mutator())
|
||||
.Apply(NS_MutatorMethod(&nsIStandardURLMutator::Init,
|
||||
nsIStandardURL::URLTYPE_AUTHORITY, aDefaultPort,
|
||||
nsCString(aSpec), aCharset, base, nullptr))
|
||||
.Finalize(aURI);
|
||||
}
|
||||
|
||||
#ifdef ANDROID
|
||||
static nsCString GetDeviceModelId() {
|
||||
// Assumed to be running on the main thread
|
||||
@ -1990,13 +1980,6 @@ nsHttpHandler::GetProtocolFlags(uint32_t* result) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHttpHandler::NewURI(const nsACString& aSpec, const char* aCharset,
|
||||
nsIURI* aBaseURI, nsIURI** aURI) {
|
||||
return mozilla::net::NewURI(aSpec, aCharset, aBaseURI, NS_HTTP_DEFAULT_PORT,
|
||||
aURI);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHttpHandler::NewChannel(nsIURI* uri, nsILoadInfo* aLoadInfo,
|
||||
nsIChannel** result) {
|
||||
@ -2537,13 +2520,6 @@ nsHttpsHandler::GetProtocolFlags(uint32_t* aProtocolFlags) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHttpsHandler::NewURI(const nsACString& aSpec, const char* aOriginCharset,
|
||||
nsIURI* aBaseURI, nsIURI** _retval) {
|
||||
return mozilla::net::NewURI(aSpec, aOriginCharset, aBaseURI,
|
||||
NS_HTTPS_DEFAULT_PORT, _retval);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHttpsHandler::NewChannel(nsIURI* aURI, nsILoadInfo* aLoadInfo,
|
||||
nsIChannel** _retval) {
|
||||
|
@ -42,8 +42,8 @@ class SubstitutingProtocolHandler {
|
||||
return mSubstitutions.Get(aRoot, nullptr);
|
||||
}
|
||||
|
||||
static nsresult CreateNewURI(const nsACString& aSpec, const char* aCharset,
|
||||
nsIURI* aBaseURI, nsIURI** aResult);
|
||||
nsresult NewURI(const nsACString& aSpec, const char* aCharset,
|
||||
nsIURI* aBaseURI, nsIURI** aResult);
|
||||
|
||||
MOZ_MUST_USE nsresult
|
||||
CollectSubstitutions(InfallibleTArray<SubstitutionMapping>& aResources);
|
||||
|
@ -64,12 +64,6 @@ nsViewSourceHandler::GetFlagsForURI(nsIURI* aURI, uint32_t* result) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsViewSourceHandler::NewURI(const nsACString& aSpec, const char* aCharset,
|
||||
nsIURI* aBaseURI, nsIURI** aResult) {
|
||||
return nsViewSourceHandler::CreateNewURI(aSpec, aCharset, aBaseURI, aResult);
|
||||
}
|
||||
|
||||
// static
|
||||
nsresult nsViewSourceHandler::CreateNewURI(const nsACString& aSpec,
|
||||
const char* aCharset,
|
||||
|
@ -297,24 +297,6 @@ BaseWebSocketChannel::GetProtocolFlags(uint32_t* aProtocolFlags) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
BaseWebSocketChannel::NewURI(const nsACString& aSpec,
|
||||
const char* aOriginCharset, nsIURI* aBaseURI,
|
||||
nsIURI** _retval) {
|
||||
LOG(("BaseWebSocketChannel::NewURI() %p\n", this));
|
||||
|
||||
int32_t port;
|
||||
nsresult rv = GetDefaultPort(&port);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIURI> base(aBaseURI);
|
||||
return NS_MutateURI(new nsStandardURL::Mutator())
|
||||
.Apply(NS_MutatorMethod(&nsIStandardURLMutator::Init,
|
||||
nsIStandardURL::URLTYPE_AUTHORITY, port,
|
||||
nsCString(aSpec), aOriginCharset, base, nullptr))
|
||||
.Finalize(_retval);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
BaseWebSocketChannel::NewChannel(nsIURI* aURI, nsILoadInfo* aLoadInfo,
|
||||
nsIChannel** outChannel) {
|
||||
|
@ -3,7 +3,7 @@
|
||||
* should be able to accept form POST.
|
||||
*/
|
||||
|
||||
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
"use strict";
|
||||
|
||||
const SCHEME = "x-bug1241377";
|
||||
|
||||
@ -31,12 +31,6 @@ CustomProtocolHandler.prototype = {
|
||||
return Ci.nsIProtocolHandler.URI_NORELATIVE |
|
||||
Ci.nsIProtocolHandler.URI_IS_LOCAL_RESOURCE;
|
||||
},
|
||||
newURI: function(aSpec, aOriginCharset, aBaseURI) {
|
||||
return Cc["@mozilla.org/network/standard-url-mutator;1"]
|
||||
.createInstance(Ci.nsIURIMutator)
|
||||
.setSpec(aSpec)
|
||||
.finalize()
|
||||
},
|
||||
newChannel: function(aURI, aLoadInfo) {
|
||||
return new CustomChannel(aURI, aLoadInfo);
|
||||
},
|
||||
|
@ -3,6 +3,7 @@
|
||||
* should not fail for channels of unknown size
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
var contentSecManager = Cc["@mozilla.org/contentsecuritymanager;1"]
|
||||
.getService(Ci.nsIContentSecurityManager);
|
||||
@ -30,9 +31,6 @@ ProtocolHandler.prototype = {
|
||||
Ci.nsIProtocolHandler.URI_NON_PERSISTABLE |
|
||||
Ci.nsIProtocolHandler.URI_SYNC_LOAD_IS_OK;
|
||||
},
|
||||
newURI: function(aSpec, aOriginCharset, aBaseURI) {
|
||||
return this.uri;
|
||||
},
|
||||
newChannel: function(aURI, aLoadInfo) {
|
||||
this.loadInfo = aLoadInfo;
|
||||
return this;
|
||||
|
@ -31,12 +31,6 @@ TestProtocolHandler.prototype = {
|
||||
Ci.nsIProtocolHandler.URI_NORELATIVE |
|
||||
Ci.nsIProtocolHandler.ALLOWS_PROXY |
|
||||
Ci.nsIProtocolHandler.URI_DANGEROUS_TO_LOAD,
|
||||
newURI: function(spec, originCharset, baseURI) {
|
||||
return Cc["@mozilla.org/network/simple-uri-mutator;1"]
|
||||
.createInstance(Ci.nsIURIMutator)
|
||||
.setSpec(spec)
|
||||
.finalize();
|
||||
},
|
||||
newChannel: function(uri, aLoadInfo) {
|
||||
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
|
||||
},
|
||||
|
@ -42,12 +42,6 @@ TestProtocolHandler.prototype = {
|
||||
Ci.nsIProtocolHandler.URI_NORELATIVE |
|
||||
Ci.nsIProtocolHandler.ALLOWS_PROXY |
|
||||
Ci.nsIProtocolHandler.URI_DANGEROUS_TO_LOAD,
|
||||
newURI: function(spec, originCharset, baseURI) {
|
||||
return Cc["@mozilla.org/network/simple-uri-mutator;1"]
|
||||
.createInstance(Ci.nsIURIMutator)
|
||||
.setSpec(spec)
|
||||
.finalize();
|
||||
},
|
||||
newChannel: function(uri, aLoadInfo) {
|
||||
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
|
||||
},
|
||||
|
@ -17,17 +17,6 @@ MozProtocolHandler.prototype = {
|
||||
defaultPort: -1,
|
||||
protocolFlags: Ci.nsIProtocolHandler.URI_DANGEROUS_TO_LOAD,
|
||||
|
||||
newURI(spec, charset, base) {
|
||||
let mutator = Cc["@mozilla.org/network/simple-uri-mutator;1"]
|
||||
.createInstance(Ci.nsIURIMutator);
|
||||
if (base) {
|
||||
mutator.setSpec(base.resolve(spec));
|
||||
} else {
|
||||
mutator.setSpec(spec);
|
||||
}
|
||||
return mutator.finalize();
|
||||
},
|
||||
|
||||
newChannel(uri, loadInfo) {
|
||||
const kCanada = "https://www.mozilla.org/contact/communities/canada/";
|
||||
let realURL = NetUtil.newURI((uri && uri.spec == "moz://eh") ? kCanada : this.urlToLoad);
|
||||
|
@ -69,13 +69,6 @@ PageIconProtocolHandler.prototype = {
|
||||
Ci.nsIProtocolHandler.URI_IS_LOCAL_RESOURCE;
|
||||
},
|
||||
|
||||
newURI(spec, originCharset, baseURI) {
|
||||
return Cc["@mozilla.org/network/simple-uri-mutator;1"]
|
||||
.createInstance(Ci.nsIURIMutator)
|
||||
.setSpec(spec)
|
||||
.finalize();
|
||||
},
|
||||
|
||||
newChannel(uri, loadInfo) {
|
||||
try {
|
||||
// Create a pipe that will give us an output stream that we can use once
|
||||
|
@ -208,18 +208,6 @@ nsAnnoProtocolHandler::GetProtocolFlags(uint32_t* aProtocolFlags) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// nsAnnoProtocolHandler::NewURI
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAnnoProtocolHandler::NewURI(const nsACString& aSpec,
|
||||
const char* aOriginCharset, nsIURI* aBaseURI,
|
||||
nsIURI** _retval) {
|
||||
*_retval = nullptr;
|
||||
return NS_MutateURI(NS_SIMPLEURIMUTATOR_CONTRACTID)
|
||||
.SetSpec(aSpec)
|
||||
.Finalize(_retval);
|
||||
}
|
||||
|
||||
// nsAnnoProtocolHandler::NewChannel
|
||||
//
|
||||
|
||||
|
@ -49,16 +49,6 @@ PageThumbsProtocol::GetProtocolFlags(uint32_t* aProtocolFlags) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// PageThumbsProtocol::NewURI
|
||||
|
||||
NS_IMETHODIMP
|
||||
PageThumbsProtocol::NewURI(const nsACString& aSpec, const char* aOriginCharset,
|
||||
nsIURI* aBaseURI, nsIURI** _retval) {
|
||||
return NS_MutateURI(NS_SIMPLEURIMUTATOR_CONTRACTID)
|
||||
.SetSpec(aSpec)
|
||||
.Finalize(_retval);
|
||||
}
|
||||
|
||||
// PageThumbsProtocol::NewChannel
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -511,15 +511,6 @@ NS_IMETHODIMP nsExternalProtocolHandler::GetProtocolFlags(uint32_t* aUritype) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsExternalProtocolHandler::NewURI(
|
||||
const nsACString& aSpec,
|
||||
const char* aCharset, // ignore charset info
|
||||
nsIURI* aBaseURI, nsIURI** _retval) {
|
||||
return NS_MutateURI(NS_SIMPLEURIMUTATOR_CONTRACTID)
|
||||
.SetSpec(aSpec)
|
||||
.Finalize(_retval);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsExternalProtocolHandler::NewChannel(nsIURI* aURI, nsILoadInfo* aLoadInfo,
|
||||
nsIChannel** aRetval) {
|
||||
|
@ -129,17 +129,6 @@ nsAndroidProtocolHandler::GetProtocolFlags(uint32_t* result) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAndroidProtocolHandler::NewURI(const nsACString& aSpec, const char* aCharset,
|
||||
nsIURI* aBaseURI, nsIURI** result) {
|
||||
nsCOMPtr<nsIURI> base(aBaseURI);
|
||||
return NS_MutateURI(NS_STANDARDURLMUTATOR_CONTRACTID)
|
||||
.Apply(NS_MutatorMethod(&nsIStandardURLMutator::Init,
|
||||
nsIStandardURL::URLTYPE_STANDARD, -1,
|
||||
nsCString(aSpec), aCharset, base, nullptr))
|
||||
.Finalize(result);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAndroidProtocolHandler::NewChannel(nsIURI* aURI, nsILoadInfo* aLoadInfo,
|
||||
nsIChannel** aResult) {
|
||||
|
Loading…
Reference in New Issue
Block a user