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.
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 [NoInterfaceObject, 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)]
69 interface DOMException {
70 constructor(optional DOMString message = "", optional DOMString name);
72 // The name of the error code (ie, a string repr of |result|).
73 readonly attribute DOMString name;
74 // A custom message set by the thrower.
75 [BinaryName="messageMoz"]
76 readonly attribute DOMString message;
77 readonly attribute unsigned short code;
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;
106 // XXXkhuey copy all of Gecko's non-standard stuff onto DOMException, but leave
107 // the prototype chain sane.
108 DOMException includes ExceptionMembers;