@@ -625,40 +625,16 @@ Protractor.prototype.initDebugger_ = function(debuggerClientPath, opt_debugPort)
625
625
// Patch in a function to help us visualize what's going on in the control
626
626
// flow.
627
627
webdriver . promise . ControlFlow . prototype . getControlFlowText = function ( ) {
628
- var descriptions = [ ] ;
629
-
630
- var getDescriptions = function ( frameOrTask , descriptions ) {
631
- if ( frameOrTask . getDescription ) {
632
- var stacktrace = frameOrTask . snapshot_ . getStacktrace ( ) ;
633
- stacktrace = stacktrace ? stacktrace . join ( '\n' ) . trim ( ) : '' ;
634
- descriptions . push ( {
635
- description : frameOrTask . getDescription ( ) ,
636
- stack : helper . filterStackTrace ( stacktrace )
637
- } ) ;
638
- } else {
639
- for ( var i = 0 ; i < frameOrTask . children_ . length ; ++ i ) {
640
- getDescriptions ( frameOrTask . children_ [ i ] , descriptions ) ;
641
- }
642
- }
643
- } ;
644
- if ( this . history_ . length ) {
645
- getDescriptions ( this . history_ [ this . history_ . length - 1 ] , descriptions ) ;
646
- }
647
- if ( this . activeFrame_ . getPendingTask ( ) ) {
648
- getDescriptions ( this . activeFrame_ . getPendingTask ( ) , descriptions ) ;
649
- }
650
- getDescriptions ( this . activeFrame_ . getRoot ( ) , descriptions ) ;
651
- var asString = '-- WebDriver control flow schedule \n' ;
652
- for ( var i = 0 ; i < descriptions . length ; ++ i ) {
653
- asString += ' |- ' + descriptions [ i ] . description ;
654
- if ( descriptions [ i ] . stack ) {
655
- asString += '\n |---' + descriptions [ i ] . stack . replace ( / \n / g, '\n |---' ) ;
656
- }
657
- if ( i != ( descriptions . length - 1 ) ) {
658
- asString += '\n' ;
659
- }
660
- }
661
- return asString ;
628
+ var controlFlowText = this . getSchedule ( /* opt_includeStackTraces */ true ) ;
629
+ // This filters the entire control flow text, not just the stack trace, so
630
+ // unless we maintain a good (i.e. non-generic) set of keywords in
631
+ // STACK_SUBSTRINGS_TO_FILTER, we run the risk of filtering out non stack
632
+ // trace. The alternative though, which is to reimplement
633
+ // webdriver.promise.ControlFlow.prototype.getSchedule() here is much
634
+ // hackier, and involves messing with the control flow's internals / private
635
+ // variables.
636
+ return helper . filterStackTrace ( controlFlowText ) ;
637
+
662
638
} ;
663
639
664
640
if ( opt_debugPort ) {
0 commit comments