1 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
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 file,
4 * You can obtain one at http://mozilla.org/MPL/2.0/.
6 * The origin of this IDL file is
7 * https://webidl.spec.whatwg.org/#idl-DOMException
9 * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
10 * liability, trademark and document use rules apply.
14 // This is the WebIDL version of nsIException. This is mostly legacy stuff.
18 interface mixin ExceptionMembers
20 // The nsresult associated with this exception.
21 readonly attribute unsigned long result;
23 // Filename location. This is the location that caused the
24 // error, which may or may not be a source file location.
25 // For example, standard language errors would generally have
26 // the same location as their top stack entry. File
27 // parsers may put the location of the file they were parsing,
30 // null indicates "no data"
31 readonly attribute DOMString filename;
32 // Valid line numbers begin at '1'. '0' indicates unknown.
33 readonly attribute unsigned long lineNumber;
34 // Valid column numbers begin at 0.
35 // We don't have an unambiguous indicator for unknown.
36 readonly attribute unsigned long columnNumber;
38 // A stack trace, if available. nsIStackFrame does not have classinfo so
39 // this was only ever usefully available to chrome JS.
40 [ChromeOnly, Exposed=Window]
41 readonly attribute StackFrame? location;
43 // Arbitary data for the implementation.
45 readonly attribute nsISupports? data;
47 // Formatted exception stack
49 readonly attribute DOMString stack;
52 [LegacyNoInterfaceObject, Exposed=(Window,Worker)]
54 // The name of the error code (ie, a string repr of |result|).
55 readonly attribute DOMString name;
56 // A custom message set by the thrower.
57 [BinaryName="messageMoz"]
58 readonly attribute DOMString message;
59 // A generic formatter - make it suitable to print, etc.
63 Exception includes ExceptionMembers;
65 // XXXkhuey this is an 'exception', not an interface, but we don't have any
66 // parser or codegen mechanisms for dealing with exceptions.
68 Exposed=(Window, Worker),
70 interface DOMException {
71 constructor(optional DOMString message = "", optional DOMString name);
73 // The name of the error code (ie, a string repr of |result|).
74 readonly attribute DOMString name;
75 // A custom message set by the thrower.
76 [BinaryName="messageMoz"]
77 readonly attribute DOMString message;
78 readonly attribute unsigned short code;
80 const unsigned short INDEX_SIZE_ERR = 1;
81 const unsigned short DOMSTRING_SIZE_ERR = 2; // historical
82 const unsigned short HIERARCHY_REQUEST_ERR = 3;
83 const unsigned short WRONG_DOCUMENT_ERR = 4;
84 const unsigned short INVALID_CHARACTER_ERR = 5;
85 const unsigned short NO_DATA_ALLOWED_ERR = 6; // historical
86 const unsigned short NO_MODIFICATION_ALLOWED_ERR = 7;
87 const unsigned short NOT_FOUND_ERR = 8;
88 const unsigned short NOT_SUPPORTED_ERR = 9;
89 const unsigned short INUSE_ATTRIBUTE_ERR = 10; // historical
90 const unsigned short INVALID_STATE_ERR = 11;
91 const unsigned short SYNTAX_ERR = 12;
92 const unsigned short INVALID_MODIFICATION_ERR = 13;
93 const unsigned short NAMESPACE_ERR = 14;
94 const unsigned short INVALID_ACCESS_ERR = 15;
95 const unsigned short VALIDATION_ERR = 16; // historical
96 const unsigned short TYPE_MISMATCH_ERR = 17; // historical; use JavaScript's TypeError instead
97 const unsigned short SECURITY_ERR = 18;
98 const unsigned short NETWORK_ERR = 19;
99 const unsigned short ABORT_ERR = 20;
100 const unsigned short URL_MISMATCH_ERR = 21;
101 const unsigned short QUOTA_EXCEEDED_ERR = 22;
102 const unsigned short TIMEOUT_ERR = 23;
103 const unsigned short INVALID_NODE_TYPE_ERR = 24;
104 const unsigned short DATA_CLONE_ERR = 25;
107 // XXXkhuey copy all of Gecko's non-standard stuff onto DOMException, but leave
108 // the prototype chain sane.
109 DOMException includes ExceptionMembers;