How to allow this code within a Chrome Packaged App without violating CSP? -
the first in console marked 'unsafe-eval'. how alter can evaluated?
index.js:
function testforfunction(str) { homecoming function () { result(typeof eval(str) == "function"); }
the error in instead not specified in console.. console says violates content security policy.
index.js:
function loadtestframe(cb, src) { if (!testframe) { testframe = createtestframe(); } frameloadcallback = cb; src = src || 4; if (typeof src == "number") { var pgs = []; (var = 1, ii = src; <= ii; ++i) { pgs.push("<div>page "+i+"</div>"); } var divstyle = [ "display:inline-block", "line-height:"+testframesize+"px", "width:"+testframesize+"px" ].join(";"); src = "javascript:'<!doctype html><html>"+ '<head><meta name="time" content="'+(new date()).gettime()+'" />'+ '<style>div{'+divstyle+'}</style></head>'+ '<body>'+pgs.join("")+'</body>'+ "</html>'"; } testframe.src = src; }
i know there ways relax default policy, if possible prefer don't utilize them..
if need different csp, need utilize sandboxed page (https://developer.chrome.com/apps/manifest/sandbox).
google-chrome google-chrome-app content-security-policy
No comments:
Post a Comment