| Index: sdk/lib/html/dartium/html_dartium.dart
|
| diff --git a/sdk/lib/html/dartium/html_dartium.dart b/sdk/lib/html/dartium/html_dartium.dart
|
| index 5547397958885d01c71a201e44eef4d18a389458..8b50c3aa50fd512643af32337e2f5c42bb5eca6f 100644
|
| --- a/sdk/lib/html/dartium/html_dartium.dart
|
| +++ b/sdk/lib/html/dartium/html_dartium.dart
|
| @@ -6938,21 +6938,43 @@ class CssViewportRule extends CssRule {
|
|
|
| @DomName('CustomEvent')
|
| class CustomEvent extends Event {
|
| + var _dartDetail;
|
| +
|
| factory CustomEvent(String type,
|
| {bool canBubble: true, bool cancelable: true, Object detail}) {
|
|
|
| final CustomEvent e = document._createEvent('CustomEvent');
|
|
|
| - e._initCustomEvent(type, canBubble, cancelable, detail);
|
| + e._dartDetail = detail;
|
| +
|
| + // Only try setting the detail if it's one of these types to avoid
|
| + // first-chance exceptions. Can expand this list in the future as needed.
|
| + if (detail is List || detail is Map || detail is String || detail is num) {
|
| + try {
|
| + e._initCustomEvent(type, canBubble, cancelable, detail);
|
| + } catch(_) {
|
| + e._initCustomEvent(type, canBubble, cancelable, null);
|
| + }
|
| + } else {
|
| + e._initCustomEvent(type, canBubble, cancelable, null);
|
| + }
|
|
|
| return e;
|
| }
|
| +
|
| + @DomName('CustomEvent.detail')
|
| + get detail {
|
| + if (_dartDetail != null) {
|
| + return _dartDetail;
|
| + }
|
| + return _detail;
|
| + }
|
| // To suppress missing implicit constructor warnings.
|
| factory CustomEvent._() { throw new UnsupportedError("Not supported"); }
|
|
|
| @DomName('CustomEvent.detail')
|
| @DocsEditable()
|
| - Object get detail native "CustomEvent_detail_Getter";
|
| + Object get _detail native "CustomEvent_detail_Getter";
|
|
|
| @DomName('CustomEvent.initCustomEvent')
|
| @DocsEditable()
|
|
|