1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/xpconnect/idl/nsIScriptError.idl Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,106 @@ 1.4 +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +/* 1.10 + * nsIConsoleMessage subclass for representing JavaScript errors and warnings. 1.11 + */ 1.12 + 1.13 + 1.14 +#include "nsISupports.idl" 1.15 +#include "nsIConsoleMessage.idl" 1.16 + 1.17 +[scriptable, uuid(cac9d8e8-0d53-4fa8-9903-bb367e4fa1fe)] 1.18 +interface nsIScriptError : nsIConsoleMessage 1.19 +{ 1.20 + /** pseudo-flag for default case */ 1.21 + const unsigned long errorFlag = 0x0; 1.22 + 1.23 + /** message is warning */ 1.24 + const unsigned long warningFlag = 0x1; 1.25 + 1.26 + /** exception was thrown for this case - exception-aware hosts can ignore */ 1.27 + const unsigned long exceptionFlag = 0x2; 1.28 + 1.29 + // XXX check how strict is implemented these days. 1.30 + /** error or warning is due to strict option */ 1.31 + const unsigned long strictFlag = 0x4; 1.32 + 1.33 + /** 1.34 + * The error message without any context/line number information. 1.35 + * 1.36 + * @note nsIConsoleMessage.message will return the error formatted 1.37 + * with file/line information. 1.38 + */ 1.39 + readonly attribute AString errorMessage; 1.40 + 1.41 + readonly attribute AString sourceName; 1.42 + readonly attribute AString sourceLine; 1.43 + readonly attribute uint32_t lineNumber; 1.44 + readonly attribute uint32_t columnNumber; 1.45 + readonly attribute uint32_t flags; 1.46 + 1.47 + /** 1.48 + * Categories I know about - 1.49 + * XUL javascript 1.50 + * content javascript (both of these from nsDocShell, currently) 1.51 + * system javascript (errors in JS components and other system JS) 1.52 + */ 1.53 + readonly attribute string category; 1.54 + 1.55 + /* Get the window id this was initialized with. Zero will be 1.56 + returned if init() was used instead of initWithWindowID(). */ 1.57 + readonly attribute unsigned long long outerWindowID; 1.58 + 1.59 + /* Get the inner window id this was initialized with. Zero will be 1.60 + returned if init() was used instead of initWithWindowID(). */ 1.61 + readonly attribute unsigned long long innerWindowID; 1.62 + 1.63 + readonly attribute boolean isFromPrivateWindow; 1.64 + 1.65 + void init(in AString message, 1.66 + in AString sourceName, 1.67 + in AString sourceLine, 1.68 + in uint32_t lineNumber, 1.69 + in uint32_t columnNumber, 1.70 + in uint32_t flags, 1.71 + in string category); 1.72 + 1.73 + /* This should be called instead of nsIScriptError.init to 1.74 + initialize with a window id. The window id should be for the 1.75 + inner window associated with this error. */ 1.76 + void initWithWindowID(in AString message, 1.77 + in AString sourceName, 1.78 + in AString sourceLine, 1.79 + in uint32_t lineNumber, 1.80 + in uint32_t columnNumber, 1.81 + in uint32_t flags, 1.82 + in ACString category, 1.83 + in unsigned long long innerWindowID); 1.84 +%{C++ 1.85 + // This overload allows passing a literal string for category. 1.86 + template<uint32_t N> 1.87 + nsresult InitWithWindowID(const nsAString& message, 1.88 + const nsAString& sourceName, 1.89 + const nsAString& sourceLine, 1.90 + uint32_t lineNumber, 1.91 + uint32_t columnNumber, 1.92 + uint32_t flags, 1.93 + const char (&c)[N], 1.94 + uint64_t aInnerWindowID) 1.95 + { 1.96 + nsDependentCString category(c, N - 1); 1.97 + return InitWithWindowID(message, sourceName, sourceLine, lineNumber, 1.98 + columnNumber, flags, category, aInnerWindowID); 1.99 + } 1.100 +%} 1.101 + 1.102 +}; 1.103 + 1.104 +%{ C++ 1.105 +#define NS_SCRIPTERROR_CID \ 1.106 +{ 0x1950539a, 0x90f0, 0x4d22, { 0xb5, 0xaf, 0x71, 0x32, 0x9c, 0x68, 0xfa, 0x35 }} 1.107 + 1.108 +#define NS_SCRIPTERROR_CONTRACTID "@mozilla.org/scripterror;1" 1.109 +%}