JS_ClearPendingException(cx);
::JS_ClearPendingException(cx);
NS_ScriptErrorReporter(JSContext *cx,                       const char *message,                       JSErrorReport *report){  nsCOMPtr<nsIScriptContext> context;  // XXX this means we are not going to get error reports on non DOM contexts  nsJSUtils::nsGetDynamicScriptContext(cx, getter_AddRefs(context));  if (context) {    nsCOMPtr<nsIScriptGlobalObject> globalObject(context->GetGlobalObject());    if (globalObject) {      nsCOMPtr<nsIScriptGlobalObjectOwner> owner;      if(NS_FAILED(globalObject->GetGlobalObjectOwner(getter_AddRefs(owner))) ||         !owner) {        NS_WARN_IF_FALSE(PR_FALSE, "Failed to get a global Object Owner");        return;      }            const char* error;      if (message) {        error = message;      }      else {        error = "<unknown>";      }        if(report) {          owner->ReportScriptError(error,                                   report->filename,                                   report->lineno,                                   report->linebuf);      }      else {          owner->ReportScriptError(error, nsnull, 0, nsnull);      }    }  }#ifdef PR_LOGGING  if (report) {    if (!gJSDiagnostics)      gJSDiagnostics = PR_NewLogModule("JSDiagnostics");    if (gJSDiagnostics) {      PR_LOG(gJSDiagnostics,             JSREPORT_IS_WARNING(report->flags) ? PR_LOG_WARNING : PR_LOG_ERROR,             ("file %s, line %u: %s\n%s%s",              report->filename, report->lineno, message,              report->linebuf ? report->linebuf : "",              (report->linebuf &&               report->linebuf[strlen(report->linebuf)-1] != '\n')              ? "\n"              : ""));    }  }#endif  // XXX do we really want to be doing this?  JS_ClearPendingException(cx);}