if (state) JS_RestoreExceptionState(cx, state);
static inline void DoPostScriptEvaluated(JSContext* cx){    if(JS_GetContextThread(cx))        JS_EndRequest(cx);#ifndef XPCONNECT_STANDALONE    // If this is a DOM JSContext, then notify nsIScriptContext of script    // completion so that it can reset its infinite loop detection mechanism.    //    // Note: We rely on the rule that if any JSContext in our JSRuntime has a    // private set then that private *must* be a pointer to an nsISupports.    nsISupports *supports = (nsISupports*) JS_GetContextPrivate(cx);    if(supports)    {        nsCOMPtr<nsIScriptContext> scx = do_QueryInterface(supports);        if(scx)            scx->ScriptEvaluated(PR_FALSE);    }#endif /* XPCONNECT_STANDALONE */}