gecko-dev/testing/web-platform/tests/background-fetch/content-security-policy.https.window.js
Peter Beverloo 5e77a02657 Bug 1476414 [wpt PR 12033] - [Background Fetch] Rename "tag" to "id", and add some documentation, a=testonly
Automatic update from web-platform-tests[Background Fetch] Rename "tag" to "id", and add some documentation

Change-Id: I9271490f9a5b68129797ba6b9062247d1b1b2c2a
Reviewed-on: https://chromium-review.googlesource.com/1135324
Reviewed-by: Alexander Timin <altimin@chromium.org>
Commit-Queue: Peter Beverloo <peter@chromium.org>
Cr-Commit-Position: refs/heads/master@{#575726}

--

wpt-commits: 2f5eda4e66c9cfb8fc8f86f11de6bee8cde31750
wpt-pr: 12033
2018-07-29 18:49:59 +01:00

21 lines
767 B
JavaScript

// META: script=/service-workers/service-worker/resources/test-helpers.sub.js
// META: script=resources/utils.js
'use strict';
// Tests that requests blocked by Content Security Policy are rejected.
// https://w3c.github.io/webappsec-csp/#should-block-request
// This is not a comprehensive test of Content Security Policy - it is just
// intended to check that CSP checks are enabled.
var meta = document.createElement('meta');
meta.setAttribute('http-equiv', 'Content-Security-Policy');
meta.setAttribute('content', "connect-src 'none'");
document.head.appendChild(meta);
backgroundFetchTest((t, bgFetch) => {
return promise_rejects(
t, new TypeError(),
bgFetch.fetch(uniqueId(), 'https://example.com'));
}, 'fetch blocked by CSP should reject');