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