mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-01 08:42:13 +00:00
bug 301574: Allow XML mode to be enabled explicitly by the XML constructor. r+a=brendan
This commit is contained in:
parent
4c342d3f62
commit
a433fbeebb
@ -1,4 +1,5 @@
|
||||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
* vim: set ts=8 sw=4 et tw=80:
|
||||
*
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
@ -4457,9 +4458,7 @@ js_EmitTree(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn)
|
||||
*/
|
||||
pn2 = pn->pn_head;
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
if (JS_HAS_XML_OPTION(cx) &&
|
||||
pn2->pn_type == TOK_DOT &&
|
||||
pn2->pn_op != JSOP_GETMETHOD) {
|
||||
if (pn2->pn_type == TOK_DOT && pn2->pn_op != JSOP_GETMETHOD) {
|
||||
JS_ASSERT(pn2->pn_op == JSOP_GETPROP);
|
||||
pn2->pn_op = JSOP_GETMETHOD;
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
* vim: set ts=4 sw=4 et tw=80:
|
||||
*
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
@ -6974,6 +6975,7 @@ static JSBool
|
||||
XML(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
{
|
||||
jsval v;
|
||||
uint32 oldopts;
|
||||
JSXML *xml, *copy;
|
||||
JSObject *xobj, *vobj;
|
||||
JSClass *clasp;
|
||||
@ -6981,8 +6983,13 @@ XML(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
v = argv[0];
|
||||
if (JSVAL_IS_NULL(v) || JSVAL_IS_VOID(v))
|
||||
v = STRING_TO_JSVAL(cx->runtime->emptyString);
|
||||
/* Toggle on XML support since the script has explicitly requested it. */
|
||||
oldopts = cx->options;
|
||||
JS_SetOptions(cx, oldopts | JSOPTION_XML);
|
||||
|
||||
xobj = ToXML(cx, v);
|
||||
|
||||
JS_SetOptions(cx, oldopts);
|
||||
if (!xobj)
|
||||
return JS_FALSE;
|
||||
*rval = OBJECT_TO_JSVAL(xobj);
|
||||
|
Loading…
Reference in New Issue
Block a user