Skip to content
This repository has been archived by the owner on Feb 22, 2018. It is now read-only.

feat(tests): Only allow unittests to run in checked mode. #41

Closed
wants to merge 1 commit into from

Conversation

jbdeboer
Copy link
Contributor

No description provided.

@vojtajina
Copy link
Contributor

That is awesome!

@pavelgj
Copy link
Contributor

pavelgj commented Jul 15, 2013

Nice!

@jbdeboer
Copy link
Contributor Author

Landed as cdcb35f

@jbdeboer jbdeboer closed this Jul 15, 2013
chirayuk added a commit to chirayuk/angular.dart that referenced this pull request Jun 26, 2014
Refer dart-archive#1182
and repro https://github.com/chirayuk/sample/tree/issue_1182_leaving_a_nested_ng_view

NgView's register cleanup handlers this way:

    _leaveSubscription = route.onLeave.listen((_) {
      _leaveSubscription.cancel();
      // …
      _cleanUp();
    });

When there are nested ng-views, upon a route change, the parent NgView
calls it's _cleanUp() first (which destroys it's child scope) and then
the child NgView attempts a cleanup.  However, it's child scope is
already detached due to the parent NgView cleaning up causing an
exception.

Stack trace is:

    'package:angular/core/scope.dart': Failed assertion: line 335 pos 12: 'isAttached' is not true.

    STACKTRACE:
    #0      Scope.destroy (package:angular/core/scope.dart:335:12)
    #1      NgView._cleanUp (package:angular/routing/ng_view.dart:130:24)
    dart-archive#2      NgView._show.<anonymous closure> (package:angular/routing/ng_view.dart:106:15)
    dart-archive#3      _rootRunUnary (dart:async/zone.dart:730)
    dart-archive#4      _ZoneDelegate.runUnary (dart:async/zone.dart:462)
    dart-archive#5      _onRunUnary.<anonymous closure> (package:angular/core/zone.dart:113:63)
    dart-archive#6      VmTurnZone._onRunBase (package:angular/core/zone.dart:97:16)
    dart-archive#7      _onRunUnary (package:angular/core/zone.dart:113:17)
    dart-archive#8      _ZoneDelegate.runUnary (dart:async/zone.dart:462)
    dart-archive#9      _CustomizedZone.runUnary (dart:async/zone.dart:667)
    dart-archive#10     _BaseZone.runUnaryGuarded (dart:async/zone.dart:582)
    dart-archive#11     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:333)
    dart-archive#12     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263)
    dart-archive#13     _SyncBroadcastStreamController._sendData.<anonymous closure> (dart:async/broadcast_stream_controller.dart:344)
    dart-archive#14     _BroadcastStreamController._forEachListener (dart:async/broadcast_stream_controller.dart:297)
    dart-archive#15     _SyncBroadcastStreamController._sendData (dart:async/broadcast_stream_controller.dart:343)
    dart-archive#16     _BroadcastStreamController.add (dart:async/broadcast_stream_controller.dart:227)
    dart-archive#17     Router._leaveCurrentRouteHelper (package:route_hierarchical/client.dart:654:48)
    dart-archive#18     Router._leaveCurrentRouteHelper (package:route_hierarchical/client.dart:656:47)
    dart-archive#19     Router._leaveCurrentRoute (package:route_hierarchical/client.dart:645:41)
    dart-archive#20     Router._leaveOldRoutes (package:route_hierarchical/client.dart:525:30)
    dart-archive#21     Router._processNewRoute (package:route_hierarchical/client.dart:497:27)
    dart-archive#22     Router._route.<anonymous closure> (package:route_hierarchical/client.dart:481:29)
    dart-archive#23     _rootRunUnary (dart:async/zone.dart:730)
    dart-archive#24     _ZoneDelegate.runUnary (dart:async/zone.dart:462)
    dart-archive#25     _onRunUnary.<anonymous closure> (package:angular/core/zone.dart:113:63)
    dart-archive#26     VmTurnZone._onRunBase (package:angular/core/zone.dart:97:16)
    dart-archive#27     _onRunUnary (package:angular/core/zone.dart:113:17)
    dart-archive#28     _ZoneDelegate.runUnary (dart:async/zone.dart:462)
    dart-archive#29     _CustomizedZone.runUnary (dart:async/zone.dart:667)
    dart-archive#30     _Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:488)
    dart-archive#31     _Future._propagateToListeners (dart:async/future_impl.dart:571)
    dart-archive#32     _Future._completeWithValue (dart:async/future_impl.dart:331)
    dart-archive#33     _Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:393)
    dart-archive#34     _rootRun (dart:async/zone.dart:723)
    dart-archive#35     _ZoneDelegate.run (dart:async/zone.dart:453)
    dart-archive#36     _onScheduleMicrotask.<anonymous closure> (package:angular/core/zone.dart:117:43)
    dart-archive#37     VmTurnZone._finishTurn (package:angular/core/zone.dart:143:34)
    dart-archive#38     VmTurnZone._onRunBase (package:angular/core/zone.dart:104:43)
    dart-archive#39     _onRunUnary (package:angular/core/zone.dart:113:17)
    dart-archive#40     _ZoneDelegate.runUnary (dart:async/zone.dart:462)
    dart-archive#41     _CustomizedZone.runUnary (dart:async/zone.dart:667)
    dart-archive#42     _BaseZone.runUnaryGuarded (dart:async/zone.dart:582)
    dart-archive#43     _BaseZone.bindUnaryCallback.<anonymous closure> (dart:async/zone.dart:608)
chirayuk added a commit to chirayuk/angular.dart that referenced this pull request Jun 26, 2014
Refer dart-archive#1182
and repro https://github.com/chirayuk/sample/tree/issue_1182_leaving_a_nested_ng_view

NgView's register cleanup handlers this way:

    _leaveSubscription = route.onLeave.listen((_) {
      _leaveSubscription.cancel();
      // …
      _cleanUp();
    });

When there are nested ng-views, upon a route change, the parent NgView
calls it's _cleanUp() first (which destroys it's child scope) and then
the child NgView attempts a cleanup.  However, it's child scope is
already detached due to the parent NgView cleaning up causing an
exception.

Stack trace is:

    'package:angular/core/scope.dart': Failed assertion: line 335 pos 12: 'isAttached' is not true.

    STACKTRACE:
    #0      Scope.destroy (package:angular/core/scope.dart:335:12)
    #1      NgView._cleanUp (package:angular/routing/ng_view.dart:130:24)
    dart-archive#2      NgView._show.<anonymous closure> (package:angular/routing/ng_view.dart:106:15)
    dart-archive#3      _rootRunUnary (dart:async/zone.dart:730)
    dart-archive#4      _ZoneDelegate.runUnary (dart:async/zone.dart:462)
    dart-archive#5      _onRunUnary.<anonymous closure> (package:angular/core/zone.dart:113:63)
    dart-archive#6      VmTurnZone._onRunBase (package:angular/core/zone.dart:97:16)
    dart-archive#7      _onRunUnary (package:angular/core/zone.dart:113:17)
    dart-archive#8      _ZoneDelegate.runUnary (dart:async/zone.dart:462)
    dart-archive#9      _CustomizedZone.runUnary (dart:async/zone.dart:667)
    dart-archive#10     _BaseZone.runUnaryGuarded (dart:async/zone.dart:582)
    dart-archive#11     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:333)
    dart-archive#12     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263)
    dart-archive#13     _SyncBroadcastStreamController._sendData.<anonymous closure> (dart:async/broadcast_stream_controller.dart:344)
    dart-archive#14     _BroadcastStreamController._forEachListener (dart:async/broadcast_stream_controller.dart:297)
    dart-archive#15     _SyncBroadcastStreamController._sendData (dart:async/broadcast_stream_controller.dart:343)
    dart-archive#16     _BroadcastStreamController.add (dart:async/broadcast_stream_controller.dart:227)
    dart-archive#17     Router._leaveCurrentRouteHelper (package:route_hierarchical/client.dart:654:48)
    dart-archive#18     Router._leaveCurrentRouteHelper (package:route_hierarchical/client.dart:656:47)
    dart-archive#19     Router._leaveCurrentRoute (package:route_hierarchical/client.dart:645:41)
    dart-archive#20     Router._leaveOldRoutes (package:route_hierarchical/client.dart:525:30)
    dart-archive#21     Router._processNewRoute (package:route_hierarchical/client.dart:497:27)
    dart-archive#22     Router._route.<anonymous closure> (package:route_hierarchical/client.dart:481:29)
    dart-archive#23     _rootRunUnary (dart:async/zone.dart:730)
    dart-archive#24     _ZoneDelegate.runUnary (dart:async/zone.dart:462)
    dart-archive#25     _onRunUnary.<anonymous closure> (package:angular/core/zone.dart:113:63)
    dart-archive#26     VmTurnZone._onRunBase (package:angular/core/zone.dart:97:16)
    dart-archive#27     _onRunUnary (package:angular/core/zone.dart:113:17)
    dart-archive#28     _ZoneDelegate.runUnary (dart:async/zone.dart:462)
    dart-archive#29     _CustomizedZone.runUnary (dart:async/zone.dart:667)
    dart-archive#30     _Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:488)
    dart-archive#31     _Future._propagateToListeners (dart:async/future_impl.dart:571)
    dart-archive#32     _Future._completeWithValue (dart:async/future_impl.dart:331)
    dart-archive#33     _Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:393)
    dart-archive#34     _rootRun (dart:async/zone.dart:723)
    dart-archive#35     _ZoneDelegate.run (dart:async/zone.dart:453)
    dart-archive#36     _onScheduleMicrotask.<anonymous closure> (package:angular/core/zone.dart:117:43)
    dart-archive#37     VmTurnZone._finishTurn (package:angular/core/zone.dart:143:34)
    dart-archive#38     VmTurnZone._onRunBase (package:angular/core/zone.dart:104:43)
    dart-archive#39     _onRunUnary (package:angular/core/zone.dart:113:17)
    dart-archive#40     _ZoneDelegate.runUnary (dart:async/zone.dart:462)
    dart-archive#41     _CustomizedZone.runUnary (dart:async/zone.dart:667)
    dart-archive#42     _BaseZone.runUnaryGuarded (dart:async/zone.dart:582)
    dart-archive#43     _BaseZone.bindUnaryCallback.<anonymous closure> (dart:async/zone.dart:608)
chirayuk added a commit to chirayuk/angular.dart that referenced this pull request Jun 26, 2014
Refer dart-archive#1182
and repro https://github.com/chirayuk/sample/tree/issue_1182_leaving_a_nested_ng_view

NgView's register cleanup handlers this way:

    _leaveSubscription = route.onLeave.listen((_) {
      _leaveSubscription.cancel();
      // …
      _cleanUp();
    });

When there are nested ng-views, upon a route change, the parent NgView
calls it's _cleanUp() first (which destroys it's child scope) and then
the child NgView attempts a cleanup.  However, it's child scope is
already detached due to the parent NgView cleaning up causing an
exception.

Stack trace is:

    'package:angular/core/scope.dart': Failed assertion: line 335 pos 12: 'isAttached' is not true.

    STACKTRACE:
    #0      Scope.destroy (package:angular/core/scope.dart:335:12)
    #1      NgView._cleanUp (package:angular/routing/ng_view.dart:130:24)
    dart-archive#2      NgView._show.<anonymous closure> (package:angular/routing/ng_view.dart:106:15)
    dart-archive#3      _rootRunUnary (dart:async/zone.dart:730)
    dart-archive#4      _ZoneDelegate.runUnary (dart:async/zone.dart:462)
    dart-archive#5      _onRunUnary.<anonymous closure> (package:angular/core/zone.dart:113:63)
    dart-archive#6      VmTurnZone._onRunBase (package:angular/core/zone.dart:97:16)
    dart-archive#7      _onRunUnary (package:angular/core/zone.dart:113:17)
    dart-archive#8      _ZoneDelegate.runUnary (dart:async/zone.dart:462)
    dart-archive#9      _CustomizedZone.runUnary (dart:async/zone.dart:667)
    dart-archive#10     _BaseZone.runUnaryGuarded (dart:async/zone.dart:582)
    dart-archive#11     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:333)
    dart-archive#12     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263)
    dart-archive#13     _SyncBroadcastStreamController._sendData.<anonymous closure> (dart:async/broadcast_stream_controller.dart:344)
    dart-archive#14     _BroadcastStreamController._forEachListener (dart:async/broadcast_stream_controller.dart:297)
    dart-archive#15     _SyncBroadcastStreamController._sendData (dart:async/broadcast_stream_controller.dart:343)
    dart-archive#16     _BroadcastStreamController.add (dart:async/broadcast_stream_controller.dart:227)
    dart-archive#17     Router._leaveCurrentRouteHelper (package:route_hierarchical/client.dart:654:48)
    dart-archive#18     Router._leaveCurrentRouteHelper (package:route_hierarchical/client.dart:656:47)
    dart-archive#19     Router._leaveCurrentRoute (package:route_hierarchical/client.dart:645:41)
    dart-archive#20     Router._leaveOldRoutes (package:route_hierarchical/client.dart:525:30)
    dart-archive#21     Router._processNewRoute (package:route_hierarchical/client.dart:497:27)
    dart-archive#22     Router._route.<anonymous closure> (package:route_hierarchical/client.dart:481:29)
    dart-archive#23     _rootRunUnary (dart:async/zone.dart:730)
    dart-archive#24     _ZoneDelegate.runUnary (dart:async/zone.dart:462)
    dart-archive#25     _onRunUnary.<anonymous closure> (package:angular/core/zone.dart:113:63)
    dart-archive#26     VmTurnZone._onRunBase (package:angular/core/zone.dart:97:16)
    dart-archive#27     _onRunUnary (package:angular/core/zone.dart:113:17)
    dart-archive#28     _ZoneDelegate.runUnary (dart:async/zone.dart:462)
    dart-archive#29     _CustomizedZone.runUnary (dart:async/zone.dart:667)
    dart-archive#30     _Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:488)
    dart-archive#31     _Future._propagateToListeners (dart:async/future_impl.dart:571)
    dart-archive#32     _Future._completeWithValue (dart:async/future_impl.dart:331)
    dart-archive#33     _Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:393)
    dart-archive#34     _rootRun (dart:async/zone.dart:723)
    dart-archive#35     _ZoneDelegate.run (dart:async/zone.dart:453)
    dart-archive#36     _onScheduleMicrotask.<anonymous closure> (package:angular/core/zone.dart:117:43)
    dart-archive#37     VmTurnZone._finishTurn (package:angular/core/zone.dart:143:34)
    dart-archive#38     VmTurnZone._onRunBase (package:angular/core/zone.dart:104:43)
    dart-archive#39     _onRunUnary (package:angular/core/zone.dart:113:17)
    dart-archive#40     _ZoneDelegate.runUnary (dart:async/zone.dart:462)
    dart-archive#41     _CustomizedZone.runUnary (dart:async/zone.dart:667)
    dart-archive#42     _BaseZone.runUnaryGuarded (dart:async/zone.dart:582)
    dart-archive#43     _BaseZone.bindUnaryCallback.<anonymous closure> (dart:async/zone.dart:608)

Closes dart-archive#1182
chirayuk added a commit that referenced this pull request Jun 26, 2014
Refer #1182
and repro https://github.com/chirayuk/sample/tree/issue_1182_leaving_a_nested_ng_view

NgView's register cleanup handlers this way:

    _leaveSubscription = route.onLeave.listen((_) {
      _leaveSubscription.cancel();
      // …
      _cleanUp();
    });

When there are nested ng-views, upon a route change, the parent NgView
calls it's _cleanUp() first (which destroys it's child scope) and then
the child NgView attempts a cleanup.  However, it's child scope is
already detached due to the parent NgView cleaning up causing an
exception.

Stack trace is:

    'package:angular/core/scope.dart': Failed assertion: line 335 pos 12: 'isAttached' is not true.

    STACKTRACE:
    #0      Scope.destroy (package:angular/core/scope.dart:335:12)
    #1      NgView._cleanUp (package:angular/routing/ng_view.dart:130:24)
    #2      NgView._show.<anonymous closure> (package:angular/routing/ng_view.dart:106:15)
    #3      _rootRunUnary (dart:async/zone.dart:730)
    #4      _ZoneDelegate.runUnary (dart:async/zone.dart:462)
    #5      _onRunUnary.<anonymous closure> (package:angular/core/zone.dart:113:63)
    #6      VmTurnZone._onRunBase (package:angular/core/zone.dart:97:16)
    #7      _onRunUnary (package:angular/core/zone.dart:113:17)
    #8      _ZoneDelegate.runUnary (dart:async/zone.dart:462)
    #9      _CustomizedZone.runUnary (dart:async/zone.dart:667)
    #10     _BaseZone.runUnaryGuarded (dart:async/zone.dart:582)
    #11     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:333)
    #12     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263)
    #13     _SyncBroadcastStreamController._sendData.<anonymous closure> (dart:async/broadcast_stream_controller.dart:344)
    #14     _BroadcastStreamController._forEachListener (dart:async/broadcast_stream_controller.dart:297)
    #15     _SyncBroadcastStreamController._sendData (dart:async/broadcast_stream_controller.dart:343)
    #16     _BroadcastStreamController.add (dart:async/broadcast_stream_controller.dart:227)
    #17     Router._leaveCurrentRouteHelper (package:route_hierarchical/client.dart:654:48)
    #18     Router._leaveCurrentRouteHelper (package:route_hierarchical/client.dart:656:47)
    #19     Router._leaveCurrentRoute (package:route_hierarchical/client.dart:645:41)
    #20     Router._leaveOldRoutes (package:route_hierarchical/client.dart:525:30)
    #21     Router._processNewRoute (package:route_hierarchical/client.dart:497:27)
    #22     Router._route.<anonymous closure> (package:route_hierarchical/client.dart:481:29)
    #23     _rootRunUnary (dart:async/zone.dart:730)
    #24     _ZoneDelegate.runUnary (dart:async/zone.dart:462)
    #25     _onRunUnary.<anonymous closure> (package:angular/core/zone.dart:113:63)
    #26     VmTurnZone._onRunBase (package:angular/core/zone.dart:97:16)
    #27     _onRunUnary (package:angular/core/zone.dart:113:17)
    #28     _ZoneDelegate.runUnary (dart:async/zone.dart:462)
    #29     _CustomizedZone.runUnary (dart:async/zone.dart:667)
    #30     _Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:488)
    #31     _Future._propagateToListeners (dart:async/future_impl.dart:571)
    #32     _Future._completeWithValue (dart:async/future_impl.dart:331)
    #33     _Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:393)
    #34     _rootRun (dart:async/zone.dart:723)
    #35     _ZoneDelegate.run (dart:async/zone.dart:453)
    #36     _onScheduleMicrotask.<anonymous closure> (package:angular/core/zone.dart:117:43)
    #37     VmTurnZone._finishTurn (package:angular/core/zone.dart:143:34)
    #38     VmTurnZone._onRunBase (package:angular/core/zone.dart:104:43)
    #39     _onRunUnary (package:angular/core/zone.dart:113:17)
    #40     _ZoneDelegate.runUnary (dart:async/zone.dart:462)
    #41     _CustomizedZone.runUnary (dart:async/zone.dart:667)
    #42     _BaseZone.runUnaryGuarded (dart:async/zone.dart:582)
    #43     _BaseZone.bindUnaryCallback.<anonymous closure> (dart:async/zone.dart:608)

Closes #1182
chirayuk added a commit that referenced this pull request Jun 26, 2014
Refer #1182
and repro https://github.com/chirayuk/sample/tree/issue_1182_leaving_a_nested_ng_view

NgView's register cleanup handlers this way:

    _leaveSubscription = route.onLeave.listen((_) {
      _leaveSubscription.cancel();
      // …
      _cleanUp();
    });

When there are nested ng-views, upon a route change, the parent NgView
calls it's _cleanUp() first (which destroys it's child scope) and then
the child NgView attempts a cleanup.  However, it's child scope is
already detached due to the parent NgView cleaning up causing an
exception.

Stack trace is:

    'package:angular/core/scope.dart': Failed assertion: line 335 pos 12: 'isAttached' is not true.

    STACKTRACE:
    #0      Scope.destroy (package:angular/core/scope.dart:335:12)
    #1      NgView._cleanUp (package:angular/routing/ng_view.dart:130:24)
    #2      NgView._show.<anonymous closure> (package:angular/routing/ng_view.dart:106:15)
    #3      _rootRunUnary (dart:async/zone.dart:730)
    #4      _ZoneDelegate.runUnary (dart:async/zone.dart:462)
    #5      _onRunUnary.<anonymous closure> (package:angular/core/zone.dart:113:63)
    #6      VmTurnZone._onRunBase (package:angular/core/zone.dart:97:16)
    #7      _onRunUnary (package:angular/core/zone.dart:113:17)
    #8      _ZoneDelegate.runUnary (dart:async/zone.dart:462)
    #9      _CustomizedZone.runUnary (dart:async/zone.dart:667)
    #10     _BaseZone.runUnaryGuarded (dart:async/zone.dart:582)
    #11     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:333)
    #12     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263)
    #13     _SyncBroadcastStreamController._sendData.<anonymous closure> (dart:async/broadcast_stream_controller.dart:344)
    #14     _BroadcastStreamController._forEachListener (dart:async/broadcast_stream_controller.dart:297)
    #15     _SyncBroadcastStreamController._sendData (dart:async/broadcast_stream_controller.dart:343)
    #16     _BroadcastStreamController.add (dart:async/broadcast_stream_controller.dart:227)
    #17     Router._leaveCurrentRouteHelper (package:route_hierarchical/client.dart:654:48)
    #18     Router._leaveCurrentRouteHelper (package:route_hierarchical/client.dart:656:47)
    #19     Router._leaveCurrentRoute (package:route_hierarchical/client.dart:645:41)
    #20     Router._leaveOldRoutes (package:route_hierarchical/client.dart:525:30)
    #21     Router._processNewRoute (package:route_hierarchical/client.dart:497:27)
    #22     Router._route.<anonymous closure> (package:route_hierarchical/client.dart:481:29)
    #23     _rootRunUnary (dart:async/zone.dart:730)
    #24     _ZoneDelegate.runUnary (dart:async/zone.dart:462)
    #25     _onRunUnary.<anonymous closure> (package:angular/core/zone.dart:113:63)
    #26     VmTurnZone._onRunBase (package:angular/core/zone.dart:97:16)
    #27     _onRunUnary (package:angular/core/zone.dart:113:17)
    #28     _ZoneDelegate.runUnary (dart:async/zone.dart:462)
    #29     _CustomizedZone.runUnary (dart:async/zone.dart:667)
    #30     _Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:488)
    #31     _Future._propagateToListeners (dart:async/future_impl.dart:571)
    #32     _Future._completeWithValue (dart:async/future_impl.dart:331)
    #33     _Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:393)
    #34     _rootRun (dart:async/zone.dart:723)
    #35     _ZoneDelegate.run (dart:async/zone.dart:453)
    #36     _onScheduleMicrotask.<anonymous closure> (package:angular/core/zone.dart:117:43)
    #37     VmTurnZone._finishTurn (package:angular/core/zone.dart:143:34)
    #38     VmTurnZone._onRunBase (package:angular/core/zone.dart:104:43)
    #39     _onRunUnary (package:angular/core/zone.dart:113:17)
    #40     _ZoneDelegate.runUnary (dart:async/zone.dart:462)
    #41     _CustomizedZone.runUnary (dart:async/zone.dart:667)
    #42     _BaseZone.runUnaryGuarded (dart:async/zone.dart:582)
    #43     _BaseZone.bindUnaryCallback.<anonymous closure> (dart:async/zone.dart:608)

Closes #1182
chirayuk added a commit that referenced this pull request Jun 26, 2014
Refer #1182
and repro https://github.com/chirayuk/sample/tree/issue_1182_leaving_a_nested_ng_view

NgView's register cleanup handlers this way:

    _leaveSubscription = route.onLeave.listen((_) {
      _leaveSubscription.cancel();
      // …
      _cleanUp();
    });

When there are nested ng-views, upon a route change, the parent NgView
calls it's _cleanUp() first (which destroys it's child scope) and then
the child NgView attempts a cleanup.  However, it's child scope is
already detached due to the parent NgView cleaning up causing an
exception.

Stack trace is:

    'package:angular/core/scope.dart': Failed assertion: line 335 pos 12: 'isAttached' is not true.

    STACKTRACE:
    #0      Scope.destroy (package:angular/core/scope.dart:335:12)
    #1      NgView._cleanUp (package:angular/routing/ng_view.dart:130:24)
    #2      NgView._show.<anonymous closure> (package:angular/routing/ng_view.dart:106:15)
    #3      _rootRunUnary (dart:async/zone.dart:730)
    #4      _ZoneDelegate.runUnary (dart:async/zone.dart:462)
    #5      _onRunUnary.<anonymous closure> (package:angular/core/zone.dart:113:63)
    #6      VmTurnZone._onRunBase (package:angular/core/zone.dart:97:16)
    #7      _onRunUnary (package:angular/core/zone.dart:113:17)
    #8      _ZoneDelegate.runUnary (dart:async/zone.dart:462)
    #9      _CustomizedZone.runUnary (dart:async/zone.dart:667)
    #10     _BaseZone.runUnaryGuarded (dart:async/zone.dart:582)
    #11     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:333)
    #12     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263)
    #13     _SyncBroadcastStreamController._sendData.<anonymous closure> (dart:async/broadcast_stream_controller.dart:344)
    #14     _BroadcastStreamController._forEachListener (dart:async/broadcast_stream_controller.dart:297)
    #15     _SyncBroadcastStreamController._sendData (dart:async/broadcast_stream_controller.dart:343)
    #16     _BroadcastStreamController.add (dart:async/broadcast_stream_controller.dart:227)
    #17     Router._leaveCurrentRouteHelper (package:route_hierarchical/client.dart:654:48)
    #18     Router._leaveCurrentRouteHelper (package:route_hierarchical/client.dart:656:47)
    #19     Router._leaveCurrentRoute (package:route_hierarchical/client.dart:645:41)
    #20     Router._leaveOldRoutes (package:route_hierarchical/client.dart:525:30)
    #21     Router._processNewRoute (package:route_hierarchical/client.dart:497:27)
    #22     Router._route.<anonymous closure> (package:route_hierarchical/client.dart:481:29)
    #23     _rootRunUnary (dart:async/zone.dart:730)
    #24     _ZoneDelegate.runUnary (dart:async/zone.dart:462)
    #25     _onRunUnary.<anonymous closure> (package:angular/core/zone.dart:113:63)
    #26     VmTurnZone._onRunBase (package:angular/core/zone.dart:97:16)
    #27     _onRunUnary (package:angular/core/zone.dart:113:17)
    #28     _ZoneDelegate.runUnary (dart:async/zone.dart:462)
    #29     _CustomizedZone.runUnary (dart:async/zone.dart:667)
    #30     _Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:488)
    #31     _Future._propagateToListeners (dart:async/future_impl.dart:571)
    #32     _Future._completeWithValue (dart:async/future_impl.dart:331)
    #33     _Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:393)
    #34     _rootRun (dart:async/zone.dart:723)
    #35     _ZoneDelegate.run (dart:async/zone.dart:453)
    #36     _onScheduleMicrotask.<anonymous closure> (package:angular/core/zone.dart:117:43)
    #37     VmTurnZone._finishTurn (package:angular/core/zone.dart:143:34)
    #38     VmTurnZone._onRunBase (package:angular/core/zone.dart:104:43)
    #39     _onRunUnary (package:angular/core/zone.dart:113:17)
    #40     _ZoneDelegate.runUnary (dart:async/zone.dart:462)
    #41     _CustomizedZone.runUnary (dart:async/zone.dart:667)
    #42     _BaseZone.runUnaryGuarded (dart:async/zone.dart:582)
    #43     _BaseZone.bindUnaryCallback.<anonymous closure> (dart:async/zone.dart:608)

Closes #1182
chirayuk added a commit that referenced this pull request Jun 26, 2014
Refer #1182
and repro https://github.com/chirayuk/sample/tree/issue_1182_leaving_a_nested_ng_view

NgView's register cleanup handlers this way:

    _leaveSubscription = route.onLeave.listen((_) {
      _leaveSubscription.cancel();
      // …
      _cleanUp();
    });

When there are nested ng-views, upon a route change, the parent NgView
calls it's _cleanUp() first (which destroys it's child scope) and then
the child NgView attempts a cleanup.  However, it's child scope is
already detached due to the parent NgView cleaning up causing an
exception.

Stack trace is:

    'package:angular/core/scope.dart': Failed assertion: line 335 pos 12: 'isAttached' is not true.

    STACKTRACE:
    #0      Scope.destroy (package:angular/core/scope.dart:335:12)
    #1      NgView._cleanUp (package:angular/routing/ng_view.dart:130:24)
    #2      NgView._show.<anonymous closure> (package:angular/routing/ng_view.dart:106:15)
    #3      _rootRunUnary (dart:async/zone.dart:730)
    #4      _ZoneDelegate.runUnary (dart:async/zone.dart:462)
    #5      _onRunUnary.<anonymous closure> (package:angular/core/zone.dart:113:63)
    #6      VmTurnZone._onRunBase (package:angular/core/zone.dart:97:16)
    #7      _onRunUnary (package:angular/core/zone.dart:113:17)
    #8      _ZoneDelegate.runUnary (dart:async/zone.dart:462)
    #9      _CustomizedZone.runUnary (dart:async/zone.dart:667)
    #10     _BaseZone.runUnaryGuarded (dart:async/zone.dart:582)
    #11     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:333)
    #12     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263)
    #13     _SyncBroadcastStreamController._sendData.<anonymous closure> (dart:async/broadcast_stream_controller.dart:344)
    #14     _BroadcastStreamController._forEachListener (dart:async/broadcast_stream_controller.dart:297)
    #15     _SyncBroadcastStreamController._sendData (dart:async/broadcast_stream_controller.dart:343)
    #16     _BroadcastStreamController.add (dart:async/broadcast_stream_controller.dart:227)
    #17     Router._leaveCurrentRouteHelper (package:route_hierarchical/client.dart:654:48)
    #18     Router._leaveCurrentRouteHelper (package:route_hierarchical/client.dart:656:47)
    #19     Router._leaveCurrentRoute (package:route_hierarchical/client.dart:645:41)
    #20     Router._leaveOldRoutes (package:route_hierarchical/client.dart:525:30)
    #21     Router._processNewRoute (package:route_hierarchical/client.dart:497:27)
    #22     Router._route.<anonymous closure> (package:route_hierarchical/client.dart:481:29)
    #23     _rootRunUnary (dart:async/zone.dart:730)
    #24     _ZoneDelegate.runUnary (dart:async/zone.dart:462)
    #25     _onRunUnary.<anonymous closure> (package:angular/core/zone.dart:113:63)
    #26     VmTurnZone._onRunBase (package:angular/core/zone.dart:97:16)
    #27     _onRunUnary (package:angular/core/zone.dart:113:17)
    #28     _ZoneDelegate.runUnary (dart:async/zone.dart:462)
    #29     _CustomizedZone.runUnary (dart:async/zone.dart:667)
    #30     _Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:488)
    #31     _Future._propagateToListeners (dart:async/future_impl.dart:571)
    #32     _Future._completeWithValue (dart:async/future_impl.dart:331)
    #33     _Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:393)
    #34     _rootRun (dart:async/zone.dart:723)
    #35     _ZoneDelegate.run (dart:async/zone.dart:453)
    #36     _onScheduleMicrotask.<anonymous closure> (package:angular/core/zone.dart:117:43)
    #37     VmTurnZone._finishTurn (package:angular/core/zone.dart:143:34)
    #38     VmTurnZone._onRunBase (package:angular/core/zone.dart:104:43)
    #39     _onRunUnary (package:angular/core/zone.dart:113:17)
    #40     _ZoneDelegate.runUnary (dart:async/zone.dart:462)
    #41     _CustomizedZone.runUnary (dart:async/zone.dart:667)
    #42     _BaseZone.runUnaryGuarded (dart:async/zone.dart:582)
    #43     _BaseZone.bindUnaryCallback.<anonymous closure> (dart:async/zone.dart:608)

Closes #1182
dsalsbury pushed a commit to dsalsbury/angular.dart that referenced this pull request Jul 16, 2014
Refer dart-archive#1182
and repro https://github.com/chirayuk/sample/tree/issue_1182_leaving_a_nested_ng_view

NgView's register cleanup handlers this way:

    _leaveSubscription = route.onLeave.listen((_) {
      _leaveSubscription.cancel();
      // …
      _cleanUp();
    });

When there are nested ng-views, upon a route change, the parent NgView
calls it's _cleanUp() first (which destroys it's child scope) and then
the child NgView attempts a cleanup.  However, it's child scope is
already detached due to the parent NgView cleaning up causing an
exception.

Stack trace is:

    'package:angular/core/scope.dart': Failed assertion: line 335 pos 12: 'isAttached' is not true.

    STACKTRACE:
    #0      Scope.destroy (package:angular/core/scope.dart:335:12)
    dart-archive#1      NgView._cleanUp (package:angular/routing/ng_view.dart:130:24)
    dart-archive#2      NgView._show.<anonymous closure> (package:angular/routing/ng_view.dart:106:15)
    dart-archive#3      _rootRunUnary (dart:async/zone.dart:730)
    dart-archive#4      _ZoneDelegate.runUnary (dart:async/zone.dart:462)
    dart-archive#5      _onRunUnary.<anonymous closure> (package:angular/core/zone.dart:113:63)
    dart-archive#6      VmTurnZone._onRunBase (package:angular/core/zone.dart:97:16)
    dart-archive#7      _onRunUnary (package:angular/core/zone.dart:113:17)
    dart-archive#8      _ZoneDelegate.runUnary (dart:async/zone.dart:462)
    dart-archive#9      _CustomizedZone.runUnary (dart:async/zone.dart:667)
    dart-archive#10     _BaseZone.runUnaryGuarded (dart:async/zone.dart:582)
    dart-archive#11     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:333)
    dart-archive#12     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263)
    dart-archive#13     _SyncBroadcastStreamController._sendData.<anonymous closure> (dart:async/broadcast_stream_controller.dart:344)
    dart-archive#14     _BroadcastStreamController._forEachListener (dart:async/broadcast_stream_controller.dart:297)
    dart-archive#15     _SyncBroadcastStreamController._sendData (dart:async/broadcast_stream_controller.dart:343)
    dart-archive#16     _BroadcastStreamController.add (dart:async/broadcast_stream_controller.dart:227)
    dart-archive#17     Router._leaveCurrentRouteHelper (package:route_hierarchical/client.dart:654:48)
    dart-archive#18     Router._leaveCurrentRouteHelper (package:route_hierarchical/client.dart:656:47)
    dart-archive#19     Router._leaveCurrentRoute (package:route_hierarchical/client.dart:645:41)
    dart-archive#20     Router._leaveOldRoutes (package:route_hierarchical/client.dart:525:30)
    dart-archive#21     Router._processNewRoute (package:route_hierarchical/client.dart:497:27)
    dart-archive#22     Router._route.<anonymous closure> (package:route_hierarchical/client.dart:481:29)
    dart-archive#23     _rootRunUnary (dart:async/zone.dart:730)
    dart-archive#24     _ZoneDelegate.runUnary (dart:async/zone.dart:462)
    dart-archive#25     _onRunUnary.<anonymous closure> (package:angular/core/zone.dart:113:63)
    dart-archive#26     VmTurnZone._onRunBase (package:angular/core/zone.dart:97:16)
    dart-archive#27     _onRunUnary (package:angular/core/zone.dart:113:17)
    dart-archive#28     _ZoneDelegate.runUnary (dart:async/zone.dart:462)
    dart-archive#29     _CustomizedZone.runUnary (dart:async/zone.dart:667)
    dart-archive#30     _Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:488)
    dart-archive#31     _Future._propagateToListeners (dart:async/future_impl.dart:571)
    dart-archive#32     _Future._completeWithValue (dart:async/future_impl.dart:331)
    dart-archive#33     _Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:393)
    dart-archive#34     _rootRun (dart:async/zone.dart:723)
    dart-archive#35     _ZoneDelegate.run (dart:async/zone.dart:453)
    dart-archive#36     _onScheduleMicrotask.<anonymous closure> (package:angular/core/zone.dart:117:43)
    dart-archive#37     VmTurnZone._finishTurn (package:angular/core/zone.dart:143:34)
    dart-archive#38     VmTurnZone._onRunBase (package:angular/core/zone.dart:104:43)
    dart-archive#39     _onRunUnary (package:angular/core/zone.dart:113:17)
    dart-archive#40     _ZoneDelegate.runUnary (dart:async/zone.dart:462)
    dart-archive#41     _CustomizedZone.runUnary (dart:async/zone.dart:667)
    dart-archive#42     _BaseZone.runUnaryGuarded (dart:async/zone.dart:582)
    dart-archive#43     _BaseZone.bindUnaryCallback.<anonymous closure> (dart:async/zone.dart:608)

Closes dart-archive#1182
dsalsbury pushed a commit to dsalsbury/angular.dart that referenced this pull request Jul 16, 2014
Refer dart-archive#1182
and repro https://github.com/chirayuk/sample/tree/issue_1182_leaving_a_nested_ng_view

NgView's register cleanup handlers this way:

    _leaveSubscription = route.onLeave.listen((_) {
      _leaveSubscription.cancel();
      // …
      _cleanUp();
    });

When there are nested ng-views, upon a route change, the parent NgView
calls it's _cleanUp() first (which destroys it's child scope) and then
the child NgView attempts a cleanup.  However, it's child scope is
already detached due to the parent NgView cleaning up causing an
exception.

Stack trace is:

    'package:angular/core/scope.dart': Failed assertion: line 335 pos 12: 'isAttached' is not true.

    STACKTRACE:
    #0      Scope.destroy (package:angular/core/scope.dart:335:12)
    dart-archive#1      NgView._cleanUp (package:angular/routing/ng_view.dart:130:24)
    dart-archive#2      NgView._show.<anonymous closure> (package:angular/routing/ng_view.dart:106:15)
    dart-archive#3      _rootRunUnary (dart:async/zone.dart:730)
    dart-archive#4      _ZoneDelegate.runUnary (dart:async/zone.dart:462)
    dart-archive#5      _onRunUnary.<anonymous closure> (package:angular/core/zone.dart:113:63)
    dart-archive#6      VmTurnZone._onRunBase (package:angular/core/zone.dart:97:16)
    dart-archive#7      _onRunUnary (package:angular/core/zone.dart:113:17)
    dart-archive#8      _ZoneDelegate.runUnary (dart:async/zone.dart:462)
    dart-archive#9      _CustomizedZone.runUnary (dart:async/zone.dart:667)
    dart-archive#10     _BaseZone.runUnaryGuarded (dart:async/zone.dart:582)
    dart-archive#11     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:333)
    dart-archive#12     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:263)
    dart-archive#13     _SyncBroadcastStreamController._sendData.<anonymous closure> (dart:async/broadcast_stream_controller.dart:344)
    dart-archive#14     _BroadcastStreamController._forEachListener (dart:async/broadcast_stream_controller.dart:297)
    dart-archive#15     _SyncBroadcastStreamController._sendData (dart:async/broadcast_stream_controller.dart:343)
    dart-archive#16     _BroadcastStreamController.add (dart:async/broadcast_stream_controller.dart:227)
    dart-archive#17     Router._leaveCurrentRouteHelper (package:route_hierarchical/client.dart:654:48)
    dart-archive#18     Router._leaveCurrentRouteHelper (package:route_hierarchical/client.dart:656:47)
    dart-archive#19     Router._leaveCurrentRoute (package:route_hierarchical/client.dart:645:41)
    dart-archive#20     Router._leaveOldRoutes (package:route_hierarchical/client.dart:525:30)
    dart-archive#21     Router._processNewRoute (package:route_hierarchical/client.dart:497:27)
    dart-archive#22     Router._route.<anonymous closure> (package:route_hierarchical/client.dart:481:29)
    dart-archive#23     _rootRunUnary (dart:async/zone.dart:730)
    dart-archive#24     _ZoneDelegate.runUnary (dart:async/zone.dart:462)
    dart-archive#25     _onRunUnary.<anonymous closure> (package:angular/core/zone.dart:113:63)
    dart-archive#26     VmTurnZone._onRunBase (package:angular/core/zone.dart:97:16)
    dart-archive#27     _onRunUnary (package:angular/core/zone.dart:113:17)
    dart-archive#28     _ZoneDelegate.runUnary (dart:async/zone.dart:462)
    dart-archive#29     _CustomizedZone.runUnary (dart:async/zone.dart:667)
    dart-archive#30     _Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:488)
    dart-archive#31     _Future._propagateToListeners (dart:async/future_impl.dart:571)
    dart-archive#32     _Future._completeWithValue (dart:async/future_impl.dart:331)
    dart-archive#33     _Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:393)
    dart-archive#34     _rootRun (dart:async/zone.dart:723)
    dart-archive#35     _ZoneDelegate.run (dart:async/zone.dart:453)
    dart-archive#36     _onScheduleMicrotask.<anonymous closure> (package:angular/core/zone.dart:117:43)
    dart-archive#37     VmTurnZone._finishTurn (package:angular/core/zone.dart:143:34)
    dart-archive#38     VmTurnZone._onRunBase (package:angular/core/zone.dart:104:43)
    dart-archive#39     _onRunUnary (package:angular/core/zone.dart:113:17)
    dart-archive#40     _ZoneDelegate.runUnary (dart:async/zone.dart:462)
    dart-archive#41     _CustomizedZone.runUnary (dart:async/zone.dart:667)
    dart-archive#42     _BaseZone.runUnaryGuarded (dart:async/zone.dart:582)
    dart-archive#43     _BaseZone.bindUnaryCallback.<anonymous closure> (dart:async/zone.dart:608)

Closes dart-archive#1182
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants