bug=427185 r=brendan a1.9=mtschrep

This commit is contained in:
igor@mir2.org 2008-04-14 23:29:06 -07:00
Родитель 828ce79f09
Коммит d8441bfe0b
4 изменённых файлов: 18 добавлений и 10 удалений

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

@ -622,6 +622,9 @@ JS_STATIC_ASSERT(sizeof(JSTempValueUnion) == sizeof(void *));
#define JS_PUSH_TEMP_ROOT_QNAME(cx,qn,tvr) \ #define JS_PUSH_TEMP_ROOT_QNAME(cx,qn,tvr) \
JS_PUSH_TEMP_ROOT_COMMON(cx, qn, tvr, JSTVU_SINGLE, qname) JS_PUSH_TEMP_ROOT_COMMON(cx, qn, tvr, JSTVU_SINGLE, qname)
#define JS_PUSH_TEMP_ROOT_NAMESPACE(cx,ns,tvr) \
JS_PUSH_TEMP_ROOT_COMMON(cx, ns, tvr, JSTVU_SINGLE, nspace)
#define JS_PUSH_TEMP_ROOT_XML(cx,xml_,tvr) \ #define JS_PUSH_TEMP_ROOT_XML(cx,xml_,tvr) \
JS_PUSH_TEMP_ROOT_COMMON(cx, xml_, tvr, JSTVU_SINGLE, xml) JS_PUSH_TEMP_ROOT_COMMON(cx, xml_, tvr, JSTVU_SINGLE, xml)

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

@ -1976,17 +1976,12 @@ JSObject *
js_InitFunctionClass(JSContext *cx, JSObject *obj) js_InitFunctionClass(JSContext *cx, JSObject *obj)
{ {
JSObject *proto; JSObject *proto;
JSAtom *atom;
JSFunction *fun; JSFunction *fun;
proto = JS_InitClass(cx, obj, NULL, &js_FunctionClass, Function, 1, proto = JS_InitClass(cx, obj, NULL, &js_FunctionClass, Function, 1,
function_props, function_methods, NULL, NULL); function_props, function_methods, NULL, NULL);
if (!proto) if (!proto)
return NULL; return NULL;
atom = js_Atomize(cx, js_FunctionClass.name, strlen(js_FunctionClass.name),
0);
if (!atom)
goto bad;
fun = js_NewFunction(cx, proto, NULL, 0, JSFUN_INTERPRETED, obj, NULL); fun = js_NewFunction(cx, proto, NULL, 0, JSFUN_INTERPRETED, obj, NULL);
if (!fun) if (!fun)
goto bad; goto bad;

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

@ -239,6 +239,7 @@ typedef union JSTempValueUnion {
JSString *string; JSString *string;
JSXML *xml; JSXML *xml;
JSXMLQName *qname; JSXMLQName *qname;
JSXMLNamespace *nspace;
JSTempValueTrace trace; JSTempValueTrace trace;
JSScopeProperty *sprop; JSScopeProperty *sprop;
JSWeakRoots *weakRoots; JSWeakRoots *weakRoots;

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

@ -314,11 +314,17 @@ js_NewXMLNamespaceObject(JSContext *cx, JSString *prefix, JSString *uri,
JSBool declared) JSBool declared)
{ {
JSXMLNamespace *ns; JSXMLNamespace *ns;
JSTempValueRooter tvr;
JSObject *obj;
ns = js_NewXMLNamespace(cx, prefix, uri, declared); ns = js_NewXMLNamespace(cx, prefix, uri, declared);
if (!ns) if (!ns)
return NULL; return NULL;
return js_GetXMLNamespaceObject(cx, ns);
JS_PUSH_TEMP_ROOT_NAMESPACE(cx, ns, &tvr);
obj = js_GetXMLNamespaceObject(cx, ns);
JS_POP_TEMP_ROOT(cx, &tvr);
return obj;
} }
JSObject * JSObject *
@ -590,11 +596,16 @@ js_NewXMLQNameObject(JSContext *cx, JSString *uri, JSString *prefix,
JSString *localName) JSString *localName)
{ {
JSXMLQName *qn; JSXMLQName *qn;
JSTempValueRooter tvr;
JSObject *obj;
qn = js_NewXMLQName(cx, uri, prefix, localName); qn = js_NewXMLQName(cx, uri, prefix, localName);
if (!qn) if (!qn)
return NULL; return NULL;
return js_GetXMLQNameObject(cx, qn); JS_PUSH_TEMP_ROOT_QNAME(cx, qn, &tvr);
obj = js_GetXMLQNameObject(cx, qn);
JS_POP_TEMP_ROOT(cx, &tvr);
return obj;
} }
JSObject * JSObject *
@ -7755,9 +7766,6 @@ js_GetFunctionNamespace(JSContext *cx, jsval *vp)
obj = rt->functionNamespaceObject; obj = rt->functionNamespaceObject;
if (!obj) { if (!obj) {
JS_UNLOCK_GC(rt); JS_UNLOCK_GC(rt);
atom = js_Atomize(cx, js_function_str, 8, 0);
JS_ASSERT(atom);
prefix = ATOM_TO_STRING(atom);
/* /*
* Note that any race to atomize anti_uri here is resolved by * Note that any race to atomize anti_uri here is resolved by
@ -7771,6 +7779,7 @@ js_GetFunctionNamespace(JSContext *cx, jsval *vp)
return JS_FALSE; return JS_FALSE;
rt->atomState.lazy.functionNamespaceURIAtom = atom; rt->atomState.lazy.functionNamespaceURIAtom = atom;
prefix = ATOM_TO_STRING(rt->atomState.typeAtoms[JSTYPE_FUNCTION]);
uri = ATOM_TO_STRING(atom); uri = ATOM_TO_STRING(atom);
obj = js_NewXMLNamespaceObject(cx, prefix, uri, JS_FALSE); obj = js_NewXMLNamespaceObject(cx, prefix, uri, JS_FALSE);
if (!obj) if (!obj)