mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-11-11 05:39:41 +02:00
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
35 lines
1.3 KiB
JavaScript
35 lines
1.3 KiB
JavaScript
// META: script=/service-workers/service-worker/resources/test-helpers.sub.js
|
|
// META: script=resources/utils.js
|
|
'use strict';
|
|
|
|
// Tests that requests to bad ports are blocked.
|
|
// https://fetch.spec.whatwg.org/#port-blocking
|
|
|
|
// This is not a comprehensive test of blocked ports - it is just intended to
|
|
// check that blocking is enabled.
|
|
|
|
backgroundFetchTest((t, bgFetch) => {
|
|
return bgFetch.fetch(uniqueId(), 'https://example.com');
|
|
}, 'fetch to default https port should register ok');
|
|
|
|
backgroundFetchTest((t, bgFetch) => {
|
|
return bgFetch.fetch(uniqueId(), 'http://127.0.0.1');
|
|
}, 'fetch to default http port should register ok');
|
|
|
|
backgroundFetchTest((t, bgFetch) => {
|
|
return bgFetch.fetch(uniqueId(), 'https://example.com:443');
|
|
}, 'fetch to port 443 should register ok');
|
|
|
|
backgroundFetchTest((t, bgFetch) => {
|
|
return bgFetch.fetch(uniqueId(), 'https://example.com:80');
|
|
}, 'fetch to port 80 should register ok, even over https');
|
|
|
|
backgroundFetchTest((t, bgFetch) => {
|
|
return bgFetch.fetch(uniqueId(), 'https://example.com:8080');
|
|
}, 'fetch to non-default non-bad port (8080) should register ok');
|
|
|
|
backgroundFetchTest((t, bgFetch) => {
|
|
return promise_rejects(
|
|
t, new TypeError(),
|
|
bgFetch.fetch(uniqueId(), 'https://example.com:587'));
|
|
}, 'fetch to bad port (SMTP) should reject');
|