@@ -12,6 +12,7 @@ import '../../entrypoints/main/main-meta.js';
1212import * as Common from '../../core/common/common.js' ;
1313import * as Host from '../../core/host/host.js' ;
1414import * as i18n from '../../core/i18n/i18n.js' ;
15+ import type * as Platform from '../../core/platform/platform.js' ;
1516import type * as ExperimentNames from '../../core/root/ExperimentNames.js' ;
1617import * as Root from '../../core/root/root.js' ;
1718import * as SDK from '../../core/sdk/sdk.js' ;
@@ -81,8 +82,8 @@ class GreenDevFloaty {
8182 if ( this . #node && this . #backendNodeId) {
8283 const msg = JSON . stringify ( {
8384 id : 9999 ,
84- method : 'Overlay.setShowGreenDevFloatyAnchor ' ,
85- params : { greenDevFloatyHighlightConfig : { backendNodeId : this . #backendNodeId} }
85+ method : 'Overlay.setShowInspectedElementAnchor ' ,
86+ params : { inspectedElementAnchorConfig : { backendNodeId : this . #backendNodeId} }
8687 } ) ;
8788 Host . InspectorFrontendHost . InspectorFrontendHostInstance . sendMessageToBackend ( msg ) ;
8889 }
@@ -147,15 +148,8 @@ class GreenDevFloaty {
147148 handlePanelRequest = ( event : Common . EventTarget . EventTargetEvent < number > ) : void => {
148149 pendingActivationSessionId = event . data ;
149150 this . #sendActivatePanelMessage( pendingActivationSessionId , 0 ) ;
150-
151- // eslint-disable-next-line @typescript-eslint/no-explicit-any
152- if ( ( window as any ) . DevToolsAPI ?. sendMessageToEmbedder ) {
153- // eslint-disable-next-line @typescript-eslint/no-explicit-any
154- ( window as any ) . DevToolsAPI . sendMessageToEmbedder ( 'openDevTools' , [ ] , ( ) => { } ) ;
155- } else {
156- // eslint-disable-next-line @typescript-eslint/no-explicit-any
157- ( Host . InspectorFrontendHost . InspectorFrontendHostInstance as any ) . sendMessageToEmbedder ( 'openDevTools' , [ ] ) ;
158- }
151+ Host . InspectorFrontendHost . InspectorFrontendHostInstance . openInNewTab (
152+ 'magic:open-devtools' as Platform . DevToolsPath . UrlString ) ;
159153 } ;
160154
161155 readonly #maxActivationRetries = 10 ;
@@ -183,13 +177,16 @@ class GreenDevFloaty {
183177 }
184178
185179 handleRestoreEvent ( event : Common . EventTarget . EventTargetEvent < number > ) : void {
180+ const sessionId = event . data ;
186181 // Only the main DevTools window (which is NOT a floaty window) should broadcast the restore request.
187182 if ( ! this . #isFloatyWindow) {
188- const sessionId = event . data ;
189183 this . #syncChannel. postMessage ( { type : 'restore-floaty' , sessionId} ) ;
184+ } else if ( this . #backendNodeId === sessionId ) {
185+ // If a floaty window receives a restore request for its own session,
186+ // it should bring itself to the front.
187+ console . error ( '[GreenDev] Calling bringToFront for session ' + sessionId ) ;
188+ Host . InspectorFrontendHost . InspectorFrontendHostInstance . bringToFront ( ) ;
190189 }
191- // If a floaty window receives a restore request for its own session,
192- // it should bring itself to the front. This is handled in #onSyncMessage.
193190 }
194191
195192 setNode ( node : SDK . DOMModel . DOMNode ) : void {
@@ -228,8 +225,8 @@ class GreenDevFloaty {
228225 if ( this . #backendNodeId) {
229226 const msg = JSON . stringify ( {
230227 id : 9999 ,
231- method : 'Overlay.setShowGreenDevFloatyAnchor ' ,
232- params : { greenDevFloatyHighlightConfig : { backendNodeId : this . #backendNodeId} }
228+ method : 'Overlay.setShowInspectedElementAnchor ' ,
229+ params : { inspectedElementAnchorConfig : { backendNodeId : this . #backendNodeId} }
233230 } ) ;
234231 Host . InspectorFrontendHost . InspectorFrontendHostInstance . sendMessageToBackend ( msg ) ;
235232 }
0 commit comments