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

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

mercurial