MozJSImplScope::~MozJSImplScope() { for (auto&& x : _funcs) { x.reset(); } unregisterOperation(); }
bool MozJSImplScope::_interruptCallback(JSContext* cx) { auto scope = getScope(cx); if (scope->_pendingGC.load()) { scope->_pendingGC.store(false); JS_GC(scope->_runtime); } else { JS_MaybeGC(cx); } bool kill = scope->isKillPending(); if (kill) { scope->_engine->getDeadlineMonitor().stopDeadline(scope); scope->unregisterOperation(); } return !kill; }
bool MozJSImplScope::_interruptCallback(JSContext* cx) { auto scope = getScope(cx); JS_SetInterruptCallback(scope->_runtime, nullptr); auto guard = MakeGuard([&]() { JS_SetInterruptCallback(scope->_runtime, _interruptCallback); }); if (scope->_pendingGC.load()) { scope->_pendingGC.store(false); JS_GC(scope->_runtime); } else { JS_MaybeGC(cx); } bool kill = scope->isKillPending(); if (kill) { scope->_engine->getDeadlineMonitor().stopDeadline(scope); scope->unregisterOperation(); scope->_status = Status(ErrorCodes::JSInterpreterFailure, "Interrupted by the host"); } return !kill; }
void MozJSImplScope::reset() { unregisterOperation(); _pendingKill.store(false); _pendingGC.store(false); advanceGeneration(); }