@@ -363,6 +363,7 @@ chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
363
363
break ;
364
364
}
365
365
case 'recordSnap' : {
366
+ console . log ( 'recordSnap. current tabsobj' , tabsObj )
366
367
const sourceTab = tabId ;
367
368
tabsObj [ tabId ] . webMetrics = metrics ;
368
369
if ( ! firstSnapshotReceived [ tabId ] ) {
@@ -525,48 +526,50 @@ chrome.contextMenus.onClicked.addListener(({ menuItemId }) => {
525
526
} ;
526
527
if ( menuItemId === 'reactime' ) chrome . windows . create ( options ) ;
527
528
} ) ;
529
+
528
530
//JR 12.20.23
529
531
//JR 1.8.23: this code fixes the no target error (still gets stuck on reactdevtools installed check), but creates an error where the addNewSnapshots reducer has an error.
530
- // chrome.tabs.query({ active: true, currentWindow: true }, (tabs) => {
531
- // console.log('onContext click tab info', tabs, new Date().toLocaleString());
532
- // if (tabs.length) {
533
- // const invokedTab = tabs[0];
534
- // const invokedTabId = invokedTab.id;
535
- // const invokedTabTitle = invokedTab.title;
536
- // tabsObj[invokedTabId] = createTabObj(invokedTabTitle);
537
- // console.log('onContextClick tabsObj created ', tabsObj);
538
- // activeTab = invokedTab;
539
-
540
- // inject backend script
541
- // const injectScript = (file, tab) => {
542
- // const htmlBody = document.getElementsByTagName('body')[0];
543
- // const script = document.createElement('script');
544
- // script.setAttribute('id', 'reactime-backend-script');
545
- // script.setAttribute('type', 'text/javascript');
546
- // script.setAttribute('src', file);
547
- // // eslint-disable-next-line prefer-template
548
- // htmlBody.appendChild(script);
549
- // };
550
-
551
- // console.log('background is injecting the backend script', new Date().toLocaleString());
552
- // chrome.scripting.executeScript({
553
- // target: { tabId: invokedTabId },
554
- // func: injectScript,
555
- // args: [chrome.runtime.getURL('bundles/backend.bundle.js'), invokedTabId],
556
- // });
557
-
558
- // console.log('contextclick invokedTab url, ', invokedTab.url, 'portsArr: ', portsArr);
559
- // if (!invokedTab.url?.match('^chrome-extension')) {
560
- // if (portsArr.length > 0) {
561
- // portsArr.forEach((bg) => {
562
- // console.log('contextClick is sending change Tab message to ', bg);
563
- // bg.postMessage({
564
- // action: 'changeTab',
565
- // payload: { tabId: invokedTabId, title: invokedTabTitle },
566
- // });
567
- // });
568
- // }
569
- // }
570
- // }
571
- // });
532
+ chrome . tabs . query ( { active : true , currentWindow : true } , ( tabs ) => {
533
+ console . log ( 'onContext click tab info' , tabs , new Date ( ) . toLocaleString ( ) ) ;
534
+ if ( tabs . length ) {
535
+ const invokedTab = tabs [ 0 ] ;
536
+ const invokedTabId = invokedTab . id ;
537
+ const invokedTabTitle = invokedTab . title ;
538
+ chrome . tabs . reload ( invokedTabId )
539
+ // tabsObj[invokedTabId] = createTabObj(invokedTabTitle);
540
+ // console.log('onContextClick tabsObj created ', tabsObj);
541
+ // activeTab = invokedTab;
542
+
543
+ // inject backend script
544
+ // const injectScript = (file, tab) => {
545
+ // const htmlBody = document.getElementsByTagName('body')[0];
546
+ // const script = document.createElement('script');
547
+ // script.setAttribute('id', 'reactime-backend-script');
548
+ // script.setAttribute('type', 'text/javascript');
549
+ // script.setAttribute('src', file);
550
+ // // eslint-disable-next-line prefer-template
551
+ // htmlBody.appendChild(script);
552
+ // };
553
+
554
+ // console.log('background is injecting the backend script', new Date().toLocaleString());
555
+ // chrome.scripting.executeScript({
556
+ // target: { tabId: invokedTabId },
557
+ // func: injectScript,
558
+ // args: [chrome.runtime.getURL('bundles/backend.bundle.js'), invokedTabId],
559
+ // });
560
+
561
+ // console.log('contextclick invokedTab url, ', invokedTab.url, 'portsArr: ', portsArr);
562
+ // if (!invokedTab.url?.match('^chrome-extension')) {
563
+ // if (portsArr.length > 0) {
564
+ // portsArr.forEach((bg) => {
565
+ // console.log('contextClick is sending change Tab message to ', bg);
566
+ // bg.postMessage({
567
+ // action: 'changeTab',
568
+ // payload: { tabId: invokedTabId, title: invokedTabTitle },
569
+ // });
570
+ // });
571
+ // }
572
+ // }
573
+ }
574
+ } ) ;
572
575
} ) ;
0 commit comments