Skip to content

Commit a268e82

Browse files
authored
fix: error from popup (#261)
1 parent d1dfe88 commit a268e82

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

app/scripts/background/main.js

+11-5
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,20 @@
6060
* @param {Object} message
6161
*/
6262
'do-script-injection': function (message) {
63+
const frameId = message.frameId;
6364
chrome.windows.getCurrent().then(w => {
6465
chrome.tabs.query({ active: true, windowId: w.id }).then(tabs => {
66+
const target = {
67+
tabId: tabs[0].id
68+
};
69+
// inject the script only into the frame
70+
// specified in the request from the devTools UI5 panel script;
71+
// If no frameId specified, the script will be injected into the main frame
72+
if (frameId !== undefined) {
73+
target.frameIds = [message.frameId];
74+
}
6575
chrome.scripting.executeScript({
66-
target: {
67-
// inject the script only into the frame
68-
// specified in the request from the devTools UI5 panel script
69-
tabId: tabs[0].id, frameIds: [message.frameId]
70-
},
76+
target,
7177
files: [message.file]
7278
});
7379
});

0 commit comments

Comments
 (0)