diff --git a/js/src/jsxml.c b/js/src/jsxml.c index 977575142481..05990f38e59a 100644 --- a/js/src/jsxml.c +++ b/js/src/jsxml.c @@ -1758,7 +1758,7 @@ ParseNodeToXML(JSContext *cx, JSParseNode *pn, JSXMLArray *inScopeNSes, qn = NULL; if (pn->pn_type == TOK_XMLCOMMENT) { if (flags & XSF_IGNORE_COMMENTS) - return PN2X_SKIP_CHILD; + goto skip_child; xml_class = JSXML_CLASS_COMMENT; } else if (pn->pn_type == TOK_XMLPI) { if (IS_XML(str)) { @@ -1771,7 +1771,7 @@ ParseNodeToXML(JSContext *cx, JSParseNode *pn, JSXMLArray *inScopeNSes, } if (flags & XSF_IGNORE_PROCESSING_INSTRUCTIONS) - return PN2X_SKIP_CHILD; + goto skip_child; qn = ParseNodeToQName(cx, pn, inScopeNSes, JS_FALSE); if (!qn) @@ -1804,6 +1804,10 @@ ParseNodeToXML(JSContext *cx, JSParseNode *pn, JSXMLArray *inScopeNSes, return NULL; return xml; +skip_child: + js_LeaveLocalRootScope(cx); + return PN2X_SKIP_CHILD; + #undef PN2X_SKIP_CHILD syntax: