@@ -770,7 +770,8 @@ ngApp
770770 maxMessages : 10
771771 } ,
772772 autoResumeInspectBrk : false ,
773- focusOnBreakpoint : false
773+ focusOnBreakpoint : false ,
774+ group : true
774775 } ;
775776 $scope . remoteConnectionSettings = { } ;
776777 $scope . Auth = new Auth ( ) ;
@@ -783,7 +784,7 @@ ngApp
783784 * Todo: write a failsafe to prevent that condition too!
784785 */
785786 { 'id' : '0' , 'name' : 'default' , 'url' : $scope . settings . scheme + 'devtools/bundled/inspector.html' , 'selected' : true } ,
786- { 'id' : '1' , 'name' : 'appspot' , 'url' : 'https://chrome-devtools-frontend.appspot .com/serve_file/@548c459fb7741b83bd517b12882f533b04a5513e /inspector.html' } ,
787+ { 'id' : '1' , 'name' : 'appspot' , 'url' : 'https://chrome-devtools-frontend.brakecode .com/inspector.html' } ,
787788 { 'id' : '2' , 'name' : 'june07' , 'url' : 'https://chrome-devtools-frontend.june07.com/front_end/inspector.html' } ,
788789 { 'id' : '3' , 'name' : 'custom' , 'url' : '' } ,
789790 ] ;
@@ -1640,6 +1641,32 @@ ngApp
16401641 saveSession ( url , infoUrl , websocketId , tab . id , nodeInspectMetadataJSON , dtpSocket ) ;
16411642 resolve ( tab ) ;
16421643 } ) ;
1644+ if ( $scope . settings . group && $scope . devToolsSessions . length > 0 ) {
1645+ let mapped = $scope . devToolsSessions . map ( session => {
1646+ return new Promise ( resolve => {
1647+ chrome . tabs . get ( session . id , tab => resolve ( { tabId : tab . id , groupId : tab . groupId } ) )
1648+ } )
1649+ } )
1650+ Promise . all ( mapped )
1651+ . then ( currentSessions => {
1652+ let ungroupedSessions = currentSessions
1653+ . filter ( session => session . groupId == - 1 )
1654+ . map ( session => session . tabId )
1655+
1656+ currentSessions = currentSessions . filter ( session => session . groupId !== - 1 )
1657+ let firstGroupId = currentSessions . length > 0 ? currentSessions [ 0 ] . groupId : - 1
1658+ if ( currentSessions . length > 0 ) {
1659+ chrome . tabs . group ( { tabIds : tab . id , groupId : firstGroupId } , groupId => {
1660+ console . log ( `Added tab to existing group ${ groupId } ` )
1661+ } )
1662+ } else {
1663+ ungroupedSessions . push ( tab . id )
1664+ chrome . tabs . group ( { tabIds : ungroupedSessions } , groupId => {
1665+ console . log ( `Added tab to new group ${ groupId } ` )
1666+ } )
1667+ }
1668+ } )
1669+ }
16431670 } ) ;
16441671 }
16451672 } ) ;
@@ -2086,15 +2113,16 @@ ngApp
20862113 } ) ;
20872114 chrome . tabs . onRemoved . addListener ( function chromeTabsRemovedEvent ( tabId ) {
20882115 $window . _gaq . push ( [ '_trackEvent' , 'Program Event' , 'onRemoved' , undefined , undefined , true ] ) ;
2089- // Why am I not calling deleteSession() here?
2090- $scope . devToolsSessions . splice ( $scope . devToolsSessions . findIndex ( function ( devToolsSession ) {
2116+ let index = $scope . devToolsSessions . findIndex ( function ( devToolsSession ) {
20912117 if ( devToolsSession . id === tabId ) {
20922118 // Tab removal doesn't mean that the debugging session is dead. So the socket should not be closed.
20932119 //$scope.devToolsProtocolClient.closeSocket(devToolsSession.dtpSocket);
20942120 unlock ( hostPortHashmap ( tabId ) ) ;
20952121 return true ;
20962122 }
2097- } ) , 1 ) ;
2123+ } )
2124+ // Why am I not calling deleteSession() here?
2125+ if ( index >= 0 ) $scope . devToolsSessions . splice ( index , 1 ) ;
20982126 } ) ;
20992127 chrome . tabs . onActivated . addListener ( function chromeTabsActivatedEvent ( tabId ) {
21002128 resolveTabPromise ( tabId ) ;
0 commit comments