Я строю расширение Chrome. Когда я проверяю это локально, я могу предпринять некоторые действия, которые вызывают нарушение CSP:
Refused to run the JavaScript URL because it violates the following Content Security Policy directive: "script-src https://apis.google.com 'self'". Either the 'unsafe-inline' keyword, a hash ('sha256-...'), or a nonce ('nonce-...') is required to enable inline execution.
Тем не менее, мой код не имеет встроенного JavaScript! Консоль ошибок указывает на первую строку моего HTML, а именно <!DOCTYPE html>
, как виновника:
Stack Trace
html/popup.html:1 (anonymous function)
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=600, height=600, initial-scale=1.0">
<link rel="stylesheet" href="../css/bootstrap-3.3.7-dist/css/bootstrap.min.css">
<link rel="stylesheet" href="../css/font-awesome-4.7.0/css/font-awesome.min.css">
<script src="https://apis.google.com/js/api.js"></script>
<script src="../go/go.js"></script>
</head>
<body style="width: 500px; height: 600px">
<div> ...
В документе нет других тегов <script>
. Файл go.js
скомпилирован из golang с использованием gopherjs .
Что происходит? Как мне выяснить, что является причиной нарушения CSP?