--- ./js/src/xpconnect/src/nsScriptError.cpp 2008-12-03 20:54:51.000000000 +0800 +++ ./js/src/xpconnect/src/nsScriptError.cpp.patched 2008-12-25 13:46:36.000000000 +0800 @@ -42,6 +42,9 @@ * place to put XPCOM things. */ + // added by agentzh + #include "string.h" + #include "nsString.h" #include "xpcprivate.h" NS_IMPL_THREADSAFE_ISUPPORTS2(nsScriptError, nsIConsoleMessage, nsIScriptError) @@ -128,6 +131,8 @@ PRUint32 flags, const char *category) { + const char* buf; + mMessage.Assign(message); mSourceName.Assign(sourceName); mLineNumber = lineNumber; @@ -136,6 +141,20 @@ mFlags = flags; mCategory.Assign(category); + // added by agentzh + if (flags == 0) { // errors only + buf = NS_ConvertUTF16toUTF8(sourceName).get(); + if (strstr(buf, "nsUpdateService.js") == NULL && strstr(buf, "nsSessionStore.js") == NULL) { + fprintf( + stderr, + "[error] ErrorConsole: %s: line %d: %s\n", + buf, + lineNumber, + NS_ConvertUTF16toUTF8(message).get() + ); + } + } + return NS_OK; }