From 49d155b6fc50257b9aee653c65fbfdd929670644 Mon Sep 17 00:00:00 2001 From: Steve Fink Date: Wed, 25 Jul 2012 16:10:19 -0700 Subject: [PATCH] Bug 777546 - Root the minimum XML stuff necessary to pass jstests --HG-- extra : rebase_source : 531766441ca042d9588e68a479fb402ad8c399be --- js/src/jsxml.cpp | 11 ++++++----- js/src/jsxml.h | 2 ++ 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/js/src/jsxml.cpp b/js/src/jsxml.cpp index 6eeb364b258..bf4249ed7cb 100644 --- a/js/src/jsxml.cpp +++ b/js/src/jsxml.cpp @@ -7310,8 +7310,9 @@ NewXMLObject(JSContext *cx, JSXML *xml) } JSObject * -js_GetXMLObject(JSContext *cx, JSXML *xml) +js_GetXMLObject(JSContext *cx, JSXML *xmlArg) { + Rooted xml(cx, xmlArg); JSObject *obj; obj = xml->object; @@ -7399,12 +7400,12 @@ js_InitXMLClass(JSContext *cx, JSObject *obj) cx->runtime->gcExactScanningEnabled = false; JS_ASSERT(obj->isNative()); - GlobalObject *global = &obj->asGlobal(); + Rooted global(cx, &obj->asGlobal()); - JSObject *xmlProto = global->createBlankPrototype(cx, &XMLClass); + RootedObject xmlProto(cx, global->createBlankPrototype(cx, &XMLClass)); if (!xmlProto) return NULL; - JSXML *xml = js_NewXML(cx, JSXML_CLASS_TEXT); + Rooted xml(cx, js_NewXML(cx, JSXML_CLASS_TEXT)); if (!xml) return NULL; xmlProto->setPrivate(xml); @@ -7449,7 +7450,7 @@ js_InitXMLClass(JSContext *cx, JSObject *obj) return NULL; /* Define the isXMLName function. */ - if (!JS_DefineFunction(cx, obj, js_isXMLName_str, xml_isXMLName, 1, 0)) + if (!JS_DefineFunction(cx, global, js_isXMLName_str, xml_isXMLName, 1, 0)) return NULL; return xmlProto; diff --git a/js/src/jsxml.h b/js/src/jsxml.h index 4c1f2cd5033..21873367d91 100644 --- a/js/src/jsxml.h +++ b/js/src/jsxml.h @@ -177,6 +177,8 @@ struct JSXML : js::gc::Cell { static void writeBarrierPre(JSXML *xml); static void writeBarrierPost(JSXML *xml, void *addr); + + static inline js::ThingRootKind rootKind() { return js::THING_ROOT_XML; } }; /* xml_flags values */