зеркало из https://github.com/mozilla/gecko-dev.git
Converting XBL bindings to use id.
This commit is contained in:
Родитель
4310ed181b
Коммит
7b0b2e099b
|
@ -178,6 +178,7 @@ protected:
|
||||||
static nsSupportsHashtable* mBindingTable; // This is a table of all the bindings files
|
static nsSupportsHashtable* mBindingTable; // This is a table of all the bindings files
|
||||||
// we have loaded
|
// we have loaded
|
||||||
// during this session.
|
// during this session.
|
||||||
|
static nsSupportsHashtable* mProtoClassTable; // Every binding with methods/properties has a protoclass.
|
||||||
static nsINameSpaceManager* gNameSpaceManager; // Used to register the XBL namespace
|
static nsINameSpaceManager* gNameSpaceManager; // Used to register the XBL namespace
|
||||||
static PRInt32 kNameSpaceID_XBL; // Convenient cached XBL namespace.
|
static PRInt32 kNameSpaceID_XBL; // Convenient cached XBL namespace.
|
||||||
|
|
||||||
|
@ -194,6 +195,8 @@ protected:
|
||||||
// Static member variable initialization
|
// Static member variable initialization
|
||||||
PRUint32 nsXBLService::gRefCnt = 0;
|
PRUint32 nsXBLService::gRefCnt = 0;
|
||||||
nsSupportsHashtable* nsXBLService::mBindingTable = nsnull;
|
nsSupportsHashtable* nsXBLService::mBindingTable = nsnull;
|
||||||
|
nsSupportsHashtable* nsXBLService::mProtoClassTable = nsnull;
|
||||||
|
|
||||||
nsINameSpaceManager* nsXBLService::gNameSpaceManager = nsnull;
|
nsINameSpaceManager* nsXBLService::gNameSpaceManager = nsnull;
|
||||||
|
|
||||||
nsIAtom* nsXBLService::kExtendsAtom = nsnull;
|
nsIAtom* nsXBLService::kExtendsAtom = nsnull;
|
||||||
|
@ -212,6 +215,7 @@ nsXBLService::nsXBLService(void)
|
||||||
if (gRefCnt == 1) {
|
if (gRefCnt == 1) {
|
||||||
// Create our binding table.
|
// Create our binding table.
|
||||||
mBindingTable = new nsSupportsHashtable();
|
mBindingTable = new nsSupportsHashtable();
|
||||||
|
mProtoClassTable = new nsSupportsHashtable();
|
||||||
|
|
||||||
// Register the XBL namespace.
|
// Register the XBL namespace.
|
||||||
nsresult rv = nsComponentManager::CreateInstance(kNameSpaceManagerCID,
|
nsresult rv = nsComponentManager::CreateInstance(kNameSpaceManagerCID,
|
||||||
|
@ -240,6 +244,8 @@ nsXBLService::~nsXBLService(void)
|
||||||
gRefCnt--;
|
gRefCnt--;
|
||||||
if (gRefCnt == 0) {
|
if (gRefCnt == 0) {
|
||||||
delete mBindingTable;
|
delete mBindingTable;
|
||||||
|
delete mProtoClassTable;
|
||||||
|
|
||||||
NS_IF_RELEASE(gNameSpaceManager);
|
NS_IF_RELEASE(gNameSpaceManager);
|
||||||
|
|
||||||
// Release our atoms
|
// Release our atoms
|
||||||
|
@ -271,7 +277,7 @@ nsXBLService::LoadBindings(nsIContent* aContent, const nsString& aURL)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!binding) {
|
if (!binding) {
|
||||||
nsCAutoString str = "Failed to locate XBL binding. The invalid binding name is: ";
|
nsCAutoString str = "Failed to locate XBL binding. XBL is now using id instead of name to reference bindings. Make sure you have switched over. The invalid binding name is: ";
|
||||||
str.AppendWithConversion(aURL);
|
str.AppendWithConversion(aURL);
|
||||||
NS_ERROR(str);
|
NS_ERROR(str);
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
|
@ -412,7 +418,7 @@ NS_IMETHODIMP nsXBLService::GetBinding(nsCAutoString& aURLStr, nsIXBLBinding** a
|
||||||
root->ChildAt(i, *getter_AddRefs(child));
|
root->ChildAt(i, *getter_AddRefs(child));
|
||||||
|
|
||||||
nsAutoString value;
|
nsAutoString value;
|
||||||
child->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::name, value);
|
child->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::id, value);
|
||||||
|
|
||||||
// If no ref is specified just use this.
|
// If no ref is specified just use this.
|
||||||
if ((bindingName.IsEmpty()) || (bindingName == value)) {
|
if ((bindingName.IsEmpty()) || (bindingName == value)) {
|
||||||
|
|
|
@ -178,6 +178,7 @@ protected:
|
||||||
static nsSupportsHashtable* mBindingTable; // This is a table of all the bindings files
|
static nsSupportsHashtable* mBindingTable; // This is a table of all the bindings files
|
||||||
// we have loaded
|
// we have loaded
|
||||||
// during this session.
|
// during this session.
|
||||||
|
static nsSupportsHashtable* mProtoClassTable; // Every binding with methods/properties has a protoclass.
|
||||||
static nsINameSpaceManager* gNameSpaceManager; // Used to register the XBL namespace
|
static nsINameSpaceManager* gNameSpaceManager; // Used to register the XBL namespace
|
||||||
static PRInt32 kNameSpaceID_XBL; // Convenient cached XBL namespace.
|
static PRInt32 kNameSpaceID_XBL; // Convenient cached XBL namespace.
|
||||||
|
|
||||||
|
@ -194,6 +195,8 @@ protected:
|
||||||
// Static member variable initialization
|
// Static member variable initialization
|
||||||
PRUint32 nsXBLService::gRefCnt = 0;
|
PRUint32 nsXBLService::gRefCnt = 0;
|
||||||
nsSupportsHashtable* nsXBLService::mBindingTable = nsnull;
|
nsSupportsHashtable* nsXBLService::mBindingTable = nsnull;
|
||||||
|
nsSupportsHashtable* nsXBLService::mProtoClassTable = nsnull;
|
||||||
|
|
||||||
nsINameSpaceManager* nsXBLService::gNameSpaceManager = nsnull;
|
nsINameSpaceManager* nsXBLService::gNameSpaceManager = nsnull;
|
||||||
|
|
||||||
nsIAtom* nsXBLService::kExtendsAtom = nsnull;
|
nsIAtom* nsXBLService::kExtendsAtom = nsnull;
|
||||||
|
@ -212,6 +215,7 @@ nsXBLService::nsXBLService(void)
|
||||||
if (gRefCnt == 1) {
|
if (gRefCnt == 1) {
|
||||||
// Create our binding table.
|
// Create our binding table.
|
||||||
mBindingTable = new nsSupportsHashtable();
|
mBindingTable = new nsSupportsHashtable();
|
||||||
|
mProtoClassTable = new nsSupportsHashtable();
|
||||||
|
|
||||||
// Register the XBL namespace.
|
// Register the XBL namespace.
|
||||||
nsresult rv = nsComponentManager::CreateInstance(kNameSpaceManagerCID,
|
nsresult rv = nsComponentManager::CreateInstance(kNameSpaceManagerCID,
|
||||||
|
@ -240,6 +244,8 @@ nsXBLService::~nsXBLService(void)
|
||||||
gRefCnt--;
|
gRefCnt--;
|
||||||
if (gRefCnt == 0) {
|
if (gRefCnt == 0) {
|
||||||
delete mBindingTable;
|
delete mBindingTable;
|
||||||
|
delete mProtoClassTable;
|
||||||
|
|
||||||
NS_IF_RELEASE(gNameSpaceManager);
|
NS_IF_RELEASE(gNameSpaceManager);
|
||||||
|
|
||||||
// Release our atoms
|
// Release our atoms
|
||||||
|
@ -271,7 +277,7 @@ nsXBLService::LoadBindings(nsIContent* aContent, const nsString& aURL)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!binding) {
|
if (!binding) {
|
||||||
nsCAutoString str = "Failed to locate XBL binding. The invalid binding name is: ";
|
nsCAutoString str = "Failed to locate XBL binding. XBL is now using id instead of name to reference bindings. Make sure you have switched over. The invalid binding name is: ";
|
||||||
str.AppendWithConversion(aURL);
|
str.AppendWithConversion(aURL);
|
||||||
NS_ERROR(str);
|
NS_ERROR(str);
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
|
@ -412,7 +418,7 @@ NS_IMETHODIMP nsXBLService::GetBinding(nsCAutoString& aURLStr, nsIXBLBinding** a
|
||||||
root->ChildAt(i, *getter_AddRefs(child));
|
root->ChildAt(i, *getter_AddRefs(child));
|
||||||
|
|
||||||
nsAutoString value;
|
nsAutoString value;
|
||||||
child->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::name, value);
|
child->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::id, value);
|
||||||
|
|
||||||
// If no ref is specified just use this.
|
// If no ref is specified just use this.
|
||||||
if ((bindingName.IsEmpty()) || (bindingName == value)) {
|
if ((bindingName.IsEmpty()) || (bindingName == value)) {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче