зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1528971: Move newChannel2 being the only implementation within nsIProtocolHandler.idl. r=valentin
This commit is contained in:
Родитель
ae9fdeccab
Коммит
cb0d9e21a7
|
@ -92,8 +92,8 @@ nsChromeProtocolHandler::NewURI(const nsACString &aSpec, const char *aCharset,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsChromeProtocolHandler::NewChannel2(nsIURI *aURI, nsILoadInfo *aLoadInfo,
|
||||
nsIChannel **aResult) {
|
||||
nsChromeProtocolHandler::NewChannel(nsIURI *aURI, nsILoadInfo *aLoadInfo,
|
||||
nsIChannel **aResult) {
|
||||
nsresult rv;
|
||||
|
||||
NS_ENSURE_ARG_POINTER(aURI);
|
||||
|
@ -191,9 +191,4 @@ nsChromeProtocolHandler::NewChannel2(nsIURI *aURI, nsILoadInfo *aLoadInfo,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsChromeProtocolHandler::NewChannel(nsIURI *aURI, nsIChannel **aResult) {
|
||||
return NewChannel2(aURI, nullptr, aResult);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -30,7 +30,6 @@ ProtocolHandler.prototype =
|
|||
}
|
||||
return mutator.finalize();
|
||||
},
|
||||
newChannel2() { throw Cr.NS_ERROR_NOT_IMPLEMENTED; },
|
||||
newChannel() { throw Cr.NS_ERROR_NOT_IMPLEMENTED; },
|
||||
QueryInterface: ChromeUtils.generateQI([
|
||||
Ci.nsIProtocolHandler,
|
||||
|
|
|
@ -114,12 +114,9 @@ CustomProtocol.prototype = {
|
|||
.setSpec(spec)
|
||||
.finalize();
|
||||
},
|
||||
newChannel2: function newChannel2(URI, loadInfo) {
|
||||
newChannel: function newChannel2(URI, loadInfo) {
|
||||
return new CustomChannel(URI, loadInfo);
|
||||
},
|
||||
newChannel: function newChannel(URI) {
|
||||
return this.newChannel2(URI);
|
||||
},
|
||||
QueryInterface: ChromeUtils.generateQI([Ci.nsISupportsWeakReference, Ci.nsIProtocolHandler]),
|
||||
};
|
||||
|
||||
|
|
|
@ -765,8 +765,8 @@ BlobURLProtocolHandler::NewURI(const nsACString& aSpec, const char* aCharset,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
BlobURLProtocolHandler::NewChannel2(nsIURI* aURI, nsILoadInfo* aLoadInfo,
|
||||
nsIChannel** aResult) {
|
||||
BlobURLProtocolHandler::NewChannel(nsIURI* aURI, nsILoadInfo* aLoadInfo,
|
||||
nsIChannel** aResult) {
|
||||
RefPtr<BlobURLChannel> channel = new BlobURLChannel(aURI, aLoadInfo);
|
||||
|
||||
auto raii = MakeScopeExit([&] {
|
||||
|
@ -814,11 +814,6 @@ BlobURLProtocolHandler::NewChannel2(nsIURI* aURI, nsILoadInfo* aLoadInfo,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
BlobURLProtocolHandler::NewChannel(nsIURI* uri, nsIChannel** result) {
|
||||
return NewChannel2(uri, nullptr, result);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
BlobURLProtocolHandler::AllowPort(int32_t port, const char* scheme,
|
||||
bool* _retval) {
|
||||
|
|
|
@ -58,13 +58,8 @@ FontTableURIProtocolHandler::GetFlagsForURI(nsIURI *aURI, uint32_t *aResult) {
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
FontTableURIProtocolHandler::NewChannel2(nsIURI *uri, nsILoadInfo *aLoadInfo,
|
||||
nsIChannel **result) {
|
||||
return NS_ERROR_DOM_BAD_URI;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
FontTableURIProtocolHandler::NewChannel(nsIURI *uri, nsIChannel **result) {
|
||||
FontTableURIProtocolHandler::NewChannel(nsIURI *uri, nsILoadInfo *aLoadInfo,
|
||||
nsIChannel **result) {
|
||||
return NS_ERROR_DOM_BAD_URI;
|
||||
}
|
||||
|
||||
|
|
|
@ -1123,8 +1123,8 @@ nsJSProtocolHandler::NewURI(const nsACString& aSpec, const char* aCharset,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJSProtocolHandler::NewChannel2(nsIURI* uri, nsILoadInfo* aLoadInfo,
|
||||
nsIChannel** result) {
|
||||
nsJSProtocolHandler::NewChannel(nsIURI* uri, nsILoadInfo* aLoadInfo,
|
||||
nsIChannel** result) {
|
||||
nsresult rv;
|
||||
|
||||
NS_ENSURE_ARG_POINTER(uri);
|
||||
|
@ -1142,11 +1142,6 @@ nsJSProtocolHandler::NewChannel2(nsIURI* uri, nsILoadInfo* aLoadInfo,
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJSProtocolHandler::NewChannel(nsIURI* uri, nsIChannel** result) {
|
||||
return NewChannel2(uri, nullptr, result);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJSProtocolHandler::AllowPort(int32_t port, const char* scheme,
|
||||
bool* _retval) {
|
||||
|
|
|
@ -64,8 +64,8 @@ nsIconProtocolHandler::NewURI(const nsACString& aSpec,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsIconProtocolHandler::NewChannel2(nsIURI* url, nsILoadInfo* aLoadInfo,
|
||||
nsIChannel** result) {
|
||||
nsIconProtocolHandler::NewChannel(nsIURI* url, nsILoadInfo* aLoadInfo,
|
||||
nsIChannel** result) {
|
||||
NS_ENSURE_ARG_POINTER(url);
|
||||
nsIconChannel* channel = new nsIconChannel;
|
||||
if (!channel) {
|
||||
|
@ -90,9 +90,4 @@ nsIconProtocolHandler::NewChannel2(nsIURI* url, nsILoadInfo* aLoadInfo,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsIconProtocolHandler::NewChannel(nsIURI* url, nsIChannel** result) {
|
||||
return NewChannel2(url, nullptr, result);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -106,8 +106,8 @@ nsJARProtocolHandler::NewURI(const nsACString &aSpec, const char *aCharset,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARProtocolHandler::NewChannel2(nsIURI *uri, nsILoadInfo *aLoadInfo,
|
||||
nsIChannel **result) {
|
||||
nsJARProtocolHandler::NewChannel(nsIURI *uri, nsILoadInfo *aLoadInfo,
|
||||
nsIChannel **result) {
|
||||
nsJARChannel *chan = new nsJARChannel();
|
||||
if (!chan) return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(chan);
|
||||
|
@ -129,11 +129,6 @@ nsJARProtocolHandler::NewChannel2(nsIURI *uri, nsILoadInfo *aLoadInfo,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARProtocolHandler::NewChannel(nsIURI *uri, nsIChannel **result) {
|
||||
return NewChannel2(uri, nullptr, result);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARProtocolHandler::AllowPort(int32_t port, const char *scheme,
|
||||
bool *_retval) {
|
||||
|
|
|
@ -921,21 +921,13 @@ nsresult nsIOService::NewChannelFromURIWithProxyFlagsInternal(
|
|||
rv = handler->DoGetProtocolFlags(aURI, &protoFlags);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// Ideally we are creating new channels by calling NewChannel2
|
||||
// (NewProxiedChannel2). Keep in mind that Addons can implement their own
|
||||
// Protocolhandlers, hence NewChannel2() might *not* be implemented. We do not
|
||||
// want to break those addons, therefore we first try to create a channel
|
||||
// calling NewChannel2(); if that fails:
|
||||
// * we fall back to creating a channel by calling NewChannel()
|
||||
// * wrap the addon channel
|
||||
// * and attach the loadInfo to the channel wrapper
|
||||
nsCOMPtr<nsIChannel> channel;
|
||||
nsCOMPtr<nsIProxiedProtocolHandler> pph = do_QueryInterface(handler);
|
||||
if (pph) {
|
||||
rv = pph->NewProxiedChannel2(aURI, nullptr, aProxyFlags, aProxyURI,
|
||||
aLoadInfo, getter_AddRefs(channel));
|
||||
} else {
|
||||
rv = handler->NewChannel2(aURI, aLoadInfo, getter_AddRefs(channel));
|
||||
rv = handler->NewChannel(aURI, aLoadInfo, getter_AddRefs(channel));
|
||||
}
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
|
|
@ -113,12 +113,7 @@ interface nsIProtocolHandler : nsISupports
|
|||
* Constructs a new channel from the given URI for this protocol handler and
|
||||
* sets the loadInfo for the constructed channel.
|
||||
*/
|
||||
nsIChannel newChannel2(in nsIURI aURI, in nsILoadInfo aLoadinfo);
|
||||
|
||||
/**
|
||||
* Constructs a new channel from the given URI for this protocol handler.
|
||||
*/
|
||||
nsIChannel newChannel(in nsIURI aURI);
|
||||
nsIChannel newChannel(in nsIURI aURI, in nsILoadInfo aLoadinfo);
|
||||
|
||||
/**
|
||||
* Allows a protocol to override blacklisted ports.
|
||||
|
|
|
@ -159,8 +159,8 @@ nsAboutProtocolHandler::NewURI(const nsACString &aSpec,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAboutProtocolHandler::NewChannel2(nsIURI *uri, nsILoadInfo *aLoadInfo,
|
||||
nsIChannel **result) {
|
||||
nsAboutProtocolHandler::NewChannel(nsIURI *uri, nsILoadInfo *aLoadInfo,
|
||||
nsIChannel **result) {
|
||||
NS_ENSURE_ARG_POINTER(uri);
|
||||
|
||||
// about:what you ask?
|
||||
|
@ -261,11 +261,6 @@ nsAboutProtocolHandler::NewChannel2(nsIURI *uri, nsILoadInfo *aLoadInfo,
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAboutProtocolHandler::NewChannel(nsIURI *uri, nsIChannel **result) {
|
||||
return NewChannel2(uri, nullptr, result);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAboutProtocolHandler::AllowPort(int32_t port, const char *scheme,
|
||||
bool *_retval) {
|
||||
|
@ -315,14 +310,8 @@ nsSafeAboutProtocolHandler::NewURI(const nsACString &aSpec,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSafeAboutProtocolHandler::NewChannel2(nsIURI *uri, nsILoadInfo *aLoadInfo,
|
||||
nsIChannel **result) {
|
||||
*result = nullptr;
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSafeAboutProtocolHandler::NewChannel(nsIURI *uri, nsIChannel **result) {
|
||||
nsSafeAboutProtocolHandler::NewChannel(nsIURI *uri, nsILoadInfo *aLoadInfo,
|
||||
nsIChannel **result) {
|
||||
*result = nullptr;
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
|
|
@ -94,8 +94,8 @@ nsDataHandler::NewURI(const nsACString& aSpec,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDataHandler::NewChannel2(nsIURI* uri, nsILoadInfo* aLoadInfo,
|
||||
nsIChannel** result) {
|
||||
nsDataHandler::NewChannel(nsIURI* uri, nsILoadInfo* aLoadInfo,
|
||||
nsIChannel** result) {
|
||||
NS_ENSURE_ARG_POINTER(uri);
|
||||
nsDataChannel* channel;
|
||||
if (XRE_IsParentProcess()) {
|
||||
|
@ -122,11 +122,6 @@ nsDataHandler::NewChannel2(nsIURI* uri, nsILoadInfo* aLoadInfo,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDataHandler::NewChannel(nsIURI* uri, nsIChannel** result) {
|
||||
return NewChannel2(uri, nullptr, result);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDataHandler::AllowPort(int32_t port, const char* scheme, bool* _retval) {
|
||||
// don't override anything.
|
||||
|
|
|
@ -164,8 +164,8 @@ nsFileProtocolHandler::NewURI(const nsACString &spec, const char *charset,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFileProtocolHandler::NewChannel2(nsIURI *uri, nsILoadInfo *aLoadInfo,
|
||||
nsIChannel **result) {
|
||||
nsFileProtocolHandler::NewChannel(nsIURI *uri, nsILoadInfo *aLoadInfo,
|
||||
nsIChannel **result) {
|
||||
nsresult rv;
|
||||
|
||||
nsFileChannel *chan;
|
||||
|
@ -196,11 +196,6 @@ nsFileProtocolHandler::NewChannel2(nsIURI *uri, nsILoadInfo *aLoadInfo,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFileProtocolHandler::NewChannel(nsIURI *uri, nsIChannel **result) {
|
||||
return NewChannel2(uri, nullptr, result);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFileProtocolHandler::AllowPort(int32_t port, const char *scheme,
|
||||
bool *result) {
|
||||
|
|
|
@ -171,16 +171,11 @@ nsFtpProtocolHandler::NewURI(const nsACString &aSpec, const char *aCharset,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFtpProtocolHandler::NewChannel2(nsIURI *url, nsILoadInfo *aLoadInfo,
|
||||
nsIChannel **result) {
|
||||
nsFtpProtocolHandler::NewChannel(nsIURI *url, nsILoadInfo *aLoadInfo,
|
||||
nsIChannel **result) {
|
||||
return NewProxiedChannel2(url, nullptr, 0, nullptr, aLoadInfo, result);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFtpProtocolHandler::NewChannel(nsIURI *url, nsIChannel **result) {
|
||||
return NewChannel2(url, nullptr, result);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFtpProtocolHandler::NewProxiedChannel2(nsIURI *uri, nsIProxyInfo *proxyInfo,
|
||||
uint32_t proxyResolveFlags,
|
||||
|
|
|
@ -965,8 +965,8 @@ nsGIOProtocolHandler::NewURI(const nsACString &aSpec,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsGIOProtocolHandler::NewChannel2(nsIURI *aURI, nsILoadInfo *aLoadInfo,
|
||||
nsIChannel **aResult) {
|
||||
nsGIOProtocolHandler::NewChannel(nsIURI *aURI, nsILoadInfo *aLoadInfo,
|
||||
nsIChannel **aResult) {
|
||||
NS_ENSURE_ARG_POINTER(aURI);
|
||||
nsresult rv;
|
||||
|
||||
|
@ -991,11 +991,6 @@ nsGIOProtocolHandler::NewChannel2(nsIURI *aURI, nsILoadInfo *aLoadInfo,
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsGIOProtocolHandler::NewChannel(nsIURI *aURI, nsIChannel **aResult) {
|
||||
return NewChannel2(aURI, nullptr, aResult);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsGIOProtocolHandler::AllowPort(int32_t aPort, const char *aScheme,
|
||||
bool *aResult) {
|
||||
|
|
|
@ -3667,7 +3667,7 @@ nsresult nsHttpChannel::ProcessFallback(bool *waitingForRedirectCallback) {
|
|||
|
||||
// Create a new channel to load the fallback entry.
|
||||
RefPtr<nsIChannel> newChannel;
|
||||
rv = gHttpHandler->NewChannel2(mURI, mLoadInfo, getter_AddRefs(newChannel));
|
||||
rv = gHttpHandler->NewChannel(mURI, mLoadInfo, getter_AddRefs(newChannel));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
uint32_t redirectFlags = nsIChannelEventSink::REDIRECT_INTERNAL;
|
||||
|
|
|
@ -2026,8 +2026,8 @@ nsHttpHandler::NewURI(const nsACString &aSpec, const char *aCharset,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHttpHandler::NewChannel2(nsIURI *uri, nsILoadInfo *aLoadInfo,
|
||||
nsIChannel **result) {
|
||||
nsHttpHandler::NewChannel(nsIURI *uri, nsILoadInfo *aLoadInfo,
|
||||
nsIChannel **result) {
|
||||
LOG(("nsHttpHandler::NewChannel\n"));
|
||||
|
||||
NS_ENSURE_ARG_POINTER(uri);
|
||||
|
@ -2050,11 +2050,6 @@ nsHttpHandler::NewChannel2(nsIURI *uri, nsILoadInfo *aLoadInfo,
|
|||
return NewProxiedChannel2(uri, nullptr, 0, nullptr, aLoadInfo, result);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHttpHandler::NewChannel(nsIURI *uri, nsIChannel **result) {
|
||||
return NewChannel2(uri, nullptr, result);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHttpHandler::AllowPort(int32_t port, const char *scheme, bool *_retval) {
|
||||
// don't override anything.
|
||||
|
@ -2563,16 +2558,11 @@ nsHttpsHandler::NewURI(const nsACString &aSpec, const char *aOriginCharset,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHttpsHandler::NewChannel2(nsIURI *aURI, nsILoadInfo *aLoadInfo,
|
||||
nsIChannel **_retval) {
|
||||
nsHttpsHandler::NewChannel(nsIURI *aURI, nsILoadInfo *aLoadInfo,
|
||||
nsIChannel **_retval) {
|
||||
MOZ_ASSERT(gHttpHandler);
|
||||
if (!gHttpHandler) return NS_ERROR_UNEXPECTED;
|
||||
return gHttpHandler->NewChannel2(aURI, aLoadInfo, _retval);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHttpsHandler::NewChannel(nsIURI *aURI, nsIChannel **_retval) {
|
||||
return NewChannel2(aURI, nullptr, _retval);
|
||||
return gHttpHandler->NewChannel(aURI, aLoadInfo, _retval);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -226,9 +226,9 @@ nsresult SubstitutingProtocolHandler::NewURI(const nsACString& aSpec,
|
|||
.Finalize(result);
|
||||
}
|
||||
|
||||
nsresult SubstitutingProtocolHandler::NewChannel2(nsIURI* uri,
|
||||
nsILoadInfo* aLoadInfo,
|
||||
nsIChannel** result) {
|
||||
nsresult SubstitutingProtocolHandler::NewChannel(nsIURI* uri,
|
||||
nsILoadInfo* aLoadInfo,
|
||||
nsIChannel** result) {
|
||||
NS_ENSURE_ARG_POINTER(uri);
|
||||
NS_ENSURE_ARG_POINTER(aLoadInfo);
|
||||
|
||||
|
@ -259,11 +259,6 @@ nsresult SubstitutingProtocolHandler::NewChannel2(nsIURI* uri,
|
|||
return SubstituteChannel(uri, aLoadInfo, result);
|
||||
}
|
||||
|
||||
nsresult SubstitutingProtocolHandler::NewChannel(nsIURI* uri,
|
||||
nsIChannel** result) {
|
||||
return NewChannel2(uri, nullptr, result);
|
||||
}
|
||||
|
||||
nsresult SubstitutingProtocolHandler::AllowPort(int32_t port,
|
||||
const char* scheme,
|
||||
bool* _retval) {
|
||||
|
|
|
@ -102,8 +102,8 @@ nsViewSourceHandler::NewURI(const nsACString &aSpec, const char *aCharset,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsViewSourceHandler::NewChannel2(nsIURI *uri, nsILoadInfo *aLoadInfo,
|
||||
nsIChannel **result) {
|
||||
nsViewSourceHandler::NewChannel(nsIURI *uri, nsILoadInfo *aLoadInfo,
|
||||
nsIChannel **result) {
|
||||
NS_ENSURE_ARG_POINTER(uri);
|
||||
nsViewSourceChannel *channel = new nsViewSourceChannel();
|
||||
if (!channel) return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
@ -126,11 +126,6 @@ nsViewSourceHandler::NewChannel2(nsIURI *uri, nsILoadInfo *aLoadInfo,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsViewSourceHandler::NewChannel(nsIURI *uri, nsIChannel **result) {
|
||||
return NewChannel2(uri, nullptr, result);
|
||||
}
|
||||
|
||||
nsresult nsViewSourceHandler::NewSrcdocChannel(nsIURI *aURI, nsIURI *aBaseURI,
|
||||
const nsAString &aSrcdoc,
|
||||
nsILoadInfo *aLoadInfo,
|
||||
|
|
|
@ -293,14 +293,8 @@ BaseWebSocketChannel::NewURI(const nsACString &aSpec,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
BaseWebSocketChannel::NewChannel2(nsIURI *aURI, nsILoadInfo *aLoadInfo,
|
||||
nsIChannel **outChannel) {
|
||||
LOG(("BaseWebSocketChannel::NewChannel2() %p\n", this));
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
BaseWebSocketChannel::NewChannel(nsIURI *aURI, nsIChannel **_retval) {
|
||||
BaseWebSocketChannel::NewChannel(nsIURI *aURI, nsILoadInfo *aLoadInfo,
|
||||
nsIChannel **outChannel) {
|
||||
LOG(("BaseWebSocketChannel::NewChannel() %p\n", this));
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
|
|
@ -66,8 +66,8 @@ nsWyciwygProtocolHandler::NewURI(const nsACString &aSpec,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWyciwygProtocolHandler::NewChannel2(nsIURI *url, nsILoadInfo *aLoadInfo,
|
||||
nsIChannel **result) {
|
||||
nsWyciwygProtocolHandler::NewChannel(nsIURI *url, nsILoadInfo *aLoadInfo,
|
||||
nsIChannel **result) {
|
||||
if (mozilla::net::IsNeckoChild()) mozilla::net::NeckoChild::InitNeckoChild();
|
||||
|
||||
NS_ENSURE_ARG_POINTER(url);
|
||||
|
@ -120,11 +120,6 @@ nsWyciwygProtocolHandler::NewChannel2(nsIURI *url, nsILoadInfo *aLoadInfo,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWyciwygProtocolHandler::NewChannel(nsIURI *url, nsIChannel **result) {
|
||||
return NewChannel2(url, nullptr, result);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsWyciwygProtocolHandler::GetProtocolFlags(uint32_t *result) {
|
||||
// Should this be an an nsINestedURI? We don't really want random webpages
|
||||
|
|
|
@ -37,12 +37,9 @@ CustomProtocolHandler.prototype = {
|
|||
.setSpec(aSpec)
|
||||
.finalize()
|
||||
},
|
||||
newChannel2: function(aURI, aLoadInfo) {
|
||||
newChannel: function(aURI, aLoadInfo) {
|
||||
return new CustomChannel(aURI, aLoadInfo);
|
||||
},
|
||||
newChannel: function(aURI) {
|
||||
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
|
||||
},
|
||||
allowPort: function(port, scheme) {
|
||||
return port != -1;
|
||||
},
|
||||
|
|
|
@ -34,13 +34,10 @@ ProtocolHandler.prototype = {
|
|||
newURI: function(aSpec, aOriginCharset, aBaseURI) {
|
||||
return this.uri;
|
||||
},
|
||||
newChannel2: function(aURI, aLoadInfo) {
|
||||
newChannel: function(aURI, aLoadInfo) {
|
||||
this.loadInfo = aLoadInfo;
|
||||
return this;
|
||||
},
|
||||
newChannel: function(aURI) {
|
||||
return this;
|
||||
},
|
||||
allowPort: function(port, scheme) {
|
||||
return port != -1;
|
||||
},
|
||||
|
|
|
@ -43,10 +43,7 @@ TestProtocolHandler.prototype = {
|
|||
.setSpec(spec)
|
||||
.finalize();
|
||||
},
|
||||
newChannel2: function(uri, aLoadInfo) {
|
||||
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
|
||||
},
|
||||
newChannel: function(uri) {
|
||||
newChannel: function(uri, aLoadInfo) {
|
||||
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
|
||||
},
|
||||
allowPort: function(port, scheme) {
|
||||
|
|
|
@ -54,10 +54,7 @@ TestProtocolHandler.prototype = {
|
|||
.setSpec(spec)
|
||||
.finalize();
|
||||
},
|
||||
newChannel2: function(uri, aLoadInfo) {
|
||||
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
|
||||
},
|
||||
newChannel: function(uri) {
|
||||
newChannel: function(uri, aLoadInfo) {
|
||||
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
|
||||
},
|
||||
allowPort: function(port, scheme) {
|
||||
|
|
|
@ -28,7 +28,7 @@ MozProtocolHandler.prototype = {
|
|||
return mutator.finalize();
|
||||
},
|
||||
|
||||
newChannel2(uri, loadInfo) {
|
||||
newChannel(uri, loadInfo) {
|
||||
const kCanada = "https://www.mozilla.org/contact/communities/canada/";
|
||||
let realURL = NetUtil.newURI((uri && uri.spec == "moz://eh") ? kCanada : this.urlToLoad);
|
||||
let channel = Services.io.newChannelFromURIWithLoadInfo(realURL, loadInfo);
|
||||
|
@ -36,10 +36,6 @@ MozProtocolHandler.prototype = {
|
|||
return channel;
|
||||
},
|
||||
|
||||
newChannel(uri) {
|
||||
return this.newChannel2(uri, null);
|
||||
},
|
||||
|
||||
QueryInterface: ChromeUtils.generateQI([Ci.nsIProtocolHandler]),
|
||||
};
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ PageIconProtocolHandler.prototype = {
|
|||
.finalize();
|
||||
},
|
||||
|
||||
newChannel2(uri, loadInfo) {
|
||||
newChannel(uri, loadInfo) {
|
||||
try {
|
||||
// Create a pipe that will give us an output stream that we can use once
|
||||
// we got all the favicon data.
|
||||
|
@ -114,10 +114,6 @@ PageIconProtocolHandler.prototype = {
|
|||
}
|
||||
},
|
||||
|
||||
newChannel(uri) {
|
||||
return this.newChannel2(uri, null);
|
||||
},
|
||||
|
||||
allowPort(port, scheme) {
|
||||
return false;
|
||||
},
|
||||
|
|
|
@ -224,8 +224,8 @@ nsAnnoProtocolHandler::NewURI(const nsACString &aSpec,
|
|||
//
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAnnoProtocolHandler::NewChannel2(nsIURI *aURI, nsILoadInfo *aLoadInfo,
|
||||
nsIChannel **_retval) {
|
||||
nsAnnoProtocolHandler::NewChannel(nsIURI *aURI, nsILoadInfo *aLoadInfo,
|
||||
nsIChannel **_retval) {
|
||||
NS_ENSURE_ARG_POINTER(aURI);
|
||||
|
||||
// annotation info
|
||||
|
@ -241,11 +241,6 @@ nsAnnoProtocolHandler::NewChannel2(nsIURI *aURI, nsILoadInfo *aLoadInfo,
|
|||
return NewFaviconChannel(aURI, annoURI, aLoadInfo, _retval);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAnnoProtocolHandler::NewChannel(nsIURI *aURI, nsIChannel **_retval) {
|
||||
return NewChannel2(aURI, nullptr, _retval);
|
||||
}
|
||||
|
||||
// nsAnnoProtocolHandler::AllowPort
|
||||
//
|
||||
// Don't override any bans on bad ports.
|
||||
|
|
|
@ -519,7 +519,7 @@ nsFaviconService::ReplaceFaviconDataFromDataURL(
|
|||
nsIContentPolicy::TYPE_INTERNAL_IMAGE_FAVICON);
|
||||
|
||||
nsCOMPtr<nsIChannel> channel;
|
||||
rv = protocolHandler->NewChannel2(dataURI, loadInfo, getter_AddRefs(channel));
|
||||
rv = protocolHandler->NewChannel(dataURI, loadInfo, getter_AddRefs(channel));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Blocking stream is OK for data URIs.
|
||||
|
|
|
@ -62,8 +62,8 @@ PageThumbsProtocol::NewURI(const nsACString& aSpec, const char* aOriginCharset,
|
|||
// PageThumbsProtocol::NewChannel
|
||||
|
||||
NS_IMETHODIMP
|
||||
PageThumbsProtocol::NewChannel2(nsIURI* aURI, nsILoadInfo* aLoadInfo,
|
||||
nsIChannel** _retval) {
|
||||
PageThumbsProtocol::NewChannel(nsIURI* aURI, nsILoadInfo* aLoadInfo,
|
||||
nsIChannel** _retval) {
|
||||
// Get the file path for the URL
|
||||
nsCOMPtr<nsIFile> filePath;
|
||||
nsresult rv = GetFilePathForURL(aURI, getter_AddRefs(filePath));
|
||||
|
@ -86,11 +86,6 @@ PageThumbsProtocol::NewChannel2(nsIURI* aURI, nsILoadInfo* aLoadInfo,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PageThumbsProtocol::NewChannel(nsIURI* aURI, nsIChannel** _retval) {
|
||||
return NewChannel2(aURI, nullptr, _retval);
|
||||
}
|
||||
|
||||
// PageThumbsProtocol::AllowPort
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
"use strict";
|
||||
|
||||
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
const {NetUtil} = ChromeUtils.import("resource://gre/modules/NetUtil.jsm");
|
||||
|
||||
// need profile so that PageThumbsStorageService can resolve the path to the underlying file
|
||||
do_get_profile();
|
||||
|
@ -11,16 +12,21 @@ function run_test() {
|
|||
ok(handler instanceof Ci.nsIProtocolHandler,
|
||||
"moz-page-thumb handler provides a protocol handler interface");
|
||||
|
||||
// create a dummy loadinfo which we can hand to newChannel.
|
||||
let dummyURI = Services.io.newURI("https://www.example.com/1");
|
||||
let dummyChannel = NetUtil.newChannel({uri: dummyURI, loadUsingSystemPrincipal: true});
|
||||
let dummyLoadInfo = dummyChannel.loadInfo;
|
||||
|
||||
// and check that the error cases work as specified
|
||||
let badhost = Services.io.newURI("moz-page-thumb://wronghost/?url=http%3A%2F%2Fwww.mozilla.org%2F");
|
||||
Assert.throws(() => handler.newChannel(badhost), /NS_ERROR_NOT_AVAILABLE/i,
|
||||
Assert.throws(() => handler.newChannel(badhost, dummyLoadInfo), /NS_ERROR_NOT_AVAILABLE/i,
|
||||
"moz-page-thumb object with wrong host must not resolve to a file path");
|
||||
|
||||
let badQuery = Services.io.newURI("moz-page-thumb://thumbnail/http%3A%2F%2Fwww.mozilla.org%2F");
|
||||
Assert.throws(() => handler.newChannel(badQuery), /NS_ERROR_MALFORMED_URI/i,
|
||||
Assert.throws(() => handler.newChannel(badQuery, dummyLoadInfo), /NS_ERROR_MALFORMED_URI/i,
|
||||
"moz-page-thumb object with malformed query parameters must not resolve to a file path");
|
||||
|
||||
let noURL = Services.io.newURI("moz-page-thumb://thumbnail/?badStuff");
|
||||
Assert.throws(() => handler.newChannel(noURL), /NS_ERROR_NOT_AVAILABLE/i,
|
||||
Assert.throws(() => handler.newChannel(noURL, dummyLoadInfo), /NS_ERROR_NOT_AVAILABLE/i,
|
||||
"moz-page-thumb object without a URL parameter must not resolve to a file path");
|
||||
}
|
||||
|
|
|
@ -515,8 +515,8 @@ NS_IMETHODIMP nsExternalProtocolHandler::NewURI(
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsExternalProtocolHandler::NewChannel2(nsIURI *aURI, nsILoadInfo *aLoadInfo,
|
||||
nsIChannel **aRetval) {
|
||||
nsExternalProtocolHandler::NewChannel(nsIURI *aURI, nsILoadInfo *aLoadInfo,
|
||||
nsIChannel **aRetval) {
|
||||
NS_ENSURE_TRUE(aURI, NS_ERROR_UNKNOWN_PROTOCOL);
|
||||
NS_ENSURE_TRUE(aRetval, NS_ERROR_UNKNOWN_PROTOCOL);
|
||||
|
||||
|
@ -533,11 +533,6 @@ nsExternalProtocolHandler::NewChannel2(nsIURI *aURI, nsILoadInfo *aLoadInfo,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsExternalProtocolHandler::NewChannel(nsIURI *aURI,
|
||||
nsIChannel **_retval) {
|
||||
return NewChannel2(aURI, nullptr, _retval);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
// External protocol handler interface implementation
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -141,8 +141,8 @@ nsAndroidProtocolHandler::NewURI(const nsACString &aSpec, const char *aCharset,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAndroidProtocolHandler::NewChannel2(nsIURI *aURI, nsILoadInfo *aLoadInfo,
|
||||
nsIChannel **aResult) {
|
||||
nsAndroidProtocolHandler::NewChannel(nsIURI *aURI, nsILoadInfo *aLoadInfo,
|
||||
nsIChannel **aResult) {
|
||||
nsCOMPtr<nsIChannel> channel = AndroidChannel::CreateChannel(aURI);
|
||||
if (!channel) return NS_ERROR_FAILURE;
|
||||
|
||||
|
@ -153,8 +153,3 @@ nsAndroidProtocolHandler::NewChannel2(nsIURI *aURI, nsILoadInfo *aLoadInfo,
|
|||
NS_ADDREF(*aResult = channel);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAndroidProtocolHandler::NewChannel(nsIURI *aURI, nsIChannel **aResult) {
|
||||
return NewChannel2(aURI, nullptr, aResult);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче