зеркало из https://github.com/mozilla/gecko-dev.git
Bug 833098: Part 1 - Remove dead code in xpfe directory viewer. r=Mossop
Most of this module is dead code, intended to convert directory listings into RDF data sources for a XUL front-end which no longer exists. Rather than keep the remaining code which still has any effect, I opted to just replace it with a JS stub, which winds up being much simpler. MozReview-Commit-ID: CiBpV0mrOo0 --HG-- extra : source : 2ea9f1f5269ed5291275a174a633b23dc92667de extra : histedit_source : fdc195bff4684a84f610b90c0d9820b860c5ff40
This commit is contained in:
Родитель
c9334a34ed
Коммит
53c3d346c3
|
@ -2020,12 +2020,6 @@ pref("network.standard-url.punycode-host", true);
|
|||
// Idle timeout for ftp control connections - 5 minute default
|
||||
pref("network.ftp.idleConnectionTimeout", 300);
|
||||
|
||||
// directory listing format
|
||||
// 2: HTML
|
||||
// 3: XUL directory viewer
|
||||
// all other values are treated like 2
|
||||
pref("network.dir.format", 2);
|
||||
|
||||
// enables the prefetch service (i.e., prefetching of <link rel="next"> and
|
||||
// <link rel="prefetch"> URLs).
|
||||
pref("network.prefetch-next", true);
|
||||
|
|
|
@ -21,6 +21,11 @@ ChromeUtils.defineModuleGetter(this, "NetUtil",
|
|||
ChromeUtils.defineModuleGetter(this, "Services",
|
||||
"resource://gre/modules/Services.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "catMan", "@mozilla.org/categorymanager;1",
|
||||
"nsICategoryManager");
|
||||
XPCOMUtils.defineLazyServiceGetter(this, "streamConv", "@mozilla.org/streamConverters;1",
|
||||
"nsIStreamConverterService");
|
||||
|
||||
/*
|
||||
* This class provides a stream filter for locale messages in CSS files served
|
||||
* by the moz-extension: protocol handler.
|
||||
|
@ -111,4 +116,32 @@ AddonLocalizationConverter.prototype = {
|
|||
},
|
||||
};
|
||||
|
||||
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([AddonLocalizationConverter]);
|
||||
function HttpIndexViewer() {
|
||||
}
|
||||
|
||||
HttpIndexViewer.prototype = {
|
||||
classID: Components.ID("{742ad274-34c5-43d1-a8b7-293eaf8962d6}"),
|
||||
QueryInterface: ChromeUtils.generateQI([Ci.nsIDocumentLoaderFactory]),
|
||||
|
||||
createInstance(aCommand, aChannel, aLoadGroup, aContentType, aContainer,
|
||||
aExtraInfo, aDocListenerResult) {
|
||||
aChannel.contentType = "text/html";
|
||||
|
||||
let contract = catMan.getCategoryEntry("Gecko-Content-Viewers", "text/html");
|
||||
let factory = Cc[contract].getService(Ci.nsIDocumentLoaderFactory);
|
||||
|
||||
let listener = {};
|
||||
let res = factory.createInstance("view", aChannel, aLoadGroup,
|
||||
"text/html", aContainer, aExtraInfo,
|
||||
listener);
|
||||
|
||||
aDocListenerResult.value =
|
||||
streamConv.asyncConvertData("application/http-index-format",
|
||||
"text/html", listener.value, null);
|
||||
|
||||
return res;
|
||||
},
|
||||
};
|
||||
|
||||
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([AddonLocalizationConverter,
|
||||
HttpIndexViewer]);
|
||||
|
|
|
@ -2,3 +2,7 @@ component {dfd07380-6083-11e4-9803-0800200c9a66} simpleServices.js
|
|||
contract @mozilla.org/addons/remote-tag-service;1 {dfd07380-6083-11e4-9803-0800200c9a66}
|
||||
component {ded150e3-c92e-4077-a396-0dba9953e39f} simpleServices.js
|
||||
contract @mozilla.org/streamconv;1?from=application/vnd.mozilla.webext.unlocalized&to=text/css {ded150e3-c92e-4077-a396-0dba9953e39f}
|
||||
|
||||
component {742ad274-34c5-43d1-a8b7-293eaf8962d6} simpleServices.js
|
||||
contract @mozilla.org/content-viewsers/http-index-format {742ad274-34c5-43d1-a8b7-293eaf8962d6}
|
||||
category Gecko-Content-Viewers application/http-index-format @mozilla.org/content-viewsers/http-index-format
|
||||
|
|
|
@ -135,7 +135,6 @@ DIRS += [
|
|||
'/tools/code-coverage',
|
||||
'/tools/power',
|
||||
'/tools/profiler',
|
||||
'/xpfe/components',
|
||||
]
|
||||
|
||||
if CONFIG['MOZ_ENABLE_XREMOTE']:
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||
# vim: set filetype=python:
|
||||
# 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/.
|
||||
|
||||
with Files("**"):
|
||||
BUG_COMPONENT = ("Core", "Window Management")
|
||||
|
||||
SOURCES += [
|
||||
'nsModule.cpp',
|
||||
]
|
||||
|
||||
FINAL_LIBRARY = 'xul'
|
||||
|
||||
LOCAL_INCLUDES += [
|
||||
'../directory',
|
||||
]
|
|
@ -1,44 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; 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 "mozilla/ModuleUtils.h"
|
||||
#include "nsDirectoryViewer.h"
|
||||
#include "rdf.h"
|
||||
#include "nsRDFCID.h"
|
||||
#include "nsCURILoader.h"
|
||||
|
||||
// Factory constructors
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsHTTPIndex, Init)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsDirectoryViewerFactory)
|
||||
|
||||
NS_DEFINE_NAMED_CID(NS_DIRECTORYVIEWERFACTORY_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_HTTPINDEX_SERVICE_CID);
|
||||
|
||||
static const mozilla::Module::CIDEntry kXPFECIDs[] = {
|
||||
{ &kNS_DIRECTORYVIEWERFACTORY_CID, false, nullptr, nsDirectoryViewerFactoryConstructor },
|
||||
{ &kNS_HTTPINDEX_SERVICE_CID, false, nullptr, nsHTTPIndexConstructor },
|
||||
{ nullptr }
|
||||
};
|
||||
|
||||
static const mozilla::Module::ContractIDEntry kXPFEContracts[] = {
|
||||
{ "@mozilla.org/xpfe/http-index-format-factory-constructor", &kNS_DIRECTORYVIEWERFACTORY_CID },
|
||||
{ NS_HTTPINDEX_SERVICE_CONTRACTID, &kNS_HTTPINDEX_SERVICE_CID },
|
||||
{ NS_HTTPINDEX_DATASOURCE_CONTRACTID, &kNS_HTTPINDEX_SERVICE_CID },
|
||||
{ nullptr }
|
||||
};
|
||||
|
||||
static const mozilla::Module::CategoryEntry kXPFECategories[] = {
|
||||
{ "Gecko-Content-Viewers", "application/http-index-format", "@mozilla.org/xpfe/http-index-format-factory-constructor" },
|
||||
{ nullptr }
|
||||
};
|
||||
|
||||
static const mozilla::Module kXPFEModule = {
|
||||
mozilla::Module::kVersion,
|
||||
kXPFECIDs,
|
||||
kXPFEContracts,
|
||||
kXPFECategories
|
||||
};
|
||||
|
||||
NSMODULE_DEFN(application) = &kXPFEModule;
|
|
@ -1,23 +0,0 @@
|
|||
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||
# vim: set filetype=python:
|
||||
# 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/.
|
||||
|
||||
with Files("**"):
|
||||
BUG_COMPONENT = ("Core", "Window Management")
|
||||
|
||||
XPIDL_SOURCES += [
|
||||
'nsIHTTPIndex.idl',
|
||||
]
|
||||
|
||||
XPIDL_MODULE = 'directory'
|
||||
|
||||
SOURCES += [
|
||||
'nsDirectoryViewer.cpp',
|
||||
]
|
||||
|
||||
FINAL_LIBRARY = 'xul'
|
||||
|
||||
if CONFIG['CC_TYPE'] in ('clang', 'gcc'):
|
||||
CXXFLAGS += ['-Wno-error=shadow']
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1,126 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; 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/. */
|
||||
|
||||
#ifndef nsdirectoryviewer__h____
|
||||
#define nsdirectoryviewer__h____
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIStreamListener.h"
|
||||
#include "nsIContentViewer.h"
|
||||
#include "nsIHTTPIndex.h"
|
||||
#include "nsIRDFService.h"
|
||||
#include "nsIRDFDataSource.h"
|
||||
#include "nsIRDFLiteral.h"
|
||||
#include "nsIDocumentLoaderFactory.h"
|
||||
#include "nsITimer.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIDirIndexListener.h"
|
||||
#include "nsIFTPChannel.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "nsIInterfaceRequestor.h"
|
||||
#include "nsIURI.h"
|
||||
|
||||
class nsIMutableArray;
|
||||
|
||||
class nsDirectoryViewerFactory : public nsIDocumentLoaderFactory
|
||||
{
|
||||
public:
|
||||
nsDirectoryViewerFactory();
|
||||
|
||||
// nsISupports interface
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIDOCUMENTLOADERFACTORY
|
||||
|
||||
protected:
|
||||
virtual ~nsDirectoryViewerFactory();
|
||||
};
|
||||
|
||||
class nsHTTPIndex final : public nsIHTTPIndex,
|
||||
public nsIRDFDataSource,
|
||||
public nsIStreamListener,
|
||||
public nsIDirIndexListener,
|
||||
public nsIInterfaceRequestor,
|
||||
public nsIFTPEventSink
|
||||
{
|
||||
private:
|
||||
|
||||
// note: these are NOT statics due to the native of nsHTTPIndex
|
||||
// where it may or may not be treated as a singleton
|
||||
|
||||
nsCOMPtr<nsIRDFResource> kNC_Child;
|
||||
nsCOMPtr<nsIRDFResource> kNC_Comment;
|
||||
nsCOMPtr<nsIRDFResource> kNC_Loading;
|
||||
nsCOMPtr<nsIRDFResource> kNC_URL;
|
||||
nsCOMPtr<nsIRDFResource> kNC_Description;
|
||||
nsCOMPtr<nsIRDFResource> kNC_ContentLength;
|
||||
nsCOMPtr<nsIRDFResource> kNC_LastModified;
|
||||
nsCOMPtr<nsIRDFResource> kNC_ContentType;
|
||||
nsCOMPtr<nsIRDFResource> kNC_FileType;
|
||||
nsCOMPtr<nsIRDFResource> kNC_IsContainer;
|
||||
nsCOMPtr<nsIRDFLiteral> kTrueLiteral;
|
||||
nsCOMPtr<nsIRDFLiteral> kFalseLiteral;
|
||||
|
||||
nsCOMPtr<nsIRDFService> mDirRDF;
|
||||
|
||||
protected:
|
||||
// We grab a reference to the content viewer container (which
|
||||
// indirectly owns us) so that we can insert ourselves as a global
|
||||
// in the script context _after_ the XUL doc has been embedded into
|
||||
// content viewer. We'll know that this has happened once we receive
|
||||
// an OnStartRequest() notification
|
||||
|
||||
nsCOMPtr<nsIRDFDataSource> mInner;
|
||||
nsCOMPtr<nsIMutableArray> mConnectionList;
|
||||
nsCOMPtr<nsIMutableArray> mNodeList;
|
||||
nsCOMPtr<nsITimer> mTimer;
|
||||
nsCOMPtr<nsIDirIndexParser> mParser;
|
||||
nsCString mBaseURL;
|
||||
nsCString mEncoding;
|
||||
bool mBindToGlobalObject;
|
||||
nsIInterfaceRequestor* mRequestor; // WEAK
|
||||
nsCOMPtr<nsIRDFResource> mDirectory;
|
||||
|
||||
explicit nsHTTPIndex(nsIInterfaceRequestor* aRequestor);
|
||||
nsresult CommonInit(void);
|
||||
nsresult Init(nsIURI* aBaseURL);
|
||||
void GetDestination(nsIRDFResource* r, nsACString& dest);
|
||||
bool isWellknownContainerURI(nsIRDFResource *r);
|
||||
nsresult AddElement(nsIRDFResource *parent, nsIRDFResource *prop,
|
||||
nsIRDFNode *child);
|
||||
|
||||
static void FireTimer(nsITimer* aTimer, void* aClosure);
|
||||
|
||||
virtual ~nsHTTPIndex();
|
||||
|
||||
public:
|
||||
nsHTTPIndex();
|
||||
nsresult Init(void);
|
||||
|
||||
static nsresult Create(nsIURI* aBaseURI, nsIInterfaceRequestor* aContainer,
|
||||
nsIHTTPIndex** aResult);
|
||||
|
||||
// nsIHTTPIndex interface
|
||||
NS_DECL_NSIHTTPINDEX
|
||||
|
||||
// NSIRDFDataSource interface
|
||||
NS_DECL_NSIRDFDATASOURCE
|
||||
|
||||
NS_DECL_NSIREQUESTOBSERVER
|
||||
NS_DECL_NSISTREAMLISTENER
|
||||
|
||||
NS_DECL_NSIDIRINDEXLISTENER
|
||||
NS_DECL_NSIINTERFACEREQUESTOR
|
||||
NS_DECL_NSIFTPEVENTSINK
|
||||
|
||||
// nsISupports interface
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsHTTPIndex, nsIHTTPIndex)
|
||||
};
|
||||
|
||||
// {82776710-5690-11d3-BE36-00104BDE6048}
|
||||
#define NS_DIRECTORYVIEWERFACTORY_CID \
|
||||
{ 0x82776710, 0x5690, 0x11d3, { 0xbe, 0x36, 0x0, 0x10, 0x4b, 0xde, 0x60, 0x48 } }
|
||||
|
||||
#endif // nsdirectoryviewer__h____
|
|
@ -1,50 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; 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/. */
|
||||
|
||||
/*
|
||||
|
||||
The interface to an HTTP index
|
||||
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsIStreamListener;
|
||||
interface nsIRDFDataSource;
|
||||
interface nsIRDFNode;
|
||||
interface nsIRDFResource;
|
||||
|
||||
[scriptable, uuid(6F2BDBD0-58C3-11d3-BE36-00104BDE6048)]
|
||||
interface nsIHTTPIndex : nsISupports
|
||||
{
|
||||
/**
|
||||
* The base URL of the HTTP index
|
||||
*/
|
||||
readonly attribute string BaseURL;
|
||||
|
||||
/**
|
||||
* The RDF datasource that contains the HTTP index information.
|
||||
*/
|
||||
readonly attribute nsIRDFDataSource DataSource;
|
||||
|
||||
/**
|
||||
* The charset to use for decoding FTP filenames
|
||||
*/
|
||||
attribute string encoding;
|
||||
};
|
||||
|
||||
%{C++
|
||||
|
||||
// {{2587e382-1324-11d4-a652-eadbb2be3484}
|
||||
#define NS_HTTPINDEX_SERVICE_CID \
|
||||
{ 0x2587e382, 0x1324, 0x11d4, { 0xa6, 0x52, 0xea, 0xdb, 0xb2, 0xbe, 0x34, 0x84 } }
|
||||
|
||||
#define NS_HTTPINDEX_SERVICE_CONTRACTID \
|
||||
"@mozilla.org/browser/httpindex-service;1"
|
||||
|
||||
#define NS_HTTPINDEX_DATASOURCE_CONTRACTID \
|
||||
"@mozilla.org/rdf/datasource;1?name=httpindex"
|
||||
|
||||
%}
|
|
@ -1,14 +0,0 @@
|
|||
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||
# vim: set filetype=python:
|
||||
# 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/.
|
||||
|
||||
with Files("**"):
|
||||
BUG_COMPONENT = ("Core", "Window Management")
|
||||
|
||||
DIRS += [
|
||||
'directory',
|
||||
'build',
|
||||
]
|
||||
|
Загрузка…
Ссылка в новой задаче