ErrorCopier::~ErrorCopier() { JSContext* cx = ac->context(); // The provenance of Debugger.DebuggeeWouldRun is the topmost locking // debugger compartment; it should not be copied around. if (ac->origin() != cx->compartment() && cx->isExceptionPending() && !cx->isThrowingDebuggeeWouldRun()) { RootedValue exc(cx); if (cx->getPendingException(&exc) && exc.isObject() && exc.toObject().is<ErrorObject>()) { cx->clearPendingException(); ac.reset(); Rooted<ErrorObject*> errObj(cx, &exc.toObject().as<ErrorObject>()); JSObject* copyobj = CopyErrorObject(cx, errObj); if (copyobj) cx->setPendingException(ObjectValue(*copyobj)); } } }