From b05a016994321b95ee5b8ffb2555c9350352425b Mon Sep 17 00:00:00 2001 From: "hyatt%netscape.com" Date: Sat, 13 May 2000 23:02:12 +0000 Subject: [PATCH] XBL changes. --- content/xbl/src/nsBindingManager.cpp | 6 ++++-- content/xbl/src/nsXBLBinding.cpp | 4 ++-- layout/xbl/src/nsBindingManager.cpp | 6 ++++-- layout/xbl/src/nsXBLBinding.cpp | 4 ++-- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/content/xbl/src/nsBindingManager.cpp b/content/xbl/src/nsBindingManager.cpp index 72d0b727b0d..8fe02aa661e 100644 --- a/content/xbl/src/nsBindingManager.cpp +++ b/content/xbl/src/nsBindingManager.cpp @@ -115,8 +115,10 @@ nsBindingManager::SetBinding(nsIContent* aContent, nsIXBLBinding* aBinding ) mBindingTable = new nsSupportsHashtable; nsISupportsKey key(aContent); - if (aBinding) - mBindingTable->Put(&key, aBinding); + if (aBinding) { + nsIXBLBinding* oldBinding = NS_STATIC_CAST(nsIXBLBinding*, mBindingTable->Put(&key, aBinding)); + NS_IF_RELEASE(oldBinding); + } else mBindingTable->Remove(&key); diff --git a/content/xbl/src/nsXBLBinding.cpp b/content/xbl/src/nsXBLBinding.cpp index 64e3a052c22..cab521e80c2 100644 --- a/content/xbl/src/nsXBLBinding.cpp +++ b/content/xbl/src/nsXBLBinding.cpp @@ -854,7 +854,7 @@ nsXBLBinding::InstallProperties(nsIContent* aBoundElement) // destruction of any initial value that might be set. // This means we only have to worry about defining the getter // or setter. - rv = ::JS_DefineUCProperty(cx, (JSObject*)mScriptObject, name.GetUnicode(), + ::JS_DefineUCProperty(cx, (JSObject*)mScriptObject, name.GetUnicode(), name.Length(), JSVAL_VOID, (JSPropertyOp) getFunc, (JSPropertyOp) setFunc, @@ -887,7 +887,7 @@ nsXBLBinding::InstallProperties(nsIContent* aBoundElement) if (!undefined) { // Define that value as a property - rv = ::JS_DefineUCProperty(cx, (JSObject*)mScriptObject, name.GetUnicode(), + ::JS_DefineUCProperty(cx, (JSObject*)mScriptObject, name.GetUnicode(), name.Length(), result, nsnull, nsnull, attrs); diff --git a/layout/xbl/src/nsBindingManager.cpp b/layout/xbl/src/nsBindingManager.cpp index 72d0b727b0d..8fe02aa661e 100644 --- a/layout/xbl/src/nsBindingManager.cpp +++ b/layout/xbl/src/nsBindingManager.cpp @@ -115,8 +115,10 @@ nsBindingManager::SetBinding(nsIContent* aContent, nsIXBLBinding* aBinding ) mBindingTable = new nsSupportsHashtable; nsISupportsKey key(aContent); - if (aBinding) - mBindingTable->Put(&key, aBinding); + if (aBinding) { + nsIXBLBinding* oldBinding = NS_STATIC_CAST(nsIXBLBinding*, mBindingTable->Put(&key, aBinding)); + NS_IF_RELEASE(oldBinding); + } else mBindingTable->Remove(&key); diff --git a/layout/xbl/src/nsXBLBinding.cpp b/layout/xbl/src/nsXBLBinding.cpp index 64e3a052c22..cab521e80c2 100644 --- a/layout/xbl/src/nsXBLBinding.cpp +++ b/layout/xbl/src/nsXBLBinding.cpp @@ -854,7 +854,7 @@ nsXBLBinding::InstallProperties(nsIContent* aBoundElement) // destruction of any initial value that might be set. // This means we only have to worry about defining the getter // or setter. - rv = ::JS_DefineUCProperty(cx, (JSObject*)mScriptObject, name.GetUnicode(), + ::JS_DefineUCProperty(cx, (JSObject*)mScriptObject, name.GetUnicode(), name.Length(), JSVAL_VOID, (JSPropertyOp) getFunc, (JSPropertyOp) setFunc, @@ -887,7 +887,7 @@ nsXBLBinding::InstallProperties(nsIContent* aBoundElement) if (!undefined) { // Define that value as a property - rv = ::JS_DefineUCProperty(cx, (JSObject*)mScriptObject, name.GetUnicode(), + ::JS_DefineUCProperty(cx, (JSObject*)mScriptObject, name.GetUnicode(), name.Length(), result, nsnull, nsnull, attrs);