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