gecko/js/xpconnect/idl/nsIScriptError.idl
2012-05-21 12:12:37 +01:00

100 lines
3.5 KiB
Plaintext

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/*
* nsIConsoleMessage subclass for representing JavaScript errors and warnings.
*/
#include "nsISupports.idl"
#include "nsIConsoleMessage.idl"
[scriptable, uuid(c6dd877a-87b6-47cc-968d-90f4514ec65f)]
interface nsIScriptError : nsIConsoleMessage
{
/** pseudo-flag for default case */
const unsigned long errorFlag = 0x0;
/** message is warning */
const unsigned long warningFlag = 0x1;
/** exception was thrown for this case - exception-aware hosts can ignore */
const unsigned long exceptionFlag = 0x2;
// XXX check how strict is implemented these days.
/** error or warning is due to strict option */
const unsigned long strictFlag = 0x4;
/**
* The error message without any context/line number information.
*
* @note nsIConsoleMessage.message will return the error formatted
* with file/line information.
*/
readonly attribute AString errorMessage;
readonly attribute AString sourceName;
readonly attribute AString sourceLine;
readonly attribute PRUint32 lineNumber;
readonly attribute PRUint32 columnNumber;
readonly attribute PRUint32 flags;
/**
* Categories I know about -
* XUL javascript
* content javascript (both of these from nsDocShell, currently)
* component javascript (errors in JS components)
*/
readonly attribute string category;
/*
The time (in milliseconds from the Epoch) that the script error instance
was initialised, and thus the time when the error occurred.
Currently used to display date and time of the message in Error console.
The timestamp is initialized as JS_now/1000 so that it can be
compared to Date.now in Javascript.
*/
readonly attribute long long timeStamp;
/* Get the window id this was initialized with. Zero will be
returned if init() was used instead of initWithWindowID(). */
readonly attribute unsigned long long outerWindowID;
/* Get the inner window id this was initialized with. Zero will be
returned if init() was used instead of initWithWindowID(). */
readonly attribute unsigned long long innerWindowID;
void init(in wstring message,
in wstring sourceName,
in wstring sourceLine,
in PRUint32 lineNumber,
in PRUint32 columnNumber,
in PRUint32 flags,
in string category);
/* This should be called instead of nsIScriptError.init to
initialize with a window id. The window id should be for the
inner window associated with this error. */
void initWithWindowID(in wstring message,
in wstring sourceName,
in wstring sourceLine,
in PRUint32 lineNumber,
in PRUint32 columnNumber,
in PRUint32 flags,
in string category,
in unsigned long long innerWindowID);
AUTF8String toString();
};
%{ C++
#define NS_SCRIPTERROR_CLASSNAME "Script Error"
#define NS_SCRIPTERROR_CID \
{ 0xe38e53b9, 0x5bb0, 0x456a, { 0xb5, 0x53, 0x57, 0x93, 0x70, 0xcb, 0x15, 0x67 }}
#define NS_SCRIPTERROR_CONTRACTID "@mozilla.org/scripterror;1"
%}