dart-gde / chrome.dart

Provide Dart interop with chrome.* APIs for Chrome Packaged Apps
Other
125 stars 48 forks source link

dart:html gives: Uncaught EvalError #264

Closed jimmyff closed 6 years ago

jimmyff commented 6 years ago

When I try to use dart:html I get the following error:

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: "script-src 'self' blob: filesystem: chrome-extension-resource:".
jimmyff commented 6 years ago

I also get this when trying the demo application code

adambender commented 6 years ago

Hey jimmyff, that error usually appears if you haven't set the CSP flag to true in your pubspec.yaml. Are you using your own pubspec.yaml or the one from the demo?

tonyclickspace commented 6 years ago

Here's a sample pubspec.yaml file that enables the CSP flag, should clear up your issue:

name: YourApp
description: Your Description
dependencies:
  chrome: any
transformers:
- chrome
- $dart2js:
    csp: true
jimmyff commented 6 years ago

Thanks guys, wIll have a go with your suggestion. Thanks