aboutsummaryrefslogtreecommitdiffstats
path: root/tests/wpt/web-platform-tests
diff options
context:
space:
mode:
authorWPT Sync Bot <josh+wptsync@joshmatthews.net>2020-01-23 08:22:35 +0000
committerWPT Sync Bot <josh+wptsync@joshmatthews.net>2020-01-23 10:58:08 +0000
commit36e52003a7cb8086ad70bcab8fb65c970cc88b34 (patch)
tree53bea5ba5d87994d65316d84ad76eaa99d7da1f8 /tests/wpt/web-platform-tests
parent24674687acaaca3a796f8cc61bc98c6e7d0097fb (diff)
downloadservo-36e52003a7cb8086ad70bcab8fb65c970cc88b34.tar.gz
servo-36e52003a7cb8086ad70bcab8fb65c970cc88b34.zip
Update web-platform-tests to revision 7ec633bbfbc01de4972e65f81f593983d9cdc17d
Diffstat (limited to 'tests/wpt/web-platform-tests')
-rw-r--r--tests/wpt/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-in-worker-transfer.html20
-rw-r--r--tests/wpt/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-worker.js17
-rw-r--r--tests/wpt/web-platform-tests/IndexedDB/idb-binary-key-detached.htm4
-rw-r--r--tests/wpt/web-platform-tests/IndexedDB/idbcursor-advance-exception-order.html2
-rw-r--r--tests/wpt/web-platform-tests/IndexedDB/idbkeyrange-includes.htm2
-rw-r--r--tests/wpt/web-platform-tests/bluetooth/idl/idl-BluetoothUUID.html8
-rw-r--r--tests/wpt/web-platform-tests/common/security-features/README.md35
-rw-r--r--tests/wpt/web-platform-tests/common/security-features/tools/format_spec_src_json.py4
-rwxr-xr-xtests/wpt/web-platform-tests/common/security-features/tools/generate.py75
-rw-r--r--tests/wpt/web-platform-tests/common/security-features/tools/template/test.debug.html.template3
-rw-r--r--tests/wpt/web-platform-tests/common/security-features/tools/template/test.release.html.template3
-rw-r--r--tests/wpt/web-platform-tests/common/test-setting-immutable-prototype.js2
-rw-r--r--tests/wpt/web-platform-tests/content-security-policy/generic/eval-typecheck-callout-order.tentative.html2
-rw-r--r--tests/wpt/web-platform-tests/cookie-store/cookieStoreManager_getSubscriptions_multiple.tentative.https.any.js16
-rw-r--r--tests/wpt/web-platform-tests/cookies/samesite/window-open-reload.https.html2
-rw-r--r--tests/wpt/web-platform-tests/cookies/samesite/window-open.https.html2
-rw-r--r--tests/wpt/web-platform-tests/css/css-flexbox/percentage-heights-010.html13
-rw-r--r--tests/wpt/web-platform-tests/css/cssom-view/MediaQueryList-addListener-handleEvent.html28
-rw-r--r--tests/wpt/web-platform-tests/css/cssom/CSSStyleSheet.html4
-rw-r--r--tests/wpt/web-platform-tests/css/cssom/medialist-interfaces-002.html2
-rw-r--r--tests/wpt/web-platform-tests/custom-elements/historical.html4
-rw-r--r--tests/wpt/web-platform-tests/dom/events/EventListener-handleEvent.html87
-rw-r--r--tests/wpt/web-platform-tests/encoding/textdecoder-fatal.any.js2
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/basic/keepalive.html86
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/headers/headers-record.html6
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/resources/keepalive-iframe.html22
-rw-r--r--tests/wpt/web-platform-tests/fetch/api/resources/stash-put.py7
-rw-r--r--tests/wpt/web-platform-tests/fetch/corb/script-resource-with-nonsniffable-types.tentative.sub.html1
-rw-r--r--tests/wpt/web-platform-tests/generic-sensor/SensorErrorEvent-constructor.https.html2
-rw-r--r--tests/wpt/web-platform-tests/html/browsers/origin/cross-origin-objects/cross-origin-objects.html94
-rw-r--r--tests/wpt/web-platform-tests/html/cross-origin-embedder-policy/require-corp.https.html22
-rw-r--r--tests/wpt/web-platform-tests/html/infrastructure/common-dom-interfaces/collections/htmlallcollection.html2
-rw-r--r--tests/wpt/web-platform-tests/html/semantics/document-metadata/the-style-element/style_load_event.html33
-rw-r--r--tests/wpt/web-platform-tests/html/semantics/embedded-content/media-elements/track/track-element/track-cue-mutable.html2
-rw-r--r--tests/wpt/web-platform-tests/interfaces/IndexedDB.idl9
-rw-r--r--tests/wpt/web-platform-tests/interfaces/native-file-system.idl92
-rw-r--r--tests/wpt/web-platform-tests/intersection-observer/document-scrolling-element-root.html6
-rw-r--r--tests/wpt/web-platform-tests/js/behaviours/SetPrototypeOf-window.html8
-rw-r--r--tests/wpt/web-platform-tests/media-source/mediasource-duration-boundaryconditions.html12
-rw-r--r--tests/wpt/web-platform-tests/mediacapture-record/BlobEvent-constructor.html12
-rw-r--r--tests/wpt/web-platform-tests/mediacapture-streams/MediaStreamTrackEvent-constructor.https.html12
-rw-r--r--tests/wpt/web-platform-tests/mediasession/positionstate.html24
-rw-r--r--tests/wpt/web-platform-tests/mediasession/setactionhandler.html4
-rw-r--r--tests/wpt/web-platform-tests/native-file-system/idlharness.https.any.js15
-rw-r--r--tests/wpt/web-platform-tests/payment-request/onpaymentmethodchange-attribute.https.html (renamed from tests/wpt/web-platform-tests/payment-request/onpaymentmenthodchange-attribute.https.html)0
-rw-r--r--tests/wpt/web-platform-tests/referrer-policy/4K+1/generic/spec_json.js1
-rw-r--r--tests/wpt/web-platform-tests/referrer-policy/4K+1/generic/test-case.sub.js11
-rw-r--r--tests/wpt/web-platform-tests/referrer-policy/4K+1/spec.src.json40
-rw-r--r--tests/wpt/web-platform-tests/referrer-policy/4K-1/generic/spec_json.js1
-rw-r--r--tests/wpt/web-platform-tests/referrer-policy/4K-1/generic/test-case.sub.js11
-rw-r--r--tests/wpt/web-platform-tests/referrer-policy/4K-1/spec.src.json40
-rw-r--r--tests/wpt/web-platform-tests/referrer-policy/4K/generic/spec_json.js1
-rw-r--r--tests/wpt/web-platform-tests/referrer-policy/4K/generic/test-case.sub.js11
-rw-r--r--tests/wpt/web-platform-tests/referrer-policy/4K/spec.src.json40
-rw-r--r--tests/wpt/web-platform-tests/referrer-policy/generic/test-case.sub.js155
-rw-r--r--tests/wpt/web-platform-tests/service-workers/service-worker/resources/interfaces-worker.sub.js6
-rw-r--r--tests/wpt/web-platform-tests/tools/wptrunner/requirements.txt2
-rw-r--r--tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/executors/base.py7
-rw-r--r--tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/manifestexpected.py7
-rw-r--r--tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/process.py2
-rw-r--r--tests/wpt/web-platform-tests/tools/wptserve/wptserve/handlers.py18
-rw-r--r--tests/wpt/web-platform-tests/tools/wptserve/wptserve/pipes.py4
-rw-r--r--tests/wpt/web-platform-tests/trusted-types/TrustedTypePolicy-CSP.tentative.html12
-rw-r--r--tests/wpt/web-platform-tests/trusted-types/TrustedTypePolicyFactory-createPolicy-cspTests.tentative.html12
-rw-r--r--tests/wpt/web-platform-tests/url/failure.html6
-rw-r--r--tests/wpt/web-platform-tests/url/toascii.window.js2
-rw-r--r--tests/wpt/web-platform-tests/wasm/jsapi/table/grow-reftypes.tentative.any.js42
-rw-r--r--tests/wpt/web-platform-tests/web-animations/interfaces/Animatable/animate.html14
-rw-r--r--tests/wpt/web-platform-tests/web-animations/interfaces/AnimationEffect/updateTiming.html2
-rw-r--r--tests/wpt/web-platform-tests/web-animations/interfaces/KeyframeEffect/processing-a-keyframes-argument-002.html4
-rw-r--r--tests/wpt/web-platform-tests/web-animations/interfaces/KeyframeEffect/setKeyframes.html2
-rw-r--r--tests/wpt/web-platform-tests/web-nfc/NDEFMessage_constructor.https.html8
-rw-r--r--tests/wpt/web-platform-tests/web-nfc/NDEFReadingEvent_constructor.https.html4
-rw-r--r--tests/wpt/web-platform-tests/web-nfc/NDEFRecord_constructor.https.html50
-rw-r--r--tests/wpt/web-platform-tests/webmessaging/with-options/null-transfer.html2
-rw-r--r--tests/wpt/web-platform-tests/webmessaging/with-ports/023.html2
-rw-r--r--tests/wpt/web-platform-tests/webrtc-extensions/RTCRtpParameters-maxFramerate.html39
-rw-r--r--tests/wpt/web-platform-tests/webrtc-identity/RTCPeerConnection-constructor.html2
-rw-r--r--tests/wpt/web-platform-tests/webrtc/RTCPeerConnection-createDataChannel.html42
-rw-r--r--tests/wpt/web-platform-tests/webrtc/RTCRtpParameters-encodings.html65
-rw-r--r--tests/wpt/web-platform-tests/webrtc/RTCRtpParameters-helper.js66
-rw-r--r--tests/wpt/web-platform-tests/webstorage/event_constructor.html2
-rw-r--r--tests/wpt/web-platform-tests/webstorage/event_initstorageevent.html2
-rw-r--r--tests/wpt/web-platform-tests/webvtt/api/VTTCue/constructor-exceptions.html12
-rw-r--r--tests/wpt/web-platform-tests/workers/modules/dedicated-worker-import-blob-url.any.js6
-rw-r--r--tests/wpt/web-platform-tests/workers/modules/dedicated-worker-import-failure.html6
-rw-r--r--tests/wpt/web-platform-tests/workers/modules/dedicated-worker-import-meta.html18
-rw-r--r--tests/wpt/web-platform-tests/workers/modules/dedicated-worker-import.any.js6
-rw-r--r--tests/wpt/web-platform-tests/workers/modules/dedicated-worker-options-type.html27
-rw-r--r--tests/wpt/web-platform-tests/workers/modules/shared-worker-import-blob-url.any.js6
-rw-r--r--tests/wpt/web-platform-tests/workers/modules/shared-worker-import.any.js6
91 files changed, 1105 insertions, 527 deletions
diff --git a/tests/wpt/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-in-worker-transfer.html b/tests/wpt/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-in-worker-transfer.html
new file mode 100644
index 00000000000..727a8a4978d
--- /dev/null
+++ b/tests/wpt/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-in-worker-transfer.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<meta charset=utf-8>
+<title>createImageBitmap in worker and transfer</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id=log></div>
+<script>
+promise_test(function(t) {
+ return new Promise(function(resolve, reject) {
+ var worker = new Worker("createImageBitmap-worker.js");
+ worker.addEventListener("message", function(evt) {
+ var bitmap = evt.data;
+ assert_equals(bitmap.width, 20);
+ assert_equals(bitmap.height, 20);
+ resolve();
+ });
+ worker.postMessage('test');
+ });
+}, 'Transfer ImageBitmap created in worker');
+</script>
diff --git a/tests/wpt/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-worker.js b/tests/wpt/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-worker.js
new file mode 100644
index 00000000000..67a0904e479
--- /dev/null
+++ b/tests/wpt/web-platform-tests/2dcontext/imagebitmap/createImageBitmap-worker.js
@@ -0,0 +1,17 @@
+function makeBlob() {
+ return new Promise(function(resolve, reject) {
+ var xhr = new XMLHttpRequest();
+ xhr.open("GET", '/images/pattern.png');
+ xhr.responseType = 'blob';
+ xhr.send();
+ xhr.onload = function() {
+ resolve(xhr.response);
+ };
+ });
+}
+
+addEventListener("message", () => {
+ makeBlob().then(createImageBitmap).then(bitmap => {
+ postMessage(bitmap, [bitmap]);
+ });
+});
diff --git a/tests/wpt/web-platform-tests/IndexedDB/idb-binary-key-detached.htm b/tests/wpt/web-platform-tests/IndexedDB/idb-binary-key-detached.htm
index 26afcfb1cd0..5a2e1f79f42 100644
--- a/tests/wpt/web-platform-tests/IndexedDB/idb-binary-key-detached.htm
+++ b/tests/wpt/web-platform-tests/IndexedDB/idb-binary-key-detached.htm
@@ -23,7 +23,7 @@ indexeddb_test(
worker.postMessage('', [buffer]);
assert_equals(array.byteLength, 0);
- assert_throws(new TypeError, () => { store.put('', buffer); });
+ assert_throws_js(TypeError, () => { store.put('', buffer); });
t.done();
},
'Detached ArrayBuffer'
@@ -43,7 +43,7 @@ indexeddb_test(
worker.postMessage('', [array.buffer]);
assert_equals(array.length, 0);
- assert_throws(new TypeError, () => { store.put('', array); });
+ assert_throws_js(TypeError, () => { store.put('', array); });
t.done();
},
'Detached TypedArray'
diff --git a/tests/wpt/web-platform-tests/IndexedDB/idbcursor-advance-exception-order.html b/tests/wpt/web-platform-tests/IndexedDB/idbcursor-advance-exception-order.html
index 13f7fdae5a5..1e05c9074d6 100644
--- a/tests/wpt/web-platform-tests/IndexedDB/idbcursor-advance-exception-order.html
+++ b/tests/wpt/web-platform-tests/IndexedDB/idbcursor-advance-exception-order.html
@@ -23,7 +23,7 @@ indexeddb_test(
const cursor = r.result;
setTimeout(t.step_func(() => {
- assert_throws(new TypeError, () => { cursor.advance(0); },
+ assert_throws_js(TypeError, () => { cursor.advance(0); },
'"zero" check (TypeError) should precede ' +
'"not active" check (TransactionInactiveError)');
t.done();
diff --git a/tests/wpt/web-platform-tests/IndexedDB/idbkeyrange-includes.htm b/tests/wpt/web-platform-tests/IndexedDB/idbkeyrange-includes.htm
index aea588051ae..9a408e888a4 100644
--- a/tests/wpt/web-platform-tests/IndexedDB/idbkeyrange-includes.htm
+++ b/tests/wpt/web-platform-tests/IndexedDB/idbkeyrange-includes.htm
@@ -8,7 +8,7 @@
test(function() {
var range = IDBKeyRange.bound(12, 34);
- assert_throws(new TypeError, function() { range.includes(); },
+ assert_throws_js(TypeError, function() { range.includes(); },
'throws if key is not specified');
assert_throws('DataError', function() { range.includes(undefined); },
diff --git a/tests/wpt/web-platform-tests/bluetooth/idl/idl-BluetoothUUID.html b/tests/wpt/web-platform-tests/bluetooth/idl/idl-BluetoothUUID.html
index 2adf35a419f..14463127e06 100644
--- a/tests/wpt/web-platform-tests/bluetooth/idl/idl-BluetoothUUID.html
+++ b/tests/wpt/web-platform-tests/bluetooth/idl/idl-BluetoothUUID.html
@@ -142,16 +142,16 @@ test(() => {
let func = () => {};
// cannonicalUUID
- assert_throws(new TypeError, () => BluetoothUUID.canonicalUUID(object));
+ assert_throws_js(TypeError, () => BluetoothUUID.canonicalUUID(object));
// [] converts to '', which converts to 0 before the range check.
assert_equals(BluetoothUUID.canonicalUUID(array), base_uuid);
- assert_throws(new TypeError, () => BluetoothUUID.canonicalUUID(func));
- assert_throws(new TypeError, () => BluetoothUUID.canonicalUUID(undefined));
+ assert_throws_js(TypeError, () => BluetoothUUID.canonicalUUID(func));
+ assert_throws_js(TypeError, () => BluetoothUUID.canonicalUUID(undefined));
assert_equals(BluetoothUUID.canonicalUUID(null), base_uuid);
assert_equals(BluetoothUUID.canonicalUUID(false), base_uuid);
assert_equals(
BluetoothUUID.canonicalUUID(true), BluetoothUUID.canonicalUUID(1));
- assert_throws(new TypeError, () => BluetoothUUID.canonicalUUID(NaN));
+ assert_throws_js(TypeError, () => BluetoothUUID.canonicalUUID(NaN));
// getService
assert_throws(TypeError(), () => BluetoothUUID.getService(object));
diff --git a/tests/wpt/web-platform-tests/common/security-features/README.md b/tests/wpt/web-platform-tests/common/security-features/README.md
index 2509d661b4a..46cabd2bb3c 100644
--- a/tests/wpt/web-platform-tests/common/security-features/README.md
+++ b/tests/wpt/web-platform-tests/common/security-features/README.md
@@ -81,6 +81,41 @@ The generator script has two targets: ```release``` and ```debug```.
Note that **release** is the default target when invoking ```generate.py```.
+## Sub projects
+
+Projects can be nested, for example to reuse a single `spec.src.json` across similar but slightly different sets of generated tests.
+The directory structure would look like:
+
+```
+project-directory/ (e.g. referrer-policy/)
+├── spec.src.json - Parent project's spec JSON
+├── generic/
+│ └── test-case.sub.js - Parent project's test helper
+├── gen/ - parent project's generated tests
+└── sub-project-directory/ (e.g. 4K)
+ ├── spec.src.json - Child project's spec JSON
+ ├── generic/
+ │ └── test-case.sub.js - Child project's test helper
+ └── gen/ - child project's generated tests
+```
+
+`generate.py --spec project-directory/sub-project-directory` generates test files under `project-directory/sub-project-directory/gen`, based on `project-directory/spec.src.json` and `project-directory/sub-project-directory/spec.src.json`.
+
+- The child project's `spec.src.json` is merged into parent project's `spec.src.json`.
+ - Two spec JSON objects are merged recursively.
+ - If a same key exists in both objects, the child's value overwrites the parent's value.
+ - If both (child's and parent's) values are arrays, then the child's value is concatenated to the parent's value.
+ - For debugging, `generate.py` dumps the merged spec JSON object as `generic/debug-output.spec.src.json`.
+- The child project's generated tests include both of the parent and child project's `test-case.sub.js`:
+ ```html
+ <script src="project-directory/test-case.sub.js"></script>
+ <script src="project-directory/sub-project-directory/test-case.sub.js"></script>
+ <script>
+ TestCase(...);
+ </script>
+ ```
+
+
## Updating the tests
The main test logic lives in ```project-directory/generic/test-case.sub.js``` with helper functions defined in ```/common/security-features/resources/common.js``` so you should probably start there.
diff --git a/tests/wpt/web-platform-tests/common/security-features/tools/format_spec_src_json.py b/tests/wpt/web-platform-tests/common/security-features/tools/format_spec_src_json.py
index b4549bb710c..d1bf5817ad2 100644
--- a/tests/wpt/web-platform-tests/common/security-features/tools/format_spec_src_json.py
+++ b/tests/wpt/web-platform-tests/common/security-features/tools/format_spec_src_json.py
@@ -7,7 +7,9 @@ def main():
'''Formats spec.src.json.'''
script_directory = os.path.dirname(os.path.abspath(__file__))
for dir in [
- 'mixed-content', 'referrer-policy', 'upgrade-insecure-requests'
+ 'mixed-content', 'referrer-policy', 'referrer-policy/4K-1',
+ 'referrer-policy/4K', 'referrer-policy/4K+1',
+ 'upgrade-insecure-requests'
]:
filename = os.path.join(script_directory, '..', '..', '..', dir,
'spec.src.json')
diff --git a/tests/wpt/web-platform-tests/common/security-features/tools/generate.py b/tests/wpt/web-platform-tests/common/security-features/tools/generate.py
index ba997067b3f..3345d652069 100755
--- a/tests/wpt/web-platform-tests/common/security-features/tools/generate.py
+++ b/tests/wpt/web-platform-tests/common/security-features/tools/generate.py
@@ -130,8 +130,8 @@ def handle_deliveries(policy_deliveries):
return {"meta": meta, "headers": headers}
-def generate_selection(spec_directory, spec_json, selection, spec,
- test_html_template_basename):
+def generate_selection(spec_directory, test_helper_filenames, spec_json,
+ selection, spec, test_html_template_basename):
test_filename = get_test_filename(spec_directory, spec_json, selection)
target_policy_delivery = util.PolicyDelivery(selection['delivery_type'],
@@ -184,9 +184,10 @@ def generate_selection(spec_directory, spec_json, selection, spec,
test_directory = os.path.dirname(test_filename)
- selection['helper_js'] = os.path.relpath(
- os.path.join(spec_directory, 'generic', 'test-case.sub.js'),
- test_directory)
+ selection['helper_js'] = ""
+ for test_helper_filename in test_helper_filenames:
+ selection['helper_js'] += ' <script src="%s"></script>\n' % (
+ os.path.relpath(test_helper_filename, test_directory))
selection['sanity_checker_js'] = os.path.relpath(
os.path.join(spec_directory, 'generic', 'sanity-checker.js'),
test_directory)
@@ -237,17 +238,20 @@ def generate_selection(spec_directory, spec_json, selection, spec,
util.write_file(test_filename, test_html_template % selection)
-def generate_test_source_files(spec_directory, spec_json, target):
+def generate_test_source_files(spec_directory, test_helper_filenames,
+ spec_json, target):
test_expansion_schema = spec_json['test_expansion_schema']
specification = spec_json['specification']
spec_json_js_template = util.get_template('spec_json.js.template')
- generated_spec_json_filename = os.path.join(spec_directory, "generic",
- "spec_json.js")
util.write_file(
- generated_spec_json_filename,
+ os.path.join(spec_directory, "generic", "spec_json.js"),
spec_json_js_template % {'spec_json': json.dumps(spec_json)})
+ util.write_file(
+ os.path.join(spec_directory, "generic", "debug-output.spec.src.json"),
+ json.dumps(spec_json, indent=2, separators=(',', ': ')))
+
# Choose a debug/release template depending on the target.
html_template = "test.%s.html.template" % target
@@ -290,12 +294,26 @@ def generate_test_source_files(spec_directory, spec_json, target):
print('Excluding selection:', selection_path)
continue
try:
- generate_selection(spec_directory, spec_json, selection, spec,
- html_template)
+ generate_selection(spec_directory, test_helper_filenames,
+ spec_json, selection, spec, html_template)
except util.ShouldSkip:
continue
+def merge_json(base, child):
+ for key in child:
+ if key not in base:
+ base[key] = child[key]
+ continue
+ # `base[key]` and `child[key]` both exists.
+ if isinstance(base[key], list) and isinstance(child[key], list):
+ base[key].extend(child[key])
+ elif isinstance(base[key], dict) and isinstance(child[key], dict):
+ merge_json(base[key], child[key])
+ else:
+ base[key] = child[key]
+
+
def main():
parser = argparse.ArgumentParser(
description='Test suite generator utility')
@@ -317,11 +335,38 @@ def main():
spec_directory = os.path.abspath(args.spec)
- spec_filename = os.path.join(spec_directory, "spec.src.json")
- spec_json = util.load_spec_json(spec_filename)
- spec_validator.assert_valid_spec_json(spec_json)
+ # Read `spec.src.json` files, starting from `spec_directory`, and
+ # continuing to parent directories as long as `spec.src.json` exists.
+ spec_filenames = []
+ test_helper_filenames = []
+ spec_src_directory = spec_directory
+ while len(spec_src_directory) >= len(util.test_root_directory):
+ spec_filename = os.path.join(spec_src_directory, "spec.src.json")
+ if not os.path.exists(spec_filename):
+ break
+ spec_filenames.append(spec_filename)
+ test_filename = os.path.join(spec_src_directory, 'generic',
+ 'test-case.sub.js')
+ assert (os.path.exists(test_filename))
+ test_helper_filenames.append(test_filename)
+ spec_src_directory = os.path.abspath(
+ os.path.join(spec_src_directory, ".."))
+
+ spec_filenames = list(reversed(spec_filenames))
+ test_helper_filenames = list(reversed(test_helper_filenames))
+
+ if len(spec_filenames) == 0:
+ print('Error: No spec.src.json is found at %s.' % spec_directory)
+ return
- generate_test_source_files(spec_directory, spec_json, args.target)
+ spec_json = util.load_spec_json(spec_filenames[0])
+ for spec_filename in spec_filenames[1:]:
+ child_spec_json = util.load_spec_json(spec_filename)
+ merge_json(spec_json, child_spec_json)
+
+ spec_validator.assert_valid_spec_json(spec_json)
+ generate_test_source_files(spec_directory, test_helper_filenames,
+ spec_json, args.target)
if __name__ == '__main__':
diff --git a/tests/wpt/web-platform-tests/common/security-features/tools/template/test.debug.html.template b/tests/wpt/web-platform-tests/common/security-features/tools/template/test.debug.html.template
index b4b0fec733e..f09395cff49 100644
--- a/tests/wpt/web-platform-tests/common/security-features/tools/template/test.debug.html.template
+++ b/tests/wpt/web-platform-tests/common/security-features/tools/template/test.debug.html.template
@@ -15,8 +15,7 @@
<script src="%(spec_json_js)s"></script>
<!-- Internal checking of the tests -->
<script src="%(sanity_checker_js)s"></script>
- <script src="%(helper_js)s"></script>
- </head>
+%(helper_js)s </head>
<body>
<script>
TestCase(
diff --git a/tests/wpt/web-platform-tests/common/security-features/tools/template/test.release.html.template b/tests/wpt/web-platform-tests/common/security-features/tools/template/test.release.html.template
index d93506e231a..6bf79f77df1 100644
--- a/tests/wpt/web-platform-tests/common/security-features/tools/template/test.release.html.template
+++ b/tests/wpt/web-platform-tests/common/security-features/tools/template/test.release.html.template
@@ -11,8 +11,7 @@
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/security-features/resources/common.sub.js"></script>
- <script src="%(helper_js)s"></script>
- </head>
+%(helper_js)s </head>
<body>
<script>
TestCase(
diff --git a/tests/wpt/web-platform-tests/common/test-setting-immutable-prototype.js b/tests/wpt/web-platform-tests/common/test-setting-immutable-prototype.js
index 92e61c07424..de619b1d766 100644
--- a/tests/wpt/web-platform-tests/common/test-setting-immutable-prototype.js
+++ b/tests/wpt/web-platform-tests/common/test-setting-immutable-prototype.js
@@ -1,7 +1,7 @@
self.testSettingImmutablePrototypeToNewValueOnly =
(prefix, target, newValue, newValueString, { isSameOriginDomain }) => {
test(() => {
- assert_throws(new TypeError, () => {
+ assert_throws_js(TypeError, () => {
Object.setPrototypeOf(target, newValue);
});
}, `${prefix}: setting the prototype to ${newValueString} via Object.setPrototypeOf should throw a TypeError`);
diff --git a/tests/wpt/web-platform-tests/content-security-policy/generic/eval-typecheck-callout-order.tentative.html b/tests/wpt/web-platform-tests/content-security-policy/generic/eval-typecheck-callout-order.tentative.html
index 7b3c12e3964..0be7cf29a28 100644
--- a/tests/wpt/web-platform-tests/content-security-policy/generic/eval-typecheck-callout-order.tentative.html
+++ b/tests/wpt/web-platform-tests/content-security-policy/generic/eval-typecheck-callout-order.tentative.html
@@ -10,7 +10,7 @@
<script nonce='abc'>
test(function() {
- assert_throws(new EvalError, function() {
+ assert_throws_js(EvalError, function() {
eval("0");
}, "eval of a string should reach host callout");
}, "eval of a string should be checked by CSP");
diff --git a/tests/wpt/web-platform-tests/cookie-store/cookieStoreManager_getSubscriptions_multiple.tentative.https.any.js b/tests/wpt/web-platform-tests/cookie-store/cookieStoreManager_getSubscriptions_multiple.tentative.https.any.js
index 625f5212615..030297e4095 100644
--- a/tests/wpt/web-platform-tests/cookie-store/cookieStoreManager_getSubscriptions_multiple.tentative.https.any.js
+++ b/tests/wpt/web-platform-tests/cookie-store/cookieStoreManager_getSubscriptions_multiple.tentative.https.any.js
@@ -43,7 +43,13 @@ promise_test(async testCase => {
{ name: 'cookie-name1', matchType: 'equals', url: `${scope}/path1` },
];
await registration.cookies.subscribe(subscriptions);
- testCase.add_cleanup(() => registration.cookies.unsubscribe(subscriptions));
+ testCase.add_cleanup(() => {
+ // For non-ServiceWorker environments, registration.unregister() cleans up
+ // cookie subscriptions.
+ if (self.GLOBAL.isWorker()) {
+ return registration.cookies.unsubscribe(subscriptions);
+ }
+ });
}
{
const subscriptions = [
@@ -51,7 +57,13 @@ promise_test(async testCase => {
{ name: 'cookie-prefix', matchType: 'starts-with' },
];
await registration.cookies.subscribe(subscriptions);
- testCase.add_cleanup(() => registration.cookies.unsubscribe(subscriptions));
+ testCase.add_cleanup(() => {
+ // For non-ServiceWorker environments, registration.unregister() cleans up
+ // cookie subscriptions.
+ if (self.GLOBAL.isWorker()) {
+ return registration.cookies.unsubscribe(subscriptions);
+ }
+ });
}
const subscriptions = await registration.cookies.getSubscriptions();
diff --git a/tests/wpt/web-platform-tests/cookies/samesite/window-open-reload.https.html b/tests/wpt/web-platform-tests/cookies/samesite/window-open-reload.https.html
index 9c30bd5ca67..ee2091b1373 100644
--- a/tests/wpt/web-platform-tests/cookies/samesite/window-open-reload.https.html
+++ b/tests/wpt/web-platform-tests/cookies/samesite/window-open-reload.https.html
@@ -34,7 +34,7 @@
window.addEventListener("message", msgHandler);
if (!w)
- reject("Popup could not be opened (did you whitelist the test site in your popup blocker?).");
+ reject("Popup could not be opened (did you allow the test site in your popup blocker?).");
});
});
}, title);
diff --git a/tests/wpt/web-platform-tests/cookies/samesite/window-open.https.html b/tests/wpt/web-platform-tests/cookies/samesite/window-open.https.html
index fe2318acc43..d685eb47fd0 100644
--- a/tests/wpt/web-platform-tests/cookies/samesite/window-open.https.html
+++ b/tests/wpt/web-platform-tests/cookies/samesite/window-open.https.html
@@ -28,7 +28,7 @@
window.addEventListener("message", msgHandler);
if (!w)
- reject("Popup could not be opened (did you whitelist the test site in your popup blocker?).");
+ reject("Popup could not be opened (did you allow the test site in your popup blocker?).");
});
});
}, title);
diff --git a/tests/wpt/web-platform-tests/css/css-flexbox/percentage-heights-010.html b/tests/wpt/web-platform-tests/css/css-flexbox/percentage-heights-010.html
new file mode 100644
index 00000000000..003cc2487ae
--- /dev/null
+++ b/tests/wpt/web-platform-tests/css/css-flexbox/percentage-heights-010.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<title>A height: 100% descendant should trigger a relayout when stretching.</title>
+<link rel="help" href="https://drafts.csswg.org/css-flexbox-1/#definite-sizes" />
+<link rel="help" href="https://bugs.chromium.org/p/chromium/issues/detail?id=1043071" />
+<link rel="match" href="../reference/ref-filled-green-100px-square.xht" />
+<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
+<div style="display: flex; width: 100px;">
+ <div style="display: flex; flex-direction: column; flex: 1; min-height: 100px;">
+ <div style="flex: 1; background: red;">
+ <div style="height: 100%; background-color: green;"></div>
+ </div>
+ </div>
+</div>
diff --git a/tests/wpt/web-platform-tests/css/cssom-view/MediaQueryList-addListener-handleEvent.html b/tests/wpt/web-platform-tests/css/cssom-view/MediaQueryList-addListener-handleEvent.html
index 5bdd9dfc9ce..47267d98bba 100644
--- a/tests/wpt/web-platform-tests/css/cssom-view/MediaQueryList-addListener-handleEvent.html
+++ b/tests/wpt/web-platform-tests/css/cssom-view/MediaQueryList-addListener-handleEvent.html
@@ -71,36 +71,38 @@ promise_test(async t => {
assert_equals(calls, 1);
}, "doesn't look up handleEvent method on callable event listeners");
-const uncaught_error_test = async (t, listener) => {
+const uncaught_error_test = async (t, getHandleEvent) => {
const mql = await createMQL(t);
- mql.addListener(listener);
- const eventWatcher = new EventWatcher(t, window, "error");
+ let calls = 0;
+ mql.addListener({
+ get handleEvent() {
+ calls++;
+ return getHandleEvent();
+ },
+ });
+
+ const eventWatcher = new EventWatcher(t, window, "error", waitForChangesReported);
const errorPromise = eventWatcher.wait_for("error");
triggerMQLEvent(mql);
const event = await errorPromise;
+ assert_equals(calls, 1, "handleEvent property was not looked up");
throw event.error;
};
promise_test(t => {
const error = { name: "test" };
- const listener = {
- get handleEvent() {
- throw error;
- },
- };
- return promise_rejects_exactly(t, error, uncaught_error_test(t, listener));
+ return promise_rejects_exactly(t, error,
+ uncaught_error_test(t, () => { throw error; }));
}, "rethrows errors when getting handleEvent");
promise_test(t => {
- const listener = { handleEvent: null };
- return promise_rejects(t, new TypeError(), uncaught_error_test(t, listener));
+ return promise_rejects(t, new TypeError(), uncaught_error_test(t, () => false));
}, "throws if handleEvent is falsy and not callable");
promise_test(t => {
- const listener = { handleEvent: "str" };
- return promise_rejects(t, new TypeError(), uncaught_error_test(t, listener));
+ return promise_rejects(t, new TypeError(), uncaught_error_test(t, () => "str"));
}, "throws if handleEvent is thruthy and not callable");
</script>
diff --git a/tests/wpt/web-platform-tests/css/cssom/CSSStyleSheet.html b/tests/wpt/web-platform-tests/css/cssom/CSSStyleSheet.html
index 90cfb02751f..d38efc28023 100644
--- a/tests/wpt/web-platform-tests/css/cssom/CSSStyleSheet.html
+++ b/tests/wpt/web-platform-tests/css/cssom/CSSStyleSheet.html
@@ -45,7 +45,7 @@
}, 'insertRule with #bar selector');
test(function() {
- assert_throws(new TypeError, function() { styleSheet.insertRule() });
+ assert_throws_js(TypeError, function() { styleSheet.insertRule() });
}, 'insertRule with no argument throws');
test(function() {
@@ -65,7 +65,7 @@
}, 'deleteRule(1)');
test(function() {
- assert_throws(new TypeError, function() { styleSheet.deleteRule() });
+ assert_throws_js(TypeError, function() { styleSheet.deleteRule() });
}, 'deleteRule with no argument throws');
test(function() {
diff --git a/tests/wpt/web-platform-tests/css/cssom/medialist-interfaces-002.html b/tests/wpt/web-platform-tests/css/cssom/medialist-interfaces-002.html
index 9820015f5e0..210ace1393a 100644
--- a/tests/wpt/web-platform-tests/css/cssom/medialist-interfaces-002.html
+++ b/tests/wpt/web-platform-tests/css/cssom/medialist-interfaces-002.html
@@ -36,7 +36,7 @@
// MediaList.deleteMedium called without argument throws error.
test(function() {
media_list = setup();
- assert_throws(new TypeError, function() { media_list.deleteMedium(); });
+ assert_throws_js(TypeError, function() { media_list.deleteMedium(); });
}, "deleteMedium_called_without_argument");
// MediaList.deleteMedium removes correct medium and updates corresponding properties.
diff --git a/tests/wpt/web-platform-tests/custom-elements/historical.html b/tests/wpt/web-platform-tests/custom-elements/historical.html
index 70981ce59c4..5a961b13ad7 100644
--- a/tests/wpt/web-platform-tests/custom-elements/historical.html
+++ b/tests/wpt/web-platform-tests/custom-elements/historical.html
@@ -17,7 +17,7 @@ test(() => {
assert_false(element.hasAttribute('is'))
} catch (e) {
// If v1 is supported, then converting string to dictionary should throw.
- assert_throws(new TypeError, function() { throw e })
+ assert_throws_js(TypeError, function() { throw e })
}
}, 'document.createElement(localName, "string") should not work')
@@ -29,7 +29,7 @@ test(() => {
assert_false(element.hasAttribute('is'))
} catch (e) {
// If v1 is supported, then converting string to dictionary should throw.
- assert_throws(new TypeError, function() { throw e })
+ assert_throws_js(TypeError, function() { throw e })
}
}, 'document.createElementNS(namespace, qualifiedName, "string") should not work')
</script>
diff --git a/tests/wpt/web-platform-tests/dom/events/EventListener-handleEvent.html b/tests/wpt/web-platform-tests/dom/events/EventListener-handleEvent.html
index 1eb80ccb15f..27730b20c58 100644
--- a/tests/wpt/web-platform-tests/dom/events/EventListener-handleEvent.html
+++ b/tests/wpt/web-platform-tests/dom/events/EventListener-handleEvent.html
@@ -30,30 +30,6 @@ test(function(t) {
test(function(t) {
var type = "foo";
var target = document.createElement("div");
- var thrownError = { name: "test" };
- var uncaughtError;
- var errorHandler = function(event) {
- uncaughtError = event.error;
- };
-
- window.addEventListener("error", errorHandler);
- t.add_cleanup(function() {
- window.removeEventListener("error", errorHandler);
- });
-
- target.addEventListener(type, {
- get handleEvent() {
- throw thrownError;
- },
- });
-
- target.dispatchEvent(new Event(type));
- assert_equals(thrownError, uncaughtError);
-}, "rethrows errors when getting `handleEvent`");
-
-test(function(t) {
- var type = "foo";
- var target = document.createElement("div");
var calls = 0;
target.addEventListener(type, {
@@ -81,45 +57,46 @@ test(function(t) {
assert_equals(calls, 1);
}, "doesn't call `handleEvent` method on callable `EventListener`");
-test(function(t) {
- var type = "foo";
- var target = document.createElement("div");
- var uncaughtError;
- var errorHandler = function(event) {
- uncaughtError = event.error;
- };
-
- window.addEventListener("error", errorHandler);
- t.add_cleanup(function() {
- window.removeEventListener("error", errorHandler);
- });
+const uncaught_error_test = async (t, getHandleEvent) => {
+ const type = "foo";
+ const target = document.createElement("div");
+ let calls = 0;
target.addEventListener(type, {
- handleEvent: null,
+ get handleEvent() {
+ calls++;
+ return getHandleEvent();
+ },
});
+ const timeout = () => {
+ return new Promise(resolve => {
+ t.step_timeout(resolve, 0);
+ });
+ };
+
+ const eventWatcher = new EventWatcher(t, window, "error", timeout);
+ const errorPromise = eventWatcher.wait_for("error");
+
target.dispatchEvent(new Event(type));
- assert_true(uncaughtError instanceof TypeError);
-}, "throws if `handleEvent` is falsy and not callable");
-test(function(t) {
- var type = "foo";
- var target = document.createElement("div");
- var uncaughtError;
- var errorHandler = function(event) {
- uncaughtError = event.error;
- };
+ const event = await errorPromise;
+ assert_equals(calls, 1, "handleEvent property was not looked up");
+ throw event.error;
+};
- window.addEventListener("error", errorHandler);
- t.add_cleanup(function() {
- window.removeEventListener("error", errorHandler);
- });
+promise_test(t => {
+ const error = { name: "test" };
- target.addEventListener(type, {
- handleEvent: 1,
- });
+ return promise_rejects_exactly(t, error,
+ uncaught_error_test(t, () => { throw error; }));
+}, "rethrows errors when getting `handleEvent`");
- target.dispatchEvent(new Event(type));
- assert_true(uncaughtError instanceof TypeError);
+promise_test(t => {
+ return promise_rejects(t, new TypeError(), uncaught_error_test(t, () => null));
+}, "throws if `handleEvent` is falsy and not callable");
+
+promise_test(t => {
+ return promise_rejects(t, new TypeError(), uncaught_error_test(t, () => 42));
}, "throws if `handleEvent` is thruthy and not callable");
</script>
diff --git a/tests/wpt/web-platform-tests/encoding/textdecoder-fatal.any.js b/tests/wpt/web-platform-tests/encoding/textdecoder-fatal.any.js
index 5884f11ec3c..ba8aa5d06c3 100644
--- a/tests/wpt/web-platform-tests/encoding/textdecoder-fatal.any.js
+++ b/tests/wpt/web-platform-tests/encoding/textdecoder-fatal.any.js
@@ -71,7 +71,7 @@ test(() => {
assert_equals(decoder.decode(new DataView(bytes.buffer, 0, 3)),
'♥',
'decode() should decode full sequence');
- assert_throws(new TypeError,
+ assert_throws_js(TypeError,
() => decoder.decode(new DataView(bytes.buffer, 0, 2)),
'decode() should throw on incomplete sequence');
assert_equals(decoder.decode(new DataView(bytes.buffer, 0, 3)),
diff --git a/tests/wpt/web-platform-tests/fetch/api/basic/keepalive.html b/tests/wpt/web-platform-tests/fetch/api/basic/keepalive.html
index 5316410004a..447ef2ddfec 100644
--- a/tests/wpt/web-platform-tests/fetch/api/basic/keepalive.html
+++ b/tests/wpt/web-platform-tests/fetch/api/basic/keepalive.html
@@ -7,25 +7,85 @@
<script src="/common/get-host-info.sub.js"></script>
<body>
<script>
+function getUrl(origin1, origin2, withHeaders) {
+ const frameOrigin = host_info.HTTP_NOTSAMESITE_ORIGIN;
+ return `${frameOrigin}/fetch/api/resources/keepalive-iframe.html?` +
+ `origin1=${origin1}&` +
+ `origin2=${origin2}&` +
+ (withHeaders ? `with-headers` : ``);
+}
+
+async function getToken() {
+ return new Promise((resolve) => {
+ window.addEventListener('message', (event) => {
+ resolve(event.data);
+ }, {once: true});
+ });
+}
+
+async function queryToken(token) {
+ const response = await fetch(`../resources/stash-take.py?key=${token}`);
+ const json = await response.json();
+ return json;
+}
+
+// In order to parallelize the work, we are going to have an async_test
+// for the rest of the work. Note that we want the serialized behavior
+// for the steps so far, so we don't want to make the entire test case
+// an async_test.
+function checkToken(testName, token) {
+ async_test((test) => {
+ new Promise((resolve) => test.step_timeout(resolve, 1000)).then(() => {
+ return queryToken(token);
+ }).then((result) => {
+ assert_equals(result, 'on');
+ }).then(() => {
+ test.done();
+ }).catch(test.step_func((e) => {
+ assert_unreached(e);
+ }));
+ }, testName);
+}
+
const host_info = get_host_info();
promise_test(async (test) => {
const iframe = document.createElement('iframe');
- iframe.src = host_info.HTTP_REMOTE_ORIGIN +
- '/fetch/api/resources/keepalive-iframe.html';
+ iframe.src = getUrl('', '', false);
document.body.appendChild(iframe);
- const uuid_promise = new Promise((resolve) => {
- window.addEventListener('message', (event) => {
- resolve(event.data);
- });
- });
+ const tokenPromise = getToken();
await (new Promise((resolve) => iframe.addEventListener('load', resolve)));
- const uuid = await uuid_promise;
+ const token = await tokenPromise;
iframe.remove();
- await (new Promise((resolve) => test.step_timeout(resolve, 1000)));
- const response = await fetch(`../resources/stash-take.py?key=${uuid}`);
- const json = await response.json();
- assert_equals(json, 'on');
-});
+
+ checkToken('same-origin', token);
+}, 'same-origin; setting up');
+
+promise_test(async (test) => {
+ const iframe = document.createElement('iframe');
+ iframe.src = getUrl(host_info.HTTP_REMOTE_ORIGIN,
+ host_info.HTTP_REMOTE_ORIGIN_WITH_DIFFERENT_PORT, false);
+ document.body.appendChild(iframe);
+ const tokenPromise = getToken();
+ await (new Promise((resolve) => iframe.addEventListener('load', resolve)));
+ const token = await tokenPromise;
+ iframe.remove();
+
+ checkToken('cross-origin redirect', token);
+}, 'cross-origin redirect; setting up');
+
+promise_test(async (test) => {
+ const iframe = document.createElement('iframe');
+ iframe.src = getUrl(host_info.HTTP_REMOTE_ORIGIN,
+ host_info.HTTP_REMOTE_ORIGIN_WITH_DIFFERENT_PORT, true);
+ document.body.appendChild(iframe);
+ const tokenPromise = getToken();
+ await (new Promise((resolve) => iframe.addEventListener('load', resolve)));
+ const token = await tokenPromise;
+ iframe.remove();
+
+ checkToken('cross-origin redirect with preflight', token);
+}, 'cross-origin redirect with preflight; setting up');
+
</script>
</body>
</html>
diff --git a/tests/wpt/web-platform-tests/fetch/api/headers/headers-record.html b/tests/wpt/web-platform-tests/fetch/api/headers/headers-record.html
index 85dfadd269d..34acc3b1c55 100644
--- a/tests/wpt/web-platform-tests/fetch/api/headers/headers-record.html
+++ b/tests/wpt/web-platform-tests/fetch/api/headers/headers-record.html
@@ -35,7 +35,7 @@ test(function() {
}, "Passing undefined to Headers constructor");
test(function() {
- assert_throws(new TypeError, function() {
+ assert_throws_js(TypeError, function() {
var h = new Headers(null);
});
}, "Passing null to Headers constructor");
@@ -126,7 +126,7 @@ test(function() {
this.add_cleanup(clearLog);
var record = { a: "b", "\uFFFF": "d" };
var proxy = new Proxy(record, loggingHandler);
- assert_throws(new TypeError, function() {
+ assert_throws_js(TypeError, function() {
var h = new Headers(proxy);
});
@@ -151,7 +151,7 @@ test(function() {
this.add_cleanup(clearLog);
var record = { a: "\uFFFF", c: "d" }
var proxy = new Proxy(record, loggingHandler);
- assert_throws(new TypeError, function() {
+ assert_throws_js(TypeError, function() {
var h = new Headers(proxy);
});
diff --git a/tests/wpt/web-platform-tests/fetch/api/resources/keepalive-iframe.html b/tests/wpt/web-platform-tests/fetch/api/resources/keepalive-iframe.html
index 742309ab4d2..47de0da7790 100644
--- a/tests/wpt/web-platform-tests/fetch/api/resources/keepalive-iframe.html
+++ b/tests/wpt/web-platform-tests/fetch/api/resources/keepalive-iframe.html
@@ -2,16 +2,24 @@
<html>
<meta charset="utf-8">
<script src="/common/utils.js"></script>
+<script src="/common/get-host-info.sub.js"></script>
<script>
-const uuid = token();
-const URL =
- `../resources/redirect.py?` +
- `delay=100&` +
- `location=../resources/stash-put.py?key=${uuid}%26value=on`;
+const SEARCH_PARAMS = new URL(location.href).searchParams;
+const ORIGIN1 = SEARCH_PARAMS.get('origin1') || '';
+const ORIGIN2 = SEARCH_PARAMS.get('origin2') || '';
+const WITH_HEADERS = !!SEARCH_PARAMS.has('with-headers');
+const TOKEN = token();
+
+const url =
+ `${ORIGIN1}/fetch/api/resources/redirect.py?` +
+ `delay=500&` +
+ `allow_headers=foo&` +
+ `location=${ORIGIN2}/fetch/api/resources/stash-put.py?key=${TOKEN}%26value=on`;
addEventListener('load', () => {
- let p = fetch(URL, {keepalive: true});
- window.parent.postMessage(uuid, '*');
+ const headers = WITH_HEADERS ? {'foo': 'bar'} : undefined;
+ let p = fetch(url, {keepalive: true, headers});
+ window.parent.postMessage(TOKEN, '*');
});
</script>
</html>
diff --git a/tests/wpt/web-platform-tests/fetch/api/resources/stash-put.py b/tests/wpt/web-platform-tests/fetch/api/resources/stash-put.py
index dd84ff1fc85..36527b98b71 100644
--- a/tests/wpt/web-platform-tests/fetch/api/resources/stash-put.py
+++ b/tests/wpt/web-platform-tests/fetch/api/resources/stash-put.py
@@ -1,4 +1,11 @@
def main(request, response):
+ if request.method == 'OPTIONS':
+ # CORS preflight
+ response.headers.set('Access-Control-Allow-Origin', '*')
+ response.headers.set('Access-Control-Allow-Methods', '*')
+ response.headers.set('Access-Control-Allow-Headers', '*')
+ return 'done'
+
url_dir = '/'.join(request.url_parts.path.split('/')[:-1]) + '/'
key = request.GET.first("key")
value = request.GET.first("value")
diff --git a/tests/wpt/web-platform-tests/fetch/corb/script-resource-with-nonsniffable-types.tentative.sub.html b/tests/wpt/web-platform-tests/fetch/corb/script-resource-with-nonsniffable-types.tentative.sub.html
index 917e54984f4..255ff1da267 100644
--- a/tests/wpt/web-platform-tests/fetch/corb/script-resource-with-nonsniffable-types.tentative.sub.html
+++ b/tests/wpt/web-platform-tests/fetch/corb/script-resource-with-nonsniffable-types.tentative.sub.html
@@ -63,6 +63,7 @@ protected_mime_types = [
"application/x-protobuf",
"application/zip",
"multipart/byteranges",
+ "multipart/signed",
"text/csv",
"text/event-stream",
]
diff --git a/tests/wpt/web-platform-tests/generic-sensor/SensorErrorEvent-constructor.https.html b/tests/wpt/web-platform-tests/generic-sensor/SensorErrorEvent-constructor.https.html
index 6e2d1684f57..2d68dec56d9 100644
--- a/tests/wpt/web-platform-tests/generic-sensor/SensorErrorEvent-constructor.https.html
+++ b/tests/wpt/web-platform-tests/generic-sensor/SensorErrorEvent-constructor.https.html
@@ -6,7 +6,7 @@
<script>
test(() => {
assert_equals(SensorErrorEvent.length, 2);
- assert_throws(new TypeError, () => new SensorErrorEvent('error'));
+ assert_throws_js(TypeError, () => new SensorErrorEvent('error'));
}, 'SensorErrorEvent constructor without init dict');
test(() => {
diff --git a/tests/wpt/web-platform-tests/html/browsers/origin/cross-origin-objects/cross-origin-objects.html b/tests/wpt/web-platform-tests/html/browsers/origin/cross-origin-objects/cross-origin-objects.html
index f16a18d639c..2c92d5e51ad 100644
--- a/tests/wpt/web-platform-tests/html/browsers/origin/cross-origin-objects/cross-origin-objects.html
+++ b/tests/wpt/web-platform-tests/html/browsers/origin/cross-origin-objects/cross-origin-objects.html
@@ -135,7 +135,7 @@ function addPromiseThenTest(func, desc) {
}
/*
- * Basic sanity testing.
+ * Basic smoke tests for same-origin and cross-origin behaviors.
*/
addTest(function(win) {
@@ -154,14 +154,14 @@ addTest(function(win) {
}, "Basic sanity-checking");
/*
- * Whitelist behavior.
+ * Tests regarding which properties are allowed cross-origin.
*
* Also tests for [[GetOwnProperty]] and [[HasOwnProperty]] behavior.
*/
-var whitelistedSymbols = [Symbol.toStringTag, Symbol.hasInstance,
+var allowedSymbols = [Symbol.toStringTag, Symbol.hasInstance,
Symbol.isConcatSpreadable];
-var windowWhitelists = {
+var windowAllowlists = {
namedFrames: ['donotleakme'],
indices: ['0', '1'],
getters: ['location', 'window', 'frames', 'self', 'top', 'parent',
@@ -174,22 +174,22 @@ var windowWhitelists = {
// otherwise throw. They are not, however, cross-origin accessible.
promiseMethods: ['createImageBitmap', 'fetch'],
}
-windowWhitelists.propNames = Array.from(new Set([...windowWhitelists.indices,
- ...windowWhitelists.getters,
- ...windowWhitelists.setters,
- ...windowWhitelists.methods,
+windowAllowlists.propNames = Array.from(new Set([...windowAllowlists.indices,
+ ...windowAllowlists.getters,
+ ...windowAllowlists.setters,
+ ...windowAllowlists.methods,
'then'])).sort();
-windowWhitelists.props = windowWhitelists.propNames.concat(whitelistedSymbols);
+windowAllowlists.props = windowAllowlists.propNames.concat(allowedSymbols);
-var locationWhitelists = {
+var locationAllowlists = {
getters: [],
setters: ['href'],
methods: ['replace'],
promiseMethods: [],
}
-locationWhitelists.propNames = Array.from(new Set([...locationWhitelists.getters,
- ...locationWhitelists.setters,
- ...locationWhitelists.methods,
+locationAllowlists.propNames = Array.from(new Set([...locationAllowlists.getters,
+ ...locationAllowlists.setters,
+ ...locationAllowlists.methods,
'then'])).sort();
// Define various sets of arguments to call cross-origin methods with. Arguments
@@ -216,7 +216,7 @@ var methodArgs = new Map(Object.entries({
addTest(function(win) {
for (var prop in window) {
- if (windowWhitelists.props.indexOf(prop) != -1) {
+ if (windowAllowlists.props.indexOf(prop) != -1) {
win[prop]; // Shouldn't throw.
Object.getOwnPropertyDescriptor(win, prop); // Shouldn't throw.
assert_true(Object.prototype.hasOwnProperty.call(win, prop), "hasOwnProperty for " + String(prop));
@@ -230,7 +230,7 @@ addTest(function(win) {
if (prop != 'location')
assert_throws("SecurityError", function() { win[prop] = undefined; }, "Should throw when writing to " + prop + " on Window");
}
- for (var prop of windowWhitelists.namedFrames) {
+ for (var prop of windowAllowlists.namedFrames) {
win[prop]; // Shouldn't throw.
Object.getOwnPropertyDescriptor(win, prop); // Shouldn't throw.
assert_true(Object.prototype.hasOwnProperty.call(win, prop), "hasOwnProperty for " + String(prop));
@@ -257,10 +257,10 @@ addTest(function(win) {
assert_throws("SecurityError", function() { win.location[prop] = undefined; }, "Should throw when writing to " + prop + " on Location");
}
}
-}, "Only whitelisted properties are accessible cross-origin");
+}, "Only certain properties are accessible cross-origin");
addPromiseTest(async function(win, test_obj) {
- async function checkProperties(objName, whitelists) {
+ async function checkProperties(objName, allowedlists) {
var localObj = window[objName];
var otherObj = win[objName];
@@ -273,10 +273,10 @@ addPromiseTest(async function(win, test_obj) {
if ("value" in desc) {
if (typeof desc.value === "function" && String(desc.value).includes("[native code]")) {
- if (whitelists.promiseMethods.includes(prop)) {
+ if (allowedlists.promiseMethods.includes(prop)) {
await promise_rejects(test_obj, "SecurityError", desc.value.call(otherObj),
`Should throw when calling ${objName}.${prop} with cross-origin this object`);
- } else if (!whitelists.methods.includes(prop)) {
+ } else if (!allowedlists.methods.includes(prop)) {
for (let args of methodArgs.get(prop) || [[]]) {
assert_throws("SecurityError", desc.value.bind(otherObj, ...args),
`Should throw when calling ${objName}.${prop} with cross-origin this object`);
@@ -290,7 +290,7 @@ addPromiseTest(async function(win, test_obj) {
}
} else {
if (desc.get) {
- if (whitelists.getters.includes(prop)) {
+ if (allowedlists.getters.includes(prop)) {
desc.get.call(otherObj); // Shouldn't throw.
} else {
assert_throws("SecurityError", desc.get.bind(otherObj),
@@ -298,7 +298,7 @@ addPromiseTest(async function(win, test_obj) {
}
}
if (desc.set) {
- if (whitelists.setters.includes(prop)) {
+ if (allowedlists.setters.includes(prop)) {
desc.set.call(otherObj, "javascript:undefined"); // Shouldn't throw.
} else {
assert_throws("SecurityError", desc.set.bind(otherObj, "foo"),
@@ -309,9 +309,9 @@ addPromiseTest(async function(win, test_obj) {
}
}
- await checkProperties("location", locationWhitelists);
- await checkProperties("window", windowWhitelists);
-}, "Only whitelisted properties are usable as cross-origin this objects");
+ await checkProperties("location", locationAllowlists);
+ await checkProperties("window", windowAllowlists);
+}, "Only certain properties are usable as cross-origin this objects");
/*
* ES Internal Methods.
@@ -341,8 +341,8 @@ addTest(function(win) {
if (Object.setPrototypeOf)
setters.push(function(p) { Object.setPrototypeOf(this, p); });
setters.forEach(function(protoSetter) {
- assert_throws(new TypeError, function() { protoSetter.call(win, new Object()); }, "proto setter |call| on cross-origin Window");
- assert_throws(new TypeError, function() { protoSetter.call(win.location, new Object()); }, "proto setter |call| on cross-origin Location");
+ assert_throws_js(TypeError, function() { protoSetter.call(win, new Object()); }, "proto setter |call| on cross-origin Window");
+ assert_throws_js(TypeError, function() { protoSetter.call(win.location, new Object()); }, "proto setter |call| on cross-origin Location");
});
// Hack to avoid "duplicate test name" harness issues.
setters.forEach(function(protoSetter) {
@@ -375,9 +375,9 @@ addTest(function(win) {
* [[PreventExtensions]]
*/
addTest(function(win) {
- assert_throws(new TypeError, function() { Object.preventExtensions(win) },
+ assert_throws_js(TypeError, function() { Object.preventExtensions(win) },
"preventExtensions on cross-origin Window should throw");
- assert_throws(new TypeError, function() { Object.preventExtensions(win.location) },
+ assert_throws_js(TypeError, function() { Object.preventExtensions(win.location) },
"preventExtensions on cross-origin Location should throw");
}, "[[PreventExtensions]] should throw for cross-origin objects");
@@ -418,14 +418,14 @@ function checkPropertyDescriptor(desc, propName, expectWritable) {
}
addTest(function(win) {
- windowWhitelists.props.forEach(function(prop) {
+ windowAllowlists.props.forEach(function(prop) {
var desc = Object.getOwnPropertyDescriptor(win, prop);
checkPropertyDescriptor(desc, prop, prop == 'location');
});
checkPropertyDescriptor(Object.getOwnPropertyDescriptor(win.location, 'replace'), 'replace', false);
checkPropertyDescriptor(Object.getOwnPropertyDescriptor(win.location, 'href'), 'href', true);
assert_equals(typeof Object.getOwnPropertyDescriptor(win.location, 'href').get, 'undefined', "Cross-origin location should have no href getter");
- whitelistedSymbols.forEach(function(prop) {
+ allowedSymbols.forEach(function(prop) {
var desc = Object.getOwnPropertyDescriptor(win.location, prop);
checkPropertyDescriptor(desc, prop, false);
});
@@ -494,9 +494,9 @@ addTest(function(win) {
let i = 0;
for (var prop in win) {
i++;
- assert_true(windowWhitelists.indices.includes(prop), prop + " is not safelisted for a cross-origin Window");
+ assert_true(windowAllowlists.indices.includes(prop), prop + " is not safelisted for a cross-origin Window");
}
- assert_equals(i, windowWhitelists.indices.length, "Enumerate all enumerable safelisted cross-origin Window properties");
+ assert_equals(i, windowAllowlists.indices.length, "Enumerate all enumerable safelisted cross-origin Window properties");
i = 0;
for (var prop in win.location) {
i++;
@@ -510,48 +510,48 @@ addTest(function(win) {
addTest(function(win) {
assert_array_equals(Object.getOwnPropertyNames(win).sort(),
- windowWhitelists.propNames,
+ windowAllowlists.propNames,
"Object.getOwnPropertyNames() gives the right answer for cross-origin Window");
assert_array_equals(Object.keys(win).sort(),
- windowWhitelists.indices,
+ windowAllowlists.indices,
"Object.keys() gives the right answer for cross-origin Window");
assert_array_equals(Object.getOwnPropertyNames(win.location).sort(),
- locationWhitelists.propNames,
+ locationAllowlists.propNames,
"Object.getOwnPropertyNames() gives the right answer for cross-origin Location");
assert_equals(Object.keys(win.location).length, 0,
"Object.keys() gives the right answer for cross-origin Location");
}, "[[OwnPropertyKeys]] should return all properties from cross-origin objects");
addTest(function(win) {
- assert_array_equals(Object.getOwnPropertySymbols(win), whitelistedSymbols,
+ assert_array_equals(Object.getOwnPropertySymbols(win), allowedSymbols,
"Object.getOwnPropertySymbols() should return the three symbol-named properties that are exposed on a cross-origin Window");
assert_array_equals(Object.getOwnPropertySymbols(win.location),
- whitelistedSymbols,
+ allowedSymbols,
"Object.getOwnPropertySymbols() should return the three symbol-named properties that are exposed on a cross-origin Location");
}, "[[OwnPropertyKeys]] should return the right symbol-named properties for cross-origin objects");
addTest(function(win) {
var allWindowProps = Reflect.ownKeys(win);
- indexedWindowProps = allWindowProps.slice(0, windowWhitelists.indices.length);
- stringWindowProps = allWindowProps.slice(0, -1 * whitelistedSymbols.length);
- symbolWindowProps = allWindowProps.slice(-1 * whitelistedSymbols.length);
+ indexedWindowProps = allWindowProps.slice(0, windowAllowlists.indices.length);
+ stringWindowProps = allWindowProps.slice(0, -1 * allowedSymbols.length);
+ symbolWindowProps = allWindowProps.slice(-1 * allowedSymbols.length);
// stringWindowProps should have "then" last in this case. Do this
// check before we call stringWindowProps.sort() below.
assert_equals(stringWindowProps[stringWindowProps.length - 1], "then",
"'then' property should be added to the end of the string list if not there");
- assert_array_equals(indexedWindowProps, windowWhitelists.indices,
+ assert_array_equals(indexedWindowProps, windowAllowlists.indices,
"Reflect.ownKeys should start with the indices exposed on the cross-origin window.");
- assert_array_equals(stringWindowProps.sort(), windowWhitelists.propNames,
+ assert_array_equals(stringWindowProps.sort(), windowAllowlists.propNames,
"Reflect.ownKeys should continue with the cross-origin window properties for a cross-origin Window.");
- assert_array_equals(symbolWindowProps, whitelistedSymbols,
+ assert_array_equals(symbolWindowProps, allowedSymbols,
"Reflect.ownKeys should end with the cross-origin symbols for a cross-origin Window.");
var allLocationProps = Reflect.ownKeys(win.location);
- stringLocationProps = allLocationProps.slice(0, -1 * whitelistedSymbols.length);
- symbolLocationProps = allLocationProps.slice(-1 * whitelistedSymbols.length);
- assert_array_equals(stringLocationProps.sort(), locationWhitelists.propNames,
+ stringLocationProps = allLocationProps.slice(0, -1 * allowedSymbols.length);
+ symbolLocationProps = allLocationProps.slice(-1 * allowedSymbols.length);
+ assert_array_equals(stringLocationProps.sort(), locationAllowlists.propNames,
"Reflect.ownKeys should start with the cross-origin window properties for a cross-origin Location.")
- assert_array_equals(symbolLocationProps, whitelistedSymbols,
+ assert_array_equals(symbolLocationProps, allowedSymbols,
"Reflect.ownKeys should end with the cross-origin symbols for a cross-origin Location.")
}, "[[OwnPropertyKeys]] should place the symbols after the property names after the subframe indices");
diff --git a/tests/wpt/web-platform-tests/html/cross-origin-embedder-policy/require-corp.https.html b/tests/wpt/web-platform-tests/html/cross-origin-embedder-policy/require-corp.https.html
index 49b2eb123b5..8747d29e934 100644
--- a/tests/wpt/web-platform-tests/html/cross-origin-embedder-policy/require-corp.https.html
+++ b/tests/wpt/web-platform-tests/html/cross-origin-embedder-policy/require-corp.https.html
@@ -131,4 +131,26 @@ promise_test(async t => {
promise_test(t => {
return promise_rejects(t, new TypeError(), fetch(get_host_info().HTTPS_REMOTE_ORIGIN+"/common/blank.html", {mode: "no-cors"}));
}, `"require-corp" top-level: fetch() to response without CORP should fail`);
+
+promise_test(t => {
+ const w = window.open();
+ return promise_rejects(t, new TypeError(), w.fetch(get_host_info().HTTPS_REMOTE_ORIGIN+"/common/blank.html", {mode: "no-cors"}));
+}, `"require-corp" top-level: fetch() to response without CORP through a WindowProxy should fail`);
+
+async_test(t => {
+ let w = window.open();
+ const frame = w.document.createElement("iframe");
+ t.add_cleanup(() => w.close());
+ t.step_timeout(() => {
+ // Make sure the iframe didn't load. See
+ // https://github.com/whatwg/html/issues/125 for why a timeout is
+ // used here. Long term all network error handling should be similar
+ // and have a reliable event.
+ assert_equals(frame.contentDocument, null);
+ t.done();
+ }, 500);
+ frame.src = "/common/blank.html";
+ document.body.append(frame);
+ assert_equals(frame.contentDocument.body.localName, "body");
+}, `"require-corp" top-level: navigating an iframe to a page without CORP, through a WindowProxy, should fail`);
</script>
diff --git a/tests/wpt/web-platform-tests/html/infrastructure/common-dom-interfaces/collections/htmlallcollection.html b/tests/wpt/web-platform-tests/html/infrastructure/common-dom-interfaces/collections/htmlallcollection.html
index e3e0778c97a..095931ad785 100644
--- a/tests/wpt/web-platform-tests/html/infrastructure/common-dom-interfaces/collections/htmlallcollection.html
+++ b/tests/wpt/web-platform-tests/html/infrastructure/common-dom-interfaces/collections/htmlallcollection.html
@@ -160,7 +160,7 @@ test(function() {
test(function() {
assert_equals(document.all.namedItem.length, 1);
- assert_throws(new TypeError, function() {
+ assert_throws_js(TypeError, function() {
document.all.namedItem();
});
}, "namedItem method with no argument");
diff --git a/tests/wpt/web-platform-tests/html/semantics/document-metadata/the-style-element/style_load_event.html b/tests/wpt/web-platform-tests/html/semantics/document-metadata/the-style-element/style_load_event.html
new file mode 100644
index 00000000000..911a088c2ab
--- /dev/null
+++ b/tests/wpt/web-platform-tests/html/semantics/document-metadata/the-style-element/style_load_event.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<title>HTML Test: The style load event should fire when textContent is changed</title>
+<link rel="author" title="Mason Freed" href="mailto:masonfreed@chromium.org">
+<link rel="help" href="https://html.spec.whatwg.org/multipage/semantics.html#update-a-style-block">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+
+<style id=target onload="load()">
+ .box { color:red; }
+</style>
+<div class='box'></div>
+<div id="log"></div>
+
+<script>
+ var loadCount = 0;
+ function load() { loadCount++; }
+
+ function styleLoad() {
+ return new Promise((resolve) => {
+ document.getElementById('target').addEventListener('load', () => {
+ resolve();
+ });
+ });
+ }
+
+ promise_test(async t => {
+ await styleLoad();
+ assert_equals(loadCount,1,"Style element should have loaded once by now");
+ target.textContent = `.box { color: green; }`;
+ await styleLoad();
+ assert_equals(loadCount,2,"Style element should fire the load event when textContent changes");
+ },"style load event should fire when textContent changed");
+</script>
diff --git a/tests/wpt/web-platform-tests/html/semantics/embedded-content/media-elements/track/track-element/track-cue-mutable.html b/tests/wpt/web-platform-tests/html/semantics/embedded-content/media-elements/track/track-element/track-cue-mutable.html
index 63c3018aa99..cb28f6591ce 100644
--- a/tests/wpt/web-platform-tests/html/semantics/embedded-content/media-elements/track/track-element/track-cue-mutable.html
+++ b/tests/wpt/web-platform-tests/html/semantics/embedded-content/media-elements/track/track-element/track-cue-mutable.html
@@ -52,7 +52,7 @@
// to the new value; if the new value is the string "auto",
// then it must be interpreted as the special value auto.
assert_equals(textCue.line, "auto");
- assert_throws(new TypeError, function() { textCue.line = "gazonk"; });
+ assert_throws_js(TypeError, function() { textCue.line = "gazonk"; });
assert_equals(textCue.line, "auto");
textCue.line = 42;
assert_equals(textCue.line, 42);
diff --git a/tests/wpt/web-platform-tests/interfaces/IndexedDB.idl b/tests/wpt/web-platform-tests/interfaces/IndexedDB.idl
index 33925d61423..a66a245466e 100644
--- a/tests/wpt/web-platform-tests/interfaces/IndexedDB.idl
+++ b/tests/wpt/web-platform-tests/interfaces/IndexedDB.idl
@@ -67,7 +67,8 @@ interface IDBDatabase : EventTarget {
readonly attribute DOMStringList objectStoreNames;
[NewObject] IDBTransaction transaction((DOMString or sequence<DOMString>) storeNames,
- optional IDBTransactionMode mode = "readonly");
+ optional IDBTransactionMode mode = "readonly",
+ optional IDBTransactionOptions options = {});
void close();
[NewObject] IDBObjectStore createObjectStore(
@@ -82,6 +83,12 @@ interface IDBDatabase : EventTarget {
attribute EventHandler onversionchange;
};
+enum IDBTransactionDurability { "default", "strict", "relaxed" };
+
+dictionary IDBTransactionOptions {
+ IDBTransactionDurability durability = "default";
+};
+
dictionary IDBObjectStoreParameters {
(DOMString or sequence<DOMString>)? keyPath = null;
boolean autoIncrement = false;
diff --git a/tests/wpt/web-platform-tests/interfaces/native-file-system.idl b/tests/wpt/web-platform-tests/interfaces/native-file-system.idl
new file mode 100644
index 00000000000..f4679175c46
--- /dev/null
+++ b/tests/wpt/web-platform-tests/interfaces/native-file-system.idl
@@ -0,0 +1,92 @@
+// GENERATED CONTENT - DO NOT EDIT
+// Content was automatically extracted by Reffy into reffy-reports
+// (https://github.com/tidoust/reffy-reports)
+// Source: Native File System (https://wicg.github.io/native-file-system/)
+
+dictionary FileSystemHandlePermissionDescriptor {
+ boolean writable = false;
+};
+
+[Exposed=(Window,Worker), SecureContext, Serializable]
+interface FileSystemHandle {
+ readonly attribute boolean isFile;
+ readonly attribute boolean isDirectory;
+ readonly attribute USVString name;
+
+ Promise<PermissionState> queryPermission(optional FileSystemHandlePermissionDescriptor descriptor = {});
+ Promise<PermissionState> requestPermission(optional FileSystemHandlePermissionDescriptor descriptor = {});
+};
+
+dictionary FileSystemCreateWriterOptions {
+ boolean keepExistingData = false;
+};
+
+[Exposed=(Window,Worker), SecureContext, Serializable]
+interface FileSystemFileHandle : FileSystemHandle {
+ Promise<File> getFile();
+ Promise<FileSystemWriter> createWriter(optional FileSystemCreateWriterOptions options = {});
+};
+
+dictionary FileSystemGetFileOptions {
+ boolean create = false;
+};
+
+dictionary FileSystemGetDirectoryOptions {
+ boolean create = false;
+};
+
+dictionary FileSystemRemoveOptions {
+ boolean recursive = false;
+};
+
+[Exposed=(Window,Worker), SecureContext, Serializable]
+interface FileSystemDirectoryHandle : FileSystemHandle {
+ Promise<FileSystemFileHandle> getFile(USVString name, optional FileSystemGetFileOptions options = {});
+ Promise<FileSystemDirectoryHandle> getDirectory(USVString name, optional FileSystemGetDirectoryOptions options = {});
+
+ // This really returns an async iterable, but that is not yet expressable in WebIDL.
+ object getEntries();
+
+ Promise<void> removeEntry(USVString name, optional FileSystemRemoveOptions options = {});
+};
+
+[Exposed=(Window,Worker), SecureContext]
+interface FileSystemWriter {
+ Promise<void> write(unsigned long long position, (BufferSource or Blob or USVString) data);
+ Promise<void> truncate(unsigned long long size);
+ Promise<void> close();
+};
+
+enum ChooseFileSystemEntriesType { "open-file", "save-file", "open-directory" };
+
+dictionary ChooseFileSystemEntriesOptionsAccepts {
+ USVString description;
+ sequence<USVString> mimeTypes;
+ sequence<USVString> extensions;
+};
+
+dictionary ChooseFileSystemEntriesOptions {
+ ChooseFileSystemEntriesType type = "open-file";
+ boolean multiple = false;
+ sequence<ChooseFileSystemEntriesOptionsAccepts> accepts;
+ boolean excludeAcceptAllOption = false;
+};
+
+[SecureContext]
+partial interface Window {
+ Promise<(FileSystemHandle or sequence<FileSystemHandle>)>
+ chooseFileSystemEntries(optional ChooseFileSystemEntriesOptions options = {});
+};
+
+enum SystemDirectoryType {
+ "sandbox"
+};
+
+dictionary GetSystemDirectoryOptions {
+ required SystemDirectoryType type;
+};
+
+[SecureContext]
+partial interface FileSystemDirectoryHandle {
+ static Promise<FileSystemDirectoryHandle> getSystemDirectory(GetSystemDirectoryOptions options);
+};
diff --git a/tests/wpt/web-platform-tests/intersection-observer/document-scrolling-element-root.html b/tests/wpt/web-platform-tests/intersection-observer/document-scrolling-element-root.html
index 9996299312c..443ff2ed85f 100644
--- a/tests/wpt/web-platform-tests/intersection-observer/document-scrolling-element-root.html
+++ b/tests/wpt/web-platform-tests/intersection-observer/document-scrolling-element-root.html
@@ -28,18 +28,16 @@ iframe.onload = function() {
runTestCycle(function() {
assert_true(!!iframe, "iframe exists");
- root = iframe.contentDocument.scrollingElement;
- assert_true(!!root, "Root element exists.");
target = iframe.contentDocument.getElementById("target");
assert_true(!!target, "Target element exists.");
var observer = new IntersectionObserver(function(changes) {
entries = entries.concat(changes)
- }, { root: root });
+ }, { root: iframe.contentDocument });
observer.observe(target);
entries = entries.concat(observer.takeRecords());
assert_equals(entries.length, 0, "No initial notifications.");
runTestCycle(step0, "First rAF.");
- }, "Observer with explicit root which is the document's scrolling element.");
+ }, "Observer with explicit root which is the document.");
};
function step0() {
diff --git a/tests/wpt/web-platform-tests/js/behaviours/SetPrototypeOf-window.html b/tests/wpt/web-platform-tests/js/behaviours/SetPrototypeOf-window.html
index 0a6ec249fa3..f104ca107c5 100644
--- a/tests/wpt/web-platform-tests/js/behaviours/SetPrototypeOf-window.html
+++ b/tests/wpt/web-platform-tests/js/behaviours/SetPrototypeOf-window.html
@@ -6,26 +6,26 @@
<div id="log"></div>
<script>
test(function() {
- assert_throws(new TypeError, function() {
+ assert_throws_js(TypeError, function() {
Object.setPrototypeOf(window, window);
}, "Setting the prototype should throw");
}, "Setting the prototype of a window to itself via setPrototypeOf");
test(function() {
- assert_throws(new TypeError, function() {
+ assert_throws_js(TypeError, function() {
window.__proto__ = window;
}, "Setting the prototype should throw");
}, "Setting the prototype of a window to itself via __proto__");
test(function() {
- assert_throws(new TypeError, function() {
+ assert_throws_js(TypeError, function() {
Object.setPrototypeOf(window, Object.create(window));
}, "Setting the prototype should throw");
}, "Setting the prototype of a window to something that has the window on " +
"its proto chain via setPrototypeOf");
test(function() {
- assert_throws(new TypeError, function() {
+ assert_throws_js(TypeError, function() {
window.__proto__ = Object.create(window);
}, "Setting the prototype should throw");
}, "Setting the prototype of a window to something that has the window on " +
diff --git a/tests/wpt/web-platform-tests/media-source/mediasource-duration-boundaryconditions.html b/tests/wpt/web-platform-tests/media-source/mediasource-duration-boundaryconditions.html
index b95e495cb1d..e5be9f18fc4 100644
--- a/tests/wpt/web-platform-tests/media-source/mediasource-duration-boundaryconditions.html
+++ b/tests/wpt/web-platform-tests/media-source/mediasource-duration-boundaryconditions.html
@@ -21,7 +21,7 @@
test.waitForExpectedEvents(function()
{
if (expectedError) {
- assert_throws(expectedError,
+ assert_throws_js(expectedError,
function() { mediaSource.duration = testDurationValue; },
"mediaSource.duration assignment throws an exception for " + testDurationValue);
test.done();
@@ -50,14 +50,14 @@
DurationBoundaryConditionTest(Number.MAX_VALUE, null, "Set duration to Number.MAX_VALUE");
DurationBoundaryConditionTest(Number.MIN_VALUE, null, "Set duration to Number.MIN_VALUE");
DurationBoundaryConditionTest(Number.MAX_VALUE - 1, null, "Set duration to Number.MAX_VALUE - 1");
- DurationBoundaryConditionTest(Number.MIN_VALUE - 1, new TypeError(), "Set duration to Number.MIN_VALUE - 1");
+ DurationBoundaryConditionTest(Number.MIN_VALUE - 1, TypeError, "Set duration to Number.MIN_VALUE - 1");
DurationBoundaryConditionTest(Number.POSITIVE_INFINITY, null, "Set duration to Number.POSITIVE_INFINITY");
- DurationBoundaryConditionTest(Number.NEGATIVE_INFINITY, new TypeError(), "Set duration to Number.NEGATIVE_INFINITY");
- DurationBoundaryConditionTest(-1 * Number.MAX_VALUE, new TypeError(), "Set duration to lowest value.");
- DurationBoundaryConditionTest(-101.9, new TypeError(), "Set duration to a negative double.");
+ DurationBoundaryConditionTest(Number.NEGATIVE_INFINITY, TypeError, "Set duration to Number.NEGATIVE_INFINITY");
+ DurationBoundaryConditionTest(-1 * Number.MAX_VALUE, TypeError, "Set duration to lowest value.");
+ DurationBoundaryConditionTest(-101.9, TypeError, "Set duration to a negative double.");
DurationBoundaryConditionTest(101.9, null, "Set duration to a positive double.");
DurationBoundaryConditionTest(0, null, "Set duration to zero");
- DurationBoundaryConditionTest(NaN, new TypeError(), "Set duration to NaN");
+ DurationBoundaryConditionTest(NaN, TypeError, "Set duration to NaN");
</script>
</body>
</html>
diff --git a/tests/wpt/web-platform-tests/mediacapture-record/BlobEvent-constructor.html b/tests/wpt/web-platform-tests/mediacapture-record/BlobEvent-constructor.html
index 3bcf4296e68..66dc3404d78 100644
--- a/tests/wpt/web-platform-tests/mediacapture-record/BlobEvent-constructor.html
+++ b/tests/wpt/web-platform-tests/mediacapture-record/BlobEvent-constructor.html
@@ -6,25 +6,25 @@
<script>
test(function() {
assert_equals(BlobEvent.length, 2);
- assert_throws(new TypeError, function() {
+ assert_throws_js(TypeError, function() {
new BlobEvent("type");
});
- assert_throws(new TypeError, function() {
+ assert_throws_js(TypeError, function() {
new BlobEvent("type", null);
});
- assert_throws(new TypeError, function() {
+ assert_throws_js(TypeError, function() {
new BlobEvent("type", undefined);
});
}, "The BlobEventInit dictionary is required");
test(function() {
- assert_throws(new TypeError, function() {
+ assert_throws_js(TypeError, function() {
new BlobEvent("type", {});
});
- assert_throws(new TypeError, function() {
+ assert_throws_js(TypeError, function() {
new BlobEvent("type", { data: null });
});
- assert_throws(new TypeError, function() {
+ assert_throws_js(TypeError, function() {
new BlobEvent("type", { data: undefined });
});
}, "The BlobEventInit dictionary's data member is required.");
diff --git a/tests/wpt/web-platform-tests/mediacapture-streams/MediaStreamTrackEvent-constructor.https.html b/tests/wpt/web-platform-tests/mediacapture-streams/MediaStreamTrackEvent-constructor.https.html
index 8f5a543d8fb..4946cd71d81 100644
--- a/tests/wpt/web-platform-tests/mediacapture-streams/MediaStreamTrackEvent-constructor.https.html
+++ b/tests/wpt/web-platform-tests/mediacapture-streams/MediaStreamTrackEvent-constructor.https.html
@@ -6,25 +6,25 @@
<script>
test(function() {
assert_equals(MediaStreamTrackEvent.length, 2);
- assert_throws(new TypeError, function() {
+ assert_throws_js(TypeError, function() {
new MediaStreamTrackEvent("type");
});
- assert_throws(new TypeError, function() {
+ assert_throws_js(TypeError, function() {
new MediaStreamTrackEvent("type", null);
});
- assert_throws(new TypeError, function() {
+ assert_throws_js(TypeError, function() {
new MediaStreamTrackEvent("type", undefined);
});
}, "The eventInitDict argument is required");
test(function() {
- assert_throws(new TypeError, function() {
+ assert_throws_js(TypeError, function() {
new MediaStreamTrackEvent("type", {});
});
- assert_throws(new TypeError, function() {
+ assert_throws_js(TypeError, function() {
new MediaStreamTrackEvent("type", { track: null });
});
- assert_throws(new TypeError, function() {
+ assert_throws_js(TypeError, function() {
new MediaStreamTrackEvent("type", { track: undefined });
});
}, "The eventInitDict's track member is required.");
diff --git a/tests/wpt/web-platform-tests/mediasession/positionstate.html b/tests/wpt/web-platform-tests/mediasession/positionstate.html
index 2eab2986d45..9033a7be5ce 100644
--- a/tests/wpt/web-platform-tests/mediasession/positionstate.html
+++ b/tests/wpt/web-platform-tests/mediasession/positionstate.html
@@ -42,8 +42,8 @@ test(() => {
}, 'Test setPositionState with zero duration');
test(() => {
- assert_throws(
- new TypeError,
+ assert_throws_js(
+ TypeError,
_ => {
window.navigator.mediaSession.setPositionState({
duration: 60.9,
@@ -54,8 +54,8 @@ test(() => {
}, 'Test setPositionState throws a TypeError if playback rate is negative');
test(() => {
- assert_throws(
- new TypeError,
+ assert_throws_js(
+ TypeError,
_ => {
window.navigator.mediaSession.setPositionState({
duration: -1
@@ -64,8 +64,8 @@ test(() => {
}, 'Test setPositionState throws a TypeError if duration is negative');
test(() => {
- assert_throws(
- new TypeError,
+ assert_throws_js(
+ TypeError,
_ => {
window.navigator.mediaSession.setPositionState({
duration: 10,
@@ -75,8 +75,8 @@ test(() => {
}, 'Test setPositionState throws a TypeError if position is negative');
test(() => {
- assert_throws(
- new TypeError,
+ assert_throws_js(
+ TypeError,
_ => {
window.navigator.mediaSession.setPositionState({
duration: 10,
@@ -86,8 +86,8 @@ test(() => {
}, 'Test setPositionState throws a TypeError if duration is less than position');
test(() => {
- assert_throws(
- new TypeError,
+ assert_throws_js(
+ TypeError,
_ => {
window.navigator.mediaSession.setPositionState({
duration: 60.9,
@@ -98,8 +98,8 @@ test(() => {
}, 'Test setPositionState throws a TypeError if playback rate is zero');
test(() => {
- assert_throws(
- new TypeError,
+ assert_throws_js(
+ TypeError,
_ => {
window.navigator.mediaSession.setPositionState({
position: 10.1,
diff --git a/tests/wpt/web-platform-tests/mediasession/setactionhandler.html b/tests/wpt/web-platform-tests/mediasession/setactionhandler.html
index 6e1bb26c67a..8f1330f8289 100644
--- a/tests/wpt/web-platform-tests/mediasession/setactionhandler.html
+++ b/tests/wpt/web-platform-tests/mediasession/setactionhandler.html
@@ -16,8 +16,8 @@ test(function(t) {
}, "Test that setActionHandler() can be executed for supported actions");
test(function(t) {
- assert_throws(
- new TypeError,
+ assert_throws_js(
+ TypeError,
_ => { window.navigator.mediaSession.setActionHandler("invalid", null); });
}, "Test that setActionHandler() throws exception for unsupported actions");
diff --git a/tests/wpt/web-platform-tests/native-file-system/idlharness.https.any.js b/tests/wpt/web-platform-tests/native-file-system/idlharness.https.any.js
new file mode 100644
index 00000000000..567912ddd77
--- /dev/null
+++ b/tests/wpt/web-platform-tests/native-file-system/idlharness.https.any.js
@@ -0,0 +1,15 @@
+// META: script=/resources/WebIDLParser.js
+// META: script=/resources/idlharness.js
+
+'use strict';
+
+idl_test(
+ ['native-file-system'],
+ ['html', 'dom'],
+ idl_array => {
+ idl_array.add_objects({
+ // TODO: Add instances of FileSystemHandle, FileSystemFileHandle,
+ // FileSystemDirectoryHandle and FileSystemWriter.
+ });
+ }
+);
diff --git a/tests/wpt/web-platform-tests/payment-request/onpaymentmenthodchange-attribute.https.html b/tests/wpt/web-platform-tests/payment-request/onpaymentmethodchange-attribute.https.html
index f641bec4aa9..f641bec4aa9 100644
--- a/tests/wpt/web-platform-tests/payment-request/onpaymentmenthodchange-attribute.https.html
+++ b/tests/wpt/web-platform-tests/payment-request/onpaymentmethodchange-attribute.https.html
diff --git a/tests/wpt/web-platform-tests/referrer-policy/4K+1/generic/spec_json.js b/tests/wpt/web-platform-tests/referrer-policy/4K+1/generic/spec_json.js
new file mode 100644
index 00000000000..39cd997338e
--- /dev/null
+++ b/tests/wpt/web-platform-tests/referrer-policy/4K+1/generic/spec_json.js
@@ -0,0 +1 @@
+var SPEC_JSON = {"selection_pattern": "%(source_context_list)s.%(delivery_type)s/%(delivery_value)s/%(subresource)s/%(origin)s.%(redirection)s.%(source_scheme)s", "test_file_path_pattern": "gen/%(source_context_list)s.%(delivery_type)s/%(delivery_value)s/%(subresource)s/%(origin)s.%(redirection)s.%(source_scheme)s.html", "test_description_template": "Referrer Policy: Expects %(expectation)s for %(subresource)s to %(origin)s origin and %(redirection)s redirection from %(source_scheme)s context.", "test_page_title_template": "Referrer-Policy: %(title)s", "specification": [{"name": "unset-referrer-policy", "title": "Referrer Policy is not explicitly defined", "description": "Check that referrer URL follows no-referrer-when-downgrade policy when no explicit Referrer Policy is set.", "specification_url": "https://w3c.github.io/webappsec-referrer-policy/#referrer-policies", "test_expansion": [{"name": "insecure-protocol", "expansion": "default", "source_scheme": "http", "source_context_list": "*", "delivery_type": "*", "delivery_value": null, "redirection": "*", "origin": ["same-http", "cross-http"], "subresource": "*", "expectation": "stripped-referrer"}, {"name": "upgrade-protocol", "expansion": "default", "source_scheme": "http", "source_context_list": "*", "delivery_type": "*", "delivery_value": null, "redirection": "*", "origin": ["same-https", "cross-https"], "subresource": "*", "expectation": "stripped-referrer"}, {"name": "downgrade-protocol", "expansion": "default", "source_scheme": "https", "source_context_list": "*", "delivery_type": "*", "delivery_value": null, "redirection": "*", "origin": ["same-http", "cross-http"], "subresource": "*", "expectation": "omitted"}, {"name": "secure-protocol", "expansion": "default", "source_scheme": "https", "source_context_list": "*", "delivery_type": "*", "delivery_value": null, "redirection": "*", "origin": ["same-https", "cross-https"], "subresource": "*", "expectation": "stripped-referrer"}]}, {"name": "no-referrer", "title": "Referrer Policy is set to 'no-referrer'", "description": "Check that sub-resource never gets the referrer URL.", "specification_url": "https://w3c.github.io/webappsec-referrer-policy/#referrer-policy-no-referrer", "test_expansion": [{"name": "generic", "expansion": "default", "source_scheme": "*", "source_context_list": "*", "delivery_type": "*", "delivery_value": "no-referrer", "redirection": "*", "origin": "*", "subresource": "*", "expectation": "omitted"}]}, {"name": "no-referrer-when-downgrade", "title": "Referrer Policy is set to 'no-referrer-when-downgrade'", "description": "Check that non a priori insecure subresource gets the full Referrer URL. A priori insecure subresource gets no referrer information.", "specification_url": "https://w3c.github.io/webappsec-referrer-policy/#referrer-policy-no-referrer-when-downgrade", "test_expansion": [{"name": "insecure-protocol", "expansion": "default", "source_scheme": "http", "source_context_list": "*", "delivery_type": "*", "delivery_value": "no-referrer-when-downgrade", "redirection": "*", "origin": ["same-http", "cross-http"], "subresource": "*", "expectation": "stripped-referrer"}, {"name": "upgrade-protocol", "expansion": "default", "source_scheme": "http", "source_context_list": "*", "delivery_type": "*", "delivery_value": "no-referrer-when-downgrade", "redirection": "*", "origin": ["same-https", "cross-https"], "subresource": "*", "expectation": "stripped-referrer"}, {"name": "downgrade-protocol", "expansion": "default", "source_scheme": "https", "source_context_list": "*", "delivery_type": "*", "delivery_value": "no-referrer-when-downgrade", "redirection": "*", "origin": ["same-http", "cross-http"], "subresource": "*", "expectation": "omitted"}, {"name": "secure-protocol", "expansion": "default", "source_scheme": "https", "source_context_list": "*", "delivery_type": "*", "delivery_value": "no-referrer-when-downgrade", "redirection": "*", "origin": ["same-https", "cross-https"], "subresource": "*", "expectation": "stripped-referrer"}]}, {"name": "origin", "title": "Referrer Policy is set to 'origin'", "description": "Check that all subresources in all casses get only the origin portion of the referrer URL.", "specification_url": "https://w3c.github.io/webappsec-referrer-policy/#referrer-policy-origin", "test_expansion": [{"name": "generic", "expansion": "default", "source_scheme": "*", "source_context_list": "*", "delivery_type": "*", "delivery_value": "origin", "redirection": "*", "origin": "*", "subresource": "*", "expectation": "origin"}]}, {"name": "same-origin", "title": "Referrer Policy is set to 'same-origin'", "description": "Check that cross-origin subresources get no referrer information and same-origin get the stripped referrer URL.", "specification_url": "https://w3c.github.io/webappsec-referrer-policy/#referrer-policy-same-origin", "test_expansion": [{"name": "same-origin-insecure", "expansion": "default", "source_scheme": "http", "source_context_list": "*", "delivery_type": "*", "delivery_value": "same-origin", "redirection": "*", "origin": "same-http", "subresource": "*", "expectation": "stripped-referrer"}, {"name": "same-origin-secure-default", "expansion": "default", "source_scheme": "https", "source_context_list": "*", "delivery_type": "*", "delivery_value": "same-origin", "redirection": "*", "origin": "same-https", "subresource": "*", "expectation": "stripped-referrer"}, {"name": "same-origin-insecure", "expansion": "override", "source_scheme": "*", "source_context_list": "*", "delivery_type": "*", "delivery_value": "same-origin", "redirection": "swap-origin", "origin": ["same-http", "same-https"], "subresource": "*", "expectation": "omitted"}, {"name": "cross-origin", "expansion": "default", "source_scheme": "*", "source_context_list": "*", "delivery_type": "*", "delivery_value": "same-origin", "redirection": "*", "origin": ["cross-http", "cross-https"], "subresource": "*", "expectation": "omitted"}]}, {"name": "origin-when-cross-origin", "title": "Referrer Policy is set to 'origin-when-cross-origin'", "description": "Check that cross-origin subresources get the origin portion of the referrer URL and same-origin get the stripped referrer URL.", "specification_url": "https://w3c.github.io/webappsec-referrer-policy/#referrer-policy-origin-when-cross-origin", "test_expansion": [{"name": "same-origin-insecure", "expansion": "default", "source_scheme": "http", "source_context_list": "*", "delivery_type": "*", "delivery_value": "origin-when-cross-origin", "redirection": "*", "origin": "same-http", "subresource": "*", "expectation": "stripped-referrer"}, {"name": "same-origin-secure-default", "expansion": "default", "source_scheme": "https", "source_context_list": "*", "delivery_type": "*", "delivery_value": "origin-when-cross-origin", "redirection": "*", "origin": "same-https", "subresource": "*", "expectation": "stripped-referrer"}, {"name": "same-origin-upgrade", "expansion": "default", "source_scheme": "http", "source_context_list": "*", "delivery_type": "*", "delivery_value": "origin-when-cross-origin", "redirection": "*", "origin": "same-https", "subresource": "*", "expectation": "origin"}, {"name": "same-origin-downgrade", "expansion": "default", "source_scheme": "https", "source_context_list": "*", "delivery_type": "*", "delivery_value": "origin-when-cross-origin", "redirection": "*", "origin": "same-http", "subresource": "*", "expectation": "origin"}, {"name": "same-origin-insecure", "expansion": "override", "source_scheme": "*", "source_context_list": "*", "delivery_type": "*", "delivery_value": "origin-when-cross-origin", "redirection": "swap-origin", "origin": ["same-http", "same-https"], "subresource": "*", "expectation": "origin"}, {"name": "cross-origin", "expansion": "default", "source_scheme": "*", "source_context_list": "*", "delivery_type": "*", "delivery_value": "origin-when-cross-origin", "redirection": "*", "origin": ["cross-http", "cross-https"], "subresource": "*", "expectation": "origin"}]}, {"name": "strict-origin", "title": "Referrer Policy is set to 'strict-origin'", "description": "Check that non a priori insecure subresource gets only the origin portion of the referrer URL. A priori insecure subresource gets no referrer information.", "specification_url": "https://w3c.github.io/webappsec-referrer-policy/#referrer-policy-strict-origin", "test_expansion": [{"name": "insecure-protocol", "expansion": "default", "source_scheme": "http", "source_context_list": "*", "delivery_type": "*", "delivery_value": "strict-origin", "redirection": "*", "origin": ["same-http", "cross-http"], "subresource": "*", "expectation": "origin"}, {"name": "upgrade-protocol", "expansion": "default", "source_scheme": "http", "source_context_list": "*", "delivery_type": "*", "delivery_value": "strict-origin", "redirection": "*", "origin": ["same-https", "cross-https"], "subresource": "*", "expectation": "origin"}, {"name": "downgrade-protocol", "expansion": "default", "source_scheme": "https", "source_context_list": "*", "delivery_type": "*", "delivery_value": "strict-origin", "redirection": "*", "origin": ["same-http", "cross-http"], "subresource": "*", "expectation": "omitted"}, {"name": "secure-protocol", "expansion": "default", "source_scheme": "https", "source_context_list": "*", "delivery_type": "*", "delivery_value": "strict-origin", "redirection": "*", "origin": ["same-https", "cross-https"], "subresource": "*", "expectation": "origin"}]}, {"name": "strict-origin-when-cross-origin", "title": "Referrer Policy is set to 'strict-origin-when-cross-origin'", "description": "Check that a priori insecure subresource gets no referrer information. Otherwise, cross-origin subresources get the origin portion of the referrer URL and same-origin get the stripped referrer URL.", "specification_url": "https://w3c.github.io/webappsec-referrer-policy/#referrer-policy-strict-origin-when-cross-origin", "test_expansion": [{"name": "same-insecure", "expansion": "default", "source_scheme": "http", "source_context_list": "*", "delivery_type": "*", "delivery_value": "strict-origin-when-cross-origin", "redirection": "*", "origin": "same-http", "subresource": "*", "expectation": "stripped-referrer"}, {"name": "same-insecure", "expansion": "override", "source_scheme": "http", "source_context_list": "*", "delivery_type": "*", "delivery_value": "strict-origin-when-cross-origin", "redirection": "swap-origin", "origin": "same-http", "subresource": "*", "expectation": "origin"}, {"name": "cross-insecure", "expansion": "default", "source_scheme": "http", "source_context_list": "*", "delivery_type": "*", "delivery_value": "strict-origin-when-cross-origin", "redirection": "*", "origin": "cross-http", "subresource": "*", "expectation": "origin"}, {"name": "upgrade-protocol", "expansion": "default", "source_scheme": "http", "source_context_list": "*", "delivery_type": "*", "delivery_value": "strict-origin-when-cross-origin", "redirection": "*", "origin": ["same-https", "cross-https"], "subresource": "*", "expectation": "origin"}, {"name": "downgrade-protocol", "expansion": "default", "source_scheme": "https", "source_context_list": "*", "delivery_type": "*", "delivery_value": "strict-origin-when-cross-origin", "redirection": "*", "origin": ["same-http", "cross-http"], "subresource": "*", "expectation": "omitted"}, {"name": "same-secure", "expansion": "default", "source_scheme": "https", "source_context_list": "*", "delivery_type": "*", "delivery_value": "strict-origin-when-cross-origin", "redirection": "*", "origin": "same-https", "subresource": "*", "expectation": "stripped-referrer"}, {"name": "same-secure", "expansion": "override", "source_scheme": "https", "source_context_list": "*", "delivery_type": "*", "delivery_value": "strict-origin-when-cross-origin", "redirection": "swap-origin", "origin": "same-https", "subresource": "*", "expectation": "origin"}, {"name": "cross-secure", "expansion": "default", "source_scheme": "https", "source_context_list": "*", "delivery_type": "*", "delivery_value": "strict-origin-when-cross-origin", "redirection": "*", "origin": "cross-https", "subresource": "*", "expectation": "origin"}]}, {"name": "unsafe-url", "title": "Referrer Policy is set to 'unsafe-url'", "description": "Check that all sub-resources get the stripped referrer URL.", "specification_url": "https://w3c.github.io/webappsec-referrer-policy/#referrer-policy-unsafe-url", "test_expansion": [{"name": "generic", "expansion": "default", "source_scheme": "*", "source_context_list": "*", "delivery_type": "*", "delivery_value": "unsafe-url", "redirection": "*", "origin": "*", "subresource": "*", "expectation": "stripped-referrer"}]}], "delivery_key": "referrerPolicy", "excluded_tests": [{"name": "cross-origin-workers", "expansion": "*", "source_scheme": "*", "source_context_list": "*", "redirection": "*", "delivery_type": "*", "delivery_value": "*", "origin": ["cross-http", "cross-https"], "subresource": ["worker-classic", "worker-module", "sharedworker-classic"], "expectation": "*"}, {"name": "upgraded-protocol-workers", "expansion": "*", "source_scheme": "http", "source_context_list": "*", "delivery_type": "*", "delivery_value": "*", "redirection": "*", "origin": ["same-https", "cross-https"], "subresource": ["worker-classic", "worker-module", "sharedworker-classic"], "expectation": "*"}, {"name": "mixed-content-insecure-subresources", "expansion": "*", "source_scheme": "https", "source_context_list": "*", "delivery_type": "*", "delivery_value": "*", "redirection": "*", "origin": ["same-http", "cross-http"], "subresource": "*", "expectation": "*"}, {"name": "area-tag", "expansion": "*", "source_scheme": "*", "source_context_list": "*", "delivery_type": "*", "delivery_value": "*", "redirection": "*", "origin": "*", "subresource": "area-tag", "expectation": "*"}, {"name": "worker-requests-with-swap-origin-redirect", "expansion": "*", "source_scheme": "*", "source_context_list": "*", "delivery_type": "*", "delivery_value": "*", "redirection": "swap-origin", "origin": "*", "subresource": ["worker-classic", "worker-module", "sharedworker-classic"], "expectation": "*"}, {"name": "overhead-for-redirection", "expansion": "*", "source_scheme": "*", "source_context_list": "*", "delivery_type": "*", "delivery_value": "*", "redirection": ["keep-origin", "swap-origin"], "origin": "*", "subresource": ["a-tag", "area-tag"], "expectation": "*"}, {"name": "source-https-unsupported-by-web-platform-tests-runners", "expansion": "*", "source_scheme": "https", "source_context_list": "*", "delivery_type": "*", "delivery_value": "*", "redirection": "*", "origin": "*", "subresource": "*", "expectation": "*"}, {"name": "<link rel=noreferrer>'s delivery_value should be no-referrer", "expansion": "*", "source_scheme": "*", "source_context_list": "*", "delivery_type": "rel-noref", "delivery_value": [null, "no-referrer-when-downgrade", "same-origin", "origin", "origin-when-cross-origin", "strict-origin", "strict-origin-when-cross-origin", "unsafe-url"], "redirection": "*", "origin": "*", "subresource": "*", "expectation": "*"}, {"name": "expectation=stripped-referrer only", "expansion": "*", "source_scheme": "*", "source_context_list": "*", "redirection": "*", "delivery_type": "*", "delivery_value": "*", "origin": "*", "subresource": "*", "expectation": ["omitted", "origin"]}, {"name": "Only on the top context", "expansion": "*", "source_scheme": "*", "source_context_list": ["req", "srcdoc-inherit", "srcdoc", "iframe", "worker-classic", "worker-classic-data", "worker-module", "worker-module-data"], "redirection": "*", "delivery_type": "*", "delivery_value": "*", "origin": "*", "subresource": "*", "expectation": "*"}], "source_context_schema": {"supported_delivery_type": {"top": ["meta", "http-rp"], "iframe": ["meta", "http-rp"], "iframe-blank": ["meta"], "srcdoc": ["meta"], "worker-classic": ["http-rp"], "worker-module": ["http-rp"], "worker-classic-data": [], "worker-module-data": []}, "supported_subresource": {"top": "*", "iframe": "*", "iframe-blank": "*", "srcdoc": "*", "worker-classic": ["xhr", "fetch", "worker-classic", "worker-module"], "worker-module": ["xhr", "fetch", "worker-classic", "worker-module"], "worker-classic-data": ["xhr", "fetch"], "worker-module-data": ["xhr", "fetch"]}}, "subresource_schema": {"supported_delivery_type": {"iframe-tag": ["attr"], "img-tag": ["attr"], "script-tag": ["attr"], "a-tag": ["attr", "rel-noref"], "area-tag": ["attr"], "xhr": [], "fetch": [], "worker-module": [], "sharedworker-classic": [], "worker-classic": []}}, "source_context_list_schema": {"top": {"description": "Policy set by the top-level Document", "sourceContextList": [{"sourceContextType": "top", "policyDeliveries": ["policy"]}], "subresourcePolicyDeliveries": []}, "req": {"description": "Subresource request's policy should override Document's policy", "sourceContextList": [{"sourceContextType": "top", "policyDeliveries": ["anotherPolicy"]}], "subresourcePolicyDeliveries": ["nonNullPolicy"]}, "srcdoc-inherit": {"description": "srcdoc iframe should inherit parent Document's policy", "sourceContextList": [{"sourceContextType": "top", "policyDeliveries": ["policy"]}, {"sourceContextType": "srcdoc"}], "subresourcePolicyDeliveries": []}, "srcdoc": {"description": "srcdoc iframe's policy should override parent Document's policy", "sourceContextList": [{"sourceContextType": "top", "policyDeliveries": ["anotherPolicy"]}, {"sourceContextType": "srcdoc", "policyDeliveries": ["nonNullPolicy"]}], "subresourcePolicyDeliveries": []}, "iframe": {"description": "external iframe's policy should override parent Document's policy", "sourceContextList": [{"sourceContextType": "top", "policyDeliveries": ["anotherPolicy"]}, {"sourceContextType": "iframe", "policyDeliveries": ["policy"]}], "subresourcePolicyDeliveries": []}, "worker-classic": {"sourceContextList": [{"sourceContextType": "top", "policyDeliveries": ["anotherPolicy"]}, {"sourceContextType": "worker-classic", "policyDeliveries": ["policy"]}], "subresourcePolicyDeliveries": []}, "worker-classic-data": {"sourceContextList": [{"sourceContextType": "top", "policyDeliveries": ["anotherPolicy"]}, {"sourceContextType": "worker-classic-data", "policyDeliveries": ["policy"]}], "subresourcePolicyDeliveries": []}, "worker-module": {"sourceContextList": [{"sourceContextType": "top", "policyDeliveries": ["anotherPolicy"]}, {"sourceContextType": "worker-module", "policyDeliveries": ["policy"]}], "subresourcePolicyDeliveries": []}, "worker-module-data": {"sourceContextList": [{"sourceContextType": "top", "policyDeliveries": ["anotherPolicy"]}, {"sourceContextType": "worker-module-data", "policyDeliveries": ["policy"]}], "subresourcePolicyDeliveries": []}}, "test_expansion_schema": {"expansion": ["default", "override"], "delivery_type": ["attr", "rel-noref", "http-rp", "meta"], "delivery_value": [null, "no-referrer", "no-referrer-when-downgrade", "same-origin", "origin", "origin-when-cross-origin", "strict-origin", "strict-origin-when-cross-origin", "unsafe-url"], "origin": ["same-http", "same-https", "cross-http", "cross-https"], "source_context_list": ["top", "req", "srcdoc-inherit", "srcdoc", "iframe", "worker-classic", "worker-classic-data", "worker-module", "worker-module-data"], "source_scheme": ["http", "https"], "redirection": ["no-redirect", "keep-origin", "swap-origin"], "subresource": ["iframe-tag", "img-tag", "script-tag", "a-tag", "area-tag", "xhr", "worker-classic", "worker-module", "sharedworker-classic", "fetch"], "expectation": ["omitted", "origin", "stripped-referrer"]}};
diff --git a/tests/wpt/web-platform-tests/referrer-policy/4K+1/generic/test-case.sub.js b/tests/wpt/web-platform-tests/referrer-policy/4K+1/generic/test-case.sub.js
new file mode 100644
index 00000000000..b602d65f414
--- /dev/null
+++ b/tests/wpt/web-platform-tests/referrer-policy/4K+1/generic/test-case.sub.js
@@ -0,0 +1,11 @@
+function TestCase(scenario, testDescription, sanityChecker) {
+ // This check is A NOOP in release.
+ sanityChecker.checkScenario(scenario);
+ return {
+ start: () => runLengthTest(
+ scenario,
+ 4096 + 1,
+ "origin",
+ "`Referer` header with length > 4k is stripped to an origin.")
+ };
+}
diff --git a/tests/wpt/web-platform-tests/referrer-policy/4K+1/spec.src.json b/tests/wpt/web-platform-tests/referrer-policy/4K+1/spec.src.json
new file mode 100644
index 00000000000..5dc2085c62f
--- /dev/null
+++ b/tests/wpt/web-platform-tests/referrer-policy/4K+1/spec.src.json
@@ -0,0 +1,40 @@
+{
+ "excluded_tests": [
+ {
+ "name": "expectation=stripped-referrer only",
+ "expansion": "*",
+ "source_scheme": "*",
+ "source_context_list": "*",
+ "redirection": "*",
+ "delivery_type": "*",
+ "delivery_value": "*",
+ "origin": "*",
+ "subresource": "*",
+ "expectation": [
+ "omitted",
+ "origin"
+ ]
+ },
+ {
+ "name": "Only on the top context",
+ "expansion": "*",
+ "source_scheme": "*",
+ "source_context_list": [
+ "req",
+ "srcdoc-inherit",
+ "srcdoc",
+ "iframe",
+ "worker-classic",
+ "worker-classic-data",
+ "worker-module",
+ "worker-module-data"
+ ],
+ "redirection": "*",
+ "delivery_type": "*",
+ "delivery_value": "*",
+ "origin": "*",
+ "subresource": "*",
+ "expectation": "*"
+ }
+ ]
+}
diff --git a/tests/wpt/web-platform-tests/referrer-policy/4K-1/generic/spec_json.js b/tests/wpt/web-platform-tests/referrer-policy/4K-1/generic/spec_json.js
new file mode 100644
index 00000000000..39cd997338e
--- /dev/null
+++ b/tests/wpt/web-platform-tests/referrer-policy/4K-1/generic/spec_json.js
@@ -0,0 +1 @@
+var SPEC_JSON = {"selection_pattern": "%(source_context_list)s.%(delivery_type)s/%(delivery_value)s/%(subresource)s/%(origin)s.%(redirection)s.%(source_scheme)s", "test_file_path_pattern": "gen/%(source_context_list)s.%(delivery_type)s/%(delivery_value)s/%(subresource)s/%(origin)s.%(redirection)s.%(source_scheme)s.html", "test_description_template": "Referrer Policy: Expects %(expectation)s for %(subresource)s to %(origin)s origin and %(redirection)s redirection from %(source_scheme)s context.", "test_page_title_template": "Referrer-Policy: %(title)s", "specification": [{"name": "unset-referrer-policy", "title": "Referrer Policy is not explicitly defined", "description": "Check that referrer URL follows no-referrer-when-downgrade policy when no explicit Referrer Policy is set.", "specification_url": "https://w3c.github.io/webappsec-referrer-policy/#referrer-policies", "test_expansion": [{"name": "insecure-protocol", "expansion": "default", "source_scheme": "http", "source_context_list": "*", "delivery_type": "*", "delivery_value": null, "redirection": "*", "origin": ["same-http", "cross-http"], "subresource": "*", "expectation": "stripped-referrer"}, {"name": "upgrade-protocol", "expansion": "default", "source_scheme": "http", "source_context_list": "*", "delivery_type": "*", "delivery_value": null, "redirection": "*", "origin": ["same-https", "cross-https"], "subresource": "*", "expectation": "stripped-referrer"}, {"name": "downgrade-protocol", "expansion": "default", "source_scheme": "https", "source_context_list": "*", "delivery_type": "*", "delivery_value": null, "redirection": "*", "origin": ["same-http", "cross-http"], "subresource": "*", "expectation": "omitted"}, {"name": "secure-protocol", "expansion": "default", "source_scheme": "https", "source_context_list": "*", "delivery_type": "*", "delivery_value": null, "redirection": "*", "origin": ["same-https", "cross-https"], "subresource": "*", "expectation": "stripped-referrer"}]}, {"name": "no-referrer", "title": "Referrer Policy is set to 'no-referrer'", "description": "Check that sub-resource never gets the referrer URL.", "specification_url": "https://w3c.github.io/webappsec-referrer-policy/#referrer-policy-no-referrer", "test_expansion": [{"name": "generic", "expansion": "default", "source_scheme": "*", "source_context_list": "*", "delivery_type": "*", "delivery_value": "no-referrer", "redirection": "*", "origin": "*", "subresource": "*", "expectation": "omitted"}]}, {"name": "no-referrer-when-downgrade", "title": "Referrer Policy is set to 'no-referrer-when-downgrade'", "description": "Check that non a priori insecure subresource gets the full Referrer URL. A priori insecure subresource gets no referrer information.", "specification_url": "https://w3c.github.io/webappsec-referrer-policy/#referrer-policy-no-referrer-when-downgrade", "test_expansion": [{"name": "insecure-protocol", "expansion": "default", "source_scheme": "http", "source_context_list": "*", "delivery_type": "*", "delivery_value": "no-referrer-when-downgrade", "redirection": "*", "origin": ["same-http", "cross-http"], "subresource": "*", "expectation": "stripped-referrer"}, {"name": "upgrade-protocol", "expansion": "default", "source_scheme": "http", "source_context_list": "*", "delivery_type": "*", "delivery_value": "no-referrer-when-downgrade", "redirection": "*", "origin": ["same-https", "cross-https"], "subresource": "*", "expectation": "stripped-referrer"}, {"name": "downgrade-protocol", "expansion": "default", "source_scheme": "https", "source_context_list": "*", "delivery_type": "*", "delivery_value": "no-referrer-when-downgrade", "redirection": "*", "origin": ["same-http", "cross-http"], "subresource": "*", "expectation": "omitted"}, {"name": "secure-protocol", "expansion": "default", "source_scheme": "https", "source_context_list": "*", "delivery_type": "*", "delivery_value": "no-referrer-when-downgrade", "redirection": "*", "origin": ["same-https", "cross-https"], "subresource": "*", "expectation": "stripped-referrer"}]}, {"name": "origin", "title": "Referrer Policy is set to 'origin'", "description": "Check that all subresources in all casses get only the origin portion of the referrer URL.", "specification_url": "https://w3c.github.io/webappsec-referrer-policy/#referrer-policy-origin", "test_expansion": [{"name": "generic", "expansion": "default", "source_scheme": "*", "source_context_list": "*", "delivery_type": "*", "delivery_value": "origin", "redirection": "*", "origin": "*", "subresource": "*", "expectation": "origin"}]}, {"name": "same-origin", "title": "Referrer Policy is set to 'same-origin'", "description": "Check that cross-origin subresources get no referrer information and same-origin get the stripped referrer URL.", "specification_url": "https://w3c.github.io/webappsec-referrer-policy/#referrer-policy-same-origin", "test_expansion": [{"name": "same-origin-insecure", "expansion": "default", "source_scheme": "http", "source_context_list": "*", "delivery_type": "*", "delivery_value": "same-origin", "redirection": "*", "origin": "same-http", "subresource": "*", "expectation": "stripped-referrer"}, {"name": "same-origin-secure-default", "expansion": "default", "source_scheme": "https", "source_context_list": "*", "delivery_type": "*", "delivery_value": "same-origin", "redirection": "*", "origin": "same-https", "subresource": "*", "expectation": "stripped-referrer"}, {"name": "same-origin-insecure", "expansion": "override", "source_scheme": "*", "source_context_list": "*", "delivery_type": "*", "delivery_value": "same-origin", "redirection": "swap-origin", "origin": ["same-http", "same-https"], "subresource": "*", "expectation": "omitted"}, {"name": "cross-origin", "expansion": "default", "source_scheme": "*", "source_context_list": "*", "delivery_type": "*", "delivery_value": "same-origin", "redirection": "*", "origin": ["cross-http", "cross-https"], "subresource": "*", "expectation": "omitted"}]}, {"name": "origin-when-cross-origin", "title": "Referrer Policy is set to 'origin-when-cross-origin'", "description": "Check that cross-origin subresources get the origin portion of the referrer URL and same-origin get the stripped referrer URL.", "specification_url": "https://w3c.github.io/webappsec-referrer-policy/#referrer-policy-origin-when-cross-origin", "test_expansion": [{"name": "same-origin-insecure", "expansion": "default", "source_scheme": "http", "source_context_list": "*", "delivery_type": "*", "delivery_value": "origin-when-cross-origin", "redirection": "*", "origin": "same-http", "subresource": "*", "expectation": "stripped-referrer"}, {"name": "same-origin-secure-default", "expansion": "default", "source_scheme": "https", "source_context_list": "*", "delivery_type": "*", "delivery_value": "origin-when-cross-origin", "redirection": "*", "origin": "same-https", "subresource": "*", "expectation": "stripped-referrer"}, {"name": "same-origin-upgrade", "expansion": "default", "source_scheme": "http", "source_context_list": "*", "delivery_type": "*", "delivery_value": "origin-when-cross-origin", "redirection": "*", "origin": "same-https", "subresource": "*", "expectation": "origin"}, {"name": "same-origin-downgrade", "expansion": "default", "source_scheme": "https", "source_context_list": "*", "delivery_type": "*", "delivery_value": "origin-when-cross-origin", "redirection": "*", "origin": "same-http", "subresource": "*", "expectation": "origin"}, {"name": "same-origin-insecure", "expansion": "override", "source_scheme": "*", "source_context_list": "*", "delivery_type": "*", "delivery_value": "origin-when-cross-origin", "redirection": "swap-origin", "origin": ["same-http", "same-https"], "subresource": "*", "expectation": "origin"}, {"name": "cross-origin", "expansion": "default", "source_scheme": "*", "source_context_list": "*", "delivery_type": "*", "delivery_value": "origin-when-cross-origin", "redirection": "*", "origin": ["cross-http", "cross-https"], "subresource": "*", "expectation": "origin"}]}, {"name": "strict-origin", "title": "Referrer Policy is set to 'strict-origin'", "description": "Check that non a priori insecure subresource gets only the origin portion of the referrer URL. A priori insecure subresource gets no referrer information.", "specification_url": "https://w3c.github.io/webappsec-referrer-policy/#referrer-policy-strict-origin", "test_expansion": [{"name": "insecure-protocol", "expansion": "default", "source_scheme": "http", "source_context_list": "*", "delivery_type": "*", "delivery_value": "strict-origin", "redirection": "*", "origin": ["same-http", "cross-http"], "subresource": "*", "expectation": "origin"}, {"name": "upgrade-protocol", "expansion": "default", "source_scheme": "http", "source_context_list": "*", "delivery_type": "*", "delivery_value": "strict-origin", "redirection": "*", "origin": ["same-https", "cross-https"], "subresource": "*", "expectation": "origin"}, {"name": "downgrade-protocol", "expansion": "default", "source_scheme": "https", "source_context_list": "*", "delivery_type": "*", "delivery_value": "strict-origin", "redirection": "*", "origin": ["same-http", "cross-http"], "subresource": "*", "expectation": "omitted"}, {"name": "secure-protocol", "expansion": "default", "source_scheme": "https", "source_context_list": "*", "delivery_type": "*", "delivery_value": "strict-origin", "redirection": "*", "origin": ["same-https", "cross-https"], "subresource": "*", "expectation": "origin"}]}, {"name": "strict-origin-when-cross-origin", "title": "Referrer Policy is set to 'strict-origin-when-cross-origin'", "description": "Check that a priori insecure subresource gets no referrer information. Otherwise, cross-origin subresources get the origin portion of the referrer URL and same-origin get the stripped referrer URL.", "specification_url": "https://w3c.github.io/webappsec-referrer-policy/#referrer-policy-strict-origin-when-cross-origin", "test_expansion": [{"name": "same-insecure", "expansion": "default", "source_scheme": "http", "source_context_list": "*", "delivery_type": "*", "delivery_value": "strict-origin-when-cross-origin", "redirection": "*", "origin": "same-http", "subresource": "*", "expectation": "stripped-referrer"}, {"name": "same-insecure", "expansion": "override", "source_scheme": "http", "source_context_list": "*", "delivery_type": "*", "delivery_value": "strict-origin-when-cross-origin", "redirection": "swap-origin", "origin": "same-http", "subresource": "*", "expectation": "origin"}, {"name": "cross-insecure", "expansion": "default", "source_scheme": "http", "source_context_list": "*", "delivery_type": "*", "delivery_value": "strict-origin-when-cross-origin", "redirection": "*", "origin": "cross-http", "subresource": "*", "expectation": "origin"}, {"name": "upgrade-protocol", "expansion": "default", "source_scheme": "http", "source_context_list": "*", "delivery_type": "*", "delivery_value": "strict-origin-when-cross-origin", "redirection": "*", "origin": ["same-https", "cross-https"], "subresource": "*", "expectation": "origin"}, {"name": "downgrade-protocol", "expansion": "default", "source_scheme": "https", "source_context_list": "*", "delivery_type": "*", "delivery_value": "strict-origin-when-cross-origin", "redirection": "*", "origin": ["same-http", "cross-http"], "subresource": "*", "expectation": "omitted"}, {"name": "same-secure", "expansion": "default", "source_scheme": "https", "source_context_list": "*", "delivery_type": "*", "delivery_value": "strict-origin-when-cross-origin", "redirection": "*", "origin": "same-https", "subresource": "*", "expectation": "stripped-referrer"}, {"name": "same-secure", "expansion": "override", "source_scheme": "https", "source_context_list": "*", "delivery_type": "*", "delivery_value": "strict-origin-when-cross-origin", "redirection": "swap-origin", "origin": "same-https", "subresource": "*", "expectation": "origin"}, {"name": "cross-secure", "expansion": "default", "source_scheme": "https", "source_context_list": "*", "delivery_type": "*", "delivery_value": "strict-origin-when-cross-origin", "redirection": "*", "origin": "cross-https", "subresource": "*", "expectation": "origin"}]}, {"name": "unsafe-url", "title": "Referrer Policy is set to 'unsafe-url'", "description": "Check that all sub-resources get the stripped referrer URL.", "specification_url": "https://w3c.github.io/webappsec-referrer-policy/#referrer-policy-unsafe-url", "test_expansion": [{"name": "generic", "expansion": "default", "source_scheme": "*", "source_context_list": "*", "delivery_type": "*", "delivery_value": "unsafe-url", "redirection": "*", "origin": "*", "subresource": "*", "expectation": "stripped-referrer"}]}], "delivery_key": "referrerPolicy", "excluded_tests": [{"name": "cross-origin-workers", "expansion": "*", "source_scheme": "*", "source_context_list": "*", "redirection": "*", "delivery_type": "*", "delivery_value": "*", "origin": ["cross-http", "cross-https"], "subresource": ["worker-classic", "worker-module", "sharedworker-classic"], "expectation": "*"}, {"name": "upgraded-protocol-workers", "expansion": "*", "source_scheme": "http", "source_context_list": "*", "delivery_type": "*", "delivery_value": "*", "redirection": "*", "origin": ["same-https", "cross-https"], "subresource": ["worker-classic", "worker-module", "sharedworker-classic"], "expectation": "*"}, {"name": "mixed-content-insecure-subresources", "expansion": "*", "source_scheme": "https", "source_context_list": "*", "delivery_type": "*", "delivery_value": "*", "redirection": "*", "origin": ["same-http", "cross-http"], "subresource": "*", "expectation": "*"}, {"name": "area-tag", "expansion": "*", "source_scheme": "*", "source_context_list": "*", "delivery_type": "*", "delivery_value": "*", "redirection": "*", "origin": "*", "subresource": "area-tag", "expectation": "*"}, {"name": "worker-requests-with-swap-origin-redirect", "expansion": "*", "source_scheme": "*", "source_context_list": "*", "delivery_type": "*", "delivery_value": "*", "redirection": "swap-origin", "origin": "*", "subresource": ["worker-classic", "worker-module", "sharedworker-classic"], "expectation": "*"}, {"name": "overhead-for-redirection", "expansion": "*", "source_scheme": "*", "source_context_list": "*", "delivery_type": "*", "delivery_value": "*", "redirection": ["keep-origin", "swap-origin"], "origin": "*", "subresource": ["a-tag", "area-tag"], "expectation": "*"}, {"name": "source-https-unsupported-by-web-platform-tests-runners", "expansion": "*", "source_scheme": "https", "source_context_list": "*", "delivery_type": "*", "delivery_value": "*", "redirection": "*", "origin": "*", "subresource": "*", "expectation": "*"}, {"name": "<link rel=noreferrer>'s delivery_value should be no-referrer", "expansion": "*", "source_scheme": "*", "source_context_list": "*", "delivery_type": "rel-noref", "delivery_value": [null, "no-referrer-when-downgrade", "same-origin", "origin", "origin-when-cross-origin", "strict-origin", "strict-origin-when-cross-origin", "unsafe-url"], "redirection": "*", "origin": "*", "subresource": "*", "expectation": "*"}, {"name": "expectation=stripped-referrer only", "expansion": "*", "source_scheme": "*", "source_context_list": "*", "redirection": "*", "delivery_type": "*", "delivery_value": "*", "origin": "*", "subresource": "*", "expectation": ["omitted", "origin"]}, {"name": "Only on the top context", "expansion": "*", "source_scheme": "*", "source_context_list": ["req", "srcdoc-inherit", "srcdoc", "iframe", "worker-classic", "worker-classic-data", "worker-module", "worker-module-data"], "redirection": "*", "delivery_type": "*", "delivery_value": "*", "origin": "*", "subresource": "*", "expectation": "*"}], "source_context_schema": {"supported_delivery_type": {"top": ["meta", "http-rp"], "iframe": ["meta", "http-rp"], "iframe-blank": ["meta"], "srcdoc": ["meta"], "worker-classic": ["http-rp"], "worker-module": ["http-rp"], "worker-classic-data": [], "worker-module-data": []}, "supported_subresource": {"top": "*", "iframe": "*", "iframe-blank": "*", "srcdoc": "*", "worker-classic": ["xhr", "fetch", "worker-classic", "worker-module"], "worker-module": ["xhr", "fetch", "worker-classic", "worker-module"], "worker-classic-data": ["xhr", "fetch"], "worker-module-data": ["xhr", "fetch"]}}, "subresource_schema": {"supported_delivery_type": {"iframe-tag": ["attr"], "img-tag": ["attr"], "script-tag": ["attr"], "a-tag": ["attr", "rel-noref"], "area-tag": ["attr"], "xhr": [], "fetch": [], "worker-module": [], "sharedworker-classic": [], "worker-classic": []}}, "source_context_list_schema": {"top": {"description": "Policy set by the top-level Document", "sourceContextList": [{"sourceContextType": "top", "policyDeliveries": ["policy"]}], "subresourcePolicyDeliveries": []}, "req": {"description": "Subresource request's policy should override Document's policy", "sourceContextList": [{"sourceContextType": "top", "policyDeliveries": ["anotherPolicy"]}], "subresourcePolicyDeliveries": ["nonNullPolicy"]}, "srcdoc-inherit": {"description": "srcdoc iframe should inherit parent Document's policy", "sourceContextList": [{"sourceContextType": "top", "policyDeliveries": ["policy"]}, {"sourceContextType": "srcdoc"}], "subresourcePolicyDeliveries": []}, "srcdoc": {"description": "srcdoc iframe's policy should override parent Document's policy", "sourceContextList": [{"sourceContextType": "top", "policyDeliveries": ["anotherPolicy"]}, {"sourceContextType": "srcdoc", "policyDeliveries": ["nonNullPolicy"]}], "subresourcePolicyDeliveries": []}, "iframe": {"description": "external iframe's policy should override parent Document's policy", "sourceContextList": [{"sourceContextType": "top", "policyDeliveries": ["anotherPolicy"]}, {"sourceContextType": "iframe", "policyDeliveries": ["policy"]}], "subresourcePolicyDeliveries": []}, "worker-classic": {"sourceContextList": [{"sourceContextType": "top", "policyDeliveries": ["anotherPolicy"]}, {"sourceContextType": "worker-classic", "policyDeliveries": ["policy"]}], "subresourcePolicyDeliveries": []}, "worker-classic-data": {"sourceContextList": [{"sourceContextType": "top", "policyDeliveries": ["anotherPolicy"]}, {"sourceContextType": "worker-classic-data", "policyDeliveries": ["policy"]}], "subresourcePolicyDeliveries": []}, "worker-module": {"sourceContextList": [{"sourceContextType": "top", "policyDeliveries": ["anotherPolicy"]}, {"sourceContextType": "worker-module", "policyDeliveries": ["policy"]}], "subresourcePolicyDeliveries": []}, "worker-module-data": {"sourceContextList": [{"sourceContextType": "top", "policyDeliveries": ["anotherPolicy"]}, {"sourceContextType": "worker-module-data", "policyDeliveries": ["policy"]}], "subresourcePolicyDeliveries": []}}, "test_expansion_schema": {"expansion": ["default", "override"], "delivery_type": ["attr", "rel-noref", "http-rp", "meta"], "delivery_value": [null, "no-referrer", "no-referrer-when-downgrade", "same-origin", "origin", "origin-when-cross-origin", "strict-origin", "strict-origin-when-cross-origin", "unsafe-url"], "origin": ["same-http", "same-https", "cross-http", "cross-https"], "source_context_list": ["top", "req", "srcdoc-inherit", "srcdoc", "iframe", "worker-classic", "worker-classic-data", "worker-module", "worker-module-data"], "source_scheme": ["http", "https"], "redirection": ["no-redirect", "keep-origin", "swap-origin"], "subresource": ["iframe-tag", "img-tag", "script-tag", "a-tag", "area-tag", "xhr", "worker-classic", "worker-module", "sharedworker-classic", "fetch"], "expectation": ["omitted", "origin", "stripped-referrer"]}};
diff --git a/tests/wpt/web-platform-tests/referrer-policy/4K-1/generic/test-case.sub.js b/tests/wpt/web-platform-tests/referrer-policy/4K-1/generic/test-case.sub.js
new file mode 100644
index 00000000000..5b6aa4216b7
--- /dev/null
+++ b/tests/wpt/web-platform-tests/referrer-policy/4K-1/generic/test-case.sub.js
@@ -0,0 +1,11 @@
+function TestCase(scenario, testDescription, sanityChecker) {
+ // This check is A NOOP in release.
+ sanityChecker.checkScenario(scenario);
+ return {
+ start: () => runLengthTest(
+ scenario,
+ 4096 - 1,
+ scenario.expectation,
+ "`Referer` header with length < 4k is not stripped to an origin.")
+ };
+}
diff --git a/tests/wpt/web-platform-tests/referrer-policy/4K-1/spec.src.json b/tests/wpt/web-platform-tests/referrer-policy/4K-1/spec.src.json
new file mode 100644
index 00000000000..5dc2085c62f
--- /dev/null
+++ b/tests/wpt/web-platform-tests/referrer-policy/4K-1/spec.src.json
@@ -0,0 +1,40 @@
+{
+ "excluded_tests": [
+ {
+ "name": "expectation=stripped-referrer only",
+ "expansion": "*",
+ "source_scheme": "*",
+ "source_context_list": "*",
+ "redirection": "*",
+ "delivery_type": "*",
+ "delivery_value": "*",
+ "origin": "*",
+ "subresource": "*",
+ "expectation": [
+ "omitted",
+ "origin"
+ ]
+ },
+ {
+ "name": "Only on the top context",
+ "expansion": "*",
+ "source_scheme": "*",
+ "source_context_list": [
+ "req",
+ "srcdoc-inherit",
+ "srcdoc",
+ "iframe",
+ "worker-classic",
+ "worker-classic-data",
+ "worker-module",
+ "worker-module-data"
+ ],
+ "redirection": "*",
+ "delivery_type": "*",
+ "delivery_value": "*",
+ "origin": "*",
+ "subresource": "*",
+ "expectation": "*"
+ }
+ ]
+}
diff --git a/tests/wpt/web-platform-tests/referrer-policy/4K/generic/spec_json.js b/tests/wpt/web-platform-tests/referrer-policy/4K/generic/spec_json.js
new file mode 100644
index 00000000000..39cd997338e
--- /dev/null
+++ b/tests/wpt/web-platform-tests/referrer-policy/4K/generic/spec_json.js
@@ -0,0 +1 @@
+var SPEC_JSON = {"selection_pattern": "%(source_context_list)s.%(delivery_type)s/%(delivery_value)s/%(subresource)s/%(origin)s.%(redirection)s.%(source_scheme)s", "test_file_path_pattern": "gen/%(source_context_list)s.%(delivery_type)s/%(delivery_value)s/%(subresource)s/%(origin)s.%(redirection)s.%(source_scheme)s.html", "test_description_template": "Referrer Policy: Expects %(expectation)s for %(subresource)s to %(origin)s origin and %(redirection)s redirection from %(source_scheme)s context.", "test_page_title_template": "Referrer-Policy: %(title)s", "specification": [{"name": "unset-referrer-policy", "title": "Referrer Policy is not explicitly defined", "description": "Check that referrer URL follows no-referrer-when-downgrade policy when no explicit Referrer Policy is set.", "specification_url": "https://w3c.github.io/webappsec-referrer-policy/#referrer-policies", "test_expansion": [{"name": "insecure-protocol", "expansion": "default", "source_scheme": "http", "source_context_list": "*", "delivery_type": "*", "delivery_value": null, "redirection": "*", "origin": ["same-http", "cross-http"], "subresource": "*", "expectation": "stripped-referrer"}, {"name": "upgrade-protocol", "expansion": "default", "source_scheme": "http", "source_context_list": "*", "delivery_type": "*", "delivery_value": null, "redirection": "*", "origin": ["same-https", "cross-https"], "subresource": "*", "expectation": "stripped-referrer"}, {"name": "downgrade-protocol", "expansion": "default", "source_scheme": "https", "source_context_list": "*", "delivery_type": "*", "delivery_value": null, "redirection": "*", "origin": ["same-http", "cross-http"], "subresource": "*", "expectation": "omitted"}, {"name": "secure-protocol", "expansion": "default", "source_scheme": "https", "source_context_list": "*", "delivery_type": "*", "delivery_value": null, "redirection": "*", "origin": ["same-https", "cross-https"], "subresource": "*", "expectation": "stripped-referrer"}]}, {"name": "no-referrer", "title": "Referrer Policy is set to 'no-referrer'", "description": "Check that sub-resource never gets the referrer URL.", "specification_url": "https://w3c.github.io/webappsec-referrer-policy/#referrer-policy-no-referrer", "test_expansion": [{"name": "generic", "expansion": "default", "source_scheme": "*", "source_context_list": "*", "delivery_type": "*", "delivery_value": "no-referrer", "redirection": "*", "origin": "*", "subresource": "*", "expectation": "omitted"}]}, {"name": "no-referrer-when-downgrade", "title": "Referrer Policy is set to 'no-referrer-when-downgrade'", "description": "Check that non a priori insecure subresource gets the full Referrer URL. A priori insecure subresource gets no referrer information.", "specification_url": "https://w3c.github.io/webappsec-referrer-policy/#referrer-policy-no-referrer-when-downgrade", "test_expansion": [{"name": "insecure-protocol", "expansion": "default", "source_scheme": "http", "source_context_list": "*", "delivery_type": "*", "delivery_value": "no-referrer-when-downgrade", "redirection": "*", "origin": ["same-http", "cross-http"], "subresource": "*", "expectation": "stripped-referrer"}, {"name": "upgrade-protocol", "expansion": "default", "source_scheme": "http", "source_context_list": "*", "delivery_type": "*", "delivery_value": "no-referrer-when-downgrade", "redirection": "*", "origin": ["same-https", "cross-https"], "subresource": "*", "expectation": "stripped-referrer"}, {"name": "downgrade-protocol", "expansion": "default", "source_scheme": "https", "source_context_list": "*", "delivery_type": "*", "delivery_value": "no-referrer-when-downgrade", "redirection": "*", "origin": ["same-http", "cross-http"], "subresource": "*", "expectation": "omitted"}, {"name": "secure-protocol", "expansion": "default", "source_scheme": "https", "source_context_list": "*", "delivery_type": "*", "delivery_value": "no-referrer-when-downgrade", "redirection": "*", "origin": ["same-https", "cross-https"], "subresource": "*", "expectation": "stripped-referrer"}]}, {"name": "origin", "title": "Referrer Policy is set to 'origin'", "description": "Check that all subresources in all casses get only the origin portion of the referrer URL.", "specification_url": "https://w3c.github.io/webappsec-referrer-policy/#referrer-policy-origin", "test_expansion": [{"name": "generic", "expansion": "default", "source_scheme": "*", "source_context_list": "*", "delivery_type": "*", "delivery_value": "origin", "redirection": "*", "origin": "*", "subresource": "*", "expectation": "origin"}]}, {"name": "same-origin", "title": "Referrer Policy is set to 'same-origin'", "description": "Check that cross-origin subresources get no referrer information and same-origin get the stripped referrer URL.", "specification_url": "https://w3c.github.io/webappsec-referrer-policy/#referrer-policy-same-origin", "test_expansion": [{"name": "same-origin-insecure", "expansion": "default", "source_scheme": "http", "source_context_list": "*", "delivery_type": "*", "delivery_value": "same-origin", "redirection": "*", "origin": "same-http", "subresource": "*", "expectation": "stripped-referrer"}, {"name": "same-origin-secure-default", "expansion": "default", "source_scheme": "https", "source_context_list": "*", "delivery_type": "*", "delivery_value": "same-origin", "redirection": "*", "origin": "same-https", "subresource": "*", "expectation": "stripped-referrer"}, {"name": "same-origin-insecure", "expansion": "override", "source_scheme": "*", "source_context_list": "*", "delivery_type": "*", "delivery_value": "same-origin", "redirection": "swap-origin", "origin": ["same-http", "same-https"], "subresource": "*", "expectation": "omitted"}, {"name": "cross-origin", "expansion": "default", "source_scheme": "*", "source_context_list": "*", "delivery_type": "*", "delivery_value": "same-origin", "redirection": "*", "origin": ["cross-http", "cross-https"], "subresource": "*", "expectation": "omitted"}]}, {"name": "origin-when-cross-origin", "title": "Referrer Policy is set to 'origin-when-cross-origin'", "description": "Check that cross-origin subresources get the origin portion of the referrer URL and same-origin get the stripped referrer URL.", "specification_url": "https://w3c.github.io/webappsec-referrer-policy/#referrer-policy-origin-when-cross-origin", "test_expansion": [{"name": "same-origin-insecure", "expansion": "default", "source_scheme": "http", "source_context_list": "*", "delivery_type": "*", "delivery_value": "origin-when-cross-origin", "redirection": "*", "origin": "same-http", "subresource": "*", "expectation": "stripped-referrer"}, {"name": "same-origin-secure-default", "expansion": "default", "source_scheme": "https", "source_context_list": "*", "delivery_type": "*", "delivery_value": "origin-when-cross-origin", "redirection": "*", "origin": "same-https", "subresource": "*", "expectation": "stripped-referrer"}, {"name": "same-origin-upgrade", "expansion": "default", "source_scheme": "http", "source_context_list": "*", "delivery_type": "*", "delivery_value": "origin-when-cross-origin", "redirection": "*", "origin": "same-https", "subresource": "*", "expectation": "origin"}, {"name": "same-origin-downgrade", "expansion": "default", "source_scheme": "https", "source_context_list": "*", "delivery_type": "*", "delivery_value": "origin-when-cross-origin", "redirection": "*", "origin": "same-http", "subresource": "*", "expectation": "origin"}, {"name": "same-origin-insecure", "expansion": "override", "source_scheme": "*", "source_context_list": "*", "delivery_type": "*", "delivery_value": "origin-when-cross-origin", "redirection": "swap-origin", "origin": ["same-http", "same-https"], "subresource": "*", "expectation": "origin"}, {"name": "cross-origin", "expansion": "default", "source_scheme": "*", "source_context_list": "*", "delivery_type": "*", "delivery_value": "origin-when-cross-origin", "redirection": "*", "origin": ["cross-http", "cross-https"], "subresource": "*", "expectation": "origin"}]}, {"name": "strict-origin", "title": "Referrer Policy is set to 'strict-origin'", "description": "Check that non a priori insecure subresource gets only the origin portion of the referrer URL. A priori insecure subresource gets no referrer information.", "specification_url": "https://w3c.github.io/webappsec-referrer-policy/#referrer-policy-strict-origin", "test_expansion": [{"name": "insecure-protocol", "expansion": "default", "source_scheme": "http", "source_context_list": "*", "delivery_type": "*", "delivery_value": "strict-origin", "redirection": "*", "origin": ["same-http", "cross-http"], "subresource": "*", "expectation": "origin"}, {"name": "upgrade-protocol", "expansion": "default", "source_scheme": "http", "source_context_list": "*", "delivery_type": "*", "delivery_value": "strict-origin", "redirection": "*", "origin": ["same-https", "cross-https"], "subresource": "*", "expectation": "origin"}, {"name": "downgrade-protocol", "expansion": "default", "source_scheme": "https", "source_context_list": "*", "delivery_type": "*", "delivery_value": "strict-origin", "redirection": "*", "origin": ["same-http", "cross-http"], "subresource": "*", "expectation": "omitted"}, {"name": "secure-protocol", "expansion": "default", "source_scheme": "https", "source_context_list": "*", "delivery_type": "*", "delivery_value": "strict-origin", "redirection": "*", "origin": ["same-https", "cross-https"], "subresource": "*", "expectation": "origin"}]}, {"name": "strict-origin-when-cross-origin", "title": "Referrer Policy is set to 'strict-origin-when-cross-origin'", "description": "Check that a priori insecure subresource gets no referrer information. Otherwise, cross-origin subresources get the origin portion of the referrer URL and same-origin get the stripped referrer URL.", "specification_url": "https://w3c.github.io/webappsec-referrer-policy/#referrer-policy-strict-origin-when-cross-origin", "test_expansion": [{"name": "same-insecure", "expansion": "default", "source_scheme": "http", "source_context_list": "*", "delivery_type": "*", "delivery_value": "strict-origin-when-cross-origin", "redirection": "*", "origin": "same-http", "subresource": "*", "expectation": "stripped-referrer"}, {"name": "same-insecure", "expansion": "override", "source_scheme": "http", "source_context_list": "*", "delivery_type": "*", "delivery_value": "strict-origin-when-cross-origin", "redirection": "swap-origin", "origin": "same-http", "subresource": "*", "expectation": "origin"}, {"name": "cross-insecure", "expansion": "default", "source_scheme": "http", "source_context_list": "*", "delivery_type": "*", "delivery_value": "strict-origin-when-cross-origin", "redirection": "*", "origin": "cross-http", "subresource": "*", "expectation": "origin"}, {"name": "upgrade-protocol", "expansion": "default", "source_scheme": "http", "source_context_list": "*", "delivery_type": "*", "delivery_value": "strict-origin-when-cross-origin", "redirection": "*", "origin": ["same-https", "cross-https"], "subresource": "*", "expectation": "origin"}, {"name": "downgrade-protocol", "expansion": "default", "source_scheme": "https", "source_context_list": "*", "delivery_type": "*", "delivery_value": "strict-origin-when-cross-origin", "redirection": "*", "origin": ["same-http", "cross-http"], "subresource": "*", "expectation": "omitted"}, {"name": "same-secure", "expansion": "default", "source_scheme": "https", "source_context_list": "*", "delivery_type": "*", "delivery_value": "strict-origin-when-cross-origin", "redirection": "*", "origin": "same-https", "subresource": "*", "expectation": "stripped-referrer"}, {"name": "same-secure", "expansion": "override", "source_scheme": "https", "source_context_list": "*", "delivery_type": "*", "delivery_value": "strict-origin-when-cross-origin", "redirection": "swap-origin", "origin": "same-https", "subresource": "*", "expectation": "origin"}, {"name": "cross-secure", "expansion": "default", "source_scheme": "https", "source_context_list": "*", "delivery_type": "*", "delivery_value": "strict-origin-when-cross-origin", "redirection": "*", "origin": "cross-https", "subresource": "*", "expectation": "origin"}]}, {"name": "unsafe-url", "title": "Referrer Policy is set to 'unsafe-url'", "description": "Check that all sub-resources get the stripped referrer URL.", "specification_url": "https://w3c.github.io/webappsec-referrer-policy/#referrer-policy-unsafe-url", "test_expansion": [{"name": "generic", "expansion": "default", "source_scheme": "*", "source_context_list": "*", "delivery_type": "*", "delivery_value": "unsafe-url", "redirection": "*", "origin": "*", "subresource": "*", "expectation": "stripped-referrer"}]}], "delivery_key": "referrerPolicy", "excluded_tests": [{"name": "cross-origin-workers", "expansion": "*", "source_scheme": "*", "source_context_list": "*", "redirection": "*", "delivery_type": "*", "delivery_value": "*", "origin": ["cross-http", "cross-https"], "subresource": ["worker-classic", "worker-module", "sharedworker-classic"], "expectation": "*"}, {"name": "upgraded-protocol-workers", "expansion": "*", "source_scheme": "http", "source_context_list": "*", "delivery_type": "*", "delivery_value": "*", "redirection": "*", "origin": ["same-https", "cross-https"], "subresource": ["worker-classic", "worker-module", "sharedworker-classic"], "expectation": "*"}, {"name": "mixed-content-insecure-subresources", "expansion": "*", "source_scheme": "https", "source_context_list": "*", "delivery_type": "*", "delivery_value": "*", "redirection": "*", "origin": ["same-http", "cross-http"], "subresource": "*", "expectation": "*"}, {"name": "area-tag", "expansion": "*", "source_scheme": "*", "source_context_list": "*", "delivery_type": "*", "delivery_value": "*", "redirection": "*", "origin": "*", "subresource": "area-tag", "expectation": "*"}, {"name": "worker-requests-with-swap-origin-redirect", "expansion": "*", "source_scheme": "*", "source_context_list": "*", "delivery_type": "*", "delivery_value": "*", "redirection": "swap-origin", "origin": "*", "subresource": ["worker-classic", "worker-module", "sharedworker-classic"], "expectation": "*"}, {"name": "overhead-for-redirection", "expansion": "*", "source_scheme": "*", "source_context_list": "*", "delivery_type": "*", "delivery_value": "*", "redirection": ["keep-origin", "swap-origin"], "origin": "*", "subresource": ["a-tag", "area-tag"], "expectation": "*"}, {"name": "source-https-unsupported-by-web-platform-tests-runners", "expansion": "*", "source_scheme": "https", "source_context_list": "*", "delivery_type": "*", "delivery_value": "*", "redirection": "*", "origin": "*", "subresource": "*", "expectation": "*"}, {"name": "<link rel=noreferrer>'s delivery_value should be no-referrer", "expansion": "*", "source_scheme": "*", "source_context_list": "*", "delivery_type": "rel-noref", "delivery_value": [null, "no-referrer-when-downgrade", "same-origin", "origin", "origin-when-cross-origin", "strict-origin", "strict-origin-when-cross-origin", "unsafe-url"], "redirection": "*", "origin": "*", "subresource": "*", "expectation": "*"}, {"name": "expectation=stripped-referrer only", "expansion": "*", "source_scheme": "*", "source_context_list": "*", "redirection": "*", "delivery_type": "*", "delivery_value": "*", "origin": "*", "subresource": "*", "expectation": ["omitted", "origin"]}, {"name": "Only on the top context", "expansion": "*", "source_scheme": "*", "source_context_list": ["req", "srcdoc-inherit", "srcdoc", "iframe", "worker-classic", "worker-classic-data", "worker-module", "worker-module-data"], "redirection": "*", "delivery_type": "*", "delivery_value": "*", "origin": "*", "subresource": "*", "expectation": "*"}], "source_context_schema": {"supported_delivery_type": {"top": ["meta", "http-rp"], "iframe": ["meta", "http-rp"], "iframe-blank": ["meta"], "srcdoc": ["meta"], "worker-classic": ["http-rp"], "worker-module": ["http-rp"], "worker-classic-data": [], "worker-module-data": []}, "supported_subresource": {"top": "*", "iframe": "*", "iframe-blank": "*", "srcdoc": "*", "worker-classic": ["xhr", "fetch", "worker-classic", "worker-module"], "worker-module": ["xhr", "fetch", "worker-classic", "worker-module"], "worker-classic-data": ["xhr", "fetch"], "worker-module-data": ["xhr", "fetch"]}}, "subresource_schema": {"supported_delivery_type": {"iframe-tag": ["attr"], "img-tag": ["attr"], "script-tag": ["attr"], "a-tag": ["attr", "rel-noref"], "area-tag": ["attr"], "xhr": [], "fetch": [], "worker-module": [], "sharedworker-classic": [], "worker-classic": []}}, "source_context_list_schema": {"top": {"description": "Policy set by the top-level Document", "sourceContextList": [{"sourceContextType": "top", "policyDeliveries": ["policy"]}], "subresourcePolicyDeliveries": []}, "req": {"description": "Subresource request's policy should override Document's policy", "sourceContextList": [{"sourceContextType": "top", "policyDeliveries": ["anotherPolicy"]}], "subresourcePolicyDeliveries": ["nonNullPolicy"]}, "srcdoc-inherit": {"description": "srcdoc iframe should inherit parent Document's policy", "sourceContextList": [{"sourceContextType": "top", "policyDeliveries": ["policy"]}, {"sourceContextType": "srcdoc"}], "subresourcePolicyDeliveries": []}, "srcdoc": {"description": "srcdoc iframe's policy should override parent Document's policy", "sourceContextList": [{"sourceContextType": "top", "policyDeliveries": ["anotherPolicy"]}, {"sourceContextType": "srcdoc", "policyDeliveries": ["nonNullPolicy"]}], "subresourcePolicyDeliveries": []}, "iframe": {"description": "external iframe's policy should override parent Document's policy", "sourceContextList": [{"sourceContextType": "top", "policyDeliveries": ["anotherPolicy"]}, {"sourceContextType": "iframe", "policyDeliveries": ["policy"]}], "subresourcePolicyDeliveries": []}, "worker-classic": {"sourceContextList": [{"sourceContextType": "top", "policyDeliveries": ["anotherPolicy"]}, {"sourceContextType": "worker-classic", "policyDeliveries": ["policy"]}], "subresourcePolicyDeliveries": []}, "worker-classic-data": {"sourceContextList": [{"sourceContextType": "top", "policyDeliveries": ["anotherPolicy"]}, {"sourceContextType": "worker-classic-data", "policyDeliveries": ["policy"]}], "subresourcePolicyDeliveries": []}, "worker-module": {"sourceContextList": [{"sourceContextType": "top", "policyDeliveries": ["anotherPolicy"]}, {"sourceContextType": "worker-module", "policyDeliveries": ["policy"]}], "subresourcePolicyDeliveries": []}, "worker-module-data": {"sourceContextList": [{"sourceContextType": "top", "policyDeliveries": ["anotherPolicy"]}, {"sourceContextType": "worker-module-data", "policyDeliveries": ["policy"]}], "subresourcePolicyDeliveries": []}}, "test_expansion_schema": {"expansion": ["default", "override"], "delivery_type": ["attr", "rel-noref", "http-rp", "meta"], "delivery_value": [null, "no-referrer", "no-referrer-when-downgrade", "same-origin", "origin", "origin-when-cross-origin", "strict-origin", "strict-origin-when-cross-origin", "unsafe-url"], "origin": ["same-http", "same-https", "cross-http", "cross-https"], "source_context_list": ["top", "req", "srcdoc-inherit", "srcdoc", "iframe", "worker-classic", "worker-classic-data", "worker-module", "worker-module-data"], "source_scheme": ["http", "https"], "redirection": ["no-redirect", "keep-origin", "swap-origin"], "subresource": ["iframe-tag", "img-tag", "script-tag", "a-tag", "area-tag", "xhr", "worker-classic", "worker-module", "sharedworker-classic", "fetch"], "expectation": ["omitted", "origin", "stripped-referrer"]}};
diff --git a/tests/wpt/web-platform-tests/referrer-policy/4K/generic/test-case.sub.js b/tests/wpt/web-platform-tests/referrer-policy/4K/generic/test-case.sub.js
new file mode 100644
index 00000000000..912c06e10e7
--- /dev/null
+++ b/tests/wpt/web-platform-tests/referrer-policy/4K/generic/test-case.sub.js
@@ -0,0 +1,11 @@
+function TestCase(scenario, testDescription, sanityChecker) {
+ // This check is A NOOP in release.
+ sanityChecker.checkScenario(scenario);
+ return {
+ start: () => runLengthTest(
+ scenario,
+ 4096,
+ scenario.expectation,
+ "`Referer` header with length == 4k is not stripped to an origin.")
+ };
+}
diff --git a/tests/wpt/web-platform-tests/referrer-policy/4K/spec.src.json b/tests/wpt/web-platform-tests/referrer-policy/4K/spec.src.json
new file mode 100644
index 00000000000..5dc2085c62f
--- /dev/null
+++ b/tests/wpt/web-platform-tests/referrer-policy/4K/spec.src.json
@@ -0,0 +1,40 @@
+{
+ "excluded_tests": [
+ {
+ "name": "expectation=stripped-referrer only",
+ "expansion": "*",
+ "source_scheme": "*",
+ "source_context_list": "*",
+ "redirection": "*",
+ "delivery_type": "*",
+ "delivery_value": "*",
+ "origin": "*",
+ "subresource": "*",
+ "expectation": [
+ "omitted",
+ "origin"
+ ]
+ },
+ {
+ "name": "Only on the top context",
+ "expansion": "*",
+ "source_scheme": "*",
+ "source_context_list": [
+ "req",
+ "srcdoc-inherit",
+ "srcdoc",
+ "iframe",
+ "worker-classic",
+ "worker-classic-data",
+ "worker-module",
+ "worker-module-data"
+ ],
+ "redirection": "*",
+ "delivery_type": "*",
+ "delivery_value": "*",
+ "origin": "*",
+ "subresource": "*",
+ "expectation": "*"
+ }
+ ]
+}
diff --git a/tests/wpt/web-platform-tests/referrer-policy/generic/test-case.sub.js b/tests/wpt/web-platform-tests/referrer-policy/generic/test-case.sub.js
index c8a6b139f33..a8292e57e1f 100644
--- a/tests/wpt/web-platform-tests/referrer-policy/generic/test-case.sub.js
+++ b/tests/wpt/web-platform-tests/referrer-policy/generic/test-case.sub.js
@@ -22,110 +22,77 @@ function invokeScenario(scenario) {
return invokeRequest(subresource, scenario.source_context_list);
}
-function TestCase(scenario, testDescription, sanityChecker) {
- // This check is A NOOP in release.
- sanityChecker.checkScenario(scenario);
+const referrerUrlResolver = {
+ "omitted": function(sourceUrl) {
+ return undefined;
+ },
+ "origin": function(sourceUrl) {
+ return new URL(sourceUrl).origin + "/";
+ },
+ "stripped-referrer": function(sourceUrl) {
+ return stripUrlForUseAsReferrer(sourceUrl);
+ }
+};
- const referrerUrlResolver = {
- "omitted": function(sourceUrl) {
- return undefined;
- },
- "origin": function(sourceUrl) {
- return new URL(sourceUrl).origin + "/";
- },
- "stripped-referrer": function(sourceUrl) {
- return stripUrlForUseAsReferrer(sourceUrl);
- }
- };
+function checkResult(scenario, expectation, result) {
+// https://w3c.github.io/webappsec-referrer-policy/#determine-requests-referrer
+ let referrerSource = result.sourceContextUrl;
+ const sentFromSrcdoc = scenario.source_context_list.length > 0 &&
+ scenario.source_context_list[scenario.source_context_list.length - 1]
+ .sourceContextType === 'srcdoc';
+ if (sentFromSrcdoc) {
+ // Step 3. While document is an iframe srcdoc document, let document be
+ // document's browsing context's browsing context container's node
+ // document. [spec text]
- const checkResult = (expectation, result) => {
- // https://w3c.github.io/webappsec-referrer-policy/#determine-requests-referrer
- let referrerSource = result.sourceContextUrl;
- const sentFromSrcdoc = scenario.source_context_list.length > 0 &&
- scenario.source_context_list[scenario.source_context_list.length - 1]
- .sourceContextType === 'srcdoc';
- if (sentFromSrcdoc) {
- // Step 3. While document is an iframe srcdoc document, let document be
- // document's browsing context's browsing context container's node
- // document. [spec text]
+ // Workaround for srcdoc cases. Currently we only test <iframe srcdoc>
+ // inside the top-level Document, so |document| in the spec here is
+ // the top-level Document.
+ // This doesn't work if e.g. we test <iframe srcdoc> inside another
+ // external <iframe>.
+ referrerSource = location.toString();
+ }
+ const expectedReferrerUrl =
+ referrerUrlResolver[expectation](referrerSource);
- // Workaround for srcdoc cases. Currently we only test <iframe srcdoc>
- // inside the top-level Document, so |document| in the spec here is
- // the top-level Document.
- // This doesn't work if e.g. we test <iframe srcdoc> inside another
- // external <iframe>.
- referrerSource = location.toString();
- }
- const expectedReferrerUrl =
- referrerUrlResolver[expectation](referrerSource);
+ // Check the reported URL.
+ assert_equals(result.referrer,
+ expectedReferrerUrl,
+ "Reported Referrer URL is '" +
+ expectation + "'.");
+ assert_equals(result.headers.referer,
+ expectedReferrerUrl,
+ "Reported Referrer URL from HTTP header is '" +
+ expectedReferrerUrl + "'");
+}
- // Check the reported URL.
- assert_equals(result.referrer,
- expectedReferrerUrl,
- "Reported Referrer URL is '" +
- expectation + "'.");
- assert_equals(result.headers.referer,
- expectedReferrerUrl,
- "Reported Referrer URL from HTTP header is '" +
- expectedReferrerUrl + "'");
- };
+function runLengthTest(scenario, urlLength, expectation, testDescription) {
+ // `Referer` headers with length over 4k are culled down to an origin, so,
+ // let's test around that boundary for tests that would otherwise return
+ // the complete URL.
+ history.pushState(null, null, "/");
+ history.replaceState(null, null,
+ "A".repeat(urlLength - location.href.length));
- function runTest() {
- function historyBackPromise(t, scenario) {
- history.back();
- return new Promise(resolve => {
- // Wait for completion of `history.back()` by listening the
- // popstate events that are fired near the end of
- // `history.back()` processing.
- window.addEventListener('popstate', resolve, {once: true});
+ promise_test(t => {
+ assert_equals(scenario.expectation, "stripped-referrer");
+ // Only on top-level Window, due to navigations using `history`.
+ assert_equals(scenario.source_context_list.length, 0);
- // Workaround for Safari: Waiting for popstate events causes
- // timeout in a-tag tests. To avoid timeout, we anyway resolve
- // the promise.
- if (scenario.subresource === 'a-tag') {
- t.step_timeout(resolve, 1000);
- }
- });
- }
+ return invokeScenario(scenario)
+ .then(result => checkResult(scenario, expectation, result));
+ }, testDescription);
+}
+
+function TestCase(scenario, testDescription, sanityChecker) {
+ // This check is A NOOP in release.
+ sanityChecker.checkScenario(scenario);
+ function runTest() {
promise_test(_ => {
return invokeScenario(scenario)
- .then(result => checkResult(scenario.expectation, result));
+ .then(result => checkResult(scenario, scenario.expectation, result));
}, testDescription);
-
- // `Referer` headers with length over 4k are culled down to an origin, so,
- // let's test around that boundary for tests that would otherwise return
- // the complete URL.
- // The following tests run only on top-level Documents, because they rely
- // on navigations using `history`.
- // Different subresource URLs are used because getRequestURLs() is called
- // for each sub test which returns a unique URL.
- if (scenario.expectation == "stripped-referrer" &&
- scenario.source_context_list.length == 0) {
- promise_test(t => {
- history.pushState(null, null, "/");
- history.replaceState(null, null, "A".repeat(4096 - location.href.length - 1));
- return invokeScenario(scenario)
- .then(result => checkResult(scenario.expectation, result))
- .finally(_ => historyBackPromise(t, scenario));
- }, "`Referer` header with length < 4k is not stripped to an origin.");
-
- promise_test(t => {
- history.pushState(null, null, "/");
- history.replaceState(null, null, "A".repeat(4096 - location.href.length));
- return invokeScenario(scenario)
- .then(result => checkResult(scenario.expectation, result))
- .finally(_ => historyBackPromise(t, scenario));
- }, "`Referer` header with length == 4k is not stripped to an origin.");
-
- promise_test(t => {
- history.pushState(null, null, "/");
- history.replaceState(null, null, "A".repeat(4096 - location.href.length + 1));
- return invokeScenario(scenario)
- .then(result => checkResult("origin", result))
- .finally(_ => historyBackPromise(t, scenario));
- }, "`Referer` header with length > 4k is stripped to an origin.");
- }
}
return {start: runTest};
diff --git a/tests/wpt/web-platform-tests/service-workers/service-worker/resources/interfaces-worker.sub.js b/tests/wpt/web-platform-tests/service-workers/service-worker/resources/interfaces-worker.sub.js
index ac79ddc0056..44bd0870b95 100644
--- a/tests/wpt/web-platform-tests/service-workers/service-worker/resources/interfaces-worker.sub.js
+++ b/tests/wpt/web-platform-tests/service-workers/service-worker/resources/interfaces-worker.sub.js
@@ -51,13 +51,13 @@ test(function() {
assert_equals(
new ExtendableEvent('ExtendableEvent').type,
'ExtendableEvent', 'Type of ExtendableEvent should be ExtendableEvent');
- assert_throws(new TypeError, function() {
+ assert_throws_js(TypeError, function() {
new FetchEvent('FetchEvent');
}, 'FetchEvent constructor with one argument throws');
- assert_throws(new TypeError, function() {
+ assert_throws_js(TypeError, function() {
new FetchEvent('FetchEvent', {});
}, 'FetchEvent constructor with empty init dict throws');
- assert_throws(new TypeError, function() {
+ assert_throws_js(TypeError, function() {
new FetchEvent('FetchEvent', {request: null});
}, 'FetchEvent constructor with null request member throws');
assert_equals(
diff --git a/tests/wpt/web-platform-tests/tools/wptrunner/requirements.txt b/tests/wpt/web-platform-tests/tools/wptrunner/requirements.txt
index 328b43a0737..ccf55d2ca7f 100644
--- a/tests/wpt/web-platform-tests/tools/wptrunner/requirements.txt
+++ b/tests/wpt/web-platform-tests/tools/wptrunner/requirements.txt
@@ -4,6 +4,6 @@ mozlog==5.0
mozdebug==0.1.1
# Pillow 7 requires Python 3
pillow==6.2.1 # pyup: <7.0
-urllib3[secure]==1.25.7
+urllib3[secure]==1.25.8
requests==2.22.0
six==1.14.0
diff --git a/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/executors/base.py b/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/executors/base.py
index 3d8af4de486..603c606e1cd 100644
--- a/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/executors/base.py
+++ b/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/executors/base.py
@@ -1,6 +1,5 @@
import base64
import hashlib
-from six.moves.http_client import HTTPConnection
import io
import json
import os
@@ -8,8 +7,10 @@ import threading
import traceback
import socket
import sys
-from six.moves.urllib.parse import urljoin, urlsplit, urlunsplit
from abc import ABCMeta, abstractmethod
+from six import text_type
+from six.moves.http_client import HTTPConnection
+from six.moves.urllib.parse import urljoin, urlsplit, urlunsplit
from ..testrunner import Stop
from .protocol import Protocol, BaseProtocolPart
@@ -293,7 +294,7 @@ class TestExecutor(object):
status = e.status
else:
status = "INTERNAL-ERROR"
- message = unicode(getattr(e, "message", ""))
+ message = text_type(getattr(e, "message", ""))
if message:
message += "\n"
message += traceback.format_exc(e)
diff --git a/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/manifestexpected.py b/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/manifestexpected.py
index 65b53f0ab97..335b0da5c90 100644
--- a/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/manifestexpected.py
+++ b/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/manifestexpected.py
@@ -1,7 +1,8 @@
import os
-from six.moves.urllib.parse import urljoin
from collections import deque
-from six import text_type
+from six import string_types, text_type
+from six.moves.urllib.parse import urljoin
+
from .wptmanifest.backends import static
from .wptmanifest.backends.base import ManifestItem
@@ -47,7 +48,7 @@ def list_prop(name, node):
"""List property"""
try:
list_prop = node.get(name)
- if isinstance(list_prop, basestring):
+ if isinstance(list_prop, string_types):
return [list_prop]
return list(list_prop)
except KeyError:
diff --git a/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/process.py b/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/process.py
index 26e11ddfc87..8a2b894cb74 100644
--- a/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/process.py
+++ b/tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/process.py
@@ -7,5 +7,5 @@ def cast_env(env):
"""Encode all the environment values as the appropriate type for each Python version
This assumes that all the data is or can be represented as UTF8"""
- env_type = six.ensure_binary if sys.version_info[0] < 3 else six.ensure_string
+ env_type = six.ensure_binary if sys.version_info[0] < 3 else six.ensure_str
return {env_type(key): env_type(value) for key, value in six.iteritems(env)}
diff --git a/tests/wpt/web-platform-tests/tools/wptserve/wptserve/handlers.py b/tests/wpt/web-platform-tests/tools/wptserve/wptserve/handlers.py
index efc1a16a932..c18fa2d3792 100644
--- a/tests/wpt/web-platform-tests/tools/wptserve/wptserve/handlers.py
+++ b/tests/wpt/web-platform-tests/tools/wptserve/wptserve/handlers.py
@@ -95,15 +95,29 @@ class DirectoryHandler(object):
link = urljoin(base_path, "..")
yield ("""<li class="dir"><a href="%(link)s">%(name)s</a></li>""" %
{"link": link, "name": ".."})
+ items = []
+ prev_item = None
for item in sorted(os.listdir(path)):
+ if prev_item and prev_item + ".headers" == item:
+ items[-1][1] = item
+ prev_item = None
+ continue
+ items.append([item, None])
+ prev_item = item
+ for item, dot_headers in items:
link = html.escape(quote(item))
+ dot_headers_markup = ""
+ if dot_headers is not None:
+ dot_headers_markup = (""" (<a href="%(link)s">.headers</a>)""" %
+ {"link": html.escape(quote(dot_headers))})
if os.path.isdir(os.path.join(path, item)):
link += "/"
class_ = "dir"
else:
class_ = "file"
- yield ("""<li class="%(class)s"><a href="%(link)s">%(name)s</a></li>""" %
- {"link": link, "name": html.escape(item), "class": class_})
+ yield ("""<li class="%(class)s"><a href="%(link)s">%(name)s</a>%(headers)s</li>""" %
+ {"link": link, "name": html.escape(item), "class": class_,
+ "headers": dot_headers_markup})
def wrap_pipeline(path, request, response):
diff --git a/tests/wpt/web-platform-tests/tools/wptserve/wptserve/pipes.py b/tests/wpt/web-platform-tests/tools/wptserve/wptserve/pipes.py
index e5d6e1c96db..3500948fc8c 100644
--- a/tests/wpt/web-platform-tests/tools/wptserve/wptserve/pipes.py
+++ b/tests/wpt/web-platform-tests/tools/wptserve/wptserve/pipes.py
@@ -396,8 +396,8 @@ class SubFunctions(object):
def uuid(request):
return str(uuid.uuid4())
- # Maintain a whitelist of supported algorithms, restricted to those that
- # are available on all platforms [1]. This ensures that test authors do not
+ # Maintain a list of supported algorithms, restricted to those that are
+ # available on all platforms [1]. This ensures that test authors do not
# unknowingly introduce platform-specific tests.
#
# [1] https://docs.python.org/2/library/hashlib.html
diff --git a/tests/wpt/web-platform-tests/trusted-types/TrustedTypePolicy-CSP.tentative.html b/tests/wpt/web-platform-tests/trusted-types/TrustedTypePolicy-CSP.tentative.html
index 0b57c3a908a..8ae162558f4 100644
--- a/tests/wpt/web-platform-tests/trusted-types/TrustedTypePolicy-CSP.tentative.html
+++ b/tests/wpt/web-platform-tests/trusted-types/TrustedTypePolicy-CSP.tentative.html
@@ -6,22 +6,22 @@
<meta http-equiv="Content-Security-Policy" content="trusted-types SomeName JustOneMoreName">
<body>
<script>
- // Whitelisted name test
+ // Allowed name test
test(t => {
let policy = window.trustedTypes.createPolicy('SomeName', { createHTML: s => s } );
assert_equals(policy.name, 'SomeName');
- }, "Whitelisted policy creation works.");
+ }, "Allowed-name policy creation works.");
- // Another whitelisted name test
+ // Another allowed name test
test(t => {
let policy = window.trustedTypes.createPolicy('JustOneMoreName', { createHTML: s => s } );
assert_equals(policy.name, 'JustOneMoreName');
- }, "Another whitelisted policy creation works.");
+ }, "Another allowed-name policy creation works.");
- // Non-whitelisted names test
+ // Non-allowed names test
test(t => {
assert_throws(new TypeError(), _ => {
window.trustedTypes.createPolicy('SomeOtherName', { createURL: s => s } );
});
- }, "Non-whitelisted policy creation throws.");
+ }, "Non-allowed name policy creation throws.");
</script>
diff --git a/tests/wpt/web-platform-tests/trusted-types/TrustedTypePolicyFactory-createPolicy-cspTests.tentative.html b/tests/wpt/web-platform-tests/trusted-types/TrustedTypePolicyFactory-createPolicy-cspTests.tentative.html
index 0b57c3a908a..8ae162558f4 100644
--- a/tests/wpt/web-platform-tests/trusted-types/TrustedTypePolicyFactory-createPolicy-cspTests.tentative.html
+++ b/tests/wpt/web-platform-tests/trusted-types/TrustedTypePolicyFactory-createPolicy-cspTests.tentative.html
@@ -6,22 +6,22 @@
<meta http-equiv="Content-Security-Policy" content="trusted-types SomeName JustOneMoreName">
<body>
<script>
- // Whitelisted name test
+ // Allowed name test
test(t => {
let policy = window.trustedTypes.createPolicy('SomeName', { createHTML: s => s } );
assert_equals(policy.name, 'SomeName');
- }, "Whitelisted policy creation works.");
+ }, "Allowed-name policy creation works.");
- // Another whitelisted name test
+ // Another allowed name test
test(t => {
let policy = window.trustedTypes.createPolicy('JustOneMoreName', { createHTML: s => s } );
assert_equals(policy.name, 'JustOneMoreName');
- }, "Another whitelisted policy creation works.");
+ }, "Another allowed-name policy creation works.");
- // Non-whitelisted names test
+ // Non-allowed names test
test(t => {
assert_throws(new TypeError(), _ => {
window.trustedTypes.createPolicy('SomeOtherName', { createURL: s => s } );
});
- }, "Non-whitelisted policy creation throws.");
+ }, "Non-allowed name policy creation throws.");
</script>
diff --git a/tests/wpt/web-platform-tests/url/failure.html b/tests/wpt/web-platform-tests/url/failure.html
index bebdb3dcc4d..ac16edf8c74 100644
--- a/tests/wpt/web-platform-tests/url/failure.html
+++ b/tests/wpt/web-platform-tests/url/failure.html
@@ -25,7 +25,7 @@ function runTests(testData) {
self.test(() => {
const url = new URL("about:blank")
- assert_throws(new TypeError, () => url.href = test.input)
+ assert_throws_js(TypeError, () => url.href = test.input)
}, "URL's href: " + name)
self.test(() => {
@@ -34,11 +34,11 @@ function runTests(testData) {
}, "XHR: " + name)
self.test(() => {
- assert_throws(new TypeError, () => self.navigator.sendBeacon(test.input))
+ assert_throws_js(TypeError, () => self.navigator.sendBeacon(test.input))
}, "sendBeacon(): " + name)
self.test(() => {
- assert_throws(new TypeError, () => self[0].location = test.input)
+ assert_throws_js(self[0].TypeError, () => self[0].location = test.input)
}, "Location's href: " + name)
self.test(() => {
diff --git a/tests/wpt/web-platform-tests/url/toascii.window.js b/tests/wpt/web-platform-tests/url/toascii.window.js
index b28c664479a..cdc488ec285 100644
--- a/tests/wpt/web-platform-tests/url/toascii.window.js
+++ b/tests/wpt/web-platform-tests/url/toascii.window.js
@@ -28,7 +28,7 @@ function runTests(tests) {
assert_equals(url.href, "https://" + hostTest.output + "/x")
} else {
if(type === "url") {
- assert_throws(new TypeError, () => makeURL("url", hostTest.input))
+ assert_throws_js(TypeError, () => makeURL("url", hostTest.input))
} else {
const url = makeURL(type, hostTest.input)
assert_equals(url.host, "")
diff --git a/tests/wpt/web-platform-tests/wasm/jsapi/table/grow-reftypes.tentative.any.js b/tests/wpt/web-platform-tests/wasm/jsapi/table/grow-reftypes.tentative.any.js
new file mode 100644
index 00000000000..807aea991bb
--- /dev/null
+++ b/tests/wpt/web-platform-tests/wasm/jsapi/table/grow-reftypes.tentative.any.js
@@ -0,0 +1,42 @@
+// META: global=jsshell
+// META: script=assertions.js
+// META: script=/wasm/jsapi/wasm-constants.js
+// META: script=/wasm/jsapi/wasm-module-builder.js
+
+// Test cases for changes to the WebAssembly.Table.prototype.grow() API that
+// come in with the reftypes proposal: the API takes a default argument, which
+// for tables of anyfunc must be either an exported wasm function or null.
+//
+// See:
+// https://github.com/WebAssembly/reference-types
+// https://bugzilla.mozilla.org/show_bug.cgi?id=1507491
+// https://github.com/WebAssembly/reference-types/issues/22
+
+test(() => {
+ const builder = new WasmModuleBuilder();
+ builder
+ .addFunction("fn", kSig_v_v)
+ .addBody([kExprEnd])
+ .exportFunc();
+ const bin = builder.toBuffer()
+ const argument = { "element": "anyfunc", "initial": 1 };
+ const table = new WebAssembly.Table(argument);
+ const fn = new WebAssembly.Instance(new WebAssembly.Module(bin)).exports.fn;
+ const result = table.grow(2, fn);
+ assert_equals(result, 1);
+ assert_equals(table.get(0), null);
+ assert_equals(table.get(1), fn);
+ assert_equals(table.get(2), fn);
+}, "Grow with exported-function argument");
+
+test(() => {
+ const argument = { "element": "anyfunc", "initial": 1 };
+ const table = new WebAssembly.Table(argument);
+ assert_throws(new TypeError(), () => table.grow(2, {}));
+}, "Grow with non-function argument");
+
+test(() => {
+ const argument = { "element": "anyfunc", "initial": 1 };
+ const table = new WebAssembly.Table(argument);
+ assert_throws(new TypeError(), () => table.grow(2, () => true));
+}, "Grow with JS-function argument");
diff --git a/tests/wpt/web-platform-tests/web-animations/interfaces/Animatable/animate.html b/tests/wpt/web-platform-tests/web-animations/interfaces/Animatable/animate.html
index 95d7db7bb3b..4d17d2dd00e 100644
--- a/tests/wpt/web-platform-tests/web-animations/interfaces/Animatable/animate.html
+++ b/tests/wpt/web-platform-tests/web-animations/interfaces/Animatable/animate.html
@@ -81,7 +81,7 @@ for (const subtest of gKeyframesTests) {
for (const subtest of gInvalidKeyframesTests) {
test(t => {
const div = createDiv(t);
- assert_throws(new TypeError, () => {
+ assert_throws_js(TypeError, () => {
div.animate(subtest.input, 2000);
});
}, `Element.animate() does not accept ${subtest.desc}`);
@@ -108,7 +108,7 @@ test(t => {
for (const invalid of gBadDelayValues) {
test(t => {
- assert_throws(new TypeError, () => {
+ assert_throws_js(TypeError, () => {
createDiv(t).animate(null, { delay: invalid });
});
}, `Element.animate() does not accept invalid delay value: ${invalid}`);
@@ -127,7 +127,7 @@ for (const invalid of gBadDurationValues) {
continue;
}
test(t => {
- assert_throws(new TypeError, () => {
+ assert_throws_js(TypeError, () => {
createDiv(t).animate(null, invalid);
});
}, 'Element.animate() does not accept invalid duration value: '
@@ -136,7 +136,7 @@ for (const invalid of gBadDurationValues) {
for (const invalid of gBadDurationValues) {
test(t => {
- assert_throws(new TypeError, () => {
+ assert_throws_js(TypeError, () => {
createDiv(t).animate(null, { duration: invalid });
});
}, 'Element.animate() does not accept invalid duration value: '
@@ -146,7 +146,7 @@ for (const invalid of gBadDurationValues) {
for (const invalidEasing of gInvalidEasings) {
test(t => {
- assert_throws(new TypeError, () => {
+ assert_throws_js(TypeError, () => {
createDiv(t).animate({ easing: invalidEasing }, 2000);
});
}, `Element.animate() does not accept invalid easing: '${invalidEasing}'`);
@@ -154,7 +154,7 @@ for (const invalidEasing of gInvalidEasings) {
for (const invalid of gBadIterationStartValues) {
test(t => {
- assert_throws(new TypeError, () => {
+ assert_throws_js(TypeError, () => {
createDiv(t).animate(null, { iterationStart: invalid });
});
}, 'Element.animate() does not accept invalid iterationStart value: ' +
@@ -163,7 +163,7 @@ for (const invalid of gBadIterationStartValues) {
for (const invalid of gBadIterationsValues) {
test(t => {
- assert_throws(new TypeError, () => {
+ assert_throws_js(TypeError, () => {
createDiv(t).animate(null, { iterations: invalid });
});
}, 'Element.animate() does not accept invalid iterations value: ' +
diff --git a/tests/wpt/web-platform-tests/web-animations/interfaces/AnimationEffect/updateTiming.html b/tests/wpt/web-platform-tests/web-animations/interfaces/AnimationEffect/updateTiming.html
index 746f0d74f19..f4f672ab1aa 100644
--- a/tests/wpt/web-platform-tests/web-animations/interfaces/AnimationEffect/updateTiming.html
+++ b/tests/wpt/web-platform-tests/web-animations/interfaces/AnimationEffect/updateTiming.html
@@ -258,7 +258,7 @@ for (const duration of gGoodDurationValues) {
for (const invalid of gBadDurationValues) {
test(t => {
- assert_throws(new TypeError, () => {
+ assert_throws_js(TypeError, () => {
createDiv(t).animate(null, { duration: invalid });
});
}, 'Throws when setting invalid duration: '
diff --git a/tests/wpt/web-platform-tests/web-animations/interfaces/KeyframeEffect/processing-a-keyframes-argument-002.html b/tests/wpt/web-platform-tests/web-animations/interfaces/KeyframeEffect/processing-a-keyframes-argument-002.html
index 8233dc07c5d..e78e13d69aa 100644
--- a/tests/wpt/web-platform-tests/web-animations/interfaces/KeyframeEffect/processing-a-keyframes-argument-002.html
+++ b/tests/wpt/web-platform-tests/web-animations/interfaces/KeyframeEffect/processing-a-keyframes-argument-002.html
@@ -37,7 +37,7 @@ test(() => {
test(() => {
for (const invalidEasing of gInvalidEasings) {
- assert_throws(new TypeError, () => {
+ assert_throws_js(TypeError, () => {
new KeyframeEffect(target, { easing: invalidEasing });
}, `TypeError is thrown for easing '${invalidEasing}'`);
}
@@ -46,7 +46,7 @@ test(() => {
test(() => {
for (const invalidEasing of gInvalidEasings) {
- assert_throws(new TypeError, () => {
+ assert_throws_js(TypeError, () => {
new KeyframeEffect(target, [{ easing: invalidEasing }]);
}, `TypeError is thrown for easing '${invalidEasing}'`);
}
diff --git a/tests/wpt/web-platform-tests/web-animations/interfaces/KeyframeEffect/setKeyframes.html b/tests/wpt/web-platform-tests/web-animations/interfaces/KeyframeEffect/setKeyframes.html
index 675a705891f..a5c81a29bd9 100644
--- a/tests/wpt/web-platform-tests/web-animations/interfaces/KeyframeEffect/setKeyframes.html
+++ b/tests/wpt/web-platform-tests/web-animations/interfaces/KeyframeEffect/setKeyframes.html
@@ -34,7 +34,7 @@ for (const subtest of gKeyframesTests) {
for (const subtest of gInvalidKeyframesTests) {
test(t => {
const effect = new KeyframeEffect(target, {});
- assert_throws(new TypeError, () => {
+ assert_throws_js(TypeError, () => {
effect.setKeyframes(subtest.input);
});
}, `KeyframeEffect constructor throws with ${subtest.desc}`);
diff --git a/tests/wpt/web-platform-tests/web-nfc/NDEFMessage_constructor.https.html b/tests/wpt/web-platform-tests/web-nfc/NDEFMessage_constructor.https.html
index 4e53828c310..5d6b557e3cc 100644
--- a/tests/wpt/web-platform-tests/web-nfc/NDEFMessage_constructor.https.html
+++ b/tests/wpt/web-platform-tests/web-nfc/NDEFMessage_constructor.https.html
@@ -8,21 +8,21 @@
test(() => {
assert_equals(NDEFMessage.length, 1);
- assert_throws(new TypeError, () => new NDEFMessage());
+ assert_throws_js(TypeError, () => new NDEFMessage());
}, 'NDEFMessage constructor without init dict');
test(() => {
- assert_throws(new TypeError, () => new NDEFMessage(null),
+ assert_throws_js(TypeError, () => new NDEFMessage(null),
'NDEFMessageInit#records is a required field.');
}, 'NDEFMessage constructor with null init dict');
test(() => {
- assert_throws(new TypeError, () => new NDEFMessage({dummy_key: 'dummy_value'}),
+ assert_throws_js(TypeError, () => new NDEFMessage({dummy_key: 'dummy_value'}),
'NDEFMessageInit#records is a required field.');
}, 'NDEFMessage constructor without NDEFMessageInit#records field');
test(() => {
- assert_throws(new TypeError, () => new NDEFMessage({records: []}),
+ assert_throws_js(TypeError, () => new NDEFMessage({records: []}),
'NDEFMessageInit#records should not be empty.');
}, 'NDEFMessage constructor with NDEFMessageInit#records being empty');
diff --git a/tests/wpt/web-platform-tests/web-nfc/NDEFReadingEvent_constructor.https.html b/tests/wpt/web-platform-tests/web-nfc/NDEFReadingEvent_constructor.https.html
index 5427b75ae2b..122070f50ed 100644
--- a/tests/wpt/web-platform-tests/web-nfc/NDEFReadingEvent_constructor.https.html
+++ b/tests/wpt/web-platform-tests/web-nfc/NDEFReadingEvent_constructor.https.html
@@ -8,11 +8,11 @@
test(() => {
assert_equals(NDEFReadingEvent.length, 2);
- assert_throws(new TypeError, () => new NDEFReadingEvent('message'));
+ assert_throws_js(TypeError, () => new NDEFReadingEvent('message'));
}, 'NDEFReadingEvent constructor without init dict');
test(() => {
- assert_throws(new TypeError, () => new NDEFReadingEvent('type',
+ assert_throws_js(TypeError, () => new NDEFReadingEvent('type',
{serialNumber: '', message: null}),
'NDEFMessageInit#records is a required field.');
}, 'NDEFReadingEvent constructor failed to construct its NDEFMessage');
diff --git a/tests/wpt/web-platform-tests/web-nfc/NDEFRecord_constructor.https.html b/tests/wpt/web-platform-tests/web-nfc/NDEFRecord_constructor.https.html
index a2ea09fa681..bf4697f8b17 100644
--- a/tests/wpt/web-platform-tests/web-nfc/NDEFRecord_constructor.https.html
+++ b/tests/wpt/web-platform-tests/web-nfc/NDEFRecord_constructor.https.html
@@ -8,42 +8,42 @@
test(() => {
assert_equals(NDEFRecord.length, 1);
- assert_throws(new TypeError, () => new NDEFRecord());
+ assert_throws_js(TypeError, () => new NDEFRecord());
}, 'NDEFRecord constructor without init dict');
test(() => {
- assert_throws(new TypeError, () => new NDEFRecord(null),
+ assert_throws_js(TypeError, () => new NDEFRecord(null),
'NDEFRecordInit#recordType is a required field.');
}, 'NDEFRecord constructor with null init dict');
test(() => {
- assert_throws(new TypeError, () => new NDEFRecord({id: test_record_id, data: test_text_data}),
+ assert_throws_js(TypeError, () => new NDEFRecord({id: test_record_id, data: test_text_data}),
'NDEFRecordInit#recordType is a required field.');
}, 'NDEFRecord constructor without NDEFRecordInit#recordType field');
test(() => {
- assert_throws(new TypeError, () => new NDEFRecord(
+ assert_throws_js(TypeError, () => new NDEFRecord(
createRecord('empty', test_text_data, test_record_id)),
'id does not apply for empty record type.');
}, 'NDEFRecord constructor with empty record type and id');
test(() => {
- assert_throws(new TypeError, () => new NDEFRecord(
+ assert_throws_js(TypeError, () => new NDEFRecord(
createRecord('empty', test_text_data, test_record_id, 'text/plain')),
'mediaType does not apply for empty record type.');
- assert_throws(new TypeError, () => new NDEFRecord(
+ assert_throws_js(TypeError, () => new NDEFRecord(
createRecord('text', test_text_data, test_record_id, 'text/plain')),
'mediaType does not apply for text record type.');
- assert_throws(new TypeError, () => new NDEFRecord(
+ assert_throws_js(TypeError, () => new NDEFRecord(
createRecord('url', test_url_data, test_record_id, 'text/plain')),
'mediaType does not apply for url record type.');
- assert_throws(new TypeError, () => new NDEFRecord(
+ assert_throws_js(TypeError, () => new NDEFRecord(
createRecord('absolute-url', test_url_data, test_record_id, 'text/plain')),
'mediaType does not apply for absolute-url record type.');
- assert_throws(new TypeError, () => new NDEFRecord(
+ assert_throws_js(TypeError, () => new NDEFRecord(
createRecord('unknown', test_buffer_data, test_record_id, 'application/octet-stream')),
'mediaType does not apply for unknown record type.');
- assert_throws(new TypeError, () => new NDEFRecord(
+ assert_throws_js(TypeError, () => new NDEFRecord(
createRecord('foo.example.com:bar', test_buffer_data, test_record_id, 'application/octet-stream')),
'mediaType does not apply for external record type.');
}, 'NDEFRecord constructor should only accept mediaType for mime record type');
@@ -207,7 +207,7 @@
}, 'NDEFRecord constructor with absolute-url record type');
test(() => {
- assert_throws(new TypeError, () => new NDEFRecord(
+ assert_throws_js(TypeError, () => new NDEFRecord(
createMimeRecord("A string is not a BufferSource")),
'Only BufferSource is allowed to be the record data.');
@@ -250,7 +250,7 @@
}, 'NDEFRecord constructor with mime record type and json data');
test(() => {
- assert_throws(new TypeError, () => new NDEFRecord(
+ assert_throws_js(TypeError, () => new NDEFRecord(
createUnknownRecord("A string is not a BufferSource")),
'Only BufferSource is allowed to be the record data.');
@@ -280,7 +280,7 @@
}, 'NDEFRecord constructor with unknown record type');
test(() => {
- assert_throws(new TypeError, () => new NDEFRecord(
+ assert_throws_js(TypeError, () => new NDEFRecord(
createRecord('foo.eXamPle.com:bAr*-', "A string is not a BufferSource or NDEFMessageInit")),
'Only BufferSource and NDEFMessageInit are allowed to be the record data.');
@@ -331,15 +331,15 @@
}, 'NDEFRecord constructor with external record type');
test(() => {
- assert_throws(new TypeError, () => new NDEFRecord(createRecord('EMptY')),
+ assert_throws_js(TypeError, () => new NDEFRecord(createRecord('EMptY')),
'Unknown record type.');
- assert_throws(new TypeError, () => new NDEFRecord(createRecord('TeXt', test_text_data)),
+ assert_throws_js(TypeError, () => new NDEFRecord(createRecord('TeXt', test_text_data)),
'Unknown record type.');
- assert_throws(new TypeError, () => new NDEFRecord(createRecord('uRL', test_url_data)),
+ assert_throws_js(TypeError, () => new NDEFRecord(createRecord('uRL', test_url_data)),
'Unknown record type.');
- assert_throws(new TypeError, () => new NDEFRecord(createRecord('Mime', test_buffer_data)),
+ assert_throws_js(TypeError, () => new NDEFRecord(createRecord('Mime', test_buffer_data)),
'Unknown record type.');
- assert_throws(new TypeError, () => new NDEFRecord(createRecord('sMart-PosTER', test_url_data)),
+ assert_throws_js(TypeError, () => new NDEFRecord(createRecord('sMart-PosTER', test_url_data)),
'Unknown record type.');
}, 'NDEFRecord constructor with record type string being treated as case sensitive');
@@ -352,21 +352,21 @@
const record = new NDEFRecord(createRecord(
[...Array(251)].map(_ => 'a').join('') + ':xyz', test_buffer_data));
// Exceeding 255, Throws.
- assert_throws(new TypeError, () => new NDEFRecord(createRecord(
+ assert_throws_js(TypeError, () => new NDEFRecord(createRecord(
[...Array(252)].map(_ => 'a').join('') + ':xyz', test_buffer_data)),
'The external type should not be longer than 255.');
- assert_throws(new TypeError, () => new NDEFRecord(createRecord(
+ assert_throws_js(TypeError, () => new NDEFRecord(createRecord(
'xyz', test_buffer_data)), 'The external type must have a \':\'.');
- assert_throws(new TypeError, () => new NDEFRecord(createRecord(
+ assert_throws_js(TypeError, () => new NDEFRecord(createRecord(
':xyz', test_buffer_data)), 'The domain should not be empty.');
- assert_throws(new TypeError, () => new NDEFRecord(createRecord(
+ assert_throws_js(TypeError, () => new NDEFRecord(createRecord(
'example.com:', test_buffer_data)), 'The type should not be empty.');
- assert_throws(new TypeError, () => new NDEFRecord(createRecord(
+ assert_throws_js(TypeError, () => new NDEFRecord(createRecord(
'example.com:xyz[', test_buffer_data)), 'The type should not contain \'[\'.');
- assert_throws(new TypeError, () => new NDEFRecord(createRecord(
+ assert_throws_js(TypeError, () => new NDEFRecord(createRecord(
'example.com:xyz~', test_buffer_data)), 'The type should not contain \'~\'.');
- assert_throws(new TypeError, () => new NDEFRecord(createRecord(
+ assert_throws_js(TypeError, () => new NDEFRecord(createRecord(
'example.com:xyz/', test_buffer_data)), 'The type should not contain \'/\'.');
}, 'NDEFRecord constructor with invalid external record type');
diff --git a/tests/wpt/web-platform-tests/webmessaging/with-options/null-transfer.html b/tests/wpt/web-platform-tests/webmessaging/with-options/null-transfer.html
index 72bebd1e38e..2ea09eb7ab4 100644
--- a/tests/wpt/web-platform-tests/webmessaging/with-options/null-transfer.html
+++ b/tests/wpt/web-platform-tests/webmessaging/with-options/null-transfer.html
@@ -5,6 +5,6 @@
<div id=log></div>
<script>
test(function(t) {
- assert_throws(new TypeError, () => postMessage('', {transfer: null}));
+ assert_throws_js(TypeError, () => postMessage('', {transfer: null}));
});
</script>
diff --git a/tests/wpt/web-platform-tests/webmessaging/with-ports/023.html b/tests/wpt/web-platform-tests/webmessaging/with-ports/023.html
index da6a5c49a44..e2569a8463f 100644
--- a/tests/wpt/web-platform-tests/webmessaging/with-ports/023.html
+++ b/tests/wpt/web-platform-tests/webmessaging/with-ports/023.html
@@ -5,7 +5,7 @@
<div id=log></div>
<script>
test(function(t) {
- assert_throws(new TypeError, () => postMessage('', '*', null));
+ assert_throws_js(TypeError, () => postMessage('', '*', null));
});
</script>
diff --git a/tests/wpt/web-platform-tests/webrtc-extensions/RTCRtpParameters-maxFramerate.html b/tests/wpt/web-platform-tests/webrtc-extensions/RTCRtpParameters-maxFramerate.html
new file mode 100644
index 00000000000..7067fbc7998
--- /dev/null
+++ b/tests/wpt/web-platform-tests/webrtc-extensions/RTCRtpParameters-maxFramerate.html
@@ -0,0 +1,39 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>RTCRtpParameters encodings</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="/webrtc/dictionary-helper.js"></script>
+<script src="/webrtc/RTCRtpParameters-helper.js"></script>
+<script>
+'use strict';
+
+test(function(t) {
+ const pc = new RTCPeerConnection();
+ t.add_cleanup(() => pc.close());
+ assert_throws(new RangeError(), () => pc.addTransceiver('video', {
+ sendEncodings: [{
+ maxFramerate: -10
+ }]
+ }));
+}, `addTransceiver() with sendEncoding.maxFramerate field set to less than 0 should reject with RangeError`);
+
+promise_test(async t => {
+ const pc = new RTCPeerConnection();
+ t.add_cleanup(() => pc.close());
+ const { sender } = pc.addTransceiver('video');
+ await doOfferAnswerExchange(t, pc);
+
+ const param = sender.getParameters();
+ validateSenderRtpParameters(param);
+ const encoding = getFirstEncoding(param);
+
+ encoding.maxFramerate = -10;
+ return promise_rejects(t, new RangeError(),
+ sender.setParameters(param));
+}, `setParameters() with encoding.maxFramerate field set to less than 0 should reject with RangeError`);
+
+test_modified_encoding('video', 'maxFramerate', 24, 16,
+ 'setParameters() with modified encoding.maxFramerate should succeed');
+
+</script>
diff --git a/tests/wpt/web-platform-tests/webrtc-identity/RTCPeerConnection-constructor.html b/tests/wpt/web-platform-tests/webrtc-identity/RTCPeerConnection-constructor.html
index 8498e6b35c9..e7b7016338d 100644
--- a/tests/wpt/web-platform-tests/webrtc-identity/RTCPeerConnection-constructor.html
+++ b/tests/wpt/web-platform-tests/webrtc-identity/RTCPeerConnection-constructor.html
@@ -6,6 +6,6 @@
<script>
test(() => {
const toStringThrows = { toString: function() { throw new Error; } };
- assert_throws(new Error, () => new RTCPeerConnection({ peerIdentity: toStringThrows }));
+ assert_throws_js(Error, () => new RTCPeerConnection({ peerIdentity: toStringThrows }));
}, "RTCPeerConnection constructor throws if the given peerIdentity getter throws");
</script>
diff --git a/tests/wpt/web-platform-tests/webrtc/RTCPeerConnection-createDataChannel.html b/tests/wpt/web-platform-tests/webrtc/RTCPeerConnection-createDataChannel.html
index 943e5728775..350f7156782 100644
--- a/tests/wpt/web-platform-tests/webrtc/RTCPeerConnection-createDataChannel.html
+++ b/tests/wpt/web-platform-tests/webrtc/RTCPeerConnection-createDataChannel.html
@@ -34,7 +34,6 @@ const stopTracks = (...streams) => {
readonly attribute USVString protocol;
readonly attribute boolean negotiated;
readonly attribute unsigned short? id;
- readonly attribute RTCPriorityType priority;
readonly attribute RTCDataChannelState readyState;
readonly attribute unsigned long bufferedAmount;
attribute unsigned long bufferedAmountLowThreshold;
@@ -51,16 +50,6 @@ const stopTracks = (...streams) => {
boolean negotiated = false;
[EnforceRange]
unsigned short id;
- RTCPriorityType priority = "low";
- };
-
- 4.9.1. RTCPriorityType Enum
-
- enum RTCPriorityType {
- "very-low",
- "low",
- "medium",
- "high"
};
*/
@@ -102,8 +91,6 @@ test(t => {
member.
15. Let channel have an [[DataChannelId]] internal slot initialized to option's id
member, if it is present and [[Negotiated]] is true, otherwise null.
- 17. Let channel have an [[DataChannelPriority]] internal slot initialized to option's
- priority member.
21. If the [[DataChannelId]] slot is null (due to no ID being passed into
createDataChannel, or [[Negotiated]] being false), and the DTLS role of the SCTP
transport has already been negotiated, then initialize [[DataChannelId]] to a value
@@ -148,7 +135,6 @@ test(t => {
// Since no offer/answer exchange has occurred yet, the DTLS role is unknown
// and so the ID should be null.
assert_equals(dc.id, null);
- assert_equals(dc.priority, 'low');
assert_equals(dc.readyState, 'connecting');
assert_equals(dc.bufferedAmount, 0);
assert_equals(dc.bufferedAmountLowThreshold, 0);
@@ -165,8 +151,7 @@ test(t => {
// Note: maxPacketLifeTime is not set in this test.
protocol: 'custom',
negotiated: true,
- id: 3,
- priority: 'high'
+ id: 3
});
assert_true(dc instanceof RTCDataChannel, 'is RTCDataChannel');
@@ -177,7 +162,6 @@ test(t => {
assert_equals(dc.protocol, 'custom');
assert_equals(dc.negotiated, true);
assert_equals(dc.id, 3);
- assert_equals(dc.priority, 'high');
assert_equals(dc.readyState, 'connecting');
assert_equals(dc.bufferedAmount, 0);
assert_equals(dc.bufferedAmountLowThreshold, 0);
@@ -189,7 +173,7 @@ test(t => {
});
assert_equals(dc2.label, 'test2');
assert_equals(dc2.maxPacketLifeTime, 42);
- assert_equals(dc.maxRetransmits, null);
+ assert_equals(dc2.maxRetransmits, null);
}, 'createDataChannel with provided parameters should initialize attributes to provided values');
/*
@@ -368,28 +352,6 @@ for (const id of [-1, 65535, 65536]) {
}
/*
- 6.2. RTCDataChannel
- createDataChannel
- 17. Let channel have an [[DataChannelPriority]] internal slot initialized to option's
- priority member.
- */
-test(t => {
- const pc = new RTCPeerConnection();
- t.add_cleanup(() => pc.close());
-
- const dc = pc.createDataChannel('', { priority: 'high' });
- assert_equals(dc.priority, 'high');
-}, 'createDataChannel with priority "high" should succeed');
-
-test(t => {
- const pc = new RTCPeerConnection();
- t.add_cleanup(() => pc.close());
-
- assert_throws(new TypeError(),
- () => pc.createDataChannel('', { priority: 'invalid' }));
-}, 'createDataChannel with invalid priority should throw TypeError');
-
-/*
6.2. createDataChannel
5. If [[DataChannelLabel]] is longer than 65535 bytes, throw a TypeError.
*/
diff --git a/tests/wpt/web-platform-tests/webrtc/RTCRtpParameters-encodings.html b/tests/wpt/web-platform-tests/webrtc/RTCRtpParameters-encodings.html
index c9e14cb374b..f71964429ae 100644
--- a/tests/wpt/web-platform-tests/webrtc/RTCRtpParameters-encodings.html
+++ b/tests/wpt/web-platform-tests/webrtc/RTCRtpParameters-encodings.html
@@ -49,7 +49,6 @@
RTCPriorityType priority;
RTCPriorityType networkPriority;
unsigned long maxBitrate;
- double maxFramerate;
[readonly]
DOMString rid;
@@ -68,14 +67,6 @@
- encodings is set to the value of the [[send encodings]] internal slot.
*/
- // Get the first encoding in param.encodings.
- // Asserts that param.encodings has at least one element.
- function getFirstEncoding(param) {
- const { encodings } = param;
- assert_equals(encodings.length, 1);
- return encodings[0];
- }
-
/*
5.1. addTransceiver
7. Create an RTCRtpSender with track, streams and sendEncodings and let sender
@@ -155,7 +146,6 @@
assert_equals(encoding.priority, 'low');
assert_equals(encoding.networkPriority, 'low');
assert_equals(encoding.maxBitrate, 8);
- assert_equals(encoding.maxFramerate, 25);
assert_not_own_property(encoding, "rid", "rid should be removed with a single encoding");
}, `sender.getParameters() should return sendEncodings set by addTransceiver()`);
@@ -267,58 +257,6 @@
});
}, `setParameters() with encoding.scaleResolutionDownBy field set to greater than 1.0 should succeed`);
- // Helper function to test that modifying an encoding field should succeed
- function test_modified_encoding(kind, field, value1, value2, desc) {
- promise_test(async t => {
- const pc = new RTCPeerConnection();
- t.add_cleanup(() => pc.close());
- const { sender } = pc.addTransceiver(kind, {
- sendEncodings: [{
- [field]: value1
- }]
- });
- await doOfferAnswerExchange(t, pc);
-
- const param1 = sender.getParameters();
- validateSenderRtpParameters(param1);
- const encoding1 = getFirstEncoding(param1);
-
- assert_equals(encoding1[field], value1);
- encoding1[field] = value2;
-
- await sender.setParameters(param1);
- const param2 = sender.getParameters();
- validateSenderRtpParameters(param2);
- const encoding2 = getFirstEncoding(param2);
- assert_equals(encoding2[field], value2);
- }, desc + ' with RTCRtpTransceiverInit');
-
- promise_test(async t => {
- const pc = new RTCPeerConnection();
- t.add_cleanup(() => pc.close());
- const { sender } = pc.addTransceiver(kind);
- await doOfferAnswerExchange(t, pc);
-
- const initParam = sender.getParameters();
- validateSenderRtpParameters(initParam);
- initParam.encodings[0][field] = value1;
- await sender.setParameters(initParam);
-
- const param1 = sender.getParameters();
- validateSenderRtpParameters(param1);
- const encoding1 = getFirstEncoding(param1);
-
- assert_equals(encoding1[field], value1);
- encoding1[field] = value2;
-
- await sender.setParameters(param1);
- const param2 = sender.getParameters();
- validateSenderRtpParameters(param2);
- const encoding2 = getFirstEncoding(param2);
- assert_equals(encoding2[field], value2);
- }, desc + ' without RTCRtpTransceiverInit');
- }
-
test_modified_encoding('audio', 'active', false, true,
'setParameters() with modified encoding.active should succeed');
@@ -331,9 +269,6 @@
test_modified_encoding('audio', 'maxBitrate', 10000, 20000,
'setParameters() with modified encoding.maxBitrate should succeed');
- test_modified_encoding('video', 'maxFramerate', 24, 16,
- 'setParameters() with modified encoding.maxFramerate should succeed');
-
test_modified_encoding('video', 'scaleResolutionDownBy', 2, 4,
'setParameters() with modified encoding.scaleResolutionDownBy should succeed');
diff --git a/tests/wpt/web-platform-tests/webrtc/RTCRtpParameters-helper.js b/tests/wpt/web-platform-tests/webrtc/RTCRtpParameters-helper.js
index d7069493008..d61d8e14932 100644
--- a/tests/wpt/web-platform-tests/webrtc/RTCRtpParameters-helper.js
+++ b/tests/wpt/web-platform-tests/webrtc/RTCRtpParameters-helper.js
@@ -242,3 +242,69 @@ function validateCodecParameters(codec) {
assert_optional_unsigned_int_field(codec, 'channels');
assert_optional_string_field(codec, 'sdpFmtpLine');
}
+
+// Get the first encoding in param.encodings.
+// Asserts that param.encodings has at least one element.
+function getFirstEncoding(param) {
+ const {
+ encodings
+ } = param;
+ assert_equals(encodings.length, 1);
+ return encodings[0];
+}
+
+// Helper function to test that modifying an encoding field should succeed
+function test_modified_encoding(kind, field, value1, value2, desc) {
+ promise_test(async t => {
+ const pc = new RTCPeerConnection();
+ t.add_cleanup(() => pc.close());
+ const {
+ sender
+ } = pc.addTransceiver(kind, {
+ sendEncodings: [{
+ [field]: value1
+ }]
+ });
+ await doOfferAnswerExchange(t, pc);
+
+ const param1 = sender.getParameters();
+ validateSenderRtpParameters(param1);
+ const encoding1 = getFirstEncoding(param1);
+
+ assert_equals(encoding1[field], value1);
+ encoding1[field] = value2;
+
+ await sender.setParameters(param1);
+ const param2 = sender.getParameters();
+ validateSenderRtpParameters(param2);
+ const encoding2 = getFirstEncoding(param2);
+ assert_equals(encoding2[field], value2);
+ }, desc + ' with RTCRtpTransceiverInit');
+
+ promise_test(async t => {
+ const pc = new RTCPeerConnection();
+ t.add_cleanup(() => pc.close());
+ const {
+ sender
+ } = pc.addTransceiver(kind);
+ await doOfferAnswerExchange(t, pc);
+
+ const initParam = sender.getParameters();
+ validateSenderRtpParameters(initParam);
+ initParam.encodings[0][field] = value1;
+ await sender.setParameters(initParam);
+
+ const param1 = sender.getParameters();
+ validateSenderRtpParameters(param1);
+ const encoding1 = getFirstEncoding(param1);
+
+ assert_equals(encoding1[field], value1);
+ encoding1[field] = value2;
+
+ await sender.setParameters(param1);
+ const param2 = sender.getParameters();
+ validateSenderRtpParameters(param2);
+ const encoding2 = getFirstEncoding(param2);
+ assert_equals(encoding2[field], value2);
+ }, desc + ' without RTCRtpTransceiverInit');
+} \ No newline at end of file
diff --git a/tests/wpt/web-platform-tests/webstorage/event_constructor.html b/tests/wpt/web-platform-tests/webstorage/event_constructor.html
index fe7fca77a93..e0bb3f374f4 100644
--- a/tests/wpt/web-platform-tests/webstorage/event_constructor.html
+++ b/tests/wpt/web-platform-tests/webstorage/event_constructor.html
@@ -8,7 +8,7 @@
<body>
<script>
test(function() {
- assert_throws(new TypeError, () => new StorageEvent());
+ assert_throws_js(TypeError, () => new StorageEvent());
// should be redundant, but .length can be wrong with custom bindings
assert_equals(StorageEvent.length, 1, 'StorageEvent.length');
}, 'constructor with no arguments');
diff --git a/tests/wpt/web-platform-tests/webstorage/event_initstorageevent.html b/tests/wpt/web-platform-tests/webstorage/event_initstorageevent.html
index 2fe89314361..b06a01617a8 100644
--- a/tests/wpt/web-platform-tests/webstorage/event_initstorageevent.html
+++ b/tests/wpt/web-platform-tests/webstorage/event_initstorageevent.html
@@ -9,7 +9,7 @@
<script>
test(() => {
const event = new StorageEvent('storage');
- assert_throws(new TypeError, () => event.initStorageEvent());
+ assert_throws_js(TypeError, () => event.initStorageEvent());
// should be redundant, but .length can be wrong with custom bindings
assert_equals(event.initStorageEvent.length, 1, 'event.initStorageEvent.length');
}, 'initStorageEvent with 0 arguments');
diff --git a/tests/wpt/web-platform-tests/webvtt/api/VTTCue/constructor-exceptions.html b/tests/wpt/web-platform-tests/webvtt/api/VTTCue/constructor-exceptions.html
index 4d051fb3e98..843cab09845 100644
--- a/tests/wpt/web-platform-tests/webvtt/api/VTTCue/constructor-exceptions.html
+++ b/tests/wpt/web-platform-tests/webvtt/api/VTTCue/constructor-exceptions.html
@@ -5,14 +5,14 @@
<div id=log></div>
<script>
test(function() {
- assert_throws(new TypeError, function() { new VTTCue(NaN, 0, 'foo'); });
- assert_throws(new TypeError, function() { new VTTCue(Infinity, 0, 'foo'); });
- assert_throws(new TypeError, function() { new VTTCue('tomorrow', 0, 'foo'); });
+ assert_throws_js(TypeError, function() { new VTTCue(NaN, 0, 'foo'); });
+ assert_throws_js(TypeError, function() { new VTTCue(Infinity, 0, 'foo'); });
+ assert_throws_js(TypeError, function() { new VTTCue('tomorrow', 0, 'foo'); });
}, document.title+', non-finite start time');
test(function() {
- assert_throws(new TypeError, function() { new VTTCue(0, NaN, 'foo'); });
- assert_throws(new TypeError, function() { new VTTCue(0, Infinity, 'foo'); });
- assert_throws(new TypeError, function() { new VTTCue(0, 'tomorrow', 'foo'); });
+ assert_throws_js(TypeError, function() { new VTTCue(0, NaN, 'foo'); });
+ assert_throws_js(TypeError, function() { new VTTCue(0, Infinity, 'foo'); });
+ assert_throws_js(TypeError, function() { new VTTCue(0, 'tomorrow', 'foo'); });
}, document.title+', non-finite end time');
test(function() {
var start = { valueOf: function() { return 42; } };
diff --git a/tests/wpt/web-platform-tests/workers/modules/dedicated-worker-import-blob-url.any.js b/tests/wpt/web-platform-tests/workers/modules/dedicated-worker-import-blob-url.any.js
index f51a821d181..e5d79add736 100644
--- a/tests/wpt/web-platform-tests/workers/modules/dedicated-worker-import-blob-url.any.js
+++ b/tests/wpt/web-platform-tests/workers/modules/dedicated-worker-import-blob-url.any.js
@@ -13,7 +13,11 @@ function import_blob_url_test(testCase) {
worker.postMessage('Send message for tests from main script.');
const msgEvent = await new Promise((resolve, reject) => {
worker.onmessage = resolve;
- worker.onerror = (error) => reject(error && error.message);
+ worker.onerror = error => {
+ const msg = error instanceof ErrorEvent ? error.message
+ : 'unknown error';
+ reject(msg);
+ };
});
assert_array_equals(msgEvent.data, testCase.expectation);
}, testCase.description);
diff --git a/tests/wpt/web-platform-tests/workers/modules/dedicated-worker-import-failure.html b/tests/wpt/web-platform-tests/workers/modules/dedicated-worker-import-failure.html
index 439bea888b2..5e8b152195a 100644
--- a/tests/wpt/web-platform-tests/workers/modules/dedicated-worker-import-failure.html
+++ b/tests/wpt/web-platform-tests/workers/modules/dedicated-worker-import-failure.html
@@ -38,7 +38,11 @@ promise_test(async () => {
worker.postMessage(scriptURL);
const msg_event = await new Promise((resolve, reject) => {
worker.onmessage = resolve;
- worker.onerror = (error) => reject(error && error.message);
+ worker.onerror = error => {
+ const msg = error instanceof ErrorEvent ? error.message
+ : 'unknown error';
+ reject(msg);
+ };
});
assert_equals(msg_event.data, 'TypeError');
}, 'Dynamic import for non-existent script should throw an exception.');
diff --git a/tests/wpt/web-platform-tests/workers/modules/dedicated-worker-import-meta.html b/tests/wpt/web-platform-tests/workers/modules/dedicated-worker-import-meta.html
index 9292b0f6d8e..4ed56e279f7 100644
--- a/tests/wpt/web-platform-tests/workers/modules/dedicated-worker-import-meta.html
+++ b/tests/wpt/web-platform-tests/workers/modules/dedicated-worker-import-meta.html
@@ -9,7 +9,11 @@ promise_test(() => {
const worker = new Worker(script_url, { type: 'module' });
return new Promise((resolve, reject) => {
worker.onmessage = resolve;
- worker.onerror = (error) => reject(error && error.message);
+ worker.onerror = error => {
+ const msg = error instanceof ErrorEvent ? error.message
+ : 'unknown error';
+ reject(msg);
+ };
})
.then(msg_event => assert_true(msg_event.data.endsWith(script_url)));
}, 'Test import.meta.url on the top-level module script.');
@@ -21,7 +25,11 @@ promise_test(() => {
worker.postMessage('./' + script_url);
return new Promise((resolve, reject) => {
worker.onmessage = resolve;
- worker.onerror = (error) => reject(error && error.message);
+ worker.onerror = error => {
+ const msg = error instanceof ErrorEvent ? error.message
+ : 'unknown error';
+ reject(msg);
+ };
})
.then(msg_event => assert_true(msg_event.data.endsWith(script_url)));
}, 'Test import.meta.url on the imported module script.');
@@ -34,7 +42,11 @@ promise_test(() => {
return new Promise((resolve, reject) => {
worker.onmessage = resolve;
- worker.onerror = (error) => reject(error && error.message);
+ worker.onerror = error => {
+ const msg = error instanceof ErrorEvent ? error.message
+ : 'unknown error';
+ reject(msg);
+ };
})
.then(msg_event => assert_true(msg_event.data.endsWith(script_url)))
.then(() => {
diff --git a/tests/wpt/web-platform-tests/workers/modules/dedicated-worker-import.any.js b/tests/wpt/web-platform-tests/workers/modules/dedicated-worker-import.any.js
index 308c5e74c15..d5bb6cccbe2 100644
--- a/tests/wpt/web-platform-tests/workers/modules/dedicated-worker-import.any.js
+++ b/tests/wpt/web-platform-tests/workers/modules/dedicated-worker-import.any.js
@@ -9,7 +9,11 @@ function import_test(testCase) {
worker.postMessage('Send message for tests from main script.');
const msgEvent = await new Promise((resolve, reject) => {
worker.onmessage = resolve;
- worker.onerror = (error) => reject(error && error.message);
+ worker.onerror = error => {
+ const msg = error instanceof ErrorEvent ? error.message
+ : 'unknown error';
+ reject(msg);
+ };
});
assert_array_equals(msgEvent.data, testCase.expectation);
}, testCase.description);
diff --git a/tests/wpt/web-platform-tests/workers/modules/dedicated-worker-options-type.html b/tests/wpt/web-platform-tests/workers/modules/dedicated-worker-options-type.html
index b7c96b15295..74523f4478b 100644
--- a/tests/wpt/web-platform-tests/workers/modules/dedicated-worker-options-type.html
+++ b/tests/wpt/web-platform-tests/workers/modules/dedicated-worker-options-type.html
@@ -25,23 +25,22 @@ promise_test(() => {
}, 'Test worker construction with the "module" worker type.');
test(() => {
- try {
- new Worker('resources/post-message-on-load-worker.js', { type: '' });
- assert_unreached(
- 'Worker construction with an empty type should throw an exception');
- } catch (e) {
- assert_equals(e.name, 'TypeError');
- }
+ assert_throws(
+ new TypeError(),
+ () => {
+ new Worker('resources/post-message-on-load-worker.js', { type: '' });
+ },
+ 'Worker construction with an empty type should throw an exception');
}, 'Test worker construction with an empty worker type.');
test(() => {
- try {
- new Worker('resources/post-message-on-load-worker.js', { type: 'unknown' });
- assert_unreached(
- 'Worker construction with an unknown type should throw an exception');
- } catch (e) {
- assert_equals(e.name, 'TypeError');
- }
+ assert_throws(
+ new TypeError(),
+ () => {
+ new Worker('resources/post-message-on-load-worker.js',
+ { type: 'unknown' });
+ },
+ 'Worker construction with an unknown type should throw an exception');
}, 'Test worker construction with an unknown worker type.');
</script>
diff --git a/tests/wpt/web-platform-tests/workers/modules/shared-worker-import-blob-url.any.js b/tests/wpt/web-platform-tests/workers/modules/shared-worker-import-blob-url.any.js
index d9e9e34c394..f56c1a5525f 100644
--- a/tests/wpt/web-platform-tests/workers/modules/shared-worker-import-blob-url.any.js
+++ b/tests/wpt/web-platform-tests/workers/modules/shared-worker-import-blob-url.any.js
@@ -14,7 +14,11 @@ function import_blob_url_test(testCase) {
worker.port.postMessage('Send message for tests from main script.');
const msgEvent = await new Promise((resolve, reject) => {
worker.port.onmessage = resolve;
- worker.onerror = (error) => reject(error && error.message);
+ worker.onerror = error => {
+ const msg = error instanceof ErrorEvent ? error.message
+ : 'unknown error';
+ reject(msg);
+ };
});
assert_array_equals(msgEvent.data, testCase.expectation);
}, testCase.description);
diff --git a/tests/wpt/web-platform-tests/workers/modules/shared-worker-import.any.js b/tests/wpt/web-platform-tests/workers/modules/shared-worker-import.any.js
index 450d4ad422b..15dfdde067a 100644
--- a/tests/wpt/web-platform-tests/workers/modules/shared-worker-import.any.js
+++ b/tests/wpt/web-platform-tests/workers/modules/shared-worker-import.any.js
@@ -10,7 +10,11 @@ function import_test(testCase) {
worker.port.postMessage('Send message for tests from main script.');
const msgEvent = await new Promise((resolve, reject) => {
worker.port.onmessage = resolve;
- worker.onerror = (error) => reject(error && error.message);
+ worker.onerror = error => {
+ const msg = error instanceof ErrorEvent ? error.message
+ : 'unknown error';
+ reject(msg);
+ };
});
assert_array_equals(msgEvent.data, testCase.expectation);
}, testCase.description);