Skip to content

Commit

Permalink
fix: error from popup
Browse files Browse the repository at this point in the history
  • Loading branch information
kineticjs committed Jan 17, 2024
1 parent 44d8e91 commit 1da6466
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions app/scripts/background/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,20 @@
* @param {Object} message
*/
'do-script-injection': function (message) {
const frameId = message.frameId;
chrome.windows.getCurrent(w => {
chrome.tabs.query({ active: true, windowId: w.id }, tabs => {
const target = {
tabId: tabs[0].id
};
// inject the script only into the frame
// specified in the request from the devTools UI5 panel script;
// If no frameId specified, the script will be injected into the main frame
if (frameId !== undefined) {
target.frameIds = [message.frameId];
}
chrome.scripting.executeScript({
target: {
// inject the script only into the frame
// specified in the request from the devTools UI5 panel script
tabId: tabs[0].id, frameIds: [message.frameId]
},
target,
files: [message.file]
});
});
Expand Down

0 comments on commit 1da6466

Please sign in to comment.