@@ -660,9 +660,11 @@ ngApp
660660 responseType : "json"
661661 } )
662662 . then ( function openDevToolsFrontend ( json ) {
663- if ( ! json . data [ 0 ] . devtoolsFrontendUrl ) return callback ( chrome . i18n . getMessage ( "errMsg7" , [ host , port ] ) ) ;
664- setDevToolsURL ( json . data [ 0 ] ) ;
665- var url = json . data [ 0 ] . devtoolsFrontendUrl . replace ( / w s = l o c a l h o s t / , 'ws=127.0.0.1' ) ;
663+ let jsonPayload = browserAgnosticFix ( json . data [ 0 ] ) ;
664+ if ( ! jsonPayload . devtoolsFrontendUrl ) return callback ( chrome . i18n . getMessage ( "errMsg7" , [ host , port ] ) ) ;
665+
666+ setDevToolsURL ( jsonPayload ) ;
667+ var url = jsonPayload . devtoolsFrontendUrl . replace ( / w s = l o c a l h o s t / , 'ws=127.0.0.1' ) ;
666668 var inspectIP = url . match ( SOCKET_PATTERN ) [ 1 ] ;
667669 var inspectPORT = url . match ( SOCKET_PATTERN ) [ 5 ] ;
668670 url = url
@@ -674,19 +676,19 @@ ngApp
674676 }
675677 if ( $scope . settings . bugfix )
676678 url = url . replace ( '' , '' ) ;
677- var websocketId = json . data [ 0 ] . id ;
679+ var websocketId = jsonPayload . id ;
678680 /** May be a good idea to put this somewhere further along the chain in case tab/window creation fails,
679681 in which case this entry will need to be removed from the array */
680682 // The following analytics setting is TOO verbose.
681683 //$window._gaq.push(['_trackEvent', 'Program Event', 'openTab', 'Non-existing tab.', undefined, true]);
682684 if ( tab . length === 0 ) {
683- createTabOrWindow ( infoUrl , url , websocketId , json . data [ 0 ] )
685+ createTabOrWindow ( infoUrl , url , websocketId , jsonPayload )
684686 . then ( function ( tab ) {
685687 var tabToUpdate = tab ;
686688 chrome . tabs . onUpdated . addListener ( function ( tabId , changeInfo ) {
687689 if ( triggerTabUpdate && tabId === tabToUpdate . id && changeInfo . status === 'complete' ) {
688690 triggerTabUpdate = false ;
689- saveSession ( url , infoUrl , websocketId , tabToUpdate . id , json . data [ 0 ] ) ;
691+ saveSession ( url , infoUrl , websocketId , tabToUpdate . id , jsonPayload ) ;
690692 callback ( tabToUpdate . url ) ;
691693 } else if ( ! triggerTabUpdate && tabId === tabToUpdate . id ) {
692694 if ( $scope . settings . debugVerbosity >= 6 ) console . log ( 'Loading updated tab [' + tabId + ']...' ) ;
@@ -983,7 +985,7 @@ ngApp
983985 responseType : "json"
984986 } )
985987 . then ( function openDevToolsFrontend ( json ) {
986- return json . data [ 0 ] . id ;
988+ return browserAgnosticFix ( json . data [ 0 ] ) . id ;
987989 } )
988990 . catch ( function ( error ) {
989991 return error ;
@@ -1560,6 +1562,11 @@ ngApp
15601562 if ( $scope . settings . debugVerbosity >= 4 ) console . log ( notificationId ) ;
15611563 } ) ;
15621564 }
1565+ function browserAgnosticFix ( jsonPayload ) {
1566+ if ( jsonPayload && jsonPayload . devtoolsFrontendUrlCompat ) jsonPayload . devtoolsFrontendUrl = jsonPayload . devtoolsFrontendUrl . replace ( / c h r o m e - d e v t o o l s : \/ \/ / , 'devtools://' ) ;
1567+ if ( jsonPayload && jsonPayload . devtoolsFrontendUrlCompat ) jsonPayload . devtoolsFrontendUrlCompat = jsonPayload . devtoolsFrontendUrlCompat . replace ( / c h r o m e - d e v t o o l s : \/ \/ / , 'devtools://' ) ;
1568+ return jsonPayload ;
1569+ }
15631570 chrome . notifications . onClicked . addListener ( function onClickedHandler ( notificationId ) {
15641571 let notification = $scope . notificationService . getNotification ( notificationId ) ;
15651572 switch ( notification . type ) {
0 commit comments