@@ -248,21 +248,6 @@ chrome.runtime.onConnect.addListener((port) => {
248248 return true ;
249249
250250 case 'jumpToSnap' :
251- // chrome.debugger.detach({ tabId: tabId });
252- // console.log('background.js: jumpToSnap:', getAccessibilityTree(tabId));
253- chrome . debugger . attach ( { tabId : tabId } , '1.3' , ( ) => {
254- chrome . debugger . sendCommand ( { tabId : tabId } , 'Accessibility.enable' , ( ) => {
255- chrome . debugger . sendCommand (
256- { tabId : tabId } ,
257- 'Accessibility.getFullAXTree' ,
258- { } ,
259- ( response ) => {
260- console . log ( response ) ;
261- chrome . debugger . detach ( { tabId : tabId } ) ;
262- } ,
263- ) ;
264- } ) ;
265- } ) ;
266251 chrome . tabs . sendMessage ( tabId , msg ) ;
267252 return true ; // attempt to fix message port closing error, consider return Promise
268253
@@ -303,7 +288,8 @@ chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
303288 action === 'jumpToSnap' ||
304289 action === 'injectScript' ||
305290 action === 'devToolsInstalled' ||
306- action === 'aReactApp'
291+ action === 'aReactApp' ||
292+ action === 'recordAXSnap'
307293 ) {
308294 isReactTimeTravel = true ;
309295 } else {
@@ -313,8 +299,22 @@ chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
313299 if ( isReactTimeTravel && ! ( tabId in tabsObj ) ) {
314300 tabsObj [ tabId ] = createTabObj ( tabTitle ) ;
315301 }
316-
317302 switch ( action ) {
303+ case 'recordAXSnap' : {
304+ chrome . debugger . attach ( { tabId : tabId } , '1.3' , ( ) => {
305+ chrome . debugger . sendCommand ( { tabId : tabId } , 'Accessibility.enable' , ( ) => {
306+ chrome . debugger . sendCommand (
307+ { tabId : tabId } ,
308+ 'Accessibility.getFullAXTree' ,
309+ { } ,
310+ ( response ) => {
311+ console . log ( response ) ;
312+ chrome . debugger . detach ( { tabId : tabId } ) ;
313+ } ,
314+ ) ;
315+ } ) ;
316+ } ) ;
317+ }
318318 case 'attemptReconnect' : {
319319 const success = 'portSuccessfullyConnected' ;
320320 sendResponse ( { success } ) ;
0 commit comments