@@ -89,7 +89,7 @@ function changeCurrLocation(tabObj, rootNode, index, name) {
8989 return ;
9090 // if not, recurse on each one of the children
9191 }
92-
92+
9393 if ( rootNode . children ) { // Carlos: remove if, redundant
9494 rootNode . children . forEach ( child => {
9595 changeCurrLocation ( tabObj , child , index , name ) ;
@@ -244,7 +244,7 @@ chrome.runtime.onMessage.addListener((request, sender) => {
244244 tabsObj [ tabId ] . snapshots . splice ( 1 ) ;
245245 // gabi :: reset hierarchy to page initial state
246246 if ( tabsObj [ tabId ] . hierarchy ) {
247- //test
247+ // test
248248 tabsObj [ tabId ] . hierarchy . children = [ ] ;
249249 // gabi :: reset currParent plus current state
250250 tabsObj [ tabId ] . currParent = 1 ;
@@ -343,13 +343,11 @@ chrome.tabs.onRemoved.addListener(tabId => {
343343 delete firstSnapshotReceived [ tabId ] ;
344344} ) ;
345345
346- // when a new url is loaded on the same tab, this remove the tabid from the tabsObj, recreate the tab and inject the script
346+ // when a new url is loaded on the same tab, this remove the tabid from the tabsObj, recreate the tab and inject the script
347347chrome . tabs . onUpdated . addListener ( ( tabId , changeInfo ) => {
348-
349348 // check if the tab title changed to see if tab need to restart
350- if ( changeInfo && tabsObj [ tabId ] ) {
351- if ( changeInfo . title && changeInfo . title !== tabsObj [ tabId ] . title ) {
352-
349+ if ( changeInfo && tabsObj [ tabId ] ) {
350+ if ( changeInfo . title && changeInfo . title !== tabsObj [ tabId ] . title ) {
353351 // tell devtools which tab to delete
354352 if ( portsArr . length > 0 ) {
355353 portsArr . forEach ( bg =>
@@ -367,21 +365,6 @@ chrome.tabs.onUpdated.addListener((tabId, changeInfo) => {
367365
368366 // recreate the tab on the tabsObj
369367 tabsObj [ tabId ] = createTabObj ( changeInfo . title ) ;
370-
371- // reinject the script to the tab
372- chrome . tabs . executeScript ( tabId , {
373- code : `
374- // Function will attach script to the dom
375- const injectScript = (file, tag) => {
376- const htmlBody = document.getElementsByTagName(tag)[0];
377- const script = document.createElement('script');
378- script.setAttribute('type', 'text/javascript');
379- script.setAttribute('src', file);
380- htmlBody.appendChild(script);
381- };
382- injectScript(chrome.runtime.getURL('bundles/backend.bundle.js'), 'body');
383- ` ,
384- } ) ;
385368 }
386369 }
387370} ) ;
0 commit comments