From fa080d191311a02f8b080e4e7cf28e2305c4c540 Mon Sep 17 00:00:00 2001 From: eight Date: Fri, 12 Oct 2018 15:21:36 +0800 Subject: [PATCH] Fix: catch csp error --- content/apply.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/content/apply.js b/content/apply.js index 98339e42..51df8ab7 100644 --- a/content/apply.js +++ b/content/apply.js @@ -110,8 +110,12 @@ const APPLY = (() => { } }; window.addEventListener(EVENT_NAME, check, true); - // eslint-disable-next-line no-eval - window.eval(`(${scriptContent})(${JSON.stringify(EVENT_NAME)})`); + try { + // eslint-disable-next-line no-eval + window.eval(`(${scriptContent})(${JSON.stringify(EVENT_NAME)})`); + } catch (err) { + // csp error + } window.removeEventListener(EVENT_NAME, check, true); return ok; }