/* static */ bool DebuggerMemory::setTrackingAllocationSites(JSContext* cx, unsigned argc, Value* vp) { THIS_DEBUGGER_MEMORY(cx, argc, vp, "(set trackingAllocationSites)", args, memory); if (!args.requireAtLeast(cx, "(set trackingAllocationSites)", 1)) return false; Debugger* dbg = memory->getDebugger(); bool enabling = ToBoolean(args[0]); if (enabling == dbg->trackingAllocationSites) return undefined(args); dbg->trackingAllocationSites = enabling; if (!dbg->enabled) return undefined(args); if (enabling) { if (!dbg->addAllocationsTrackingForAllDebuggees(cx)) { dbg->trackingAllocationSites = false; return false; } } else { dbg->removeAllocationsTrackingForAllDebuggees(); } return undefined(args); }