Fix: catch csp error

This commit is contained in:
eight 2018-10-12 15:21:36 +08:00
parent e0b064115d
commit fa080d1913

View File

@ -110,8 +110,12 @@ const APPLY = (() => {
} }
}; };
window.addEventListener(EVENT_NAME, check, true); window.addEventListener(EVENT_NAME, check, true);
try {
// eslint-disable-next-line no-eval // eslint-disable-next-line no-eval
window.eval(`(${scriptContent})(${JSON.stringify(EVENT_NAME)})`); window.eval(`(${scriptContent})(${JSON.stringify(EVENT_NAME)})`);
} catch (err) {
// csp error
}
window.removeEventListener(EVENT_NAME, check, true); window.removeEventListener(EVENT_NAME, check, true);
return ok; return ok;
} }