[XForms] XPath expressions using namespaces inside repeats generate error messages. Bug 312848, r=aaronr+smaug

git-svn-id: svn://10.0.0.236/trunk@184751 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
allan%beaufour.dk 2005-11-16 06:49:37 +00:00
parent cafea0846b
commit ba67c0475d
2 changed files with 8 additions and 14 deletions

View File

@ -773,11 +773,19 @@ nsXFormsRepeatElement::Refresh()
rv = riContext->SetContext(contextNode, i, contextSize);
NS_ENSURE_SUCCESS(rv, rv);
// We need to insert the context node before adding the children, or the
// children will fail to set up their proper XForms context.
nsCOMPtr<nsIDOMNode> domNode;
rv = mHTMLElement->AppendChild(riElement, getter_AddRefs(domNode));
NS_ENSURE_SUCCESS(rv, rv);
// Iterate over template children, clone them, and append them to <contextcontainer>
nsCOMPtr<nsIDOMNode> child;
rv = mElement->GetFirstChild(getter_AddRefs(child));
NS_ENSURE_SUCCESS(rv, rv);
while (child) {
/// XXX the node probably refreshes itself twice here, once on cloning
/// and once when it's inserted ... that's not necessary.
nsCOMPtr<nsIDOMNode> childClone;
rv = CloneNode(child, getter_AddRefs(childClone));
NS_ENSURE_SUCCESS(rv, rv);
@ -790,16 +798,6 @@ nsXFormsRepeatElement::Refresh()
NS_ENSURE_SUCCESS(rv, rv);
child = newNode;
}
// Append node
nsCOMPtr<nsIDOMNode> domNode;
rv = mHTMLElement->AppendChild(riElement, getter_AddRefs(domNode));
NS_ENSURE_SUCCESS(rv, rv);
// There is an awfull lot of evaluating being done by all the
// children, as they are created and inserted into the different
// places in the DOM, the only refresh necessary is the one when they
// are appended in mHTMLElement.
}
if (!mParent && !mCurrentIndex && mMaxIndex) {

View File

@ -391,10 +391,6 @@ nsXFormsUtils::EvaluateXPath(const nsAString &aExpression,
nsCOMArray<nsIDOMNode> *aSet,
nsStringArray *aIndexesUsed)
{
nsCOMPtr<nsIDOMDocument> doc;
aContextNode->GetOwnerDocument(getter_AddRefs(doc));
NS_ENSURE_TRUE(doc, nsnull);
nsCOMPtr<nsIXFormsXPathEvaluator> eval =
do_CreateInstance("@mozilla.org/dom/xforms-xpath-evaluator;1");
NS_ENSURE_TRUE(eval, nsnull);