簡體   English   中英

驗證時出現ExpressiveAnnotations錯誤消息

[英]ExpressiveAnnotations error message on validation

將ExpressiveAnnotations(expressive.annotations.validate.js)插入我的應用程序並觸發要驗證的輸入后,瀏覽器會顯示錯誤消息(參見下文)。 我不認為問題來自我的代碼而不是配置問題。

我已經發現這一行(在ExpressiveAnnotations中)會導致問題:

ctxEval: function(exp, ctx) { // evaluates expression in the scope of context object
    return (new Function('expression', 'context', 'with(context){return eval(expression)}'))(exp, ctx); // function constructor used on purpose (a hack), for 'with' statement not to collide with strict mode, which
                                                                                                        // is applied to entire module scope (BTW 'use strict'; pragma intentionally not put to function constructor)
}

顯示的錯誤消息:

[fail](16:14:32):EvalError:拒絕將字符串評估為JavaScript,因為'unsafe-eval'不是以下內容安全策略指令中允許的腳本源:“script-src'self''不安全-排隊'”。

為了解決這個問題,我將CSP設置為以下值:

"content_security_policy": "script-src 'self' 'unsafe-eval';

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM