Bug 374547, regression: unable to repeat xbl bound element inside another with the same binding r=jst,sr=bz

This commit is contained in:
Olli.Pettay@helsinki.fi 2007-04-01 05:19:44 -07:00
parent dac58ab9ec
commit 2ac9d63c5d
2 changed files with 9 additions and 2 deletions

View File

@ -88,6 +88,8 @@
#include "nsIDOMLoadListener.h"
#include "nsIDOMEventGroup.h"
#define NS_MAX_XBL_BINDING_RECURSION 20
static PRBool IsChromeOrResourceURI(nsIURI* aURI)
{
PRBool isChrome = PR_FALSE;
@ -107,6 +109,7 @@ IsAncestorBinding(nsIDocument* aDocument,
NS_ASSERTION(aChildBindingURI, "expected a binding URI");
NS_ASSERTION(aChild, "expected a child content");
PRUint32 bindingRecursion = 0;
nsIContent* bindingParent = aChild->GetBindingParent();
nsBindingManager* bindingManager = aDocument->BindingManager();
for (nsIContent* prev = aChild;
@ -122,12 +125,16 @@ IsAncestorBinding(nsIDocument* aDocument,
&equal);
NS_ENSURE_SUCCESS(rv, PR_TRUE); // assume the worst
if (equal) {
++bindingRecursion;
if (bindingRecursion < NS_MAX_XBL_BINDING_RECURSION) {
continue;
}
nsCAutoString spec;
aChildBindingURI->GetSpec(spec);
NS_ConvertUTF8toUTF16 bindingURI(spec);
const PRUnichar* params[] = { bindingURI.get() };
nsContentUtils::ReportToConsole(nsContentUtils::eXBL_PROPERTIES,
"RecursiveBinding",
"TooDeepBindingRecursion",
params, NS_ARRAY_LENGTH(params),
aDocument->GetDocumentURI(),
EmptyString(), 0, 0,

View File

@ -37,7 +37,7 @@ UnexpectedElement=Unexpected <%1$S> element.
# LOCALIZATION NOTE: do not localize key="%S" modifiers="%S"
GTK2Conflict=Key event not available on GTK2: key="%S" modifiers="%S"
WinConflict=Key event not available on some keyboard layouts: key="%S" modifiers="%S"
RecursiveBinding=The XBL binding "%S" is already used by an ancestor element
TooDeepBindingRecursion=The XBL binding "%S" is already used by too many ancestor elements; not applying it to prevent infinite recursion.
CircularExtendsBinding=Extending the XBL binding "%S" with "%S" would lead to it extending itself
# LOCALIZATION NOTE: do not localize <handler command="...">
CommandNotInChrome=Use of <handler command="..."> not allowed outside chrome.