Rename progids to foo.bar.1 format; change console.js to take advantage of nsIScriptError messages when it gets them.

This commit is contained in:
mccabe%netscape.com 2000-03-31 04:17:54 +00:00
Родитель 8747d1f24c
Коммит 426dbb7c2d
3 изменённых файлов: 18 добавлений и 5 удалений

Просмотреть файл

@ -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"
%}

Просмотреть файл

@ -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"
%}

Просмотреть файл

@ -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);
}