Update web-platform-tests to revision 60220357131c65146444da1f54624d5b54d0975d

This commit is contained in:
WPT Sync Bot 2018-07-18 15:43:58 +00:00 committed by Tom Servo
parent c45192614c
commit 775b784f79
2144 changed files with 58115 additions and 29658 deletions

View file

@ -1,3 +1,4 @@
spec: https://html.spec.whatwg.org/multipage/canvas.html#2dcontext
suggested_reviewers:
- AmeliaBR
- annevk

View file

@ -0,0 +1,44 @@
<!DOCTYPE html>
<html>
<title>createImageBitmap: clipping to the bitmap</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/canvas-tests.js"></script>
<script>
promise_test(function(t) {
return new Promise(function(resolve, reject) {
const image = new Image();
image.onload = function() { resolve(image); };
image.onerror = function() { reject(); };
image.src = "/images/green-16x16.png";
}).then(function(image) {
return createImageBitmap(image, 8, 8, 16, 16);
}).then(function(imageBitmap) {
const color = 204;
const canvas = document.createElement("canvas");
canvas.width = 16;
canvas.height = 16;
// debug
document.body.appendChild(canvas);
canvas.setAttribute("style", "width: 100px; height: 100px;");
const ctx = canvas.getContext("2d");
ctx.fillStyle = `rgb(${color}, ${color}, ${color})`;
ctx.fillRect(0, 0, 20, 20);
ctx.drawImage(imageBitmap, 0, 0);
const expected = [
[ 4, 4, 0,255,0,255],
[12, 4, color,color,color,255],
[ 4, 12, color,color,color,255],
[12, 12, color,color,color,255],
];
for (let [x, y, r, g, b, a] of expected) {
_assertPixel(canvas, x,y, r,g,b,a, `${x},${y}`, `${r},${g},${b},${a}`);
}
});
});
</script>

View file

@ -1,2 +1,3 @@
spec: https://wicg.github.io/BackgroundSync/spec/
suggested_reviewers:
- beverloo

View file

@ -6,10 +6,14 @@
// https://wicg.github.io/BackgroundSync/spec/
promise_test(async () => {
const idl = await fetch('/interfaces/BackgroundSync.idl').then(r => r.text());
const sw = await fetch('/interfaces/ServiceWorker.idl').then(r => r.text());
const html = await fetch('/interfaces/html.idl').then(r => r.text());
const dom = await fetch('/interfaces/dom.idl').then(r => r.text());
const srcs = [
'BackgroundSync',
'service-workers',
'html',
'dom'
];
const [idl, sw, html, dom] = await Promise.all(
srcs.map(i => fetch(`/interfaces/${i}.idl`).then(r => r.text())));
const idlArray = new IdlArray();
idlArray.add_idls(idl);

View file

@ -1,3 +1,4 @@
spec: https://w3c.github.io/FileAPI/
suggested_reviewers:
- inexorabletash
- zqzhang

View file

@ -22,28 +22,22 @@
<script>
'use strict';
promise_test(async () => {
const idl = await fetch('/interfaces/FileAPI.idl').then(r => r.text());
const dom = await fetch('/interfaces/dom.idl').then(r => r.text());
const html = await fetch('/interfaces/html.idl').then(r => r.text());
const url = await fetch('/interfaces/url.idl').then(r => r.text());
const idl_array = new IdlArray();
idl_array.add_idls(idl);
idl_array.add_dependency_idls(url);
idl_array.add_dependency_idls(html);
idl_array.add_dependency_idls(dom);
idl_array.add_untested_idls("[Exposed=(Window,Worker)] interface ArrayBuffer {};");
idl_array.add_objects({
Blob: ['new Blob(["TEST"])'],
File: ['new File(["myFileBits"], "myFileName")'],
FileList: ['document.querySelector("#fileChooser").files'],
FileReader: ['new FileReader()']
});
idl_array.test();
}, 'Test FileAPI IDL implementation');
idl_test(
['FileAPI'],
['dom', 'html', 'url'],
idl_array => {
idl_array.add_untested_idls(
"[Exposed=(Window,Worker)] interface ArrayBuffer {};"
);
idl_array.add_objects({
Blob: ['new Blob(["TEST"])'],
File: ['new File(["myFileBits"], "myFileName")'],
FileList: ['document.querySelector("#fileChooser").files'],
FileReader: ['new FileReader()']
});
},
'Test FileAPI IDL implementation'
);
</script>
</body>

View file

@ -1,25 +1,22 @@
importScripts("/resources/testharness.js");
importScripts("/resources/WebIDLParser.js", "/resources/idlharness.js");
promise_test(async () => {
const idl = await fetch('/interfaces/FileAPI.idl').then(r => r.text());
const dom = await fetch('/interfaces/dom.idl').then(r => r.text());
const html = await fetch('/interfaces/html.idl').then(r => r.text());
const url = await fetch('/interfaces/url.idl').then(r => r.text());
'use strict';
const idl_array = new IdlArray();
idl_array.add_idls(idl);
idl_array.add_dependency_idls(dom);
idl_array.add_dependency_idls(html);
idl_array.add_dependency_idls(url);
idl_array.add_untested_idls("[Exposed=(Window,Worker)] interface ArrayBuffer {};");
idl_array.add_objects({
Blob: ['new Blob(["TEST"])'],
File: ['new File(["myFileBits"], "myFileName")'],
FileReader: ['new FileReader()'],
FileReaderSync: ['new FileReaderSync()']
});
// https://w3c.github.io/FileAPI/
idl_array.test();
}, 'Test FileAPI IDL implementation');
idl_test(
['FileAPI'],
['dom', 'html', 'url'],
idl_array => {
idl_array.add_untested_idls("[Exposed=(Window,Worker)] interface ArrayBuffer {};");
idl_array.add_objects({
Blob: ['new Blob(["TEST"])'],
File: ['new File(["myFileBits"], "myFileName")'],
FileReader: ['new FileReader()'],
FileReaderSync: ['new FileReaderSync()']
});
},
'Test FileAPI IDL implementation'
);
done();

View file

@ -1,8 +1,5 @@
spec: https://w3c.github.io/IndexedDB/
suggested_reviewers:
- odinho
- inexorabletash
- chunywang
- dumbmatter
- zqzhang
- yunxiaoxie
- zhaozihao

View file

@ -0,0 +1,25 @@
// META: global=window,worker
// META: script=/resources/WebIDLParser.js
// META: script=/resources/idlharness.js
idl_test(
['IndexedDB'],
['html', 'dom'],
idl_array => {
idl_array.add_objects({
IDBCursor: [],
IDBCursorWithValue: [],
IDBDatabase: [],
IDBFactory: [self.indexedDB],
IDBIndex: [],
IDBKeyRange: [IDBKeyRange.only(0)],
IDBObjectStore: [],
IDBOpenDBRequest: [],
IDBRequest: [],
IDBTransaction: [],
IDBVersionChangeEvent: ['new IDBVersionChangeEvent("type")'],
DOMStringList: [],
});
},
'IndexedDB interfaces'
);

View file

@ -1,31 +0,0 @@
// META: script=/resources/WebIDLParser.js
// META: script=/resources/idlharness.js
promise_test(async t => {
const [html, dom, indexeddb] = await Promise.all([
'/interfaces/html.idl',
'/interfaces/dom.idl',
'/interfaces/IndexedDB.idl',
].map(url => fetch(url).then(response => response.text())));
const idl_array = new IdlArray();
idl_array.add_untested_idls(html, { only: ['WindowOrWorkerGlobalScope'] });
idl_array.add_untested_idls(dom);
idl_array.add_idls(indexeddb);
idl_array.add_objects({
IDBCursor: [],
IDBCursorWithValue: [],
IDBDatabase: [],
IDBFactory: [self.indexedDB],
IDBIndex: [],
IDBKeyRange: [IDBKeyRange.only(0)],
IDBObjectStore: [],
IDBOpenDBRequest: [],
IDBRequest: [],
IDBTransaction: [],
IDBVersionChangeEvent: [new IDBVersionChangeEvent('')],
DOMStringList: [],
});
idl_array.test();
}, 'Test driver');

View file

@ -1,4 +1,4 @@
spec: https://w3c.github.io/webcrypto/
suggested_reviewers:
- Wafflespeanut
- jimsch
- engelke

View file

@ -0,0 +1,16 @@
// META: script=/resources/WebIDLParser.js
// META: script=/resources/idlharness.js
// https://w3c.github.io/webcrypto/Overview.html
promise_test(async () => {
const idl = await fetch(`/interfaces/WebCryptoAPI.idl`).then(r => r.text());
const idl_array = new IdlArray();
idl_array.add_idls(idl);
idl_array.add_objects({
Crypto: ['crypto'],
SubtleCrypto: ['crypto.subtle']
});
idl_array.test();
}, 'WebCryptoAPI interfaces');

View file

@ -1,40 +0,0 @@
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<title>IDL check of WebCrypto</title>
<link rel="help" href="https://w3c.github.io/webcrypto/Overview.html#crypto-interface">
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src=/resources/WebIDLParser.js></script>
<script src=/resources/idlharness.js></script>
</head>
<body>
<h1 class="instructions">Description</h1>
<p class="instructions">This test verifies that the implementations of the WebCrypto API match with its WebIDL definition.</p>
<div id='log'></div>
<script>
var file_input;
setup(function() {
var idl_array = new IdlArray();
var request = new XMLHttpRequest();
request.open("GET", "../interfaces/WebCryptoAPI.idl");
request.send();
request.onload = function() {
var idls = request.responseText;
idl_array.add_idls(idls);
idl_array.add_objects({"Crypto":["crypto"], "SubtleCrypto":["crypto.subtle"]});
idl_array.test();
done();
};
}, {explicit_done: true});
</script>

View file

@ -1,22 +0,0 @@
importScripts("/resources/testharness.js");
importScripts("/resources/WebIDLParser.js", "/resources/idlharness.js");
var request = new XMLHttpRequest();
request.open("GET", "../interfaces/WebCryptoAPI.idl");
request.send();
request.onload = function() {
var idl_array = new IdlArray();
var idls = request.responseText;
idl_array.add_untested_idls("[Global] interface Window { };");
idl_array.add_untested_idls("interface ArrayBuffer {};");
idl_array.add_untested_idls("interface ArrayBufferView {};");
idl_array.add_idls(idls);
idl_array.add_objects({"Crypto":["crypto"], "SubtleCrypto":["crypto.subtle"]});
idl_array.test();
done();
};

View file

@ -1,3 +1,4 @@
spec: https://heycam.github.io/webidl/
suggested_reviewers:
- domenic
- jensl

View file

@ -22,7 +22,7 @@ function doTest(idl) {
}
promise_test(function() {
return fetch("/interfaces/webidl.idl").then(response => response.text())
return fetch("/interfaces/WebIDL.idl").then(response => response.text())
.then(doTest);
}, "Test driver");
</script>

View file

@ -1,3 +1,4 @@
spec: https://w3c.github.io/accelerometer/
suggested_reviewers:
- zqzhang
- dontcallmedom

View file

@ -1,3 +1,4 @@
spec: https://w3c.github.io/accname/
suggested_reviewers:
- halindrome
- joanmarie

View file

@ -0,0 +1,14 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>AmbientLightSensor iframe test</title>
<link rel="author" title="Intel" href="http://www.intel.com">
<link rel="help" href="https://w3c.github.io/ambient-light/">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/generic-sensor/generic-sensor-tests.js"></script>
<script src="/generic-sensor/generic-sensor-iframe-tests.sub.js"></script>
<script src="/generic-sensor/generic-sensor-feature-policy-test.sub.js"></script>
<div id="log"></div>
<script>
run_generic_sensor_iframe_tests('AmbientLightSensor');
</script>

View file

@ -1,6 +1,6 @@
spec: https://w3c.github.io/ambient-light/
suggested_reviewers:
- zqzhang
- Volker-E
- dontcallmedom
- riju
- alexshalamov

View file

@ -1,4 +1,4 @@
spec: https://www.w3.org/TR/annotation-model/
suggested_reviewers:
- halindrome
- bigbluehat
- tcole3

View file

@ -1,2 +1,3 @@
spec: https://www.w3.org/TR/annotation-protocol/
suggested_reviewers:
- halindrome

View file

@ -1,3 +1,4 @@
spec: https://www.w3.org/TR/annotation-vocab/
suggested_reviewers:
- halindrome
- gkellogg

View file

@ -1,3 +1,4 @@
spec: https://wiki.mozilla.org/APNG_Specification
suggested_reviewers:
- stuartparmenter
- svgeesus

View file

@ -0,0 +1,7 @@
spec: https://w3c.github.io/manifest/
suggested_reviewers:
- anssiko
- kenchris
- marcoscaceres
- mgiuca
- mounirlamouri

View file

@ -0,0 +1,18 @@
// META: script=/resources/WebIDLParser.js
// META: script=/resources/idlharness.js
// https://w3c.github.io/manifest/
'use strict';
idl_test(
['appmanifest'],
['html', 'dom'],
idl_array => {
idl_array.add_objects({
Window: ['window'],
BeforeInstallPromptEvent: ['new BeforeInstallPromptEvent("type")'],
});
},
'appmanifest interfaces'
);

View file

@ -1,2 +1,3 @@
spec: https://domenic.github.io/async-local-storage/
suggested_reviewers:
- domenic

View file

@ -1,50 +0,0 @@
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<title>IDL check of sinkId on HTMLMediaElement</title>
<link rel="author" title="Dominique Hazael-Massieux" href="mailto:dom@w3.org"/>
<link rel="help" href="https://www.w3.org/TR/audio-output/#htmlmediaelement-extensions">
</head>
<body>
<h1 class="instructions">Description</h1>
<p class="instructions">This test verifies the availability of <code>sinkId</code>/<code>setSinkId</code> on the HTMLMediaElement interface.</p>
<div id='log'></div>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src=/resources/WebIDLParser.js></script>
<script src=/resources/idlharness.js></script>
<!-- -->
<script type="text/plain" id='untested_idl'>
interface HTMLMediaElement {
};
interface HTMLAudioElement : HTMLMediaElement {
};
interface HTMLVideoElement : HTMLMediaElement {
};
</script>
<script type="text/plain" id="idl">
// The IDL is copied from the 15 December 2016 draft.
partial interface HTMLMediaElement {
readonly attribute DOMString sinkId;
Promise<void> setSinkId(DOMString sinkId);
};</script>
<script>
(function() {
var idl_array = new IdlArray();
idl_array.add_untested_idls(document.getElementById('untested_idl').textContent);
idl_array.add_idls(document.getElementById('idl').textContent);
window.audio = document.createElement("audio");
window.video = document.createElement("video");
idl_array.add_objects({"HTMLAudioElement": ["audio"], "HTMLVideoElement": ["video"]});
idl_array.test();
done();
})();
</script>
</body>
</html>

View file

@ -1,2 +1,3 @@
spec: https://w3c.github.io/mediacapture-output/
suggested_reviewers:
- guidou

View file

@ -0,0 +1,24 @@
// META: script=/resources/WebIDLParser.js
// META: script=/resources/idlharness.js
// https://w3c.github.io/mediacapture-output/
'use strict';
promise_test(async () => {
const srcs = ['audio-output', 'dom', 'html'];
const [idl, dom, html] = await Promise.all(
srcs.map(i => fetch(`/interfaces/${i}.idl`).then(r => r.text())));
const idl_array = new IdlArray();
idl_array.add_idls(idl);
idl_array.add_dependency_idls(html);
idl_array.add_dependency_idls(dom);
self.audio = document.createElement('audio');
self.video = document.createElement('video');
idl_array.add_objects({
HTMLAudioElement: ['audio'],
HTMLVideoElement: ['video']
});
idl_array.test();
}, 'Test IDL implementation of audio-output API');

View file

@ -1,3 +1,4 @@
spec: https://wicg.github.io/background-fetch/
suggested_reviewers:
- beverloo
- jakearchibald

View file

@ -16,5 +16,5 @@ document.head.appendChild(meta);
backgroundFetchTest((t, bgFetch) => {
return promise_rejects(
t, new TypeError(),
bgFetch.fetch(uniqueTag(), 'https://example.com'));
bgFetch.fetch(uniqueId(), 'https://example.com'));
}, 'fetch blocked by CSP should reject');

View file

@ -10,23 +10,23 @@
// https://url.spec.whatwg.org/#include-credentials
backgroundFetchTest((t, bgFetch) => {
return bgFetch.fetch(uniqueTag(), 'https://example.com');
return bgFetch.fetch(uniqueId(), 'https://example.com');
}, 'fetch without credentials in URL should register ok');
backgroundFetchTest((t, bgFetch) => {
return promise_rejects(
t, new TypeError(),
bgFetch.fetch(uniqueTag(), 'https://username:password@example.com'));
bgFetch.fetch(uniqueId(), 'https://username:password@example.com'));
}, 'fetch with username and password in URL should reject');
backgroundFetchTest((t, bgFetch) => {
return promise_rejects(
t, new TypeError(),
bgFetch.fetch(uniqueTag(), 'https://username:@example.com'));
bgFetch.fetch(uniqueId(), 'https://username:@example.com'));
}, 'fetch with username and empty password in URL should reject');
backgroundFetchTest((t, bgFetch) => {
return promise_rejects(
t, new TypeError(),
bgFetch.fetch(uniqueTag(), 'https://:password@example.com'));
bgFetch.fetch(uniqueId(), 'https://:password@example.com'));
}, 'fetch with empty username and password in URL should reject');

View file

@ -13,5 +13,5 @@
backgroundFetchTest((t, bgFetch) => {
return promise_rejects(
t, new TypeError(),
bgFetch.fetch(uniqueTag(), 'https://example.com/?\n<'));
bgFetch.fetch(uniqueId(), 'https://example.com/?\n<'));
}, 'fetch to URL containing \\n and < should reject');

View file

@ -0,0 +1,27 @@
// META: script=/service-workers/service-worker/resources/test-helpers.sub.js
// META: script=resources/utils.js
'use strict';
// Covers basic functionality provided by BackgroundFetchManager.fetch().
// https://wicg.github.io/background-fetch/#background-fetch-manager-fetch
backgroundFetchTest(async (test, backgroundFetch) => {
const registrationId = uniqueId();
const registration = await backgroundFetch.fetch(
registrationId, 'resources/feature-name.txt');
assert_equals(registration.id, registrationId);
assert_equals(registration.uploadTotal, 0);
assert_equals(registration.uploaded, 0);
assert_equals(registration.downloadTotal, 0);
// Skip `downloaded`, as the transfer may have started already.
const {type, results} = await getMessageFromServiceWorker();
assert_equals('backgroundfetched', type);
assert_equals(results.length, 1);
assert_true(results[0].url.includes('resources/feature-name.txt'));
assert_equals(results[0].status, 200);
assert_equals(results[0].text, 'Background Fetch');
}, 'Using Background Fetch to successfully fetch a single resource');

View file

@ -0,0 +1,19 @@
// META: script=/service-workers/service-worker/resources/test-helpers.sub.js
// META: script=resources/utils.js
'use strict';
// Covers functionality provided by BackgroundFetchManager.getIds(), which
// exposes the keys of active background fetches.
//
// https://wicg.github.io/background-fetch/#background-fetch-manager-getIds
backgroundFetchTest(async (test, backgroundFetch) => {
const registrationId = uniqueId();
const registration = await backgroundFetch.fetch(
registrationId, 'resources/feature-name.txt');
assert_equals(registration.id, registrationId);
assert_true((await backgroundFetch.getIds()).includes(registrationId));
}, 'The BackgroundFetchManager exposes active fetches');

View file

@ -6,7 +6,12 @@
// https://wicg.github.io/background-fetch/
promise_test(async () => {
const srcs = ['background-fetch', 'dedicated-workers', 'ServiceWorker', 'dom'];
const srcs = [
'background-fetch',
'dedicated-workers',
'service-workers',
'dom'
];
const [idls, worker, serviceWorker, dom] = await Promise.all(
srcs.map(i => fetch(`/interfaces/${i}.idl`).then(r => r.text())));

View file

@ -15,65 +15,65 @@
// intended to check that blocking is enabled.
backgroundFetchTest((t, bgFetch) => {
return bgFetch.fetch(uniqueTag(), 'https://example.com');
return bgFetch.fetch(uniqueId(), 'https://example.com');
}, 'https: fetch should register ok');
backgroundFetchTest((t, bgFetch) => {
return bgFetch.fetch(uniqueTag(), 'http://127.0.0.1');
return bgFetch.fetch(uniqueId(), 'http://127.0.0.1');
}, 'loopback IPv4 http: fetch should register ok');
backgroundFetchTest((t, bgFetch) => {
return bgFetch.fetch(uniqueTag(), 'http://[::1]');
return bgFetch.fetch(uniqueId(), 'http://[::1]');
}, 'loopback IPv6 http: fetch should register ok');
backgroundFetchTest((t, bgFetch) => {
return bgFetch.fetch(uniqueTag(), 'http://localhost');
return bgFetch.fetch(uniqueId(), 'http://localhost');
}, 'localhost http: fetch should register ok');
backgroundFetchTest((t, bgFetch) => {
return promise_rejects(t, new TypeError(),
bgFetch.fetch(uniqueTag(), 'http://example.com'));
bgFetch.fetch(uniqueId(), 'http://example.com'));
}, 'non-loopback http: fetch should reject');
backgroundFetchTest((t, bgFetch) => {
return promise_rejects(t, new TypeError(),
bgFetch.fetch(uniqueTag(), 'http://192.0.2.0'));
bgFetch.fetch(uniqueId(), 'http://192.0.2.0'));
}, 'non-loopback IPv4 http: fetch should reject');
backgroundFetchTest((t, bgFetch) => {
return promise_rejects(t, new TypeError(),
bgFetch.fetch(uniqueTag(), 'http://[2001:db8::1]'));
bgFetch.fetch(uniqueId(), 'http://[2001:db8::1]'));
}, 'non-loopback IPv6 http: fetch should reject');
backgroundFetchTest((t, bgFetch) => {
return promise_rejects(t, new TypeError(),
bgFetch.fetch(uniqueTag(), ['https://example.com',
'http://example.com']));
bgFetch.fetch(uniqueId(), ['https://example.com',
'http://example.com']));
}, 'https: and non-loopback http: fetch should reject');
backgroundFetchTest((t, bgFetch) => {
return promise_rejects(t, new TypeError(),
bgFetch.fetch(uniqueTag(), ['http://example.com',
'https://example.com']));
bgFetch.fetch(uniqueId(), ['http://example.com',
'https://example.com']));
}, 'non-loopback http: and https: fetch should reject');
backgroundFetchTest((t, bgFetch) => {
return promise_rejects(t, new TypeError(),
bgFetch.fetch(uniqueTag(), 'wss:127.0.0.1'));
bgFetch.fetch(uniqueId(), 'wss:127.0.0.1'));
}, 'wss: fetch should reject');
backgroundFetchTest((t, bgFetch) => {
return promise_rejects(t, new TypeError(),
bgFetch.fetch(uniqueTag(), 'file:///'));
bgFetch.fetch(uniqueId(), 'file:///'));
}, 'file: fetch should reject');
backgroundFetchTest((t, bgFetch) => {
return promise_rejects(t, new TypeError(),
bgFetch.fetch(uniqueTag(), 'data:text/plain,foo'));
bgFetch.fetch(uniqueId(), 'data:text/plain,foo'));
}, 'data: fetch should reject');
backgroundFetchTest((t, bgFetch) => {
return promise_rejects(t, new TypeError(),
bgFetch.fetch(uniqueTag(), 'foobar:bazqux'));
bgFetch.fetch(uniqueId(), 'foobar:bazqux'));
}, 'unknown scheme fetch should reject');

View file

@ -9,27 +9,27 @@
// check that blocking is enabled.
backgroundFetchTest((t, bgFetch) => {
return bgFetch.fetch(uniqueTag(), 'https://example.com');
return bgFetch.fetch(uniqueId(), 'https://example.com');
}, 'fetch to default https port should register ok');
backgroundFetchTest((t, bgFetch) => {
return bgFetch.fetch(uniqueTag(), 'http://127.0.0.1');
return bgFetch.fetch(uniqueId(), 'http://127.0.0.1');
}, 'fetch to default http port should register ok');
backgroundFetchTest((t, bgFetch) => {
return bgFetch.fetch(uniqueTag(), 'https://example.com:443');
return bgFetch.fetch(uniqueId(), 'https://example.com:443');
}, 'fetch to port 443 should register ok');
backgroundFetchTest((t, bgFetch) => {
return bgFetch.fetch(uniqueTag(), 'https://example.com:80');
return bgFetch.fetch(uniqueId(), 'https://example.com:80');
}, 'fetch to port 80 should register ok, even over https');
backgroundFetchTest((t, bgFetch) => {
return bgFetch.fetch(uniqueTag(), 'https://example.com:8080');
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(uniqueTag(), 'https://example.com:587'));
bgFetch.fetch(uniqueId(), 'https://example.com:587'));
}, 'fetch to bad port (SMTP) should reject');

View file

@ -0,0 +1 @@
Background Fetch

View file

@ -1 +1,24 @@
// Deliberately left empty for now.
let source = null;
async function getFetchResult(settledFetch) {
if (!settledFetch.response)
return Promise.resolve(null);
return {
url: settledFetch.response.url,
status: settledFetch.response.status,
text: await settledFetch.response.text(),
};
}
self.addEventListener('message', event => {
source = event.source;
source.postMessage('ready');
});
self.addEventListener('backgroundfetched', event => {
event.waitUntil(
event.fetches.values()
.then(fetches => Promise.all(fetches.map(fetch => getFetchResult(fetch))))
.then(results => source.postMessage({ type: event.type, results })));
});

View file

@ -1,26 +1,52 @@
'use strict';
let nextBackgroundFetchId = 0;
// Waits for a single message received from a registered Service Worker.
async function getMessageFromServiceWorker() {
return new Promise(resolve => {
function listener(event) {
navigator.serviceWorker.removeEventListener('message', listener);
resolve(event.data);
}
navigator.serviceWorker.addEventListener('message', listener);
});
}
// Registers the instrumentation Service Worker located at "resources/sw.js"
// with a scope unique to the test page that's running, and waits for it to be
// activated. The Service Worker will be unregistered automatically.
//
// Depends on /service-workers/service-worker/resources/test-helpers.sub.js
async function registerAndActivateServiceWorker(test) {
const script = 'resources/sw.js';
const scope = 'resources/scope' + location.pathname;
let serviceWorkerRegistration =
await service_worker_unregister_and_register(test, script, scope);
add_completion_callback(() => {
serviceWorkerRegistration.unregister();
});
add_completion_callback(() => serviceWorkerRegistration.unregister());
await wait_for_state(test, serviceWorkerRegistration.installing, 'activated');
return serviceWorkerRegistration;
}
// Creates a Promise test for |func| given the |description|. The |func| will be
// executed with the `backgroundFetch` object of an activated Service Worker
// Registration.
function backgroundFetchTest(func, description) {
promise_test(async t => {
const serviceWorkerRegistration = await registerAndActivateServiceWorker(t);
serviceWorkerRegistration.active.postMessage(null /* unused */);
assert_equals(await getMessageFromServiceWorker(), 'ready');
return func(t, serviceWorkerRegistration.backgroundFetch);
}, description);
}
let _nextBackgroundFetchTag = 0;
function uniqueTag() {
return 'tag' + _nextBackgroundFetchTag++;
}
// Returns a Background Fetch ID that's unique for the current page.
function uniqueId() {
return 'id' + nextBackgroundFetchId++;
}

View file

@ -1,3 +1,4 @@
spec: https://w3c.github.io/battery/
suggested_reviewers:
- anssiko
- dontcallmedom

View file

@ -1,3 +1,4 @@
spec: https://w3c.github.io/beacon/
suggested_reviewers:
- toddreifsteck
- igrigorik

View file

@ -1,3 +1,4 @@
spec: https://webbluetoothcg.github.io/web-bluetooth/
suggested_reviewers:
- jyasskin
- g-ortuno

View file

@ -3,14 +3,8 @@
<script src="/resources/testharnessreport.js"></script>
<script>
'use strict';
const test_desc = '[SameObject] test for navigator.bluetooth';
test(() => {
assert_true('bluetooth' in navigator,
'navigator.bluetooth exists.');
}, 'navigator.bluetooth IDL test');
test(() => {
assert_equals(navigator.bluetooth, navigator.bluetooth);
}, test_desc);
assert_false('bluetooth' in navigator);
}, 'navigator.bluetooth not available in insecure contexts');
</script>

View file

@ -0,0 +1,16 @@
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
'use strict';
const test_desc = '[SameObject] test for navigator.bluetooth';
test(() => {
assert_true('bluetooth' in navigator,
'navigator.bluetooth exists.');
}, 'navigator.bluetooth IDL test');
test(() => {
assert_equals(navigator.bluetooth, navigator.bluetooth);
}, test_desc);
</script>

View file

@ -0,0 +1,25 @@
// META: script=/resources/WebIDLParser.js
// META: script=/resources/idlharness.js
'use strict';
// https://webbluetoothcg.github.io/web-bluetooth/
idl_test(
['web-bluetooth'],
['dom', 'html', 'permissions'],
idl_array => {
try {
self.event = new BluetoothAdvertisingEvent('type');
} catch(e) {
// Surfaced when 'event' is undefined below.
}
idl_array.add_objects({
Navigator: ['navigator'],
Bluetooth: ['navigator.bluetooth'],
BluetoothAdvertisingEvent: ['event'],
});
},
'web-bluetooth interfaces.'
);

View file

@ -1,19 +0,0 @@
// META: script=/resources/WebIDLParser.js
// META: script=/resources/idlharness.js
'use strict';
// https://webbluetoothcg.github.io/web-bluetooth/
promise_test(async () => {
const srcs = ['web-bluetooth', 'dom', 'html', 'permissions'];
const [idl, dom, html, permissions] = await Promise.all(
srcs.map(i => fetch(`/interfaces/${i}.idl`).then(r => r.text())));
const idl_array = new IdlArray();
idl_array.add_idls(idl);
idl_array.add_dependency_idls(dom);
idl_array.add_dependency_idls(html);
idl_array.add_dependency_idls(permissions);
idl_array.test();
}, 'web-bluetooth interfaces.');

View file

@ -1,2 +1,3 @@
spec: https://wicg.github.io/budget-api/
suggested_reviewers:
- beverloo

View file

@ -1,3 +1,4 @@
spec: https://w3c.github.io/webappsec-clear-site-data/
suggested_reviewers:
- mikewest
- msramek

View file

@ -4,10 +4,10 @@
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id=test>
<p>Apart from this webpage, the test opens another html web page. One test
is run in this web page, and another in the second web page.
</div>
<!--
Apart from this webpage, the test opens two more html web page. One test is run
in this web page, and two in the other web pages.
-->
<script>
@ -23,11 +23,11 @@
// verifies that the user agent does not send the client hints in the request
// headers.
// Verify the initial state to make sure that the browser does not have client
// hints preferences cached from a previous run of the test.
// Test is marked as tentative until https://github.com/whatwg/fetch/issues/726
// is resolved.
// First, verify the initial state to make sure that the browser does not have
// client hints preferences cached from a previous run of the test.
promise_test(t => {
return fetch("echo_client_hints_received.py").then(r => {
assert_equals(r.status, 200)
@ -35,25 +35,33 @@ promise_test(t => {
// headers when fetching echo_client_hints_received.py.
assert_false(r.headers.has("device-memory-received"), "device-memory-received");
});
}, "Test that the browser does not have client hints preferences cached");
promise_test(t => {
return fetch("resources/accept_ch.html").then(r => {
assert_equals(r.status, 200)
assert_false(r.headers.has("device-memory-received"), "device-memory-received");
// Open a new window.
window.open("resources/do_not_expect_client_hints_headers.html");
});
}, "Test receiving Accept-CH header");
}, "Precondition: Test that the browser does not have client hints preferences cached");
async_test(t => {
window.addEventListener('message', function(event) {
t.done();
})
window.addEventListener('message', function(e) {
if(!e.source.location.pathname.includes("do_not_expect_client_hints_headers.html")) {
return;
}
if(typeof e.data != "string")
return;
assert_equals(e.data, "PASS");
t.done();
})
}, "Loading of resources/do_not_expect_client_hints_headers.html did not finish.");
</script>
function acceptChLoaded() {
// Open a new window. Verify that the user agent does not attach the client
// hints.
var verify_win = window.open("do_not_expect_client_hints_headers.html");
assert_not_equals(verify_win, null, "Popup windows not allowed?");
}
// Fetching this webpage should NOT cause user-agent to persist client hint
// preferences for the origin.
var win = window.open("resources/accept_ch.html");
assert_not_equals(win, null, "Popup windows not allowed?");
win.addEventListener('load', acceptChLoaded, false);
</script>
</body>
</html>

View file

@ -16,7 +16,7 @@
// of client hints it receives in the request headers.
promise_test(t => {
return fetch("https://{{domains[]}}:{{ports[https][0]}}/client-hints/echo_client_hints_received.py", {"mode": "no-cors"}).then(r => {
return fetch("https://{{domains[]}}:{{ports[https][0]}}/client-hints/echo_client_hints_received.py").then(r => {
assert_equals(r.status, 200)
// Verify that the browser includes client hints in the headers for a
// same-origin fetch.

View file

@ -4,10 +4,10 @@
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id=test>
<p>Apart from this webpage, the test opens another html web page. One test
is run in this web page, and another in the second web page.
</div>
<!--
Apart from this webpage, the test opens two more html web page. One test is run
in this web page, and two in the other web pages.
-->
<script>
@ -23,11 +23,11 @@
// verifies that the user agent actually sends the client hints in the request
// headers.
// Verify the initial state to make sure that the browser does not have client
// hints preferences cached from a previous run of the test.
// Test is marked as tentative until https://github.com/whatwg/fetch/issues/726
// is resolved.
// First, verify the initial state to make sure that the browser does not have
// client hints preferences cached from a previous run of the test.
promise_test(t => {
return fetch("echo_client_hints_received.py").then(r => {
assert_equals(r.status, 200)
@ -35,26 +35,33 @@ promise_test(t => {
// headers when fetching echo_client_hints_received.py.
assert_false(r.headers.has("device-memory-received"), "device-memory-received");
});
}, "Test that the browser does not have client hints preferences cached");
promise_test(t => {
return fetch("resources/accept_ch_lifetime.html").then(r => {
assert_equals(r.status, 200)
assert_false(r.headers.has("device-memory-received"), "device-memory-received");
// Open a new window.
window.open("resources/expect_client_hints_headers.html");
});
}, "Test receiving Accept-CH-Lifetime header");
}, "Precondition: Test that the browser does not have client hints preferences cached");
async_test(t => {
window.addEventListener('message', function(event) {
t.done();
window.addEventListener('message', function(e) {
if(!e.source.location.pathname.includes("expect_client_hints_headers.html")) {
return;
}
if(typeof e.data != "string")
return;
assert_equals(e.data, "PASS");
t.done();
})
}, "Loading of resources/expect_client_hints_headers.html did not finish.");
</script>
function acceptChLifetimeLoaded() {
// Open a new window. Verify that the user agent attaches the client hints.
var verify_win = window.open("expect_client_hints_headers.html");
assert_not_equals(verify_win, null, "Popup windows not allowed?");
}
// Fetching this webpage should cause user-agent to persist client hint
// preferences for the origin.
var win = window.open("resources/accept_ch_lifetime.html");
assert_not_equals(win, null, "Popup windows not allowed?");
win.addEventListener('load', acceptChLifetimeLoaded, false);
</script>
</body>
</html>

View file

@ -0,0 +1,68 @@
<html>
<title>Accept-CH-Lifetime test with cross-origin iframe</title>
<body>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<!--
Apart from this webpage, the test opens another html web page. One test is run
in this web page, and another in the second web page.
-->
<script>
// This test fetches resources/accept_ch_lifetime.html in a cross origin iframe.
// The response headers to that webpage contain Accept-CH and Accept-CH-Lifetime
// headers.
// Fetching that webpage should NOT cause the user-agent to persist origin
// preferences for the client hints specified.
// Next, to verify if the origin preferences were NOT persisted by the user
// agent, this test fetches resources/do_not_expect_client_hints_headers.html
// in a new window. Fetching of
// resources/do_not_expect_client_hints_headers.html
// verifies that the user agent did not actually sent the client hints in the
// request headers.
// Test is marked as tentative until https://github.com/whatwg/fetch/issues/726
// is resolved.
// First, verify the initial state to make sure that the browser does not have
// client hints preferences cached from a previous run of the test.
promise_test(t => {
return fetch("echo_client_hints_received.py").then(r => {
assert_equals(r.status, 200)
// Verify that the browser did not include client hints in the request
// headers when fetching echo_client_hints_received.py.
assert_false(r.headers.has("device-memory-received"), "device-memory-received");
});
}, "Precondition: Test that the browser does not have client hints preferences cached");
async_test(t => {
window.addEventListener('message', function(e) {
if(!e.source.location.pathname.includes("do_not_expect_client_hints_headers.html")) {
return;
}
if(typeof e.data != "string")
return;
assert_equals(e.data, "PASS");
t.done();
})
}, "Loading of resources/do_not_expect_client_hints_headers.html did not finish.");
function acceptChLifetimeLoaded() {
// Open a new window. Verify that the user agent does not attach the client
// hints.
var verify_win = window.open("resources/do_not_expect_client_hints_headers.html");
assert_not_equals(verify_win, null, "Popup windows not allowed?");
}
</script>
<!-- Fetching this webpage should NOT cause user-agent to persist client hint
preferences for the origin.-->
<iframe onload="acceptChLifetimeLoaded()" src="https://{{hosts[][www]}}:{{ports[https][0]}}/client-hints/resources/accept_ch_lifetime.html"></iframe>
</body>
</html>

View file

@ -0,0 +1,67 @@
<html>
<title>Accept-CH-Lifetime test with same-origin iframe</title>
<body>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<!--
Apart from this webpage, the test opens another html web page. One test is run
in this web page, and another in the second web page.
-->
<script>
// This test fetches resources/accept_ch_lifetime.html in a same origin iframe.
// The response headers to that webpage contain Accept-CH and Accept-CH-Lifetime
// headers.
// Fetching that webpage should cause the user-agent to persist origin
// preferences for the client hints specified in Accept-CH header for a
// duration specified in the Accept-CH-Lifetime header.
// Next, to verify if the origin preferences were persisted by the user
// agent, this test fetches resources/expect_client_hints_headers.html
// in a new window. Fetching of resources/expect_client_hints_headers.html
// verifies that the user agent actually sends the client hints in the request
// headers.
// Test is marked as tentative until https://github.com/whatwg/fetch/issues/726
// is resolved.
// First, verify the initial state to make sure that the browser does not have
// client hints preferences cached from a previous run of the test.
promise_test(t => {
return fetch("echo_client_hints_received.py").then(r => {
assert_equals(r.status, 200)
// Verify that the browser did not include client hints in the request
// headers when fetching echo_client_hints_received.py.
assert_false(r.headers.has("device-memory-received"), "device-memory-received");
});
}, "Precondition: Test that the browser does not have client hints preferences cached");
async_test(t => {
window.addEventListener('message', function(e) {
if(!e.source.location.pathname.includes("expect_client_hints_headers.html")) {
return;
}
if(typeof e.data != "string")
return;
assert_equals(e.data, "PASS");
t.done();
})
}, "Loading of resources/expect_client_hints_headers.html did not finish.");
function acceptChLifetimeLoaded() {
// Open a new window. Verify that the user agent attaches the client hints.
var verify_win = window.open("resources/expect_client_hints_headers.html");
assert_not_equals(verify_win, null, "Popup windows not allowed?");
}
</script>
<!-- Fetching this webpage should cause user-agent to persist client hint
preferences for the origin.-->
<iframe onload="acceptChLifetimeLoaded()" src="resources/accept_ch_lifetime.html"></iframe>
</body>
</html>

View file

@ -0,0 +1,71 @@
<html>
<title>Accept-CH-Lifetime test with subresource</title>
<body>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<!--
Apart from this webpage, the test opens another html web page. One test is run
in this web page, and another in the second web page.
-->
<script>
// This test fetches resources/accept_ch_lifetime.html as a subresource. The
// response headers to that webpage contain Accept-CH and Accept-CH-Lifetime
// headers.
// Fetching that webpage as a subresource should NOT cause the user-agent to
// persist origin preferences for the client hints specified in Accept-CH
// header.
// Next, to verify if the origin preferences were not persisted by the user
// agent, this test fetches resources/do_not_expect_client_hints_headers.html
// in a new window. Fetching of
// resources/do_not_expect_client_hints_headers.html verifies that the user
// agent does not send the client hints in the request headers.
// Test is marked as tentative until https://github.com/whatwg/fetch/issues/726
// is resolved.
// First, verify the initial state to make sure that the browser does not have
// client hints preferences cached from a previous run of the test.
promise_test(t => {
return fetch("echo_client_hints_received.py").then(r => {
assert_equals(r.status, 200)
// Verify that the browser did not include client hints in the request
// headers when fetching echo_client_hints_received.py.
assert_false(r.headers.has("device-memory-received"), "device-memory-received");
});
}, "Precondition: Test that the browser does not have client hints preferences cached");
promise_test(t => {
// Fetching this web page as a subresource should NOT cause user-agent to
// persist client hint preferences for the origin.
return fetch("resources/accept_ch_lifetime.html").then(r => {
assert_equals(r.status, 200)
// Verify that the browser did not include client hints in the request
// headers.
assert_false(r.headers.has("device-memory-received"), "device-memory-received");
// Open a new window. Verify that the user agent does not attach the client
// hints.
var win = window.open("resources/do_not_expect_client_hints_headers.html");
assert_not_equals(win, null, "Popup windows not allowed?");
});
}, "Test receiving Accept-CH-Lifetime header");
async_test(t => {
window.addEventListener('message', function(e) {
if(!e.source.location.pathname.includes("do_not_expect_client_hints_headers.html")) {
return;
}
if(typeof e.data != "string")
return;
assert_equals(e.data, "PASS");
t.done();
})
}, "Loading of resources/do_not_expect_client_hints_headers.html did not finish.");
</script>
</body>
</html>

View file

@ -0,0 +1,35 @@
<html>
<meta http-equiv="Accept-CH" content="DPR, Width, Viewport-Width, Device-Memory, rtt, downlink, ect">
<title>Accept-CH http-equiv insecure transport test</title>
<body>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
// Even though this HTML file contains "Accept-CH" http-equiv headers, the
// browser should NOT attach the specified client hints in the HTTP request
// headers since the page is being fetched over an insecure transport.
// Test this functionality by fetching an XHR from this page hosted on
// an insecure HTTP server.
// echo_client_hints_received.py sets the response headers depending on the set
// of client hints it receives in the request headers.
promise_test(t => {
return fetch("/client-hints/echo_client_hints_received.py").then(r => {
assert_equals(r.status, 200)
// Verify that the browser does not include client hints in the headers
// when fetching the XHR from an insecure HTTP server.
assert_false(r.headers.has("device-memory-received"), "device-memory-received");
assert_false(r.headers.has("dpr-received"), "dpr-received");
assert_false(r.headers.has("viewport-width-received"), "viewport-width-received");
assert_false(r.headers.has("rtt-received"), "rtt-received");
assert_false(r.headers.has("downlink-received"), "downlink-received");
assert_false(r.headers.has("ect-received"), "ect-received");
});
}, "Accept-CH http-equiv test over insecure transport");
</script>
</body>
</html>

View file

@ -0,0 +1,49 @@
<html>
<meta http-equiv="Accept-CH" content="DPR, Width, Viewport-Width, Device-Memory, rtt, downlink, ect">
<title>Accept-CH http-equiv cross-navigation test</title>
<body>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id=test>
<p>Apart from this webpage, the test opens another html web page. One test
is run in this web page, and another in the second web page.
</div>
<script>
// This test contains accept-ch http-equiv header. Due to the missing
// Accept-CH-Lifetime header, the user-agent should not persist origin
// preferences for the client hints specified in Accept-CH header.
// Next, to verify that the origin preferences were not persisted by the user
// agent, this test fetches resources/do_not_expect_client_hints_headers.html
// in a new window. Fetching of
// resources/do_not_expect_client_hints_headers.html
// verifies that the user agent does not send the client hints in the request
// headers.
// Test is marked as tentative until https://github.com/whatwg/fetch/issues/726
// is resolved.
promise_test(t => {
return fetch("echo_client_hints_received.py").then(r => {
assert_equals(r.status, 200)
// Verify that the browser includes client hints in the request
// headers when fetching echo_client_hints_received.py within this page.
assert_true(r.headers.has("device-memory-received"), "device-memory-received");
});
}, "Test that the browser attaches client hints on subresources in the same navigation");
// Verify that the browser does not attach client hints on resources in a
// different navigation. This verifies that the client hint preferences were
// not persisted for the origin.
window.open("resources/do_not_expect_client_hints_headers.html");
async_test(t => {
window.addEventListener('message', function(event) {
t.done();
})
}, "Loading of resources/do_not_expect_client_hints_headers.html did not finish.");
</script>
</body>
</html>

View file

@ -0,0 +1,62 @@
<html>
<meta http-equiv="Accept-CH" content="DPR, Width, Viewport-Width, Device-Memory, rtt, downlink, ect">
<title>Accept-CH http-equiv same-origin and cross-origin test</title>
<body>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
// Since this HTML file contains "Accept-CH" http-equiv headers the browser
// should attach the specified client hints in the HTTP request headers
// depending on whether the resource is being fetched from
// the same origin or a different origin. Test this functionality by fetching
// same-origin and cross-origin resources from this page.
//
// echo_client_hints_received.py sets the response headers depending on the set
// of client hints it receives in the request headers.
promise_test(t => {
return fetch("https://{{domains[]}}:{{ports[https][0]}}/client-hints/echo_client_hints_received.py").then(r => {
assert_equals(r.status, 200)
// Verify that the browser includes client hints in the headers for a
// same-origin fetch.
assert_true(r.headers.has("device-memory-received"), "device-memory-received");
assert_true(r.headers.has("dpr-received"), "dpr-received");
assert_true(r.headers.has("viewport-width-received"), "viewport-width-received");
assert_true(r.headers.has("rtt-received"), "rtt-received");
var rtt = parseInt(r.headers.get("rtt-received"));
assert_greater_than_equal(rtt, 0);
assert_less_than_equal(rtt, 3000);
assert_equals(rtt % 50, 0, 'rtt must be a multiple of 50 msec');
assert_true(r.headers.has("downlink-received"), "downlink-received");
var downlinkKbps = r.headers.get("downlink-received") * 1000;
assert_greater_than_equal(downlinkKbps, 0);
assert_less_than_equal(downlinkKbps, 10000);
assert_in_array(r.headers.get("ect-received"), ["slow-2g", "2g",
"3g", "4g"], 'ect-received is unexpected');
});
}, "Same origin Accept-CH http-equiv test");
promise_test(t => {
return fetch("https://{{domains[www]}}:{{ports[https][0]}}/client-hints/echo_client_hints_received.py").then(r => {
assert_equals(r.status, 200)
// Verify that the browser does not include client hints in the headers
// for a cross-origin fetch.
assert_false(r.headers.has("device-memory-received"), "device-memory-received");
assert_false(r.headers.has("dpr-received"), "dpr-received");
assert_false(r.headers.has("viewport-width-received"), "viewport-width-received");
assert_false(r.headers.has("rtt-received"), "rtt-received");
assert_false(r.headers.has("downlink-received"), "downlink-received");
assert_false(r.headers.has("ect-received"), "ect-received");
});
}, "Cross-Origin Accept-CH http-equiv test");
</script>
</body>
</html>

View file

@ -0,0 +1,66 @@
<html>
<title>Accept-CH-Lifetime test</title>
<body>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<!--
Apart from this webpage, the test opens two more html web page. One test is run
in this web page, and two in the other web pages.
-->
<script>
// This test fetches resources/http_equiv_accept_ch_lifetime.html. The response
// to that webpage contains Accept-CH and Accept-CH-Lifetime http-equiv headers.
// Fetching that webpage should cause the user-agent to persist origin
// preferences for the client hints specified in Accept-CH header for a
// duration specified in the Accept-CH-Lifetime header.
// Next, to verify if the origin preferences were persisted by the user
// agent, this test fetches resources/expect_client_hints_headers.html
// in a new window. Fetching of resources/expect_client_hints_headers.html
// verifies that the user agent actually sends the client hints in the request
// headers.
// Test is marked as tentative until https://github.com/whatwg/fetch/issues/726
// is resolved.
// First, verify the initial state to make sure that the browser does not have
// client hints preferences cached from a previous run of the test.
promise_test(t => {
return fetch("echo_client_hints_received.py").then(r => {
assert_equals(r.status, 200)
// Verify that the browser did not include client hints in the request
// headers when fetching echo_client_hints_received.py.
assert_false(r.headers.has("device-memory-received"), "device-memory-received");
});
}, "Precondition: Test that the browser does not have client hints preferences cached");
async_test(t => {
window.addEventListener('message', function(e) {
if(!e.source.location.pathname.includes("expect_client_hints_headers.html")) {
return;
}
if(typeof e.data != "string")
return;
assert_equals(e.data, "PASS");
t.done();
})
}, "Loading of resources/expect_client_hints_headers.html did not finish.");
function acceptChLifetimeLoaded() {
// Open a new window. Verify that the user agent attaches the client hints.
var verify_win = window.open("expect_client_hints_headers.html");
assert_not_equals(verify_win, null, "Popup windows not allowed?");
}
// Fetching this webpage should cause user-agent to persist client hint
// preferences for the origin.
var win = window.open("resources/http_equiv_accept_ch_lifetime.html");
assert_not_equals(win, null, "Popup windows not allowed?");
win.addEventListener('load', acceptChLifetimeLoaded, false);
</script>
</body>
</html>

View file

@ -0,0 +1,66 @@
<html>
<title>Accept-CH-Lifetime test with cross-origin iframe</title>
<body>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<!--
Apart from this webpage, the test opens another html web page. One test is run
in this web page, and another in the second web page.
-->
<script>
// This test fetches resources/http_equiv_accept_ch_lifetime.html in a cross
// origin iframe. The response to that webpage contains Accept-CH and
// Accept-CH-Lifetime http-equiv headers.
// Fetching that webpage should NOT cause the user-agent to persist origin
// preferences for the client hints specified.
// Next, to verify if the origin preferences were NOT persisted by the user
// agent, this test fetches resources/do_not_expect_client_hints_headers.html
// in a new window. Fetching of
// resources/do_not_expect_client_hints_headers.html
// verifies that the user agent did not actually sent the client hints in the
// request headers.
// Test is marked as tentative until https://github.com/whatwg/fetch/issues/726
// is resolved.
// First, verify the initial state to make sure that the browser does not have
// client hints preferences cached from a previous run of the test.
promise_test(t => {
return fetch("echo_client_hints_received.py").then(r => {
assert_equals(r.status, 200)
// Verify that the browser did not include client hints in the request
// headers when fetching echo_client_hints_received.py.
assert_false(r.headers.has("device-memory-received"), "device-memory-received");
});
}, "Precondition: Test that the browser does not have client hints preferences cached");
async_test(t => {
window.addEventListener('message', function(e) {
if(!e.source.location.pathname.includes("do_not_expect_client_hints_headers.html")) {
return;
}
if(typeof e.data != "string")
return;
assert_equals(e.data, "PASS");
t.done();
})
}, "Loading of resources/do_not_expect_client_hints_headers.html did not finish.");
function acceptChLifetimeLoaded() {
var verify_win = window.open("resources/do_not_expect_client_hints_headers.html");
assert_not_equals(verify_win, null, "Popup windows not allowed?");
}
</script>
<!-- Fetching this webpage should NOT cause user-agent to persist client hint
preferences for the origin.-->
<iframe onload="acceptChLifetimeLoaded()" src="https://{{hosts[][www]}}:{{ports[https][0]}}/client-hints/resources/http_equiv_accept_ch_lifetime.html"></iframe>
</body>
</html>

View file

@ -0,0 +1,67 @@
<html>
<title>Accept-CH-Lifetime test with same-origin iframe</title>
<body>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<!--
Apart from this webpage, the test opens another html web page. One test is run
in this web page, and another in the second web page.
-->
<script>
// This test fetches resources/http_equiv_accept_ch_lifetime.html in a same
// origin iframe. The response to that webpage contains Accept-CH and
// Accept-CH-Lifetime http-equiv headers.
// Fetching that webpage should cause the user-agent to persist origin
// preferences for the client hints specified in Accept-CH header for a
// duration specified in the Accept-CH-Lifetime header.
// Next, to verify if the origin preferences were persisted by the user
// agent, this test fetches resources/expect_client_hints_headers.html
// in a new window. Fetching of resources/expect_client_hints_headers.html
// verifies that the user agent actually sends the client hints in the request
// headers.
// Test is marked as tentative until https://github.com/whatwg/fetch/issues/726
// is resolved.
// First, verify the initial state to make sure that the browser does not have
// client hints preferences cached from a previous run of the test.
promise_test(t => {
return fetch("echo_client_hints_received.py").then(r => {
assert_equals(r.status, 200)
// Verify that the browser did not include client hints in the request
// headers when fetching echo_client_hints_received.py.
assert_false(r.headers.has("device-memory-received"), "device-memory-received");
});
}, "Precondition: Test that the browser does not have client hints preferences cached");
async_test(t => {
window.addEventListener('message', function(e) {
if(!e.source.location.pathname.includes("expect_client_hints_headers.html")) {
return;
}
if(typeof e.data != "string")
return;
assert_equals(e.data, "PASS");
t.done();
})
}, "Loading of resources/expect_client_hints_headers.html did not finish.");
function acceptChLifetimeLoaded() {
// Open a new window. Verify that the user agent attaches the client hints.
var verify_win = window.open("resources/expect_client_hints_headers.html");
assert_not_equals(verify_win, null, "Popup windows not allowed?");
}
</script>
<!-- Fetching this webpage should cause user-agent to persist client hint
preferences for the origin.-->
<iframe onload="acceptChLifetimeLoaded()" src="resources/http_equiv_accept_ch_lifetime.html"></iframe>
</body>
</html>

View file

@ -0,0 +1,74 @@
<html>
<title>Accept-CH-Lifetime test with subresource</title>
<body>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<!--
Apart from this webpage, the test opens another html web page. One test is run
in this web page, and another in the second web page.
-->
<script>
// This test fetches resources/http_equiv_accept_ch_lifetime.html as a
// subresource. The response to that webpage contains Accept-CH and
// Accept-CH-Lifetime http-equiv headers.
// Fetching that webpage as a subresource should NOT cause the user-agent to
// persist origin preferences for the client hints specified in Accept-CH
// header.
// Next, to verify if the origin preferences were not persisted by the user
// agent, this test fetches resources/do_not_expect_client_hints_headers.html
// in a new window. Fetching of
// resources/do_not_expect_client_hints_headers.html verifies that the user
// agent does not send the client hints in the request headers.
// Test is marked as tentative until https://github.com/whatwg/fetch/issues/726
// is resolved.
// First, verify the initial state to make sure that the browser does not have
// client hints preferences cached from a previous run of the test.
promise_test(t => {
return fetch("echo_client_hints_received.py").then(r => {
assert_equals(r.status, 200)
// Verify that the browser did not include client hints in the request
// headers when fetching echo_client_hints_received.py.
assert_false(r.headers.has("device-memory-received"), "device-memory-received");
});
}, "Precondition: Test that the browser does not have client hints preferences cached");
promise_test(t => {
// Fetching this web page as a subresource should NOT cause user-agent to
// persist client hint preferences for the origin.
return fetch("resources/http_equiv_accept_ch_lifetime.html").then(r => {
assert_equals(r.status, 200)
// Verify that the browser did not include client hints in the request
// headers.
assert_false(r.headers.has("device-memory-received"), "device-memory-received");
// Open a new window. Verify that the user agent does not attach the client
// hints.
var win = window.open("resources/do_not_expect_client_hints_headers.html");
assert_not_equals(win, null, "Popup windows not allowed?");
});
}, "Test receiving Accept-CH-Lifetime header");
async_test(t => {
window.addEventListener('message', function(e) {
if(!e.source.location.pathname.includes("do_not_expect_client_hints_headers.html")) {
return;
}
if(typeof e.data != "string")
return;
assert_equals(e.data, "PASS");
t.done();
})
}, "Loading of resources/do_not_expect_client_hints_headers.html did not finish.");
</script>
</body>
</html>

View file

@ -0,0 +1,28 @@
<html>
<meta http-equiv="Accept-CH" content="DPR Width">
<title>Accept-CH malformed http-equiv test</title>
<body>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
promise_test(t => {
return fetch("/client-hints/echo_client_hints_received.py").then(r => {
assert_equals(r.status, 200)
// Verify that the browser does not include client hints in the headers
// since Accept-CH value in http-equiv is malformed (includes whitespace
// between attributes instead of comma).
assert_false(r.headers.has("device-memory-received"), "device-memory-received");
assert_false(r.headers.has("dpr-received"), "dpr-received");
assert_false(r.headers.has("viewport-width-received"), "viewport-width-received");
assert_false(r.headers.has("rtt-received"), "rtt-received");
assert_false(r.headers.has("downlink-received"), "downlink-received");
assert_false(r.headers.has("ect-received"), "ect-received");
});
}, "Accept-CH malformed http-equiv test");
</script>
</body>
</html>

View file

@ -1,2 +1,2 @@
Accept-CH: device-memory
Accept-CH-Lifetime: 20
Accept-CH-Lifetime: 5

View file

@ -1,8 +1,5 @@
<html>
<body>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
// This test checks if browser attaches the device-memory client hint in the
@ -11,18 +8,15 @@
// echo_client_hints_received.py sets the response headers depending on the set
// of client hints it receives in the request headers.
promise_test(t => {
return fetch("../echo_client_hints_received.py").then(r => {
assert_equals(r.status, 200)
// Verify that the browser did not include client hints in the request
// headers when fetching echo_client_hints_received.py.
assert_false(r.headers.has("device-memory-received"), "device-memory-received");
fetch("../echo_client_hints_received.py").then(r => {
if(r.status == 200 && !r.headers.has("device-memory-received")) {
window.top.opener.postMessage('PASS', '*');
});
}, "Test if device-memory header was not sent by the browser");
}
else {
window.top.opener.postMessage('FAIL', '*');
}
});
</script>
</body>
</html>

View file

@ -1,8 +1,5 @@
<html>
<body>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
// This test checks if browser attaches the device-memory client hint in the
@ -11,18 +8,15 @@
// echo_client_hints_received.py sets the response headers depending on the set
// of client hints it receives in the request headers.
promise_test(t => {
return fetch("../echo_client_hints_received.py").then(r => {
assert_equals(r.status, 200)
// Verify that the browser included client hints in the request headers when
// fetching echo_client_hints_received.py.
assert_true(r.headers.has("device-memory-received"), "device-memory-received");
fetch("../echo_client_hints_received.py").then(r => {
if(r.status == 200 && r.headers.has("device-memory-received")) {
window.top.opener.postMessage('PASS', '*');
});
}, "Test if device-memory header was sent by the browser");
}
else {
window.top.opener.postMessage('FAIL', '*');
}
});
</script>
</body>
</html>

View file

@ -0,0 +1,6 @@
<html>
<meta http-equiv="Accept-CH" content="device-memory">
<meta http-equiv="Accept-CH-Lifetime" content="5">
<body>
</body>
</html>

View file

@ -1,3 +1,3 @@
spec: https://w3c.github.io/clipboard-apis/
suggested_reviewers:
- garykac
- hallvors

View file

@ -1,3 +1,4 @@
spec: https://compat.spec.whatwg.org/
suggested_reviewers:
- cdumez
- foolip

View file

@ -1,65 +0,0 @@
<!DOCTYPE html>
<title>-webkit-appearance support</title>
<!-- There is no spec for -webkit-appearance. It is supported in Opera, Safari,
Chrome, and Edge. Firefox has expressed intent to support it. -->
<link rel="help" href="https://github.com/whatwg/compat/issues/6">
<meta name="assert" content="This test checks for support of the -webkit-appearance CSS attribute." />
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="tester"></div>
<script>
const WEBKIT_APPEARANCE_VALUES = [
'none',
'checkbox',
'radio',
'push-button',
'square-button',
'button',
'button-bevel',
'inner-spin-button',
'listbox',
'listitem',
'media-enter-fullscreen-button',
'media-exit-fullscreen-button',
'media-mute-button',
'media-play-button',
'media-overlay-play-button',
'media-toggle-closed-captions-button',
'media-slider',
'media-sliderthumb',
'media-volume-slider-container',
'media-volume-slider',
'media-volume-sliderthumb',
'media-controls-background',
'media-controls-fullscreen-background',
'media-current-time-display',
'media-time-remaining-display',
'menulist',
'menulist-button',
'menulist-text',
'menulist-textfield',
'meter',
'progress-bar',
'progress-bar-value',
'slider-horizontal',
'slider-vertical',
'sliderthumb-horizontal',
'sliderthumb-vertical',
'caret',
'searchfield',
'searchfield-cancel-button',
'textfield',
'textarea',
];
for (const appearance_value of WEBKIT_APPEARANCE_VALUES) {
test(() => {
const div = document.getElementById('tester');
div.style = `-webkit-appearance: ${appearance_value}`;
assert_equals(getComputedStyle(div).webkitAppearance, appearance_value);
});
}
</script>

View file

@ -1,3 +1,4 @@
spec: https://console.spec.whatwg.org/
suggested_reviewers:
- domenic
- pwnall

View file

@ -4,7 +4,7 @@
<title>Console Count Reset - Logging Manual Test</title>
<meta name="author" title="Dominic Farolino" href="mailto:domfarolino@gmail.com">
<meta name="assert" content="Console countReset method">
<link rel="help" href="https://console.spec.whatwg.org/#countReset">
<link rel="help" href="https://console.spec.whatwg.org/#countreset">
</head>
<body>
<p>Open the console inside the developer tools. It should contain entries whose contents are:</p>

View file

@ -0,0 +1,70 @@
<!DOCTYPE html>
<html>
<head>
<title>Console Timing Methods - Logging Manual Test</title>
<meta name="author" title="Dominic Farolino" href="mailto:domfarolino@gmail.com">
<meta name="assert" content="Console timing methods">
<link rel="help" href="https://console.spec.whatwg.org/#timing">
</head>
<body>
<p>Open the console inside the developer tools. It should contain entries whose contents are:</p>
<p><code>default: &lt;some time></code></p>
<p><code>default: &lt;some time></code></p>
<p><code>default: &lt;some time></code></p>
<p><code>default: &lt;some time> extra data</code></p>
<p><code>default: &lt;some time></code></p>
<p><code>default: &lt;some time></code></p>
<p><code>default: &lt;some time> extra data</code></p>
<p><code>default: &lt;some time></code></p>
<p><code>default: &lt;some time></code></p>
<p><code>default: &lt;some time> extra data</code></p>
<p><code>default: &lt;some time></code></p>
<p><code>custom toString(): &lt;some time></code></p>
<p><code>custom toString(): &lt;some time> extra data</code></p>
<p><code>custom toString(): &lt;some time></code></p>
<p><code>a label: &lt;some time></code></p>
<p><code>a label: &lt;some time> extra data</code></p>
<p><code>a label: &lt;some time></code></p>
<p style="color:grey;">[some warning message indicating that a timer for label "b" does not exist]</p>
<script>
console.time();
console.timeLog();
console.timeEnd();
console.time(undefined);
console.timeLog(undefined);
console.timeLog(undefined, "extra data");
console.timeEnd(undefined);
console.time("default");
console.timeLog("default");
console.timeLog("default", "extra data");
console.timeEnd("default");
console.time({toString() {return "default"}});
console.timeLog({toString() {return "default"}});
console.timeLog({toString() {return "default"}}, "extra data");
console.timeEnd({toString() {return "default"}});
console.time({toString() {return "custom toString()"}});
console.timeLog({toString() {return "custom toString()"}});
console.timeLog({toString() {return "custom toString()"}}, "extra data");
console.timeEnd({toString() {return "custom toString()"}});
console.time("a label");
console.timeLog("a label");
console.timeLog("a label", "extra data");
console.timeEnd("a label");
console.timeLog("b"); // should produce a warning
console.timeEnd("b"); // should produce a warning
</script>
</body>
</html>

View file

@ -1,2 +1,3 @@
spec: https://w3c.github.io/webappsec-csp/
suggested_reviewers:
- hillbrad

View file

@ -0,0 +1,21 @@
// META: script=/resources/WebIDLParser.js
// META: script=/resources/idlharness.js
// https://w3c.github.io/webappsec-csp/embedded/
'use strict';
promise_test(async () => {
const idl = await fetch('/interfaces/csp-embedded-enforcement.idl').then(r => r.text());
const html = await fetch('/interfaces/html.idl').then(r => r.text());
const dom = await fetch('/interfaces/dom.idl').then(r => r.text());
const idl_array = new IdlArray();
idl_array.add_idls(idl);
idl_array.add_dependency_idls(html);
idl_array.add_dependency_idls(dom);
idl_array.add_objects({
HTMLIFrameElement: ['document.createElement("iframe")'],
});
idl_array.test();
}, 'csp-embedded-enforcement IDL');

View file

@ -7,7 +7,8 @@
var watcher = new EventWatcher(t, document, 'securitypolicyviolation');
watcher.wait_for('securitypolicyviolation').then(t.step_func_done(e => {
assert_equals(e.blockedURI, "eval");
assert_equals(e.lineNumber, 14);
assert_equals(e.lineNumber, 15);
assert_equals(e.columnNumber, 12);
}));
try {

View file

@ -7,7 +7,8 @@
var watcher = new EventWatcher(t, document, 'securitypolicyviolation');
watcher.wait_for('securitypolicyviolation').then(t.step_func_done(e => {
assert_equals(e.blockedURI, "inline");
assert_equals(e.lineNumber, 14);
assert_equals(e.lineNumber, 15);
assert_equals(e.columnNumber, 1);
}));
}, "Inline violations have a blockedURI of 'inline'");
</script>

View file

@ -1,54 +0,0 @@
<!DOCTYPE html>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src=/resources/WebIDLParser.js></script>
<script src=/resources/idlharness.js></script>
<script type="text/plain" id="untested">
enum SecurityPolicyViolationEventDisposition {
"enforce", "report"
};
dictionary SecurityPolicyViolationEventInit : EventInit {
DOMString documentURI;
DOMString referrer;
DOMString blockedURI;
DOMString violatedDirective;
DOMString effectiveDirective;
DOMString originalPolicy;
DOMString sourceFile;
SecurityPolicyViolationEventDisposition disposition;
unsigned short statusCode;
long lineNumber;
long columnNumber;
};
</script>
<script type="text/plain" id="tested">
[Constructor(DOMString type, optional SecurityPolicyViolationEventInit eventInitDict)]
interface SecurityPolicyViolationEvent : Event {
readonly attribute DOMString documentURI;
readonly attribute DOMString referrer;
readonly attribute DOMString blockedURI;
readonly attribute DOMString violatedDirective;
readonly attribute DOMString effectiveDirective;
readonly attribute DOMString originalPolicy;
readonly attribute DOMString sourceFile;
readonly attribute SecurityPolicyViolationEventDisposition disposition;
readonly attribute unsigned short statusCode;
readonly attribute long lineNumber;
readonly attribute long columnNumber;
};
</script>
<script>
promise_test(async function() {
const dom = await fetch('/interfaces/dom.idl').then(r => r.text());
const idl_array = new IdlArray();
idl_array.add_untested_idls(document.querySelector('#untested').textContent);
idl_array.add_untested_idls(dom, { only: ['Event', 'EventInit'] });
idl_array.add_idls(document.querySelector('#tested').textContent);
idl_array.add_objects({
SecurityPolicyViolationEvent: ['new SecurityPolicyViolationEvent({})']
});
idl_array.test();
})
</script>

View file

@ -0,0 +1,19 @@
// META: script=/resources/WebIDLParser.js
// META: script=/resources/idlharness.js
// https://w3c.github.io/webappsec-csp/
'use strict';
idl_test(
['CSP'],
['dom'],
idl_array => {
idl_array.add_objects({
SecurityPolicyViolationEvent: [
'new SecurityPolicyViolationEvent("securitypolicyviolation")'
]
})
},
'Test Content Security Policy IDL implementation'
);

View file

@ -35,20 +35,30 @@
}))
.then(t.step_func(e => {
assert_equals(e.blockedURI, "inline");
assert_equals(e.lineNumber, 132);
assert_equals(e.target, document, "Disconnected elements target the document");
assert_equals(e.lineNumber, 118);
assert_equals(e.columnNumber, 4);
assert_equals(e.target, document, "Elements created in this document, but pushed into a same-origin frame trigger on that frame's document, not on this frame's document.");
return watcher.wait_for('securitypolicyviolation');
}))
.then(t.step_func(e => {
assert_equals(e.blockedURI, "inline");
assert_equals(e.lineNumber, 143);
assert_equals(e.target, document, "Elements disconnected after triggering target the document.");
assert_equals(e.lineNumber, 131);
assert_equals(e.columnNumber, 4);
assert_equals(e.target, document, "Elements created in this document, but pushed into a same-origin frame trigger on that frame's document, not on this frame's document.");
return watcher.wait_for('securitypolicyviolation');
}))
.then(t.step_func(e => {
assert_equals(e.blockedURI, "inline");
assert_equals(e.lineNumber, 157);
assert_equals(e.target, document, "Elements in DocumentFragments target the document");
assert_equals(e.lineNumber, 139);
assert_equals(e.columnNumber, 4);
assert_equals(e.target, document, "Inline event handlers for disconnected elements target the document.");
return watcher.wait_for('securitypolicyviolation');
}))
.then(t.step_func(e => {
assert_equals(e.blockedURI, "inline");
assert_equals(e.lineNumber, 0);
assert_equals(e.columnNumber, 0);
assert_equals(e.target, document, "Inline event handlers for elements disconnected after triggering target the document.");
}))
.then(t.step_func_done(_ => {
unexecuted_test.done();
@ -119,7 +129,6 @@
assert_equals(events, 2);
}));
document.querySelector('#block6').contentDocument.body.appendChild(d);
d.click();
}, "Elements created in this document, but pushed into a same-origin frame trigger on that frame's document, not on this frame's document.");
</script>

View file

@ -73,8 +73,8 @@
if(data["csp-report"] != undefined && data["csp-report"][reportField] != undefined) {
assert_field_value(data["csp-report"][reportField], reportValue, reportField);
} else if (data[0] != undefined && data[0]["report"] != undefined && data[0]["report"][reportField] != undefined) {
assert_field_value(data[0]["report"][reportField], reportValue, reportField);
} else if (data[0] != undefined && data[0]["body"] != undefined && data[0]["body"][reportField] != undefined) {
assert_field_value(data[0]["body"][reportField], reportValue, reportField);
} else {
assert_equals("", reportField, "Expected report field could not be found in report");
}

View file

@ -1,2 +1,5 @@
var url = new URL("../support/ping.js", document.baseURI).toString();
assert_worker_is_loaded(url, document.getElementById("foo").getAttribute("data-desc-fallback"));
if (document.getElementById("foo").hasAttribute("blocked-worker"))
assert_worker_is_blocked(url, document.getElementById("foo").getAttribute("data-desc-fallback"));
else
assert_worker_is_loaded(url, document.getElementById("foo").getAttribute("data-desc-fallback"));

View file

@ -1,2 +1,5 @@
var url = new URL("../support/ping.js", document.baseURI).toString();
assert_service_worker_is_loaded(url, document.getElementById("foo").getAttribute("data-desc-fallback"));
if (document.getElementById("foo").hasAttribute("blocked-worker"))
assert_service_worker_is_blocked(url, document.getElementById("foo").getAttribute("data-desc-fallback"));
else
assert_service_worker_is_loaded(url, document.getElementById("foo").getAttribute("data-desc-fallback"));

View file

@ -1,2 +1,5 @@
var url = new URL("../support/ping.js", document.baseURI).toString();
assert_shared_worker_is_loaded(url, document.getElementById("foo").getAttribute("data-desc-fallback"));
if (document.getElementById("foo").hasAttribute("blocked-worker"))
assert_shared_worker_is_blocked(url, document.getElementById("foo").getAttribute("data-desc-fallback"));
else
assert_shared_worker_is_loaded(url, document.getElementById("foo").getAttribute("data-desc-fallback"));

View file

@ -0,0 +1,9 @@
<!doctype html>
<meta charset=utf-8>
<title>Web platform test for dedicated worker allowed by worker-src self</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src="../support/testharness-helper.js"></script>
<meta http-equiv="Content-Security-Policy" content="child-src 'none'; script-src 'self'; default-src 'none'; ">
<script src="../support/dedicated-worker-helper.js" blocked-worker id="foo" data-desc-fallback="Same-origin dedicated worker allowed by worker-src 'self'."></script>

View file

@ -0,0 +1,9 @@
<!doctype html>
<meta charset=utf-8>
<title>Web platform test for service worker allowed by child-src self</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src="../support/testharness-helper.js"></script>
<meta http-equiv="Content-Security-Policy" content="child-src 'none'; script-src 'self'; default-src 'none'; ">
<script src="../support/service-worker-helper.js" blocked-worker id="foo" data-desc-fallback="Same-origin service worker allowed by child-src 'self'."></script>

View file

@ -0,0 +1,9 @@
<!doctype html>
<meta charset=utf-8>
<title>Web platform test for shared worker allowed by child-src self</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src="../support/testharness-helper.js"></script>
<meta http-equiv="Content-Security-Policy" content="child-src 'none'; script-src 'self'; default-src 'none'; ">
<script src="../support/shared-worker-helper.js" blocked-worker id="foo" data-desc-fallback="Same-origin shared worker allowed by child-src 'self'."></script>

Some files were not shown because too many files have changed in this diff Show more