@@ -94,7 +94,6 @@ function createTabObj(title) {
9494// 2. param tabObj: arg tabsObj[tabId], which is an object that holds info about a specific tab. Should change the name of tabObj to tabCollection or something
9595class HistoryNode {
9696 constructor ( obj , tabObj , axSnap ) {
97- console . log ( 'background.js: HistoryNode constructor: obj:\n' , obj , '\n' , 'tabObj:' , tabObj ) ;
9897 // continues the order of number of total state changes
9998 this . index = tabObj . index ;
10099 tabObj . index += 1 ;
@@ -104,8 +103,7 @@ class HistoryNode {
104103 // marks from what branch this node is originated
105104 this . branch = tabObj . currBranch ;
106105 this . stateSnapshot = obj ;
107- this . axSnapshot = axSnap ;
108- console . log ( 'this.axSnapshot:' , this . axSnapshot ) ;
106+ this . axSnapshot = tabObj . axSnapshots [ tabObj . axSnapshots . length - 1 ] ;
109107 this . children = [ ] ;
110108 }
111109}
@@ -288,9 +286,7 @@ chrome.runtime.onConnect.addListener((port) => {
288286 return true ;
289287
290288 case 'jumpToSnap' :
291- // console.log('background.js: tabsObj before jump:', tabsObj);
292289 chrome . tabs . sendMessage ( tabId , msg ) ;
293- // console.log('background.js: tabsObj after jump:', tabsObj);
294290 return true ; // attempt to fix message port closing error, consider return Promise
295291
296292 case 'toggleRecord' :
@@ -402,11 +398,10 @@ chrome.runtime.onMessage.addListener(async (request, sender, sendResponse) => {
402398 break ;
403399 }
404400 case 'recordSnap' : {
401+ console . log ( 'background.js: recordSnap: tabsObj[tabId]:' , tabsObj [ tabId ] ) ;
405402 function addAxSnap ( snap ) {
406403 const pruned = pruneAxTree ( snap ) ;
407404 tabsObj [ tabId ] . axSnapshots . push ( pruned ) ;
408- console . log ( 'addAxSnap axSnapshot:' , pruned ) ;
409- // return new HistoryNode();
410405 }
411406
412407 function attachDebugger ( tabId , version ) {
@@ -459,36 +454,13 @@ chrome.runtime.onMessage.addListener(async (request, sender, sendResponse) => {
459454 const sourceTab = tabId ;
460455 tabsObj [ tabId ] . webMetrics = metrics ;
461456
462- // console.log('after chrome.debugger axSnap:', axSnap);
463457 if ( ! firstSnapshotReceived [ tabId ] ) {
464- console . log ( '!firstSnapshotReceived[tabId]:' , true ) ;
465- // chrome.debugger.attach({ tabId: tabId }, '1.3', () => {
466- // chrome.debugger.sendCommand({ tabId: tabId }, 'Accessibility.enable', () => {
467- // chrome.debugger.sendCommand(
468- // { tabId: tabId },
469- // 'Accessibility.getFullAXTree',
470- // {},
471- // (response) => {
472- // addAxSnap(response.nodes);
473- // chrome.debugger.detach({ tabId: tabId });
474- // },
475- // );
476- // });
477- // });
478458 await axRecord ( tabId ) ;
479459 firstSnapshotReceived [ tabId ] = true ;
480460 reloaded [ tabId ] = false ;
481461 tabsObj [ tabId ] . webMetrics = metrics ;
482462 tabsObj [ tabId ] . snapshots . push ( request . payload ) ;
483- sendToHierarchy (
484- tabsObj [ tabId ] ,
485- new HistoryNode (
486- request . payload ,
487- tabsObj [ tabId ] ,
488- tabsObj [ tabId ] . axSnapshots [ tabsObj [ tabId ] . axSnapshots . length - 1 ] ,
489- ) ,
490- ) ;
491- console . log ( 'first snap tabsObj[tabId].axSnapshots' , tabsObj [ tabId ] . axSnapshots ) ;
463+ sendToHierarchy ( tabsObj [ tabId ] , new HistoryNode ( request . payload , tabsObj [ tabId ] ) ) ;
492464 if ( portsArr . length > 0 ) {
493465 portsArr . forEach ( ( bg ) =>
494466 bg . postMessage ( {
@@ -515,49 +487,13 @@ chrome.runtime.onMessage.addListener(async (request, sender, sendResponse) => {
515487 reloaded [ tabId ] = false ;
516488 } else {
517489 tabsObj [ tabId ] . snapshots . push ( request . payload ) ;
518- // console.log('push subsequent axSnap:', axSnap);
519490 // INVOKING buildHierarchy FIGURE OUT WHAT TO PASS IN
520491 if ( ! tabsObj [ tabId ] [ index ] ) {
521- console . log ( '!tabsObj[tabId][index]:' , true ) ;
522- // chrome.debugger.attach({ tabId: tabId }, '1.3', () => {
523- // chrome.debugger.sendCommand({ tabId: tabId }, 'Accessibility.enable', () => {
524- // chrome.debugger.sendCommand(
525- // { tabId: tabId },
526- // 'Accessibility.getFullAXTree',
527- // {},
528- // (response) => {
529- // addAxSnap(response.nodes);
530- // chrome.debugger.detach({ tabId: tabId });
531- // },
532- // );
533- // });
534- // });
535492 await axRecord ( tabId ) ;
536- sendToHierarchy (
537- tabsObj [ tabId ] ,
538- new HistoryNode (
539- request . payload ,
540- tabsObj [ tabId ] ,
541- tabsObj [ tabId ] . axSnapshots [ tabsObj [ tabId ] . axSnapshots . length - 1 ] ,
542- ) ,
543- ) ;
493+ sendToHierarchy ( tabsObj [ tabId ] , new HistoryNode ( request . payload , tabsObj [ tabId ] ) ) ;
544494 }
545495 }
546496
547- // chrome.debugger.attach({ tabId: tabId }, '1.3', () => {
548- // chrome.debugger.sendCommand({ tabId: tabId }, 'Accessibility.enable', () => {
549- // chrome.debugger.sendCommand(
550- // { tabId: tabId },
551- // 'Accessibility.getFullAXTree',
552- // {},
553- // (response) => {
554- // console.log(response);
555- // chrome.debugger.detach({ tabId: tabId });
556- // },
557- // );
558- // });
559- // });
560-
561497 // sends new tabs obj to devtools
562498 if ( portsArr . length > 0 ) {
563499 portsArr . forEach ( ( bg ) =>
0 commit comments