2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-05-21 04:12:37 -07:00
|
|
|
/* 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/. */
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/*
|
|
|
|
* nsIConsoleMessage subclass for representing JavaScript errors and warnings.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#include "nsISupports.idl"
|
|
|
|
#include "nsIConsoleMessage.idl"
|
|
|
|
|
2013-05-24 11:36:56 -07:00
|
|
|
[scriptable, uuid(cac9d8e8-0d53-4fa8-9903-bb367e4fa1fe)]
|
2007-03-22 10:30:00 -07:00
|
|
|
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;
|
2012-08-22 08:56:38 -07:00
|
|
|
readonly attribute uint32_t lineNumber;
|
|
|
|
readonly attribute uint32_t columnNumber;
|
|
|
|
readonly attribute uint32_t flags;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Categories I know about -
|
|
|
|
* XUL javascript
|
|
|
|
* content javascript (both of these from nsDocShell, currently)
|
2013-07-16 20:38:44 -07:00
|
|
|
* system javascript (errors in JS components and other system JS)
|
2007-03-22 10:30:00 -07:00
|
|
|
*/
|
|
|
|
readonly attribute string category;
|
|
|
|
|
2010-10-20 17:24:15 -07:00
|
|
|
/* Get the window id this was initialized with. Zero will be
|
2011-08-24 13:44:35 -07:00
|
|
|
returned if init() was used instead of initWithWindowID(). */
|
2010-10-20 17:24:15 -07:00
|
|
|
readonly attribute unsigned long long outerWindowID;
|
|
|
|
|
2011-08-24 13:44:35 -07:00
|
|
|
/* 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;
|
|
|
|
|
2012-10-19 14:52:21 -07:00
|
|
|
readonly attribute boolean isFromPrivateWindow;
|
|
|
|
|
2012-09-09 16:29:12 -07:00
|
|
|
void init(in AString message,
|
|
|
|
in AString sourceName,
|
|
|
|
in AString sourceLine,
|
2012-08-22 08:56:38 -07:00
|
|
|
in uint32_t lineNumber,
|
|
|
|
in uint32_t columnNumber,
|
|
|
|
in uint32_t flags,
|
2011-12-21 13:51:29 -08:00
|
|
|
in string category);
|
|
|
|
|
2010-10-20 17:24:15 -07:00
|
|
|
/* This should be called instead of nsIScriptError.init to
|
|
|
|
initialize with a window id. The window id should be for the
|
2011-08-24 13:44:35 -07:00
|
|
|
inner window associated with this error. */
|
2012-09-09 16:29:12 -07:00
|
|
|
void initWithWindowID(in AString message,
|
|
|
|
in AString sourceName,
|
|
|
|
in AString sourceLine,
|
2012-08-22 08:56:38 -07:00
|
|
|
in uint32_t lineNumber,
|
|
|
|
in uint32_t columnNumber,
|
|
|
|
in uint32_t flags,
|
2013-08-02 00:09:11 -07:00
|
|
|
in ACString category,
|
2011-08-24 13:44:35 -07:00
|
|
|
in unsigned long long innerWindowID);
|
2013-08-02 00:09:11 -07:00
|
|
|
%{C++
|
|
|
|
// This overload allows passing a literal string for category.
|
|
|
|
template<uint32_t N>
|
|
|
|
nsresult InitWithWindowID(const nsAString& message,
|
|
|
|
const nsAString& sourceName,
|
|
|
|
const nsAString& sourceLine,
|
|
|
|
uint32_t lineNumber,
|
|
|
|
uint32_t columnNumber,
|
|
|
|
uint32_t flags,
|
|
|
|
const char (&c)[N],
|
|
|
|
uint64_t aInnerWindowID)
|
|
|
|
{
|
|
|
|
nsDependentCString category(c, N - 1);
|
|
|
|
return InitWithWindowID(message, sourceName, sourceLine, lineNumber,
|
|
|
|
columnNumber, flags, category, aInnerWindowID);
|
|
|
|
}
|
|
|
|
%}
|
|
|
|
|
2010-10-20 17:24:15 -07:00
|
|
|
};
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
%{ C++
|
|
|
|
#define NS_SCRIPTERROR_CID \
|
2013-05-24 11:36:56 -07:00
|
|
|
{ 0x1950539a, 0x90f0, 0x4d22, { 0xb5, 0xaf, 0x71, 0x32, 0x9c, 0x68, 0xfa, 0x35 }}
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
#define NS_SCRIPTERROR_CONTRACTID "@mozilla.org/scripterror;1"
|
|
|
|
%}
|