| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 part of $LIBRARYNAME; | 5 part of $LIBRARYNAME; |
| 6 | 6 |
| 7 $(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS
{ | 7 $(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS
{ |
| 8 | 8 |
| 9 static const String INDEX_SIZE = 'IndexSizeError'; | 9 static const String INDEX_SIZE = 'IndexSizeError'; |
| 10 static const String HIERARCHY_REQUEST = 'HierarchyRequestError'; | 10 static const String HIERARCHY_REQUEST = 'HierarchyRequestError'; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 static const String NETWORK = 'NetworkError'; | 23 static const String NETWORK = 'NetworkError'; |
| 24 static const String ABORT = 'AbortError'; | 24 static const String ABORT = 'AbortError'; |
| 25 static const String URL_MISMATCH = 'URLMismatchError'; | 25 static const String URL_MISMATCH = 'URLMismatchError'; |
| 26 static const String QUOTA_EXCEEDED = 'QuotaExceededError'; | 26 static const String QUOTA_EXCEEDED = 'QuotaExceededError'; |
| 27 static const String TIMEOUT = 'TimeoutError'; | 27 static const String TIMEOUT = 'TimeoutError'; |
| 28 static const String INVALID_NODE_TYPE = 'InvalidNodeTypeError'; | 28 static const String INVALID_NODE_TYPE = 'InvalidNodeTypeError'; |
| 29 static const String DATA_CLONE = 'DataCloneError'; | 29 static const String DATA_CLONE = 'DataCloneError'; |
| 30 // Is TypeError class derived from DomException but name is 'TypeError' | 30 // Is TypeError class derived from DomException but name is 'TypeError' |
| 31 static const String TYPE_ERROR = 'TypeError'; | 31 static const String TYPE_ERROR = 'TypeError'; |
| 32 | 32 |
| 33 $if DART2JS | |
| 34 String get name { | 33 String get name { |
| 35 var errorName = JS('String', '#.name', this); | 34 var errorName = JS('String', '#.name', this); |
| 36 // Although Safari nightly has updated the name to SecurityError, Safari 5 | 35 // Although Safari nightly has updated the name to SecurityError, Safari 5 |
| 37 // and 6 still return SECURITY_ERR. | 36 // and 6 still return SECURITY_ERR. |
| 38 if (Device.isWebKit && errorName == 'SECURITY_ERR') return 'SecurityError'; | 37 if (Device.isWebKit && errorName == 'SECURITY_ERR') return 'SecurityError'; |
| 39 // Chrome release still uses old string, remove this line when Chrome stable | 38 // Chrome release still uses old string, remove this line when Chrome stable |
| 40 // also prints out SyntaxError. | 39 // also prints out SyntaxError. |
| 41 if (Device.isWebKit && errorName == 'SYNTAX_ERR') return 'SyntaxError'; | 40 if (Device.isWebKit && errorName == 'SYNTAX_ERR') return 'SyntaxError'; |
| 42 return errorName; | 41 return errorName; |
| 43 } | 42 } |
| 44 $endif | |
| 45 $if JSINTEROP | |
| 46 String _name; | |
| 47 String _message; | |
| 48 | |
| 49 // To suppress missing implicit constructor warnings. | |
| 50 factory DomException._() { throw new UnsupportedError("Not supported"); } | |
| 51 | |
| 52 @Deprecated("Internal Use Only") | |
| 53 DomException.internal_() { } | |
| 54 | |
| 55 @Deprecated("Internal Use Only") | |
| 56 DomException.jsInterop(String m) { | |
| 57 var name_index = m.indexOf(': '); | |
| 58 if (name_index < 0) { | |
| 59 _name = ""; | |
| 60 _message = m; | |
| 61 } else { | |
| 62 _name = m.substring(0, name_index); | |
| 63 _message = m.substring(name_index + 1).trim(); | |
| 64 } | |
| 65 } | |
| 66 | |
| 67 @DomName('DOMException.message') | |
| 68 @DocsEditable() | |
| 69 String get message => _message ?? | |
| 70 (_message = _blink.BlinkDOMException.instance.message_Getter_(this)); | |
| 71 | |
| 72 @DomName('DOMException.name') | |
| 73 @DocsEditable() | |
| 74 String get name => _name ?? | |
| 75 (_name = _blink.BlinkDOMException.instance.name_Getter_(this)); | |
| 76 | |
| 77 @DomName('DOMException.toString') | |
| 78 @DocsEditable() | |
| 79 String toString() => "$name: $message"; | |
| 80 | |
| 81 $else | |
| 82 $!MEMBERS | 43 $!MEMBERS |
| 83 $endif | |
| 84 $if DART2JS | |
| 85 @DomName('DOMException.toString') | 44 @DomName('DOMException.toString') |
| 86 @DocsEditable() | 45 @DocsEditable() |
| 87 String toString() => JS('String', 'String(#)', this); | 46 String toString() => JS('String', 'String(#)', this); |
| 88 $endif | |
| 89 } | 47 } |
| OLD | NEW |