mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 702003 - Handle NULL during JSXML tracing (r=luke)
This commit is contained in:
parent
f40e833352
commit
b9aca2f5a5
@ -1947,7 +1947,7 @@ AutoGCRooter::trace(JSTracer *trc)
|
||||
case NAMESPACES: {
|
||||
JSXMLArray<JSObject> &array = static_cast<AutoNamespaceArray *>(this)->array;
|
||||
MarkObjectRange(trc, array.length, array.vector, "JSXMLArray.vector");
|
||||
array.cursors->trace(trc);
|
||||
js_XMLArrayCursorTrace(trc, array.cursors);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -210,6 +210,12 @@ Mark(JSTracer *trc, const MarkablePtr<JSObject> &o, const char *name)
|
||||
MarkObject(trc, o, name);
|
||||
}
|
||||
|
||||
inline void
|
||||
Mark(JSTracer *trc, const MarkablePtr<JSXML> &xml, const char *name)
|
||||
{
|
||||
MarkXML(trc, xml, name);
|
||||
}
|
||||
|
||||
inline bool
|
||||
IsMarked(JSContext *cx, const js::Value &v)
|
||||
{
|
||||
|
@ -874,27 +874,14 @@ attr_identity(const JSXML *xmla, const JSXML *xmlb)
|
||||
return qname_identity(xmla->name, xmlb->name);
|
||||
}
|
||||
|
||||
template<>
|
||||
void
|
||||
JSXMLArrayCursor<JSXML>::trace(JSTracer *trc)
|
||||
{
|
||||
for (JSXMLArrayCursor<JSXML> *cursor = this; cursor; cursor = cursor->next)
|
||||
MarkXML(trc, cursor->root, "cursor_root");
|
||||
}
|
||||
|
||||
template<>
|
||||
void
|
||||
JSXMLArrayCursor<JSObject>::trace(JSTracer *trc)
|
||||
{
|
||||
for (JSXMLArrayCursor<JSObject> *cursor = this; cursor; cursor = cursor->next)
|
||||
MarkObject(trc, cursor->root, "cursor_root");
|
||||
}
|
||||
|
||||
template<class T>
|
||||
static void
|
||||
XMLArrayCursorTrace(JSTracer *trc, JSXMLArrayCursor<T> *cursor)
|
||||
void
|
||||
js_XMLArrayCursorTrace(JSTracer *trc, JSXMLArrayCursor<T> *cursor)
|
||||
{
|
||||
cursor->trace(trc);
|
||||
for (; cursor; cursor = cursor->next) {
|
||||
if (cursor->root)
|
||||
Mark(trc, (const MarkablePtr<T> &)cursor->root, "cursor_root");
|
||||
}
|
||||
}
|
||||
|
||||
template<class T>
|
||||
@ -7360,7 +7347,7 @@ js_TraceXML(JSTracer *trc, JSXML *xml)
|
||||
}
|
||||
|
||||
MarkXMLRange(trc, xml->xml_kids.length, xml->xml_kids.vector, "xml_kids");
|
||||
XMLArrayCursorTrace(trc, xml->xml_kids.cursors);
|
||||
js_XMLArrayCursorTrace(trc, xml->xml_kids.cursors);
|
||||
|
||||
if (xml->xml_class == JSXML_CLASS_LIST) {
|
||||
if (xml->xml_target)
|
||||
@ -7371,10 +7358,10 @@ js_TraceXML(JSTracer *trc, JSXML *xml)
|
||||
MarkObjectRange(trc, xml->xml_namespaces.length,
|
||||
xml->xml_namespaces.vector,
|
||||
"xml_namespaces");
|
||||
XMLArrayCursorTrace(trc, xml->xml_namespaces.cursors);
|
||||
js_XMLArrayCursorTrace(trc, xml->xml_namespaces.cursors);
|
||||
|
||||
MarkXMLRange(trc, xml->xml_attrs.length, xml->xml_attrs.vector, "xml_attrs");
|
||||
XMLArrayCursorTrace(trc, xml->xml_attrs.cursors);
|
||||
js_XMLArrayCursorTrace(trc, xml->xml_attrs.cursors);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -121,10 +121,12 @@ struct JSXMLArrayCursor
|
||||
return NULL;
|
||||
return root = array->vector[index];
|
||||
}
|
||||
|
||||
void trace(JSTracer *trc);
|
||||
};
|
||||
|
||||
template<class T>
|
||||
void
|
||||
js_XMLArrayCursorTrace(JSTracer *trc, JSXMLArrayCursor<T> *cursor);
|
||||
|
||||
#define JSXML_PRESET_CAPACITY JS_BIT(31)
|
||||
#define JSXML_CAPACITY_MASK JS_BITMASK(31)
|
||||
#define JSXML_CAPACITY(array) ((array)->capacity & JSXML_CAPACITY_MASK)
|
||||
|
Loading…
Reference in New Issue
Block a user