| Index: LayoutTests/dart/custom/lifecycle-exception.dart
|
| diff --git a/LayoutTests/dart/custom/lifecycle-exception.dart b/LayoutTests/dart/custom/lifecycle-exception.dart
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..20af4825080812e21e77dd7d394872453c9c551d
|
| --- /dev/null
|
| +++ b/LayoutTests/dart/custom/lifecycle-exception.dart
|
| @@ -0,0 +1,59 @@
|
| +// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
|
| +// for details. All rights reserved. Use of this source code is governed by a
|
| +// BSD-style license that can be found in the LICENSE file.
|
| +
|
| +import 'dart:html';
|
| +
|
| +class Error extends HtmlElement {
|
| + Error.created() : super.created();
|
| +
|
| + void attached() {
|
| + print('before attached throw');
|
| + throw 'attached error';
|
| + print('after attached throw');
|
| + }
|
| +
|
| + void detached() {
|
| + print('before detached throw');
|
| + throw 'detached error';
|
| + print('after detached throw');
|
| + }
|
| +
|
| + void attributeChanged() {
|
| + print('wrong number of arguments - this should never be reached');
|
| + }
|
| +}
|
| +
|
| +class Error2 extends HtmlElement {
|
| + Error2.created() : super.created() {
|
| + throw 'Error2 cannot be created';
|
| + }
|
| +}
|
| +
|
| +main() {
|
| + // Test Error.
|
| + try {
|
| + document.register('x-error', Error);
|
| + var element = document.createElement('x-error');
|
| + document.body.append(element);
|
| + try {
|
| + element.attached();
|
| + } catch(e) {
|
| + print('Caught direct throw');
|
| + }
|
| + element.setAttribute('foo', 'bar');
|
| + element.remove();
|
| + } catch (e) {
|
| + print('No error should be propagated here: $e');
|
| + }
|
| +
|
| + // Test Error2.
|
| + try {
|
| + document.register('x-error2', Error2);
|
| + var element = document.createElement('x-error2');
|
| + print(element is Error2);
|
| + print(element is Element);
|
| + } catch (e) {
|
| + print('No error should be propagated here: $e');
|
| + }
|
| +}
|
|
|