зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1530685 - Part 3: Remove nsIJARProtocolHandler; r=valentin
This is an unneeded scriptable interface. Since we no longer have XPCOM add-ons, we can know statically that nsJARProtocolHandler will be handling the jar protocol, so there is no need for ascertaining this at runtime. Depends on D21223 Differential Revision: https://phabricator.services.mozilla.com/D21224 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
b98f05904d
Коммит
f300d392ff
|
@ -16,7 +16,6 @@ XPCSHELL_TESTS_MANIFESTS += ['test/unit/xpcshell.ini']
|
|||
|
||||
XPIDL_SOURCES += [
|
||||
'nsIJARChannel.idl',
|
||||
'nsIJARProtocolHandler.idl',
|
||||
'nsIJARURI.idl',
|
||||
'nsIZipReader.idl',
|
||||
]
|
||||
|
@ -24,6 +23,7 @@ XPIDL_SOURCES += [
|
|||
XPIDL_MODULE = 'jar'
|
||||
|
||||
EXPORTS += [
|
||||
'nsJARProtocolHandler.h',
|
||||
'nsJARURI.h',
|
||||
'nsZipArchive.h',
|
||||
'zipstruct.h',
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsIProtocolHandler.idl"
|
||||
|
||||
interface nsIZipReaderCache;
|
||||
|
||||
[scriptable, uuid(92c3b42c-98c4-11d3-8cd9-0060b0fc14a3)]
|
||||
interface nsIJARProtocolHandler : nsIProtocolHandler {
|
||||
|
||||
/**
|
||||
* JARCache contains the collection of open jar files.
|
||||
*/
|
||||
readonly attribute nsIZipReaderCache JARCache;
|
||||
};
|
|
@ -27,6 +27,7 @@
|
|||
#include "private/pprio.h"
|
||||
#include "nsInputStreamPump.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsJARProtocolHandler.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::net;
|
||||
|
@ -949,12 +950,10 @@ nsJARChannel::EnsureCached(bool *aIsCached) {
|
|||
rv = ioService->GetProtocolHandler("jar", getter_AddRefs(handler));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIJARProtocolHandler> jarHandler = do_QueryInterface(handler);
|
||||
auto jarHandler = static_cast<nsJARProtocolHandler *>(handler.get());
|
||||
MOZ_ASSERT(jarHandler);
|
||||
|
||||
nsCOMPtr<nsIZipReaderCache> jarCache;
|
||||
rv = jarHandler->GetJARCache(getter_AddRefs(jarCache));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsIZipReaderCache *jarCache = jarHandler->JarCache();
|
||||
|
||||
rv = jarCache->GetZipIfCached(jarFile, getter_AddRefs(mPreCachedJarReader));
|
||||
if (rv == NS_ERROR_CACHE_KEY_NOT_FOUND) {
|
||||
|
|
|
@ -47,8 +47,8 @@ nsIMIMEService *nsJARProtocolHandler::MimeService() {
|
|||
return mMimeService.get();
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsJARProtocolHandler, nsIJARProtocolHandler,
|
||||
nsIProtocolHandler, nsISupportsWeakReference)
|
||||
NS_IMPL_ISUPPORTS(nsJARProtocolHandler, nsIProtocolHandler,
|
||||
nsISupportsWeakReference)
|
||||
|
||||
already_AddRefed<nsJARProtocolHandler> nsJARProtocolHandler::GetSingleton() {
|
||||
if (!gJarHandler) {
|
||||
|
@ -62,13 +62,6 @@ already_AddRefed<nsJARProtocolHandler> nsJARProtocolHandler::GetSingleton() {
|
|||
return do_AddRef(gJarHandler);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJARProtocolHandler::GetJARCache(nsIZipReaderCache **result) {
|
||||
*result = mJARCache;
|
||||
NS_ADDREF(*result);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsIProtocolHandler methods:
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#define nsJARProtocolHandler_h__
|
||||
|
||||
#include "mozilla/StaticPtr.h"
|
||||
#include "nsIJARProtocolHandler.h"
|
||||
#include "nsIProtocolHandler.h"
|
||||
#include "nsIJARURI.h"
|
||||
#include "nsIZipReader.h"
|
||||
|
@ -15,12 +14,11 @@
|
|||
#include "nsWeakReference.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
class nsJARProtocolHandler final : public nsIJARProtocolHandler,
|
||||
class nsJARProtocolHandler final : public nsIProtocolHandler,
|
||||
public nsSupportsWeakReference {
|
||||
public:
|
||||
NS_DECL_THREADSAFE_ISUPPORTS
|
||||
NS_DECL_NSIPROTOCOLHANDLER
|
||||
NS_DECL_NSIJARPROTOCOLHANDLER
|
||||
|
||||
// nsJARProtocolHandler methods:
|
||||
nsJARProtocolHandler();
|
||||
|
@ -31,7 +29,7 @@ class nsJARProtocolHandler final : public nsIJARProtocolHandler,
|
|||
|
||||
// returns non addref'ed pointer.
|
||||
nsIMIMEService *MimeService();
|
||||
nsIZipReaderCache *JarCache() { return mJARCache; }
|
||||
nsIZipReaderCache *JarCache() const { return mJARCache; }
|
||||
|
||||
protected:
|
||||
virtual ~nsJARProtocolHandler();
|
||||
|
|
|
@ -32,10 +32,10 @@
|
|||
#include "nsIDOMWindowUtils.h" // for nsIJSRAIIHelper
|
||||
#include "nsIFileURL.h"
|
||||
#include "nsIIOService.h"
|
||||
#include "nsIJARProtocolHandler.h"
|
||||
#include "nsIJARURI.h"
|
||||
#include "nsIStringEnumerator.h"
|
||||
#include "nsIZipReader.h"
|
||||
#include "nsJARProtocolHandler.h"
|
||||
#include "nsJSUtils.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
|
@ -191,12 +191,10 @@ static Result<nsCOMPtr<nsIZipReaderCache>, nsresult> GetJarCache() {
|
|||
nsCOMPtr<nsIProtocolHandler> jarProto;
|
||||
MOZ_TRY(ios->GetProtocolHandler("jar", getter_AddRefs(jarProto)));
|
||||
|
||||
nsCOMPtr<nsIJARProtocolHandler> jar = do_QueryInterface(jarProto);
|
||||
auto jar = static_cast<nsJARProtocolHandler*>(jarProto.get());
|
||||
MOZ_ASSERT(jar);
|
||||
|
||||
nsCOMPtr<nsIZipReaderCache> zipCache;
|
||||
MOZ_TRY(jar->GetJARCache(getter_AddRefs(zipCache)));
|
||||
|
||||
nsCOMPtr<nsIZipReaderCache> zipCache = jar->JarCache();
|
||||
return std::move(zipCache);
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче