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 * http://dom.spec.whatwg.org/#exception-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.
19 Exposed=(Window,Worker)]
20 interface ExceptionMembers
22 // A custom message set by the thrower. LenientThis so it can be
23 // gotten on the prototype, which Error.prototype.toString will do
24 // if someone tries to stringify DOMException.prototype.
26 readonly attribute DOMString message;
27 // The nsresult associated with this exception.
28 readonly attribute unsigned long result;
29 // The name of the error code (ie, a string repr of |result|).
30 // LenientThis so it can be gotten on the prototype, which
31 // Error.prototype.toString will do if someone tries to stringify
32 // DOMException.prototype.
34 readonly attribute DOMString name;
36 // Filename location. This is the location that caused the
37 // error, which may or may not be a source file location.
38 // For example, standard language errors would generally have
39 // the same location as their top stack entry. File
40 // parsers may put the location of the file they were parsing,
43 // null indicates "no data"
44 readonly attribute DOMString filename;
45 // Valid line numbers begin at '1'. '0' indicates unknown.
46 readonly attribute unsigned long lineNumber;
47 // Valid column numbers begin at 0.
48 // We don't have an unambiguous indicator for unknown.
49 readonly attribute unsigned long columnNumber;
51 // A stack trace, if available. nsIStackFrame does not have classinfo so
52 // this was only ever usefully available to chrome JS.
54 readonly attribute StackFrame? location;
55 // An inner exception that triggered this, if available.
56 readonly attribute nsISupports? inner;
58 // Arbitary data for the implementation.
59 readonly attribute nsISupports? data;
61 // Formatted exception stack
63 readonly attribute DOMString stack;
68 // A generic formatter - make it suitable to print, etc.
72 Exception implements ExceptionMembers;
74 // XXXkhuey this is an 'exception', not an interface, but we don't have any
75 // parser or codegen mechanisms for dealing with exceptions.
77 Exposed=(Window, Worker)]
78 interface DOMException {
79 const unsigned short INDEX_SIZE_ERR = 1;
80 const unsigned short DOMSTRING_SIZE_ERR = 2; // historical
81 const unsigned short HIERARCHY_REQUEST_ERR = 3;
82 const unsigned short WRONG_DOCUMENT_ERR = 4;
83 const unsigned short INVALID_CHARACTER_ERR = 5;
84 const unsigned short NO_DATA_ALLOWED_ERR = 6; // historical
85 const unsigned short NO_MODIFICATION_ALLOWED_ERR = 7;
86 const unsigned short NOT_FOUND_ERR = 8;
87 const unsigned short NOT_SUPPORTED_ERR = 9;
88 const unsigned short INUSE_ATTRIBUTE_ERR = 10; // historical
89 const unsigned short INVALID_STATE_ERR = 11;
90 const unsigned short SYNTAX_ERR = 12;
91 const unsigned short INVALID_MODIFICATION_ERR = 13;
92 const unsigned short NAMESPACE_ERR = 14;
93 const unsigned short INVALID_ACCESS_ERR = 15;
94 const unsigned short VALIDATION_ERR = 16; // historical
95 const unsigned short TYPE_MISMATCH_ERR = 17; // historical; use JavaScript's TypeError instead
96 const unsigned short SECURITY_ERR = 18;
97 const unsigned short NETWORK_ERR = 19;
98 const unsigned short ABORT_ERR = 20;
99 const unsigned short URL_MISMATCH_ERR = 21;
100 const unsigned short QUOTA_EXCEEDED_ERR = 22;
101 const unsigned short TIMEOUT_ERR = 23;
102 const unsigned short INVALID_NODE_TYPE_ERR = 24;
103 const unsigned short DATA_CLONE_ERR = 25;
105 readonly attribute unsigned short code;
108 // XXXkhuey copy all of Gecko's non-standard stuff onto DOMException, but leave
109 // the prototype chain sane.
110 DOMException implements ExceptionMembers;