michael@0: /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: /* michael@0: * nsIConsoleMessage subclass for representing JavaScript errors and warnings. michael@0: */ michael@0: michael@0: michael@0: #include "nsISupports.idl" michael@0: #include "nsIConsoleMessage.idl" michael@0: michael@0: [scriptable, uuid(cac9d8e8-0d53-4fa8-9903-bb367e4fa1fe)] michael@0: interface nsIScriptError : nsIConsoleMessage michael@0: { michael@0: /** pseudo-flag for default case */ michael@0: const unsigned long errorFlag = 0x0; michael@0: michael@0: /** message is warning */ michael@0: const unsigned long warningFlag = 0x1; michael@0: michael@0: /** exception was thrown for this case - exception-aware hosts can ignore */ michael@0: const unsigned long exceptionFlag = 0x2; michael@0: michael@0: // XXX check how strict is implemented these days. michael@0: /** error or warning is due to strict option */ michael@0: const unsigned long strictFlag = 0x4; michael@0: michael@0: /** michael@0: * The error message without any context/line number information. michael@0: * michael@0: * @note nsIConsoleMessage.message will return the error formatted michael@0: * with file/line information. michael@0: */ michael@0: readonly attribute AString errorMessage; michael@0: michael@0: readonly attribute AString sourceName; michael@0: readonly attribute AString sourceLine; michael@0: readonly attribute uint32_t lineNumber; michael@0: readonly attribute uint32_t columnNumber; michael@0: readonly attribute uint32_t flags; michael@0: michael@0: /** michael@0: * Categories I know about - michael@0: * XUL javascript michael@0: * content javascript (both of these from nsDocShell, currently) michael@0: * system javascript (errors in JS components and other system JS) michael@0: */ michael@0: readonly attribute string category; michael@0: michael@0: /* Get the window id this was initialized with. Zero will be michael@0: returned if init() was used instead of initWithWindowID(). */ michael@0: readonly attribute unsigned long long outerWindowID; michael@0: michael@0: /* Get the inner window id this was initialized with. Zero will be michael@0: returned if init() was used instead of initWithWindowID(). */ michael@0: readonly attribute unsigned long long innerWindowID; michael@0: michael@0: readonly attribute boolean isFromPrivateWindow; michael@0: michael@0: void init(in AString message, michael@0: in AString sourceName, michael@0: in AString sourceLine, michael@0: in uint32_t lineNumber, michael@0: in uint32_t columnNumber, michael@0: in uint32_t flags, michael@0: in string category); michael@0: michael@0: /* This should be called instead of nsIScriptError.init to michael@0: initialize with a window id. The window id should be for the michael@0: inner window associated with this error. */ michael@0: void initWithWindowID(in AString message, michael@0: in AString sourceName, michael@0: in AString sourceLine, michael@0: in uint32_t lineNumber, michael@0: in uint32_t columnNumber, michael@0: in uint32_t flags, michael@0: in ACString category, michael@0: in unsigned long long innerWindowID); michael@0: %{C++ michael@0: // This overload allows passing a literal string for category. michael@0: template michael@0: nsresult InitWithWindowID(const nsAString& message, michael@0: const nsAString& sourceName, michael@0: const nsAString& sourceLine, michael@0: uint32_t lineNumber, michael@0: uint32_t columnNumber, michael@0: uint32_t flags, michael@0: const char (&c)[N], michael@0: uint64_t aInnerWindowID) michael@0: { michael@0: nsDependentCString category(c, N - 1); michael@0: return InitWithWindowID(message, sourceName, sourceLine, lineNumber, michael@0: columnNumber, flags, category, aInnerWindowID); michael@0: } michael@0: %} michael@0: michael@0: }; michael@0: michael@0: %{ C++ michael@0: #define NS_SCRIPTERROR_CID \ michael@0: { 0x1950539a, 0x90f0, 0x4d22, { 0xb5, 0xaf, 0x71, 0x32, 0x9c, 0x68, 0xfa, 0x35 }} michael@0: michael@0: #define NS_SCRIPTERROR_CONTRACTID "@mozilla.org/scripterror;1" michael@0: %}