| OLD | NEW | 
|---|
| (Empty) |  | 
|  | 1 // Copyright (c) 2014, the Dart project authors.  Please see the AUTHORS file | 
|  | 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. | 
|  | 4 | 
|  | 5 import 'dart:html'; | 
|  | 6 | 
|  | 7 class Error extends HtmlElement { | 
|  | 8   Error.created() : super.created(); | 
|  | 9 | 
|  | 10   void attached() { | 
|  | 11     print('before attached throw'); | 
|  | 12     throw 'attached error'; | 
|  | 13     print('after attached throw'); | 
|  | 14   } | 
|  | 15 | 
|  | 16   void detached() { | 
|  | 17     print('before detached throw'); | 
|  | 18     throw 'detached error'; | 
|  | 19     print('after detached throw'); | 
|  | 20   } | 
|  | 21 | 
|  | 22   void attributeChanged() { | 
|  | 23     print('wrong number of arguments - this should never be reached'); | 
|  | 24   } | 
|  | 25 } | 
|  | 26 | 
|  | 27 class Error2 extends HtmlElement { | 
|  | 28   Error2.created() : super.created() { | 
|  | 29     throw 'Error2 cannot be created'; | 
|  | 30   } | 
|  | 31 } | 
|  | 32 | 
|  | 33 main() { | 
|  | 34   // Test Error. | 
|  | 35   try { | 
|  | 36     document.register('x-error', Error); | 
|  | 37     var element = document.createElement('x-error'); | 
|  | 38     document.body.append(element); | 
|  | 39     try { | 
|  | 40       element.attached(); | 
|  | 41     } catch(e) { | 
|  | 42       print('Caught direct throw'); | 
|  | 43     } | 
|  | 44     element.setAttribute('foo', 'bar'); | 
|  | 45     element.remove(); | 
|  | 46   } catch (e) { | 
|  | 47     print('No error should be propagated here: $e'); | 
|  | 48   } | 
|  | 49 | 
|  | 50   // Test Error2. | 
|  | 51   try { | 
|  | 52     document.register('x-error2', Error2); | 
|  | 53     var element = document.createElement('x-error2'); | 
|  | 54     print(element is Error2); | 
|  | 55     print(element is Element); | 
|  | 56   } catch (e) { | 
|  | 57     print('No error should be propagated here: $e'); | 
|  | 58   } | 
|  | 59 } | 
| OLD | NEW | 
|---|