Skip to content

Commit 7dc7895

Browse files
committed
Committing experimental changes.
1 parent 2564ef4 commit 7dc7895

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/extension/background.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// Import snapshots from "../app/components/snapshots".
22
import 'core-js';
3+
4+
console.log('Hello from line 4');
35
// Store ports in an array.
46
const portsArr = [];
57
const reloaded = {};
@@ -123,6 +125,7 @@ function changeCurrLocation(tabObj, rootNode, index, name) {
123125

124126
// Establishing incoming connection with devtools.
125127
chrome.runtime.onConnect.addListener(port => {
128+
console.log('Hello from line 126');
126129
// port is one end of the connection - an object
127130
// push every port connected to the ports array
128131
portsArr.push(port);
@@ -199,6 +202,7 @@ chrome.runtime.onConnect.addListener(port => {
199202
return true;
200203
case 'launchContentScript':
201204
// !!! in Manifest Version 3 this will need to be changed to the commented out code below !!!
205+
console.log('Youre here');
202206
chrome.scripting.executeScript({
203207
target: { tabId },
204208
files: ['bundles/content.bundle.js'],
@@ -220,6 +224,7 @@ chrome.runtime.onConnect.addListener(port => {
220224

221225
// background.js listening for a message from contentScript.js
222226
chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
227+
console.log('Hello from line 224');
223228
// AUTOMATIC MESSAGE SENT BY CHROME WHEN CONTENT SCRIPT IS FIRST LOADED: set Content
224229
if (request.type === 'SIGN_CONNECT') {
225230
return true;
@@ -282,19 +287,21 @@ chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
282287
// This injects a script into the app that you're testing Reactime on,
283288
// so that Reactime's backend files can communicate with the app's DOM.
284289
case 'injectScript': {
290+
console.log('Hello from line 287');
285291
chrome.scripting.executeScript({
286292
target: { tabId },
287-
func: () => {
293+
func: tab => {
288294
const injectScript = (file, tag) => {
289295
const htmlBody = document.getElementsByTagName(tag)[0];
290296
const script = document.createElement('script');
291297
script.setAttribute('type', 'text/javascript');
292298
script.setAttribute('src', file);
293-
document.title = tabId + '-' + document.title;
299+
document.title = tab + '-' + document.title;
294300
htmlBody.appendChild(script);
295301
};
296302
injectScript(chrome.runtime.getURL('bundles/backend.bundle.js'), 'body');
297303
},
304+
args: [tabId],
298305
});
299306
// chrome.tabs.executeScript(tabId, {
300307
// code: `

src/extension/contentScript.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ let firstMessage = true;
1313
let isRecording = true;
1414

1515
window.addEventListener('message', msg => {
16+
console.log('Hello from line 16');
17+
console.log('msg is', msg.data);
1618
// Event listener runs constantly based on actions
1719
// recorded on the test application from backend files (linkFiber.ts).
1820
// Background.js has a listener that includes switch cases, depending on
@@ -82,4 +84,5 @@ getCLS(gatherMetrics);
8284

8385
// Send message to background.js for injecting the initial script
8486
// into the app's DOM.
87+
console.log('Hello from line 86');
8588
chrome.runtime.sendMessage({ action: 'injectScript' });

0 commit comments

Comments
 (0)