зеркало из https://github.com/mozilla/gecko-dev.git
Revert many of the interface changes from bug 568691, so that binaries can be made which are compatible with Firefox 3.6 and Firefox 4. Note that this is not an ongoing process: it will not be possible to make single binary components which are compatible with both Firefox 4 and Firefox 4.1, but you will be able to ship two components and select one based on the platform version.
This commit is contained in:
Родитель
c70b7f03ef
Коммит
e9d5a3c6b8
|
@ -74,6 +74,7 @@ SDK_XPIDLSRCS = \
|
|||
nsIClassInfo.idl \
|
||||
nsIComponentRegistrar.idl \
|
||||
nsIFactory.idl \
|
||||
nsIModule.idl \
|
||||
nsIServiceManager.idl \
|
||||
nsIComponentManager.idl \
|
||||
nsICategoryManager.idl \
|
||||
|
@ -96,7 +97,7 @@ FORCE_STATIC_LIB = 1
|
|||
FORCE_USE_PIC = 1
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
DEFINES += -D_IMPL_NS_COM -DNAKED_DLL_SUFFIX=\"$(patsubst .%,%,$(DLL_SUFFIX))\"
|
||||
DEFINES += -D_IMPL_NS_COM
|
||||
|
||||
ifneq (,$(filter gtk2,$(MOZ_WIDGET_TOOLKIT)))
|
||||
CXXFLAGS += $(MOZ_GTK2_CFLAGS)
|
||||
|
|
|
@ -326,6 +326,17 @@ CategoryNode::AddLeaf(const char* aEntryName,
|
|||
return rv;
|
||||
}
|
||||
|
||||
void
|
||||
CategoryNode::DeleteLeaf(const char* aEntryName)
|
||||
{
|
||||
// we don't throw any errors, because it normally doesn't matter
|
||||
// and it makes JS a lot cleaner
|
||||
MutexAutoLock lock(mLock);
|
||||
|
||||
// we can just remove the entire hash entry without introspection
|
||||
mTable.RemoveEntry(aEntryName);
|
||||
}
|
||||
|
||||
NS_METHOD
|
||||
CategoryNode::Enumerate(nsISimpleEnumerator **_retval)
|
||||
{
|
||||
|
@ -554,11 +565,33 @@ nsCategoryManager::GetCategoryEntry( const char *aCategoryName,
|
|||
return status;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCategoryManager::AddCategoryEntry( const char *aCategoryName,
|
||||
const char *aEntryName,
|
||||
const char *aValue,
|
||||
PRBool aPersist,
|
||||
PRBool aReplace,
|
||||
char **_retval )
|
||||
{
|
||||
if (aPersist) {
|
||||
NS_ERROR("Category manager doesn't support persistence.");
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
AddCategoryEntry(aCategoryName, aEntryName, aValue, aReplace, _retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsCategoryManager::AddCategoryEntry(const char *aCategoryName,
|
||||
const char *aEntryName,
|
||||
const char *aValue)
|
||||
const char *aValue,
|
||||
bool aReplace,
|
||||
char** aOldValue)
|
||||
{
|
||||
if (aOldValue)
|
||||
*aOldValue = NULL;
|
||||
|
||||
// Before we can insert a new entry, we'll need to
|
||||
// find the |CategoryNode| to put it in...
|
||||
CategoryNode* category;
|
||||
|
@ -594,10 +627,72 @@ nsCategoryManager::AddCategoryEntry(const char *aCategoryName,
|
|||
NotifyObservers(NS_XPCOM_CATEGORY_ENTRY_ADDED_OBSERVER_ID,
|
||||
aCategoryName, aEntryName);
|
||||
|
||||
if (aOldValue)
|
||||
*aOldValue = oldEntry;
|
||||
else
|
||||
NS_Free(oldEntry);
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCategoryManager::DeleteCategoryEntry( const char *aCategoryName,
|
||||
const char *aEntryName,
|
||||
PRBool aDontPersist)
|
||||
{
|
||||
if (!aDontPersist) {
|
||||
NS_ERROR("Persistence not supported in the category manager.");
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
NS_ENSURE_ARG_POINTER(aCategoryName);
|
||||
NS_ENSURE_ARG_POINTER(aEntryName);
|
||||
|
||||
/*
|
||||
Note: no errors are reported since failure to delete
|
||||
probably won't hurt you, and returning errors seriously
|
||||
inconveniences JS clients
|
||||
*/
|
||||
|
||||
CategoryNode* category;
|
||||
{
|
||||
MutexAutoLock lock(mLock);
|
||||
category = get_category(aCategoryName);
|
||||
}
|
||||
|
||||
if (category) {
|
||||
category->DeleteLeaf(aEntryName);
|
||||
|
||||
NotifyObservers(NS_XPCOM_CATEGORY_ENTRY_REMOVED_OBSERVER_ID,
|
||||
aCategoryName, aEntryName);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCategoryManager::DeleteCategory( const char *aCategoryName )
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aCategoryName);
|
||||
|
||||
// the categories are arena-allocated, so we don't
|
||||
// actually delete them. We just remove all of the
|
||||
// leaf nodes.
|
||||
|
||||
CategoryNode* category;
|
||||
{
|
||||
MutexAutoLock lock(mLock);
|
||||
category = get_category(aCategoryName);
|
||||
}
|
||||
|
||||
if (category) {
|
||||
category->Clear();
|
||||
NotifyObservers(NS_XPCOM_CATEGORY_CLEARED_OBSERVER_ID,
|
||||
aCategoryName, nsnull);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsCategoryManager::EnumerateCategory( const char *aCategoryName,
|
||||
nsISimpleEnumerator **_retval )
|
||||
|
|
|
@ -86,6 +86,13 @@ public:
|
|||
char** _retval,
|
||||
PLArenaPool* aArena);
|
||||
|
||||
void DeleteLeaf(const char* aEntryName);
|
||||
|
||||
void Clear() {
|
||||
mozilla::MutexAutoLock lock(mLock);
|
||||
mTable.Clear();
|
||||
}
|
||||
|
||||
PRUint32 Count() {
|
||||
mozilla::MutexAutoLock lock(mLock);
|
||||
PRUint32 tCount = mTable.Count();
|
||||
|
@ -132,7 +139,9 @@ public:
|
|||
|
||||
void AddCategoryEntry(const char* aCategory,
|
||||
const char* aKey,
|
||||
const char* aValue);
|
||||
const char* aValue,
|
||||
bool aReplace = true,
|
||||
char** aOldValue = NULL);
|
||||
|
||||
static nsresult Create(nsISupports* aOuter, REFNSIID aIID, void** aResult);
|
||||
|
||||
|
|
|
@ -1544,6 +1544,44 @@ nsComponentManagerImpl::UnregisterFactory(const nsCID& aClass,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsComponentManagerImpl::AutoRegister(nsIFile* aLocation)
|
||||
{
|
||||
nsCOMPtr<nsILocalFile> lf = do_QueryInterface(aLocation);
|
||||
if (!lf)
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
|
||||
XRE_AddComponentLocation(NS_COMPONENT_LOCATION, lf);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsComponentManagerImpl::AutoUnregister(nsIFile* aLocation)
|
||||
{
|
||||
NS_ERROR("AutoUnregister not implemented.");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsComponentManagerImpl::RegisterFactoryLocation(const nsCID& aCID,
|
||||
const char* aClassName,
|
||||
const char* aContractID,
|
||||
nsIFile* aFile,
|
||||
const char* aLoaderStr,
|
||||
const char* aType)
|
||||
{
|
||||
NS_ERROR("RegisterFactoryLocation not implemented.");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsComponentManagerImpl::UnregisterFactoryLocation(const nsCID& aCID,
|
||||
nsIFile* aFile)
|
||||
{
|
||||
NS_ERROR("UnregisterFactoryLocation not implemented.");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsComponentManagerImpl::IsCIDRegistered(const nsCID & aClass,
|
||||
PRBool *_retval)
|
||||
|
@ -1611,7 +1649,6 @@ nsComponentManagerImpl::EnumerateContractIDs(nsISimpleEnumerator **aEnumerator)
|
|||
return CallQueryInterface(e, aEnumerator);
|
||||
}
|
||||
|
||||
#if 0
|
||||
NS_IMETHODIMP
|
||||
nsComponentManagerImpl::CIDToContractID(const nsCID & aClass,
|
||||
char **_retval)
|
||||
|
@ -1619,7 +1656,6 @@ nsComponentManagerImpl::CIDToContractID(const nsCID & aClass,
|
|||
NS_ERROR("CIDTOContractID not implemented");
|
||||
return NS_ERROR_FACTORY_NOT_REGISTERED;
|
||||
}
|
||||
#endif
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsComponentManagerImpl::ContractIDToCID(const char *aContractID,
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
* @status FROZEN
|
||||
*/
|
||||
|
||||
[scriptable, uuid(70F95BAF-8F93-4D24-B9E0-3428DF27A835)]
|
||||
[scriptable, uuid(3275b2cd-af6d-429a-80d7-f0c5120342ac)]
|
||||
interface nsICategoryManager : nsISupports
|
||||
{
|
||||
/**
|
||||
|
@ -54,6 +54,34 @@ interface nsICategoryManager : nsISupports
|
|||
*/
|
||||
string getCategoryEntry(in string aCategory, in string aEntry);
|
||||
|
||||
/**
|
||||
* Add an entry to a category.
|
||||
* @param aCategory The name of the category ("protocol")
|
||||
* @param aEntry The entry to be added ("http")
|
||||
* @param aValue The value for the entry ("moz.httprulez.1")
|
||||
* @param aPersist Should this data persist between invocations?
|
||||
* @param aReplace Should we replace an existing entry?
|
||||
* @return Previous entry, if any
|
||||
*/
|
||||
string addCategoryEntry(in string aCategory, in string aEntry,
|
||||
in string aValue, in boolean aPersist,
|
||||
in boolean aReplace);
|
||||
|
||||
/**
|
||||
* Delete an entry from the category.
|
||||
* @param aCategory The name of the category ("protocol")
|
||||
* @param aEntry The entry to be added ("http")
|
||||
* @param aPersist Delete persistent data from registry, if present?
|
||||
*/
|
||||
void deleteCategoryEntry(in string aCategory, in string aEntry,
|
||||
in boolean aPersist);
|
||||
|
||||
/**
|
||||
* Delete a category and all entries.
|
||||
* @param aCategory The category to be deleted.
|
||||
*/
|
||||
void deleteCategory(in string aCategory);
|
||||
|
||||
/**
|
||||
* Enumerate the entries in a category.
|
||||
* @param aCategory The category to be enumerated.
|
||||
|
|
|
@ -44,9 +44,29 @@ interface nsIFile;
|
|||
interface nsIFactory;
|
||||
interface nsISimpleEnumerator;
|
||||
|
||||
[scriptable, uuid(B0010F0B-C162-48A1-9E5E-E3453B80388C)]
|
||||
[scriptable, uuid(2417cbfe-65ad-48a6-b4b6-eb84db174392)]
|
||||
interface nsIComponentRegistrar : nsISupports
|
||||
{
|
||||
/**
|
||||
* autoRegister
|
||||
*
|
||||
* Register a .manifest or .xpt file, or an entire directory containing
|
||||
* these files. Registration lasts for this run only, and is not cached.
|
||||
*
|
||||
* @note Formerly this method would register component files directly. This
|
||||
* is no longer supported.
|
||||
*/
|
||||
void autoRegister(in nsIFile aSpec);
|
||||
|
||||
/**
|
||||
* autoUnregister
|
||||
* @status OBSOLETE: This method is no longer implemented, but preserved
|
||||
* in this interface for binary compatibility with
|
||||
* Mozilla 1.9.2.
|
||||
*/
|
||||
void autoUnregister(in nsIFile aSpec);
|
||||
|
||||
|
||||
/**
|
||||
* registerFactory
|
||||
*
|
||||
|
@ -54,8 +74,9 @@ interface nsIComponentRegistrar : nsISupports
|
|||
*
|
||||
* @param aClass : CID of object
|
||||
* @param aClassName : Class Name of CID (unused)
|
||||
* @param aContractID : ContractID associated with CID aClass (optional)
|
||||
* @param aFactory : Factory that will be registered for CID aClass
|
||||
* @param aContractID : ContractID associated with CID aClass. May be null
|
||||
* if no contract ID is needed.
|
||||
* @param aFactory : Factory that will be registered for CID aClass.
|
||||
* If aFactory is null, the contract will be associated
|
||||
* with a previously registered CID.
|
||||
*/
|
||||
|
@ -79,6 +100,28 @@ interface nsIComponentRegistrar : nsISupports
|
|||
void unregisterFactory(in nsCIDRef aClass,
|
||||
in nsIFactory aFactory);
|
||||
|
||||
/**
|
||||
* registerFactoryLocation
|
||||
* @status OBSOLETE: This method is no longer implemented, but preserved
|
||||
* in this interface for binary compatibility with
|
||||
* Mozilla 1.9.2.
|
||||
*/
|
||||
void registerFactoryLocation(in nsCIDRef aClass,
|
||||
in string aClassName,
|
||||
in string aContractID,
|
||||
in nsIFile aFile,
|
||||
in string aLoaderStr,
|
||||
in string aType);
|
||||
|
||||
/**
|
||||
* unregisterFactoryLocation
|
||||
* @status OBSOLETE: This method is no longer implemented, but preserved
|
||||
* in this interface for binary compatibility with
|
||||
* Mozilla 1.9.2.
|
||||
*/
|
||||
void unregisterFactoryLocation(in nsCIDRef aClass,
|
||||
in nsIFile aFile);
|
||||
|
||||
/**
|
||||
* isCIDRegistered
|
||||
*
|
||||
|
@ -124,6 +167,14 @@ interface nsIComponentRegistrar : nsISupports
|
|||
*/
|
||||
nsISimpleEnumerator enumerateContractIDs();
|
||||
|
||||
/**
|
||||
* CIDToContractID
|
||||
* @status OBSOLETE: This method is no longer implemented, but preserved
|
||||
* in this interface for binary compatibility with
|
||||
* Mozilla 1.9.2.
|
||||
*/
|
||||
string CIDToContractID(in nsCIDRef aClass);
|
||||
|
||||
/**
|
||||
* contractIDToCID
|
||||
*
|
||||
|
|
|
@ -0,0 +1,115 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla 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/MPL/
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsIFile;
|
||||
interface nsIComponentManager;
|
||||
|
||||
/**
|
||||
* The nsIModule interface.
|
||||
* @status FROZEN
|
||||
*/
|
||||
|
||||
[scriptable, uuid(7392D032-5371-11d3-994E-00805FD26FEE)]
|
||||
interface nsIModule : nsISupports
|
||||
{
|
||||
/**
|
||||
* Object Instance Creation
|
||||
*
|
||||
* Obtains a Class Object from a nsIModule for a given CID and IID pair.
|
||||
* This class object can either be query to a nsIFactory or a may be
|
||||
* query to a nsIClassInfo.
|
||||
*
|
||||
* @param aCompMgr : The global component manager
|
||||
* @param aClass : ClassID of object instance requested
|
||||
* @param aIID : IID of interface requested
|
||||
*
|
||||
*/
|
||||
void getClassObject(in nsIComponentManager aCompMgr,
|
||||
in nsCIDRef aClass,
|
||||
in nsIIDRef aIID,
|
||||
[retval, iid_is(aIID)] out nsQIResult aResult);
|
||||
|
||||
|
||||
/**
|
||||
* One time registration callback
|
||||
*
|
||||
* When the nsIModule is discovered, this method will be
|
||||
* called so that any setup registration can be preformed.
|
||||
*
|
||||
* @param aCompMgr : The global component manager
|
||||
* @param aLocation : The location of the nsIModule on disk
|
||||
* @param aLoaderStr: Opaque loader specific string
|
||||
* @param aType : Loader Type being used to load this module
|
||||
*/
|
||||
void registerSelf(in nsIComponentManager aCompMgr,
|
||||
in nsIFile aLocation,
|
||||
in string aLoaderStr,
|
||||
in string aType);
|
||||
/**
|
||||
* One time unregistration callback
|
||||
*
|
||||
* When the nsIModule is being unregistered, this method will be
|
||||
* called so that any unregistration can be preformed
|
||||
*
|
||||
* @param aCompMgr : The global component manager
|
||||
* @param aLocation : The location of the nsIModule on disk
|
||||
* @param aLoaderStr : Opaque loader specific string
|
||||
*
|
||||
*/
|
||||
void unregisterSelf(in nsIComponentManager aCompMgr,
|
||||
in nsIFile aLocation,
|
||||
in string aLoaderStr);
|
||||
|
||||
/**
|
||||
* Module load management
|
||||
*
|
||||
* @param aCompMgr : The global component manager
|
||||
*
|
||||
* @return indicates to the caller if the module can be unloaded.
|
||||
* Returning PR_TRUE isn't a guarantee that the module will be
|
||||
* unloaded. It constitues only willingness of the module to be
|
||||
* unloaded. It is very important to ensure that no outstanding
|
||||
* references to the module's code/data exist before returning
|
||||
* PR_TRUE.
|
||||
* Returning PR_FALSE guaratees that the module won't be unloaded.
|
||||
*/
|
||||
boolean canUnload(in nsIComponentManager aCompMgr);
|
||||
};
|
||||
|
||||
|
Загрузка…
Ссылка в новой задаче