处理js在chrome扩展中不起作用

时间:2015-03-20 16:00:18

标签: javascript google-chrome-extension processing

我在Google Chrome扩展程序中使用Processing JS。常规网页有效,但当我尝试扩展时,会显示以下内容:

window.localStorage is not available in packaged apps. Use chrome.storage.local instead. extensions::platformApp:17

processing.js:718 Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "default-src 'self' chrome-extension-resource:". Note that 'script-src' was not explicitly set, so 'default-src' is used as a fallback.
processing.js:798 Processing.js: Unable to execute pjs sketch.
processing.js:799 Uncaught EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "default-src 'self' chrome-extension-resource:".

有什么方法吗?

1 个答案:

答案 0 :(得分:1)

没有

您无法放宽default CSP of Chrome Apps以允许eval,并且无法让localStorage工作,disabledchrome.storage是异步的,因此你不能制作填充物。

除非Processing制作的版本与Chrome Apps平台兼容,或者您​​对其进行了大量修改,否则无法解决此问题。