| 78 | |
| 79 | /**@param {(...args: any[]) => any} func*/ |
| 80 | export async function injectFuncScript(func, ...args) { |
| 81 | const [tab] = await chrome.tabs.query({ active: true, currentWindow: true }); |
| 82 | try { |
| 83 | const results = await chrome.scripting.executeScript({ |
| 84 | target: { tabId: tab.id }, |
| 85 | func: func, |
| 86 | args: args, |
| 87 | }); |
| 88 | return results[0].result; |
| 89 | } catch (error) { |
| 90 | console.error(error); |
| 91 | } |
| 92 | } |
| 93 | |
| 94 | export async function reportBug(error) { |
| 95 | const [tab] = await chrome.tabs.query({ active: true, currentWindow: true }); |