Don't forget to call the new-script and destroy-script hooks in js_FilterXMLList, so the debugger knows about the script cloned there.

This commit is contained in:
brendan%mozilla.org 2004-11-25 06:57:17 +00:00
parent 80859c486d
commit ac737db06e
3 changed files with 14 additions and 2 deletions

View File

@ -1135,8 +1135,8 @@ js_CallNewScriptHook(JSContext *cx, JSScript *script, JSFunction *fun)
}
}
void
js_DestroyScript(JSContext *cx, JSScript *script)
JS_FRIEND_API(void)
js_CallDestroyScriptHook(JSContext *cx, JSScript *script)
{
JSRuntime *rt;
JSDestroyScriptHook hook;
@ -1145,6 +1145,12 @@ js_DestroyScript(JSContext *cx, JSScript *script)
hook = rt->destroyScriptHook;
if (hook)
hook(cx, script, rt->destroyScriptHookData);
}
void
js_DestroyScript(JSContext *cx, JSScript *script)
{
js_CallDestroyScriptHook(cx, script);
JS_ClearScriptTraps(cx, script);
js_FreeAtomMap(cx, &script->atomMap);

View File

@ -143,6 +143,9 @@ js_NewScriptFromCG(JSContext *cx, JSCodeGenerator *cg, JSFunction *fun);
extern JS_FRIEND_API(void)
js_CallNewScriptHook(JSContext *cx, JSScript *script, JSFunction *fun);
extern JS_FRIEND_API(void)
js_CallDestroyScriptHook(JSContext *cx, JSScript *script);
extern void
js_DestroyScript(JSContext *cx, JSScript *script);

View File

@ -7620,6 +7620,7 @@ js_FilterXMLList(JSContext *cx, JSObject *obj, jsbytecode *pc, uint32 len,
script.code = script.main = pc;
script.length = len;
frame.script = &script;
js_CallNewScriptHook(cx, &script, fp->fun);
for (i = 0, n = list->xml_kids.length; i < n; i++) {
kid = XMLARRAY_MEMBER(&list->xml_kids, i, JSXML);
@ -7643,6 +7644,8 @@ js_FilterXMLList(JSContext *cx, JSObject *obj, jsbytecode *pc, uint32 len,
*vp = OBJECT_TO_JSVAL(resobj);
out:
if (frame.script == &script)
js_CallDestroyScriptHook(cx, &script);
if (inLRS)
JS_LeaveLocalRootScope(cx);
cx->fp = fp;