[XForms] Generate xforms-compute-exceptions for binds. Bug 330579, r=doronr+smaug

This commit is contained in:
aaronr%us.ibm.com 2006-03-16 19:17:19 +00:00
Родитель d910b92107
Коммит c914c224ed
1 изменённых файлов: 16 добавлений и 5 удалений

Просмотреть файл

@ -76,6 +76,7 @@
#include "nsArray.h"
#include "nsIDOMDocumentXBL.h"
#include "nsIProgrammingLanguage.h"
#include "nsDOMError.h"
#define XFORMS_LAZY_INSTANCE_BINDING \
"chrome://xforms/content/xforms.xml#xforms-lazy-instance"
@ -1630,13 +1631,23 @@ nsXFormsModelElement::ProcessBind(nsIXFormsXPathEvaluator *aEvaluator,
nsIDOMXPathResult::ORDERED_NODE_SNAPSHOT_TYPE,
nsnull, getter_AddRefs(result));
if (NS_FAILED(rv)) {
if (rv == NS_ERROR_DOM_INVALID_EXPRESSION_ERR) {
// the xpath expression isn't valid xpath
const nsPromiseFlatString& flat = PromiseFlatString(expr);
const PRUnichar *strings[] = { flat.get() };
nsXFormsUtils::ReportError(NS_LITERAL_STRING("exprParseError"),
strings, 1, aBindElement, nsnull);
nsXFormsUtils::DispatchEvent(mElement, eEvent_ComputeException);
} else {
#ifdef DEBUG
printf("xforms-binding-exception: XPath Evaluation failed\n");
printf("xforms-binding-exception: XPath Evaluation failed\n");
#endif
const PRUnichar *strings[] = { expr.get() };
nsXFormsUtils::ReportError(NS_LITERAL_STRING("nodesetEvaluateError"),
strings, 1, aBindElement, aBindElement);
nsXFormsUtils::DispatchEvent(mElement, eEvent_BindingException);
const PRUnichar *strings[] = { expr.get() };
nsXFormsUtils::ReportError(NS_LITERAL_STRING("nodesetEvaluateError"),
strings, 1, aBindElement, aBindElement);
nsXFormsUtils::DispatchEvent(mElement, eEvent_BindingException);
}
return rv;
}