js/xpconnect/idl/nsIScriptError.idl

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 /*
michael@0 7 * nsIConsoleMessage subclass for representing JavaScript errors and warnings.
michael@0 8 */
michael@0 9
michael@0 10
michael@0 11 #include "nsISupports.idl"
michael@0 12 #include "nsIConsoleMessage.idl"
michael@0 13
michael@0 14 [scriptable, uuid(cac9d8e8-0d53-4fa8-9903-bb367e4fa1fe)]
michael@0 15 interface nsIScriptError : nsIConsoleMessage
michael@0 16 {
michael@0 17 /** pseudo-flag for default case */
michael@0 18 const unsigned long errorFlag = 0x0;
michael@0 19
michael@0 20 /** message is warning */
michael@0 21 const unsigned long warningFlag = 0x1;
michael@0 22
michael@0 23 /** exception was thrown for this case - exception-aware hosts can ignore */
michael@0 24 const unsigned long exceptionFlag = 0x2;
michael@0 25
michael@0 26 // XXX check how strict is implemented these days.
michael@0 27 /** error or warning is due to strict option */
michael@0 28 const unsigned long strictFlag = 0x4;
michael@0 29
michael@0 30 /**
michael@0 31 * The error message without any context/line number information.
michael@0 32 *
michael@0 33 * @note nsIConsoleMessage.message will return the error formatted
michael@0 34 * with file/line information.
michael@0 35 */
michael@0 36 readonly attribute AString errorMessage;
michael@0 37
michael@0 38 readonly attribute AString sourceName;
michael@0 39 readonly attribute AString sourceLine;
michael@0 40 readonly attribute uint32_t lineNumber;
michael@0 41 readonly attribute uint32_t columnNumber;
michael@0 42 readonly attribute uint32_t flags;
michael@0 43
michael@0 44 /**
michael@0 45 * Categories I know about -
michael@0 46 * XUL javascript
michael@0 47 * content javascript (both of these from nsDocShell, currently)
michael@0 48 * system javascript (errors in JS components and other system JS)
michael@0 49 */
michael@0 50 readonly attribute string category;
michael@0 51
michael@0 52 /* Get the window id this was initialized with. Zero will be
michael@0 53 returned if init() was used instead of initWithWindowID(). */
michael@0 54 readonly attribute unsigned long long outerWindowID;
michael@0 55
michael@0 56 /* Get the inner window id this was initialized with. Zero will be
michael@0 57 returned if init() was used instead of initWithWindowID(). */
michael@0 58 readonly attribute unsigned long long innerWindowID;
michael@0 59
michael@0 60 readonly attribute boolean isFromPrivateWindow;
michael@0 61
michael@0 62 void init(in AString message,
michael@0 63 in AString sourceName,
michael@0 64 in AString sourceLine,
michael@0 65 in uint32_t lineNumber,
michael@0 66 in uint32_t columnNumber,
michael@0 67 in uint32_t flags,
michael@0 68 in string category);
michael@0 69
michael@0 70 /* This should be called instead of nsIScriptError.init to
michael@0 71 initialize with a window id. The window id should be for the
michael@0 72 inner window associated with this error. */
michael@0 73 void initWithWindowID(in AString message,
michael@0 74 in AString sourceName,
michael@0 75 in AString sourceLine,
michael@0 76 in uint32_t lineNumber,
michael@0 77 in uint32_t columnNumber,
michael@0 78 in uint32_t flags,
michael@0 79 in ACString category,
michael@0 80 in unsigned long long innerWindowID);
michael@0 81 %{C++
michael@0 82 // This overload allows passing a literal string for category.
michael@0 83 template<uint32_t N>
michael@0 84 nsresult InitWithWindowID(const nsAString& message,
michael@0 85 const nsAString& sourceName,
michael@0 86 const nsAString& sourceLine,
michael@0 87 uint32_t lineNumber,
michael@0 88 uint32_t columnNumber,
michael@0 89 uint32_t flags,
michael@0 90 const char (&c)[N],
michael@0 91 uint64_t aInnerWindowID)
michael@0 92 {
michael@0 93 nsDependentCString category(c, N - 1);
michael@0 94 return InitWithWindowID(message, sourceName, sourceLine, lineNumber,
michael@0 95 columnNumber, flags, category, aInnerWindowID);
michael@0 96 }
michael@0 97 %}
michael@0 98
michael@0 99 };
michael@0 100
michael@0 101 %{ C++
michael@0 102 #define NS_SCRIPTERROR_CID \
michael@0 103 { 0x1950539a, 0x90f0, 0x4d22, { 0xb5, 0xaf, 0x71, 0x32, 0x9c, 0x68, 0xfa, 0x35 }}
michael@0 104
michael@0 105 #define NS_SCRIPTERROR_CONTRACTID "@mozilla.org/scripterror;1"
michael@0 106 %}

mercurial