Skip to content

Commit b68125a

Browse files
author
hoang.tran12
committed
.
1 parent a811ae5 commit b68125a

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

popup/index.js

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -304,14 +304,19 @@ async function runScript(script) {
304304
let tab = await getCurrentTab();
305305
let willRun = checkBlackWhiteList(script, tab.url);
306306
if (willRun) {
307-
recentScriptsSaver.add(script);
308-
if (isFunction(script.onClickExtension)) await script.onClickExtension();
309-
if (isFunction(script.onClick)) await runScriptInCurrentTab(script.onClick);
310-
if (isFunction(script.onClickContentScript))
311-
await sendEventToTab(tab.id, {
312-
type: MsgType.runScript,
313-
scriptId: script.id,
314-
});
307+
try {
308+
recentScriptsSaver.add(script);
309+
if (isFunction(script.onClickExtension)) await script.onClickExtension();
310+
if (isFunction(script.onClick))
311+
await runScriptInCurrentTab(script.onClick);
312+
if (isFunction(script.onClickContentScript))
313+
await sendEventToTab(tab.id, {
314+
type: MsgType.runScript,
315+
scriptId: script.id,
316+
});
317+
} catch (e) {
318+
console.log("ERROR: run script", e);
319+
}
315320
} else {
316321
let w = script?.whiteList?.join(", ");
317322
let b = [...(script?.blackList || []), ...GlobalBlackList]?.join(", ");

0 commit comments

Comments
 (0)