コード例 #1
0
void
JSCompartment::clearTraps(JSContext *cx, JSScript *script)
{
    for (BreakpointSiteMap::Enum e(breakpointSites); !e.empty(); e.popFront()) {
        BreakpointSite *site = e.front().value;
        if (!script || site->script == script)
            site->clearTrap(cx, &e);
    }
}
コード例 #2
0
void
JSCompartment::sweepBreakpoints(JSContext *cx)
{
    for (BreakpointSiteMap::Enum e(breakpointSites); !e.empty(); e.popFront()) {
        BreakpointSite *site = e.front().value;
        // clearTrap and nextbp are necessary here to avoid possibly
        // reading *site or *bp after destroying it.
        bool scriptGone = IsAboutToBeFinalized(cx, site->script);
        bool clearTrap = scriptGone && site->hasTrap();
        
        Breakpoint *nextbp;
        for (Breakpoint *bp = site->firstBreakpoint(); bp; bp = nextbp) {
            nextbp = bp->nextInSite();
            if (scriptGone || IsAboutToBeFinalized(cx, bp->debugger->toJSObject()))
                bp->destroy(cx, &e);
        }
        
        if (clearTrap)
            site->clearTrap(cx, &e);
    }
}