mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-17 07:15:46 +00:00
5e77a02657
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
21 lines
767 B
JavaScript
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');
|