1999-09-28 04:44:47 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
*
|
1999-11-06 06:40:37 +03:00
|
|
|
* The contents of this file are subject to the Netscape Public
|
|
|
|
* License Version 1.1 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.mozilla.org/NPL/
|
1999-09-28 04:44:47 +04:00
|
|
|
*
|
1999-11-06 06:40:37 +03:00
|
|
|
* Software distributed under the License is distributed on an "AS
|
|
|
|
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
|
|
|
* implied. See the License for the specific language governing
|
|
|
|
* rights and limitations under the License.
|
1999-09-28 04:44:47 +04:00
|
|
|
*
|
|
|
|
* The Original Code is Mozilla Communicator client code.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is Netscape Communications
|
1999-11-06 06:40:37 +03:00
|
|
|
* Corporation. Portions created by Netscape are
|
|
|
|
* Copyright (C) 1998 Netscape Communications Corporation. All
|
|
|
|
* Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
2000-02-03 01:24:56 +03:00
|
|
|
* Pierre Phaneuf <pp@ludusdesign.com>
|
1999-09-28 04:44:47 +04:00
|
|
|
*/
|
2000-01-25 00:28:28 +03:00
|
|
|
#include "nspr.h"
|
|
|
|
#include "nsString.h"
|
1999-09-28 04:44:47 +04:00
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsLayoutModule.h"
|
|
|
|
#include "nsLayoutCID.h"
|
|
|
|
#include "nsIComponentManager.h"
|
1999-11-30 07:50:42 +03:00
|
|
|
#include "nsNetUtil.h"
|
1999-09-28 04:44:47 +04:00
|
|
|
#include "nsICSSStyleSheet.h"
|
|
|
|
#include "nsICSSLoader.h"
|
|
|
|
#include "nsHTMLAtoms.h"
|
|
|
|
#include "nsCSSKeywords.h" // to addref/release table
|
|
|
|
#include "nsCSSProps.h" // to addref/release table
|
|
|
|
#include "nsCSSAtoms.h" // to addref/release table
|
|
|
|
#include "nsColorNames.h" // to addref/release table
|
|
|
|
#ifdef INCLUDE_XUL
|
|
|
|
#include "nsXULAtoms.h"
|
|
|
|
#endif
|
1999-10-02 15:01:41 +04:00
|
|
|
//MathML Mod - RBS
|
|
|
|
#ifdef MOZ_MATHML
|
|
|
|
#include "nsMathMLAtoms.h"
|
|
|
|
#include "nsMathMLOperators.h"
|
|
|
|
#endif
|
1999-09-28 04:44:47 +04:00
|
|
|
#include "nsLayoutAtoms.h"
|
|
|
|
#include "nsDOMCID.h"
|
|
|
|
#include "nsIScriptContext.h"
|
|
|
|
#include "nsINameSpaceManager.h"
|
|
|
|
#include "nsIScriptNameSetRegistry.h"
|
|
|
|
#include "nsIScriptNameSpaceManager.h"
|
|
|
|
#include "nsIScriptExternalNameSet.h"
|
|
|
|
|
2000-05-10 17:13:39 +04:00
|
|
|
#include "nsINodeInfo.h"
|
|
|
|
|
2000-01-19 07:11:23 +03:00
|
|
|
#include "nsIElementFactory.h"
|
|
|
|
|
1999-09-28 04:44:47 +04:00
|
|
|
#include "nsIDocumentEncoder.h"
|
|
|
|
|
2000-04-02 02:31:45 +04:00
|
|
|
// SVG
|
|
|
|
#ifdef MOZ_SVG
|
|
|
|
#include "nsSVGAtoms.h"
|
|
|
|
#endif
|
|
|
|
|
1999-09-28 04:44:47 +04:00
|
|
|
// XXX
|
|
|
|
#include "nsIServiceManager.h"
|
|
|
|
|
1999-10-20 03:01:23 +04:00
|
|
|
#include "nsTextTransformer.h"
|
2000-04-14 00:07:13 +04:00
|
|
|
#include "nsIHTTPProtocolHandler.h"
|
|
|
|
#include "gbdate.h"
|
|
|
|
#define PRODUCT_NAME "Gecko"
|
1999-10-20 03:01:23 +04:00
|
|
|
|
2000-04-14 00:07:13 +04:00
|
|
|
static NS_DEFINE_CID(kHTTPHandlerCID, NS_IHTTPHANDLER_CID);
|
1999-09-28 04:44:47 +04:00
|
|
|
static nsLayoutModule *gModule = NULL;
|
|
|
|
|
|
|
|
extern "C" NS_EXPORT nsresult NSGetModule(nsIComponentManager *servMgr,
|
2000-01-25 00:28:28 +03:00
|
|
|
nsIFile* location,
|
1999-09-28 04:44:47 +04:00
|
|
|
nsIModule** return_cobj)
|
|
|
|
{
|
|
|
|
nsresult rv = NS_OK;
|
|
|
|
|
|
|
|
NS_ASSERTION(return_cobj, "Null argument");
|
|
|
|
NS_ASSERTION(gModule == NULL, "nsLayoutModule: Module already created.");
|
|
|
|
|
|
|
|
// Create an initialize the layout module instance
|
|
|
|
nsLayoutModule *m = new nsLayoutModule();
|
|
|
|
if (!m) {
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Increase refcnt and store away nsIModule interface to m in return_cobj
|
2000-02-03 01:24:56 +03:00
|
|
|
rv = m->QueryInterface(NS_GET_IID(nsIModule), (void**)return_cobj);
|
1999-09-28 04:44:47 +04:00
|
|
|
if (NS_FAILED(rv)) {
|
|
|
|
delete m;
|
|
|
|
m = nsnull;
|
|
|
|
}
|
|
|
|
gModule = m; // WARNING: Weak Reference
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
static NS_DEFINE_IID(kIScriptNameSetRegistryIID, NS_ISCRIPTNAMESETREGISTRY_IID);
|
|
|
|
static NS_DEFINE_IID(kCScriptNameSetRegistryCID, NS_SCRIPT_NAMESET_REGISTRY_CID);
|
|
|
|
static NS_DEFINE_IID(kIScriptNameSpaceManagerIID, NS_ISCRIPTNAMESPACEMANAGER_IID);
|
|
|
|
static NS_DEFINE_IID(kIScriptExternalNameSetIID, NS_ISCRIPTEXTERNALNAMESET_IID);
|
|
|
|
|
|
|
|
class LayoutScriptNameSet : public nsIScriptExternalNameSet {
|
|
|
|
public:
|
|
|
|
LayoutScriptNameSet();
|
|
|
|
virtual ~LayoutScriptNameSet();
|
|
|
|
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
|
|
|
|
NS_IMETHOD InitializeClasses(nsIScriptContext* aScriptContext);
|
|
|
|
NS_IMETHOD AddNameSet(nsIScriptContext* aScriptContext);
|
|
|
|
};
|
|
|
|
|
|
|
|
LayoutScriptNameSet::LayoutScriptNameSet()
|
|
|
|
{
|
|
|
|
NS_INIT_REFCNT();
|
|
|
|
}
|
|
|
|
|
|
|
|
LayoutScriptNameSet::~LayoutScriptNameSet()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMPL_ISUPPORTS(LayoutScriptNameSet, kIScriptExternalNameSetIID);
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
LayoutScriptNameSet::InitializeClasses(nsIScriptContext* aScriptContext)
|
|
|
|
{
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
LayoutScriptNameSet::AddNameSet(nsIScriptContext* aScriptContext)
|
|
|
|
{
|
|
|
|
nsresult result = NS_OK;
|
|
|
|
nsIScriptNameSpaceManager* manager;
|
|
|
|
static NS_DEFINE_IID(kHTMLImageElementCID, NS_HTMLIMAGEELEMENT_CID);
|
|
|
|
static NS_DEFINE_IID(kHTMLOptionElementCID, NS_HTMLOPTIONELEMENT_CID);
|
|
|
|
|
|
|
|
result = aScriptContext->GetNameSpaceManager(&manager);
|
|
|
|
if (NS_OK == result) {
|
2000-04-03 15:20:35 +04:00
|
|
|
result = manager->RegisterGlobalName(NS_ConvertToString("HTMLImageElement"),
|
1999-09-28 04:44:47 +04:00
|
|
|
kHTMLImageElementCID,
|
|
|
|
PR_TRUE);
|
|
|
|
if (NS_FAILED(result)) {
|
|
|
|
NS_RELEASE(manager);
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2000-04-03 15:20:35 +04:00
|
|
|
result = manager->RegisterGlobalName(NS_ConvertToString("HTMLOptionElement"),
|
1999-09-28 04:44:47 +04:00
|
|
|
kHTMLOptionElementCID,
|
|
|
|
PR_TRUE);
|
|
|
|
if (NS_FAILED(result)) {
|
|
|
|
NS_RELEASE(manager);
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_RELEASE(manager);
|
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
|
|
static NS_DEFINE_IID(kIModuleIID, NS_IMODULE_IID);
|
|
|
|
|
|
|
|
nsIScriptNameSetRegistry* nsLayoutModule::gRegistry;
|
2000-03-21 15:14:29 +03:00
|
|
|
nsICSSStyleSheet* nsLayoutModule::gUAStyleSheet = nsnull;
|
1999-09-28 04:44:47 +04:00
|
|
|
|
|
|
|
nsLayoutModule::nsLayoutModule()
|
|
|
|
: mInitialized(PR_FALSE)
|
|
|
|
{
|
|
|
|
NS_INIT_ISUPPORTS();
|
|
|
|
}
|
|
|
|
|
|
|
|
nsLayoutModule::~nsLayoutModule()
|
|
|
|
{
|
|
|
|
Shutdown();
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMPL_ISUPPORTS(nsLayoutModule, kIModuleIID)
|
|
|
|
|
|
|
|
// Perform our one-time intialization for this module
|
|
|
|
nsresult
|
|
|
|
nsLayoutModule::Initialize()
|
|
|
|
{
|
2000-03-21 13:34:56 +03:00
|
|
|
nsresult rv = NS_OK;
|
|
|
|
|
1999-09-28 04:44:47 +04:00
|
|
|
if (mInitialized) {
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
1999-10-02 04:55:57 +04:00
|
|
|
mInitialized = PR_TRUE;
|
|
|
|
|
1999-09-28 04:44:47 +04:00
|
|
|
// Register all of our atoms once
|
|
|
|
nsCSSAtoms::AddRefAtoms();
|
|
|
|
nsCSSKeywords::AddRefTable();
|
|
|
|
nsCSSProps::AddRefTable();
|
|
|
|
nsColorNames::AddRefTable();
|
|
|
|
nsHTMLAtoms::AddRefAtoms();
|
1999-10-01 01:14:14 +04:00
|
|
|
nsLayoutAtoms::AddRefAtoms();
|
1999-09-28 04:44:47 +04:00
|
|
|
#ifdef INCLUDE_XUL
|
|
|
|
nsXULAtoms::AddRefAtoms();
|
|
|
|
#endif
|
1999-10-02 15:01:41 +04:00
|
|
|
//MathML Mod - RBS
|
|
|
|
#ifdef MOZ_MATHML
|
|
|
|
nsMathMLOperators::AddRefTable();
|
|
|
|
nsMathMLAtoms::AddRefAtoms();
|
|
|
|
#endif
|
1999-09-28 04:44:47 +04:00
|
|
|
|
2000-04-02 02:31:45 +04:00
|
|
|
// SVG
|
|
|
|
#ifdef MOZ_SVG
|
|
|
|
nsSVGAtoms::AddRefAtoms();
|
|
|
|
#endif
|
|
|
|
|
1999-09-28 04:44:47 +04:00
|
|
|
// XXX Initialize the script name set thingy-ma-jigger
|
|
|
|
if (!gRegistry) {
|
|
|
|
rv = nsServiceManager::GetService(kCScriptNameSetRegistryCID,
|
|
|
|
kIScriptNameSetRegistryIID,
|
|
|
|
(nsISupports**) &gRegistry);
|
|
|
|
if (NS_SUCCEEDED(rv)) {
|
|
|
|
LayoutScriptNameSet* nameSet = new LayoutScriptNameSet();
|
|
|
|
gRegistry->AddExternalNameSet(nameSet);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-04-14 00:07:13 +04:00
|
|
|
SetUserAgent();
|
|
|
|
|
1999-10-20 03:01:23 +04:00
|
|
|
rv = nsTextTransformer::Initialize();
|
|
|
|
if (NS_FAILED(rv)) {
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
1999-09-28 04:44:47 +04:00
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Shutdown this module, releasing all of the module resources
|
|
|
|
void
|
|
|
|
nsLayoutModule::Shutdown()
|
|
|
|
{
|
2000-02-16 10:42:00 +03:00
|
|
|
if (!mInitialized) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
1999-09-28 04:44:47 +04:00
|
|
|
// Release all of our atoms
|
|
|
|
nsColorNames::ReleaseTable();
|
|
|
|
nsCSSProps::ReleaseTable();
|
|
|
|
nsCSSKeywords::ReleaseTable();
|
|
|
|
nsCSSAtoms::ReleaseAtoms();
|
|
|
|
nsHTMLAtoms::ReleaseAtoms();
|
1999-10-01 01:14:14 +04:00
|
|
|
nsLayoutAtoms::ReleaseAtoms();
|
1999-09-28 04:44:47 +04:00
|
|
|
#ifdef INCLUDE_XUL
|
|
|
|
nsXULAtoms::ReleaseAtoms();
|
|
|
|
#endif
|
1999-10-02 15:01:41 +04:00
|
|
|
//MathML Mod - RBS
|
|
|
|
#ifdef MOZ_MATHML
|
|
|
|
nsMathMLOperators::ReleaseTable();
|
|
|
|
nsMathMLAtoms::ReleaseAtoms();
|
|
|
|
#endif
|
2000-04-02 02:31:45 +04:00
|
|
|
// SVG
|
|
|
|
#ifdef MOZ_SVG
|
|
|
|
nsSVGAtoms::ReleaseAtoms();
|
|
|
|
#endif
|
1999-09-28 04:44:47 +04:00
|
|
|
|
1999-10-20 03:01:23 +04:00
|
|
|
nsTextTransformer::Shutdown();
|
|
|
|
|
1999-09-28 04:44:47 +04:00
|
|
|
NS_IF_RELEASE(gRegistry);
|
2000-03-21 15:14:29 +03:00
|
|
|
NS_IF_RELEASE(gUAStyleSheet);
|
1999-09-28 04:44:47 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsLayoutModule::GetClassObject(nsIComponentManager *aCompMgr,
|
|
|
|
const nsCID& aClass,
|
|
|
|
const nsIID& aIID,
|
|
|
|
void** r_classObj)
|
|
|
|
{
|
|
|
|
nsresult rv;
|
|
|
|
|
|
|
|
if (!mInitialized) {
|
|
|
|
rv = Initialize();
|
|
|
|
if (NS_FAILED(rv)) {
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-01-28 18:16:54 +03:00
|
|
|
nsCOMPtr<nsIFactory> f = new nsLayoutFactory(aClass);
|
1999-09-28 04:44:47 +04:00
|
|
|
if (!f) {
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
|
|
|
|
2000-01-28 18:16:54 +03:00
|
|
|
return f->QueryInterface(aIID, r_classObj);
|
1999-09-28 04:44:47 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------
|
|
|
|
|
|
|
|
struct Components {
|
|
|
|
const char* mDescription;
|
|
|
|
nsID mCID;
|
|
|
|
const char* mProgID;
|
|
|
|
};
|
|
|
|
|
2000-01-19 07:11:23 +03:00
|
|
|
// The HTML namespace.
|
|
|
|
|
1999-09-28 04:44:47 +04:00
|
|
|
// The list of components we register
|
|
|
|
static Components gComponents[] = {
|
|
|
|
{ "Namespace manager", NS_NAMESPACEMANAGER_CID, nsnull, },
|
|
|
|
{ "Event listener manager", NS_EVENTLISTENERMANAGER_CID, nsnull, },
|
|
|
|
{ "Frame utility", NS_FRAME_UTIL_CID, nsnull, },
|
|
|
|
{ "Print preview context", NS_PRINT_PREVIEW_CONTEXT_CID, nsnull, },
|
|
|
|
{ "Layout debugger", NS_LAYOUT_DEBUGGER_CID, nsnull, },
|
|
|
|
|
|
|
|
{ "HTML document", NS_HTMLDOCUMENT_CID, nsnull, },
|
|
|
|
{ "HTML style sheet", NS_HTMLSTYLESHEET_CID, nsnull, },
|
|
|
|
{ "HTML-CSS style sheet", NS_HTML_CSS_STYLESHEET_CID, nsnull, },
|
|
|
|
|
2000-05-11 03:02:32 +04:00
|
|
|
{ "DOM implementation", NS_DOM_IMPLEMENTATION_CID, nsnull, },
|
|
|
|
|
1999-09-28 04:44:47 +04:00
|
|
|
{ "XML document", NS_XMLDOCUMENT_CID, nsnull, },
|
|
|
|
{ "Image document", NS_IMAGEDOCUMENT_CID, nsnull, },
|
|
|
|
|
|
|
|
{ "CSS parser", NS_CSSPARSER_CID, nsnull, },
|
|
|
|
{ "CSS loader", NS_CSS_LOADER_CID, nsnull, },
|
|
|
|
|
2000-01-19 07:11:23 +03:00
|
|
|
{ "HTML element factory", NS_HTML_ELEMENT_FACTORY_CID, NS_HTML_ELEMENT_FACTORY_PROGID, },
|
1999-09-28 04:44:47 +04:00
|
|
|
{ "Text element", NS_TEXTNODE_CID, nsnull, },
|
|
|
|
|
2000-01-19 07:11:23 +03:00
|
|
|
{ "XML element factory", NS_XML_ELEMENT_FACTORY_CID, NS_XML_ELEMENT_FACTORY_PROGID, },
|
1999-10-05 04:12:21 +04:00
|
|
|
|
1999-09-28 04:44:47 +04:00
|
|
|
{ "Selection", NS_SELECTION_CID, nsnull, },
|
|
|
|
{ "Frame selection", NS_FRAMESELECTION_CID, nsnull, },
|
|
|
|
{ "Range", NS_RANGE_CID, nsnull, },
|
|
|
|
{ "Content iterator", NS_CONTENTITERATOR_CID, nsnull, },
|
2000-03-31 11:18:45 +04:00
|
|
|
{ "Generated Content iterator", NS_GENERATEDCONTENTITERATOR_CID, nsnull, },
|
|
|
|
{ "Generated Subtree iterator", NS_GENERATEDSUBTREEITERATOR_CID, nsnull, },
|
1999-09-28 04:44:47 +04:00
|
|
|
{ "Subtree iterator", NS_SUBTREEITERATOR_CID, nsnull, },
|
|
|
|
|
|
|
|
// XXX ick
|
|
|
|
{ "HTML image element", NS_HTMLIMAGEELEMENT_CID, nsnull, },
|
|
|
|
{ "HTML option element", NS_HTMLOPTIONELEMENT_CID, nsnull, },
|
|
|
|
{ "Presentation shell", NS_PRESSHELL_CID, nsnull, },
|
|
|
|
// XXX end ick
|
|
|
|
|
|
|
|
{ "HTML document encoder", NS_TEXT_ENCODER_CID,
|
|
|
|
NS_DOC_ENCODER_PROGID_BASE "text/html", },
|
|
|
|
{ "Plaintext document encoder", NS_TEXT_ENCODER_CID,
|
|
|
|
NS_DOC_ENCODER_PROGID_BASE "text/plain", },
|
|
|
|
{ "XIF document encoder", NS_TEXT_ENCODER_CID,
|
|
|
|
NS_DOC_ENCODER_PROGID_BASE "text/xif", },
|
2000-01-12 12:25:48 +03:00
|
|
|
|
|
|
|
{ "XBL Service", NS_XBLSERVICE_CID, "component://netscape/xbl" },
|
2000-05-10 01:42:40 +04:00
|
|
|
{ "XBL Binding Manager", NS_BINDINGMANAGER_CID, "component://netscape/xbl/binding-manager" },
|
|
|
|
|
2000-04-14 15:21:19 +04:00
|
|
|
{ "AutoCopy Service", NS_AUTOCOPYSERVICE_CID, "component://netscape/autocopy" },
|
2000-05-10 17:13:39 +04:00
|
|
|
|
|
|
|
{ "NodeInfoManager", NS_NODEINFOMANAGER_CID, NS_NODEINFOMANAGER_PROGID }
|
1999-09-28 04:44:47 +04:00
|
|
|
};
|
|
|
|
#define NUM_COMPONENTS (sizeof(gComponents) / sizeof(gComponents[0]))
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsLayoutModule::RegisterSelf(nsIComponentManager *aCompMgr,
|
2000-01-25 00:28:28 +03:00
|
|
|
nsIFile* aPath,
|
1999-09-28 04:44:47 +04:00
|
|
|
const char* registryLocation,
|
|
|
|
const char* componentType)
|
|
|
|
{
|
|
|
|
nsresult rv = NS_OK;
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
printf("*** Registering layout components\n");
|
|
|
|
#endif
|
|
|
|
|
|
|
|
Components* cp = gComponents;
|
|
|
|
Components* end = cp + NUM_COMPONENTS;
|
|
|
|
while (cp < end) {
|
|
|
|
rv = aCompMgr->RegisterComponentSpec(cp->mCID, cp->mDescription,
|
|
|
|
cp->mProgID, aPath, PR_TRUE, PR_TRUE);
|
|
|
|
if (NS_FAILED(rv)) {
|
|
|
|
#ifdef DEBUG
|
|
|
|
printf("nsLayoutModule: unable to register %s component => %x\n",
|
|
|
|
cp->mDescription, rv);
|
|
|
|
#endif
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
cp++;
|
|
|
|
}
|
|
|
|
|
|
|
|
rv = RegisterDocumentFactories(aCompMgr, aPath);
|
|
|
|
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsLayoutModule::UnregisterSelf(nsIComponentManager* aCompMgr,
|
2000-01-25 00:28:28 +03:00
|
|
|
nsIFile* aPath,
|
1999-09-28 04:44:47 +04:00
|
|
|
const char* registryLocation)
|
|
|
|
{
|
|
|
|
#ifdef DEBUG
|
|
|
|
printf("*** Unregistering layout components\n");
|
|
|
|
#endif
|
|
|
|
Components* cp = gComponents;
|
|
|
|
Components* end = cp + NUM_COMPONENTS;
|
|
|
|
while (cp < end) {
|
|
|
|
nsresult rv = aCompMgr->UnregisterComponentSpec(cp->mCID, aPath);
|
|
|
|
if (NS_FAILED(rv)) {
|
|
|
|
#ifdef DEBUG
|
|
|
|
printf("nsLayoutModule: unable to unregister %s component => %x\n",
|
|
|
|
cp->mDescription, rv);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
cp++;
|
|
|
|
}
|
|
|
|
|
|
|
|
UnregisterDocumentFactories(aCompMgr, aPath);
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsLayoutModule::CanUnload(nsIComponentManager *aCompMgr, PRBool *okToUnload)
|
|
|
|
{
|
|
|
|
if (!okToUnload) {
|
|
|
|
return NS_ERROR_INVALID_POINTER;
|
|
|
|
}
|
|
|
|
*okToUnload = PR_FALSE;
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
2000-04-14 00:07:13 +04:00
|
|
|
|
|
|
|
void
|
|
|
|
nsLayoutModule::SetUserAgent( void )
|
|
|
|
{
|
2000-04-16 15:19:26 +04:00
|
|
|
nsString productName; productName.AssignWithConversion(PRODUCT_NAME);
|
|
|
|
nsString productVersion; productVersion.AssignWithConversion(PRODUCT_VERSION);
|
2000-04-14 00:07:13 +04:00
|
|
|
nsresult rv = nsnull;
|
|
|
|
|
|
|
|
nsCOMPtr<nsIHTTPProtocolHandler> theService(do_GetService(kHTTPHandlerCID,
|
|
|
|
&rv));
|
|
|
|
|
|
|
|
if( NS_SUCCEEDED(rv) && (nsnull != theService) )
|
|
|
|
{
|
|
|
|
rv = theService->SetProduct(productName.GetUnicode());
|
|
|
|
|
|
|
|
rv = theService->SetProductSub(productVersion.GetUnicode());
|
|
|
|
}
|
|
|
|
}
|