Fix profile manager crash.
git-svn-id: svn://10.0.0.236/trunk@71012 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -49,7 +49,7 @@
|
||||
#include "nsINameSpace.h"
|
||||
#include "nsJSUtils.h"
|
||||
#include "nsIJSRuntimeService.h"
|
||||
#include "nsIXBLService.h"
|
||||
#include "nsXBLService.h"
|
||||
|
||||
// Event listeners
|
||||
#include "nsIEventListenerManager.h"
|
||||
@@ -130,14 +130,6 @@ XBLBindingCtor(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rva
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
static PRBool PR_CALLBACK DeleteClasses(nsHashKey* aKey, void* aValue, void* closure)
|
||||
{
|
||||
JSClass* c = (JSClass*)aValue;
|
||||
nsAllocator::Free(c->name);
|
||||
delete c;
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
// *********************************************************************/
|
||||
// The XBLBinding class
|
||||
|
||||
@@ -183,8 +175,6 @@ public:
|
||||
// Static members
|
||||
static PRUint32 gRefCnt;
|
||||
|
||||
static nsHashtable* gClassTable;
|
||||
|
||||
static nsIAtom* kContentAtom;
|
||||
static nsIAtom* kInterfaceAtom;
|
||||
static nsIAtom* kHandlersAtom;
|
||||
@@ -254,9 +244,7 @@ protected:
|
||||
|
||||
// Static initialization
|
||||
PRUint32 nsXBLBinding::gRefCnt = 0;
|
||||
|
||||
nsHashtable* nsXBLBinding::gClassTable = nsnull;
|
||||
|
||||
|
||||
nsIAtom* nsXBLBinding::kContentAtom = nsnull;
|
||||
nsIAtom* nsXBLBinding::kInterfaceAtom = nsnull;
|
||||
nsIAtom* nsXBLBinding::kHandlersAtom = nsnull;
|
||||
@@ -370,8 +358,6 @@ nsXBLBinding::nsXBLBinding(void)
|
||||
entry->mAttributeAtom = NS_NewAtom(entry->mAttributeName);
|
||||
++entry;
|
||||
}
|
||||
|
||||
gClassTable = new nsHashtable();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -412,11 +398,6 @@ nsXBLBinding::~nsXBLBinding(void)
|
||||
NS_IF_RELEASE(entry->mAttributeAtom);
|
||||
++entry;
|
||||
}
|
||||
|
||||
// Walk the hashtable and delete the JSClasses
|
||||
if (gClassTable)
|
||||
gClassTable->Enumerate(DeleteClasses);
|
||||
delete gClassTable;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1140,7 +1121,7 @@ nsXBLBinding::InitClass(const nsCString& aClassName, nsIScriptContext* aContext,
|
||||
JSClass* c;
|
||||
void* classObject;
|
||||
nsStringKey key(aClassName);
|
||||
classObject = gClassTable->Get(&key);
|
||||
classObject = (nsXBLService::gClassTable)->Get(&key);
|
||||
|
||||
if (classObject)
|
||||
c = (JSClass*)classObject;
|
||||
@@ -1162,7 +1143,7 @@ nsXBLBinding::InitClass(const nsCString& aClassName, nsIScriptContext* aContext,
|
||||
c->hasInstance = 0;
|
||||
|
||||
// Add c to our table.
|
||||
gClassTable->Put(&key, (void*)c);
|
||||
(nsXBLService::gClassTable)->Put(&key, (void*)c);
|
||||
}
|
||||
|
||||
// Retrieve the current prototype for the JS object.
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
*/
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIXBLService.h"
|
||||
#include "nsXBLService.h"
|
||||
#include "nsIInputStream.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsHashtable.h"
|
||||
@@ -110,68 +110,6 @@ public:
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsProxyStream, NS_GET_IID(nsIInputStream));
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class nsXBLService: public nsIXBLService
|
||||
{
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// This function loads a particular XBL file and installs all of the bindings
|
||||
// onto the element.
|
||||
NS_IMETHOD LoadBindings(nsIContent* aContent, const nsString& aURL);
|
||||
|
||||
// This function clears out the bindings on a given content node.
|
||||
NS_IMETHOD FlushBindings(nsIContent* aContent);
|
||||
|
||||
// This function clears out the binding doucments in our cache.
|
||||
NS_IMETHOD FlushBindingDocuments();
|
||||
|
||||
// For a given element, returns a flat list of all the anonymous children that need
|
||||
// frames built.
|
||||
NS_IMETHOD GetContentList(nsIContent* aContent, nsISupportsArray** aResult, nsIContent** aChildElement,
|
||||
PRBool* aMultipleInsertionPoints);
|
||||
|
||||
// Gets the object's base class type.
|
||||
NS_IMETHOD ResolveTag(nsIContent* aContent, PRInt32* aNameSpaceID, nsIAtom** aResult);
|
||||
|
||||
NS_IMETHOD AllowScripts(nsIContent* aContent, PRBool* aAllowScripts);
|
||||
|
||||
public:
|
||||
nsXBLService();
|
||||
virtual ~nsXBLService();
|
||||
|
||||
// This method loads a binding doc and then builds the specific binding required.
|
||||
NS_IMETHOD GetBinding(const nsCString& aURLStr, nsIXBLBinding** aResult);
|
||||
|
||||
// This method checks the hashtable and then calls FetchBindingDocument on a miss.
|
||||
NS_IMETHOD GetBindingDocument(const nsCString& aURI, nsIDocument** aResult);
|
||||
|
||||
// This method synchronously loads and parses an XBL file.
|
||||
NS_IMETHOD FetchBindingDocument(nsIURI* aURI, nsIDocument** aResult);
|
||||
|
||||
// This method walks a binding document and removes any text nodes
|
||||
// that contain only whitespace.
|
||||
NS_IMETHOD StripWhitespaceNodes(nsIContent* aContent);
|
||||
|
||||
// MEMBER VARIABLES
|
||||
protected:
|
||||
static nsSupportsHashtable* mBindingTable; // This is a table of all the bindings files
|
||||
// we have loaded
|
||||
// during this session.
|
||||
static nsSupportsHashtable* mScriptAccessTable; // Can the doc's bindings access scripts
|
||||
static nsINameSpaceManager* gNameSpaceManager; // Used to register the XBL namespace
|
||||
static PRInt32 kNameSpaceID_XBL; // Convenient cached XBL namespace.
|
||||
|
||||
static PRUint32 gRefCnt; // A count of XBLservice instances.
|
||||
|
||||
static PRBool gDisableChromeCache;
|
||||
|
||||
// XBL Atoms
|
||||
static nsIAtom* kExtendsAtom;
|
||||
static nsIAtom* kHasChildrenAtom;
|
||||
static nsIAtom* kURIAtom;
|
||||
};
|
||||
|
||||
|
||||
// Implementation /////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -181,6 +119,8 @@ nsSupportsHashtable* nsXBLService::mBindingTable = nsnull;
|
||||
nsSupportsHashtable* nsXBLService::mScriptAccessTable = nsnull;
|
||||
|
||||
nsINameSpaceManager* nsXBLService::gNameSpaceManager = nsnull;
|
||||
|
||||
nsHashtable* nsXBLService::gClassTable = nsnull;
|
||||
|
||||
nsIAtom* nsXBLService::kExtendsAtom = nsnull;
|
||||
nsIAtom* nsXBLService::kHasChildrenAtom = nsnull;
|
||||
@@ -230,9 +170,19 @@ nsXBLService::nsXBLService(void)
|
||||
NS_WITH_SERVICE(nsIPref, prefs, NS_PREF_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
prefs->GetBoolPref(kDisableChromeCachePref, &gDisableChromeCache);
|
||||
|
||||
gClassTable = new nsHashtable();
|
||||
}
|
||||
}
|
||||
|
||||
static PRBool PR_CALLBACK DeleteClasses(nsHashKey* aKey, void* aValue, void* closure)
|
||||
{
|
||||
JSClass* c = (JSClass*)aValue;
|
||||
nsAllocator::Free(c->name);
|
||||
delete c;
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
nsXBLService::~nsXBLService(void)
|
||||
{
|
||||
gRefCnt--;
|
||||
@@ -246,6 +196,11 @@ nsXBLService::~nsXBLService(void)
|
||||
NS_RELEASE(kExtendsAtom);
|
||||
NS_RELEASE(kHasChildrenAtom);
|
||||
NS_RELEASE(kURIAtom);
|
||||
|
||||
// Walk the hashtable and delete the JSClasses
|
||||
if (gClassTable)
|
||||
gClassTable->Enumerate(DeleteClasses);
|
||||
delete gClassTable;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
100
mozilla/content/xbl/src/nsXBLService.h
Normal file
100
mozilla/content/xbl/src/nsXBLService.h
Normal file
@@ -0,0 +1,100 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* 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/
|
||||
*
|
||||
* 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 Communicator client code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Original Author: David W. Hyatt (hyatt@netscape.com)
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "nsIXBLService.h"
|
||||
|
||||
class nsIXBLBinding;
|
||||
class nsINameSpaceManager;
|
||||
class nsIContent;
|
||||
class nsIDocument;
|
||||
class nsIAtom;
|
||||
class nsString;
|
||||
class nsIURI;
|
||||
class nsSupportsHashtable;
|
||||
class nsHashtable;
|
||||
|
||||
class nsXBLService: public nsIXBLService
|
||||
{
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// This function loads a particular XBL file and installs all of the bindings
|
||||
// onto the element.
|
||||
NS_IMETHOD LoadBindings(nsIContent* aContent, const nsString& aURL);
|
||||
|
||||
// This function clears out the bindings on a given content node.
|
||||
NS_IMETHOD FlushBindings(nsIContent* aContent);
|
||||
|
||||
// This function clears out the binding doucments in our cache.
|
||||
NS_IMETHOD FlushBindingDocuments();
|
||||
|
||||
// For a given element, returns a flat list of all the anonymous children that need
|
||||
// frames built.
|
||||
NS_IMETHOD GetContentList(nsIContent* aContent, nsISupportsArray** aResult, nsIContent** aChildElement,
|
||||
PRBool* aMultipleInsertionPoints);
|
||||
|
||||
// Gets the object's base class type.
|
||||
NS_IMETHOD ResolveTag(nsIContent* aContent, PRInt32* aNameSpaceID, nsIAtom** aResult);
|
||||
|
||||
NS_IMETHOD AllowScripts(nsIContent* aContent, PRBool* aAllowScripts);
|
||||
|
||||
public:
|
||||
nsXBLService();
|
||||
virtual ~nsXBLService();
|
||||
|
||||
// This method loads a binding doc and then builds the specific binding required.
|
||||
NS_IMETHOD GetBinding(const nsCString& aURLStr, nsIXBLBinding** aResult);
|
||||
|
||||
// This method checks the hashtable and then calls FetchBindingDocument on a miss.
|
||||
NS_IMETHOD GetBindingDocument(const nsCString& aURI, nsIDocument** aResult);
|
||||
|
||||
// This method synchronously loads and parses an XBL file.
|
||||
NS_IMETHOD FetchBindingDocument(nsIURI* aURI, nsIDocument** aResult);
|
||||
|
||||
// This method walks a binding document and removes any text nodes
|
||||
// that contain only whitespace.
|
||||
NS_IMETHOD StripWhitespaceNodes(nsIContent* aContent);
|
||||
|
||||
// MEMBER VARIABLES
|
||||
public:
|
||||
static nsSupportsHashtable* mBindingTable; // This is a table of all the bindings files
|
||||
// we have loaded
|
||||
// during this session.
|
||||
static nsSupportsHashtable* mScriptAccessTable; // Can the doc's bindings access scripts
|
||||
static nsINameSpaceManager* gNameSpaceManager; // Used to register the XBL namespace
|
||||
static PRInt32 kNameSpaceID_XBL; // Convenient cached XBL namespace.
|
||||
|
||||
static PRUint32 gRefCnt; // A count of XBLservice instances.
|
||||
|
||||
static PRBool gDisableChromeCache;
|
||||
|
||||
static nsHashtable* gClassTable; // A table of JSClass objects.
|
||||
|
||||
// XBL Atoms
|
||||
static nsIAtom* kExtendsAtom;
|
||||
static nsIAtom* kHasChildrenAtom;
|
||||
static nsIAtom* kURIAtom;
|
||||
};
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
#include "nsINameSpace.h"
|
||||
#include "nsJSUtils.h"
|
||||
#include "nsIJSRuntimeService.h"
|
||||
#include "nsIXBLService.h"
|
||||
#include "nsXBLService.h"
|
||||
|
||||
// Event listeners
|
||||
#include "nsIEventListenerManager.h"
|
||||
@@ -130,14 +130,6 @@ XBLBindingCtor(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rva
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
static PRBool PR_CALLBACK DeleteClasses(nsHashKey* aKey, void* aValue, void* closure)
|
||||
{
|
||||
JSClass* c = (JSClass*)aValue;
|
||||
nsAllocator::Free(c->name);
|
||||
delete c;
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
// *********************************************************************/
|
||||
// The XBLBinding class
|
||||
|
||||
@@ -183,8 +175,6 @@ public:
|
||||
// Static members
|
||||
static PRUint32 gRefCnt;
|
||||
|
||||
static nsHashtable* gClassTable;
|
||||
|
||||
static nsIAtom* kContentAtom;
|
||||
static nsIAtom* kInterfaceAtom;
|
||||
static nsIAtom* kHandlersAtom;
|
||||
@@ -254,9 +244,7 @@ protected:
|
||||
|
||||
// Static initialization
|
||||
PRUint32 nsXBLBinding::gRefCnt = 0;
|
||||
|
||||
nsHashtable* nsXBLBinding::gClassTable = nsnull;
|
||||
|
||||
|
||||
nsIAtom* nsXBLBinding::kContentAtom = nsnull;
|
||||
nsIAtom* nsXBLBinding::kInterfaceAtom = nsnull;
|
||||
nsIAtom* nsXBLBinding::kHandlersAtom = nsnull;
|
||||
@@ -370,8 +358,6 @@ nsXBLBinding::nsXBLBinding(void)
|
||||
entry->mAttributeAtom = NS_NewAtom(entry->mAttributeName);
|
||||
++entry;
|
||||
}
|
||||
|
||||
gClassTable = new nsHashtable();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -412,11 +398,6 @@ nsXBLBinding::~nsXBLBinding(void)
|
||||
NS_IF_RELEASE(entry->mAttributeAtom);
|
||||
++entry;
|
||||
}
|
||||
|
||||
// Walk the hashtable and delete the JSClasses
|
||||
if (gClassTable)
|
||||
gClassTable->Enumerate(DeleteClasses);
|
||||
delete gClassTable;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1140,7 +1121,7 @@ nsXBLBinding::InitClass(const nsCString& aClassName, nsIScriptContext* aContext,
|
||||
JSClass* c;
|
||||
void* classObject;
|
||||
nsStringKey key(aClassName);
|
||||
classObject = gClassTable->Get(&key);
|
||||
classObject = (nsXBLService::gClassTable)->Get(&key);
|
||||
|
||||
if (classObject)
|
||||
c = (JSClass*)classObject;
|
||||
@@ -1162,7 +1143,7 @@ nsXBLBinding::InitClass(const nsCString& aClassName, nsIScriptContext* aContext,
|
||||
c->hasInstance = 0;
|
||||
|
||||
// Add c to our table.
|
||||
gClassTable->Put(&key, (void*)c);
|
||||
(nsXBLService::gClassTable)->Put(&key, (void*)c);
|
||||
}
|
||||
|
||||
// Retrieve the current prototype for the JS object.
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
*/
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIXBLService.h"
|
||||
#include "nsXBLService.h"
|
||||
#include "nsIInputStream.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsHashtable.h"
|
||||
@@ -110,68 +110,6 @@ public:
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsProxyStream, NS_GET_IID(nsIInputStream));
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class nsXBLService: public nsIXBLService
|
||||
{
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// This function loads a particular XBL file and installs all of the bindings
|
||||
// onto the element.
|
||||
NS_IMETHOD LoadBindings(nsIContent* aContent, const nsString& aURL);
|
||||
|
||||
// This function clears out the bindings on a given content node.
|
||||
NS_IMETHOD FlushBindings(nsIContent* aContent);
|
||||
|
||||
// This function clears out the binding doucments in our cache.
|
||||
NS_IMETHOD FlushBindingDocuments();
|
||||
|
||||
// For a given element, returns a flat list of all the anonymous children that need
|
||||
// frames built.
|
||||
NS_IMETHOD GetContentList(nsIContent* aContent, nsISupportsArray** aResult, nsIContent** aChildElement,
|
||||
PRBool* aMultipleInsertionPoints);
|
||||
|
||||
// Gets the object's base class type.
|
||||
NS_IMETHOD ResolveTag(nsIContent* aContent, PRInt32* aNameSpaceID, nsIAtom** aResult);
|
||||
|
||||
NS_IMETHOD AllowScripts(nsIContent* aContent, PRBool* aAllowScripts);
|
||||
|
||||
public:
|
||||
nsXBLService();
|
||||
virtual ~nsXBLService();
|
||||
|
||||
// This method loads a binding doc and then builds the specific binding required.
|
||||
NS_IMETHOD GetBinding(const nsCString& aURLStr, nsIXBLBinding** aResult);
|
||||
|
||||
// This method checks the hashtable and then calls FetchBindingDocument on a miss.
|
||||
NS_IMETHOD GetBindingDocument(const nsCString& aURI, nsIDocument** aResult);
|
||||
|
||||
// This method synchronously loads and parses an XBL file.
|
||||
NS_IMETHOD FetchBindingDocument(nsIURI* aURI, nsIDocument** aResult);
|
||||
|
||||
// This method walks a binding document and removes any text nodes
|
||||
// that contain only whitespace.
|
||||
NS_IMETHOD StripWhitespaceNodes(nsIContent* aContent);
|
||||
|
||||
// MEMBER VARIABLES
|
||||
protected:
|
||||
static nsSupportsHashtable* mBindingTable; // This is a table of all the bindings files
|
||||
// we have loaded
|
||||
// during this session.
|
||||
static nsSupportsHashtable* mScriptAccessTable; // Can the doc's bindings access scripts
|
||||
static nsINameSpaceManager* gNameSpaceManager; // Used to register the XBL namespace
|
||||
static PRInt32 kNameSpaceID_XBL; // Convenient cached XBL namespace.
|
||||
|
||||
static PRUint32 gRefCnt; // A count of XBLservice instances.
|
||||
|
||||
static PRBool gDisableChromeCache;
|
||||
|
||||
// XBL Atoms
|
||||
static nsIAtom* kExtendsAtom;
|
||||
static nsIAtom* kHasChildrenAtom;
|
||||
static nsIAtom* kURIAtom;
|
||||
};
|
||||
|
||||
|
||||
// Implementation /////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -181,6 +119,8 @@ nsSupportsHashtable* nsXBLService::mBindingTable = nsnull;
|
||||
nsSupportsHashtable* nsXBLService::mScriptAccessTable = nsnull;
|
||||
|
||||
nsINameSpaceManager* nsXBLService::gNameSpaceManager = nsnull;
|
||||
|
||||
nsHashtable* nsXBLService::gClassTable = nsnull;
|
||||
|
||||
nsIAtom* nsXBLService::kExtendsAtom = nsnull;
|
||||
nsIAtom* nsXBLService::kHasChildrenAtom = nsnull;
|
||||
@@ -230,9 +170,19 @@ nsXBLService::nsXBLService(void)
|
||||
NS_WITH_SERVICE(nsIPref, prefs, NS_PREF_PROGID, &rv);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
prefs->GetBoolPref(kDisableChromeCachePref, &gDisableChromeCache);
|
||||
|
||||
gClassTable = new nsHashtable();
|
||||
}
|
||||
}
|
||||
|
||||
static PRBool PR_CALLBACK DeleteClasses(nsHashKey* aKey, void* aValue, void* closure)
|
||||
{
|
||||
JSClass* c = (JSClass*)aValue;
|
||||
nsAllocator::Free(c->name);
|
||||
delete c;
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
nsXBLService::~nsXBLService(void)
|
||||
{
|
||||
gRefCnt--;
|
||||
@@ -246,6 +196,11 @@ nsXBLService::~nsXBLService(void)
|
||||
NS_RELEASE(kExtendsAtom);
|
||||
NS_RELEASE(kHasChildrenAtom);
|
||||
NS_RELEASE(kURIAtom);
|
||||
|
||||
// Walk the hashtable and delete the JSClasses
|
||||
if (gClassTable)
|
||||
gClassTable->Enumerate(DeleteClasses);
|
||||
delete gClassTable;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
100
mozilla/layout/xbl/src/nsXBLService.h
Normal file
100
mozilla/layout/xbl/src/nsXBLService.h
Normal file
@@ -0,0 +1,100 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* 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/
|
||||
*
|
||||
* 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 Communicator client code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Original Author: David W. Hyatt (hyatt@netscape.com)
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "nsIXBLService.h"
|
||||
|
||||
class nsIXBLBinding;
|
||||
class nsINameSpaceManager;
|
||||
class nsIContent;
|
||||
class nsIDocument;
|
||||
class nsIAtom;
|
||||
class nsString;
|
||||
class nsIURI;
|
||||
class nsSupportsHashtable;
|
||||
class nsHashtable;
|
||||
|
||||
class nsXBLService: public nsIXBLService
|
||||
{
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// This function loads a particular XBL file and installs all of the bindings
|
||||
// onto the element.
|
||||
NS_IMETHOD LoadBindings(nsIContent* aContent, const nsString& aURL);
|
||||
|
||||
// This function clears out the bindings on a given content node.
|
||||
NS_IMETHOD FlushBindings(nsIContent* aContent);
|
||||
|
||||
// This function clears out the binding doucments in our cache.
|
||||
NS_IMETHOD FlushBindingDocuments();
|
||||
|
||||
// For a given element, returns a flat list of all the anonymous children that need
|
||||
// frames built.
|
||||
NS_IMETHOD GetContentList(nsIContent* aContent, nsISupportsArray** aResult, nsIContent** aChildElement,
|
||||
PRBool* aMultipleInsertionPoints);
|
||||
|
||||
// Gets the object's base class type.
|
||||
NS_IMETHOD ResolveTag(nsIContent* aContent, PRInt32* aNameSpaceID, nsIAtom** aResult);
|
||||
|
||||
NS_IMETHOD AllowScripts(nsIContent* aContent, PRBool* aAllowScripts);
|
||||
|
||||
public:
|
||||
nsXBLService();
|
||||
virtual ~nsXBLService();
|
||||
|
||||
// This method loads a binding doc and then builds the specific binding required.
|
||||
NS_IMETHOD GetBinding(const nsCString& aURLStr, nsIXBLBinding** aResult);
|
||||
|
||||
// This method checks the hashtable and then calls FetchBindingDocument on a miss.
|
||||
NS_IMETHOD GetBindingDocument(const nsCString& aURI, nsIDocument** aResult);
|
||||
|
||||
// This method synchronously loads and parses an XBL file.
|
||||
NS_IMETHOD FetchBindingDocument(nsIURI* aURI, nsIDocument** aResult);
|
||||
|
||||
// This method walks a binding document and removes any text nodes
|
||||
// that contain only whitespace.
|
||||
NS_IMETHOD StripWhitespaceNodes(nsIContent* aContent);
|
||||
|
||||
// MEMBER VARIABLES
|
||||
public:
|
||||
static nsSupportsHashtable* mBindingTable; // This is a table of all the bindings files
|
||||
// we have loaded
|
||||
// during this session.
|
||||
static nsSupportsHashtable* mScriptAccessTable; // Can the doc's bindings access scripts
|
||||
static nsINameSpaceManager* gNameSpaceManager; // Used to register the XBL namespace
|
||||
static PRInt32 kNameSpaceID_XBL; // Convenient cached XBL namespace.
|
||||
|
||||
static PRUint32 gRefCnt; // A count of XBLservice instances.
|
||||
|
||||
static PRBool gDisableChromeCache;
|
||||
|
||||
static nsHashtable* gClassTable; // A table of JSClass objects.
|
||||
|
||||
// XBL Atoms
|
||||
static nsIAtom* kExtendsAtom;
|
||||
static nsIAtom* kHasChildrenAtom;
|
||||
static nsIAtom* kURIAtom;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user