From 426dbb7c2d13396411e1f91941a171cdf7f71ec4 Mon Sep 17 00:00:00 2001 From: "mccabe%netscape.com" Date: Fri, 31 Mar 2000 04:17:54 +0000 Subject: [PATCH] Rename progids to foo.bar.1 format; change console.js to take advantage of nsIScriptError messages when it gets them. --- xpfe/components/console/nsIConsoleService.idl | 4 ++-- xpfe/components/console/nsIScriptError.idl | 4 ++-- .../console/resources/content/console.js | 15 ++++++++++++++- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/xpfe/components/console/nsIConsoleService.idl b/xpfe/components/console/nsIConsoleService.idl index 25e107c1dc43..0bc13260665a 100644 --- a/xpfe/components/console/nsIConsoleService.idl +++ b/xpfe/components/console/nsIConsoleService.idl @@ -24,7 +24,6 @@ #include "nsIConsoleListener.idl" #include "nsIConsoleMessage.idl" - [scriptable, uuid(a647f184-1dd1-11b2-a9d1-8537b201161b)] interface nsIConsoleService : nsISupports { @@ -52,5 +51,6 @@ interface nsIConsoleService : nsISupports #define NS_CONSOLESERVICE_CID \ { 0x7e3ff85c, 0x1dd2, 0x11b2, { 0x8d, 0x4b, 0xeb, 0x45, 0x2c, 0xb0, 0xff, 0x40 }} -#define NS_CONSOLESERVICE_PROGID "consoleservice" +#define NS_CONSOLESERVICE_PROGID "mozilla.consoleservice.1" %} + diff --git a/xpfe/components/console/nsIScriptError.idl b/xpfe/components/console/nsIScriptError.idl index 6f3d09dde134..a0dc23b8f122 100644 --- a/xpfe/components/console/nsIScriptError.idl +++ b/xpfe/components/console/nsIScriptError.idl @@ -54,7 +54,7 @@ interface nsIScriptError : nsIConsoleMessage void init(in wstring message, in wstring sourceName, - in wstring sourcLine, + in wstring sourceLine, in PRUint32 lineNumber, in PRUint32 columnNumber, in PRUint32 flags, @@ -65,5 +65,5 @@ interface nsIScriptError : nsIConsoleMessage #define NS_SCRIPTERROR_CID \ { 0xe38e53b9, 0x5bb0, 0x456a, { 0xb5, 0x53, 0x57, 0x93, 0x70, 0xcb, 0x15, 0x67 }} -#define NS_SCRIPTERROR_PROGID "scripterror" +#define NS_SCRIPTERROR_PROGID "mozilla.scripterror.1" %} diff --git a/xpfe/components/console/resources/content/console.js b/xpfe/components/console/resources/content/console.js index 82ddf383dd7a..09d645820fff 100644 --- a/xpfe/components/console/resources/content/console.js +++ b/xpfe/components/console/resources/content/console.js @@ -100,7 +100,20 @@ function appendMessage(messageObject) { var c = document.getElementById("console"); var e = document.createElement("message"); - var t = document.createTextNode(messageObject.message); + var text; + try { + // Try to QI it to a script error to get more info. + var scripterror = + messageObject.QueryInterface(Components.interfaces.nsIScriptError); + + text = scripterror.sourceName + " line " + scripterror.lineNumber + + ": " + scripterror.message; + } catch (exn) { + // QI failed, just try to treat it as an nsIConsoleMessage + text = messageObject.message; + } + + var t = document.createTextNode(text); e.appendChild(t); c.appendChild(e); }