Verify the series of sub-tests that are executed for "partial" namespace objects.
+
+
+
+
+
diff --git a/test/fixtures/wpt/resources/test/tests/functional/iframe-callback.html b/test/fixtures/wpt/resources/test/tests/functional/iframe-callback.html
new file mode 100644
index 00000000000..f49d0aa6b80
--- /dev/null
+++ b/test/fixtures/wpt/resources/test/tests/functional/iframe-callback.html
@@ -0,0 +1,116 @@
+
+
+
+Example with iframe that notifies containing document via callbacks
+
+
+
+
+
Callbacks From Tests Running In An IFRAME
+
A test is run inside an iframe with a same origin document. The
+containing document should receive callbacks as the tests progress inside the
+iframe. A single passing test is expected in the summary below.
+
+
+
+
+
+
+
+
diff --git a/test/fixtures/wpt/resources/test/tests/functional/iframe-consolidate-errors.html b/test/fixtures/wpt/resources/test/tests/functional/iframe-consolidate-errors.html
new file mode 100644
index 00000000000..ef9b8702eca
--- /dev/null
+++ b/test/fixtures/wpt/resources/test/tests/functional/iframe-consolidate-errors.html
@@ -0,0 +1,50 @@
+
+
+
+Example with iframe that consolidates errors via fetch_tests_from_window
+
+
+
+
+
+
Fetching Tests From a Child Context
+
This test demonstrates the use of fetch_tests_from_window to pull
+tests from an iframe into the primary document.
+
The test suite is expected to fail due to an unhandled exception in the
+child context.
+
+
+
+
+
+
+
+
+
diff --git a/test/fixtures/wpt/resources/test/tests/functional/iframe-consolidate-tests.html b/test/fixtures/wpt/resources/test/tests/functional/iframe-consolidate-tests.html
new file mode 100644
index 00000000000..246dddee115
--- /dev/null
+++ b/test/fixtures/wpt/resources/test/tests/functional/iframe-consolidate-tests.html
@@ -0,0 +1,85 @@
+
+
+
+Example with iframe that consolidates tests via fetch_tests_from_window
+
+
+
+
+
+
Fetching Tests From a Child Context
+
This test demonstrates the use of fetch_tests_from_window to pull
+tests from an iframe into the primary document.
+
The test suite will not complete until tests in the child context have finished
+executing
+
+
+
+
+
+
+
+
diff --git a/test/fixtures/wpt/resources/test/tests/functional/iframe-msg.html b/test/fixtures/wpt/resources/test/tests/functional/iframe-msg.html
new file mode 100644
index 00000000000..283a5d98cc3
--- /dev/null
+++ b/test/fixtures/wpt/resources/test/tests/functional/iframe-msg.html
@@ -0,0 +1,84 @@
+
+
+
+Example with iframe that notifies containing document via cross document messaging
+
+
+
+
+
Notifications From Tests Running In An IFRAME
+
A test is run inside an iframe with a same origin document. The
+containing document should receive messages via postMessage/
+onmessage as the tests progress inside the iframe. A single
+passing test is expected in the summary below.
+
+
+
+
+
+
+
diff --git a/test/fixtures/wpt/resources/test/tests/functional/log-insertion.html b/test/fixtures/wpt/resources/test/tests/functional/log-insertion.html
new file mode 100644
index 00000000000..9a63c3dbded
--- /dev/null
+++ b/test/fixtures/wpt/resources/test/tests/functional/log-insertion.html
@@ -0,0 +1,46 @@
+
+Log insertion
+
+
+
+
diff --git a/test/fixtures/wpt/resources/test/tests/functional/no-title.html b/test/fixtures/wpt/resources/test/tests/functional/no-title.html
new file mode 100644
index 00000000000..a337e4e5f57
--- /dev/null
+++ b/test/fixtures/wpt/resources/test/tests/functional/no-title.html
@@ -0,0 +1,146 @@
+
+
+
+Tests with no title
+
+
+
+
+
This test demonstrates the use of promise_test. Assumes ECMAScript 6
+Promise support. Some failures are expected.
+
+
+
+
+
diff --git a/test/fixtures/wpt/resources/test/tests/functional/queue.html b/test/fixtures/wpt/resources/test/tests/functional/queue.html
new file mode 100644
index 00000000000..0c721286ec2
--- /dev/null
+++ b/test/fixtures/wpt/resources/test/tests/functional/queue.html
@@ -0,0 +1,130 @@
+
+
+
+Test queuing synchronous tests
+
+
+
+
+
+
+
+
+
+
diff --git a/test/fixtures/wpt/resources/test/tests/functional/setup-function-worker.js b/test/fixtures/wpt/resources/test/tests/functional/setup-function-worker.js
new file mode 100644
index 00000000000..82c1456aa64
--- /dev/null
+++ b/test/fixtures/wpt/resources/test/tests/functional/setup-function-worker.js
@@ -0,0 +1,14 @@
+importScripts("/resources/testharness.js");
+
+// Regression test for https://github.com/web-platform-tests/wpt/issues/27299,
+// where we broke the ability for a setup function in a worker to contain an
+// assertion (even a passing one).
+setup(function() {
+ assert_true(true, "True is true");
+});
+
+// We must define at least one test for the harness, though it is not what we
+// are testing here.
+test(function() {
+ assert_false(false, "False is false");
+}, 'Worker test');
diff --git a/test/fixtures/wpt/resources/test/tests/functional/setup-worker-service.html b/test/fixtures/wpt/resources/test/tests/functional/setup-worker-service.html
new file mode 100644
index 00000000000..9f24adac2d0
--- /dev/null
+++ b/test/fixtures/wpt/resources/test/tests/functional/setup-worker-service.html
@@ -0,0 +1,86 @@
+
+
+
+Setup function in a service worker
+
+
+
+
+
Setup function in a service worker
+
This test assumes that the browser supports ServiceWorkers.
+
+
+
+
+
diff --git a/test/fixtures/wpt/resources/test/tests/functional/single-page-test-fail.html b/test/fixtures/wpt/resources/test/tests/functional/single-page-test-fail.html
new file mode 100644
index 00000000000..8bbd530c48d
--- /dev/null
+++ b/test/fixtures/wpt/resources/test/tests/functional/single-page-test-fail.html
@@ -0,0 +1,28 @@
+
+Example with file_is_test (should fail)
+
+
+
+
diff --git a/test/fixtures/wpt/resources/test/tests/functional/single-page-test-no-assertions.html b/test/fixtures/wpt/resources/test/tests/functional/single-page-test-no-assertions.html
new file mode 100644
index 00000000000..9b39d2a02cc
--- /dev/null
+++ b/test/fixtures/wpt/resources/test/tests/functional/single-page-test-no-assertions.html
@@ -0,0 +1,25 @@
+
+Example single page test with no asserts
+
+
+
+
diff --git a/test/fixtures/wpt/resources/test/tests/functional/single-page-test-no-body.html b/test/fixtures/wpt/resources/test/tests/functional/single-page-test-no-body.html
new file mode 100644
index 00000000000..cb018f4dae5
--- /dev/null
+++ b/test/fixtures/wpt/resources/test/tests/functional/single-page-test-no-body.html
@@ -0,0 +1,26 @@
+
+Example single page test with no body
+
+
+
+
diff --git a/test/fixtures/wpt/resources/test/tests/functional/single-page-test-pass.html b/test/fixtures/wpt/resources/test/tests/functional/single-page-test-pass.html
new file mode 100644
index 00000000000..e143e22f3c7
--- /dev/null
+++ b/test/fixtures/wpt/resources/test/tests/functional/single-page-test-pass.html
@@ -0,0 +1,28 @@
+
+Example with file_is_test
+
+
+
+
diff --git a/test/fixtures/wpt/resources/test/tests/functional/step_wait.html b/test/fixtures/wpt/resources/test/tests/functional/step_wait.html
new file mode 100644
index 00000000000..8235d9d48a1
--- /dev/null
+++ b/test/fixtures/wpt/resources/test/tests/functional/step_wait.html
@@ -0,0 +1,79 @@
+
+Tests for step_wait
+
+
+
+
+
diff --git a/test/fixtures/wpt/resources/test/tests/functional/step_wait_func.html b/test/fixtures/wpt/resources/test/tests/functional/step_wait_func.html
new file mode 100644
index 00000000000..9fed18a3e20
--- /dev/null
+++ b/test/fixtures/wpt/resources/test/tests/functional/step_wait_func.html
@@ -0,0 +1,49 @@
+
+Tests for step_wait_func and step_wait_func_done
+
+
+
+
+
diff --git a/test/fixtures/wpt/resources/test/tests/functional/task-scheduling-promise-test.html b/test/fixtures/wpt/resources/test/tests/functional/task-scheduling-promise-test.html
new file mode 100644
index 00000000000..9d8e5c11cc9
--- /dev/null
+++ b/test/fixtures/wpt/resources/test/tests/functional/task-scheduling-promise-test.html
@@ -0,0 +1,241 @@
+
+testharness.js - task scheduling
+
+
+
+
+
diff --git a/test/fixtures/wpt/resources/test/tests/functional/task-scheduling-test.html b/test/fixtures/wpt/resources/test/tests/functional/task-scheduling-test.html
new file mode 100644
index 00000000000..035844448de
--- /dev/null
+++ b/test/fixtures/wpt/resources/test/tests/functional/task-scheduling-test.html
@@ -0,0 +1,141 @@
+
+testharness.js - task scheduling
+
+
+
+
+
diff --git a/test/fixtures/wpt/resources/test/tests/functional/uncaught-exception-handle.html b/test/fixtures/wpt/resources/test/tests/functional/uncaught-exception-handle.html
new file mode 100644
index 00000000000..764b0c4055b
--- /dev/null
+++ b/test/fixtures/wpt/resources/test/tests/functional/uncaught-exception-handle.html
@@ -0,0 +1,33 @@
+
+
+
+Harness Handling Uncaught Exception
+
+
+
+
+
Demonstrates running testharness based tests inside a dedicated web worker.
+
The test harness is expected to fail due to an uncaught exception in one worker.
+
+
+
+
+
diff --git a/test/fixtures/wpt/resources/test/tests/functional/worker-error.js b/test/fixtures/wpt/resources/test/tests/functional/worker-error.js
new file mode 100644
index 00000000000..7b89602f04b
--- /dev/null
+++ b/test/fixtures/wpt/resources/test/tests/functional/worker-error.js
@@ -0,0 +1,8 @@
+importScripts("/resources/testharness.js");
+
+// The following sub-test ensures that the worker is not interpreted as a
+// single-page test. The subsequent uncaught exception should therefore be
+// interpreted as a harness error rather than a single-page test failure.
+test(function() {}, "worker test that completes successfully before exception");
+
+throw new Error("This failure is expected.");
diff --git a/test/fixtures/wpt/resources/test/tests/functional/worker-service.html b/test/fixtures/wpt/resources/test/tests/functional/worker-service.html
new file mode 100644
index 00000000000..2e07746e622
--- /dev/null
+++ b/test/fixtures/wpt/resources/test/tests/functional/worker-service.html
@@ -0,0 +1,115 @@
+
+
+
+Example with a service worker
+
+
+
+
+
Service Worker Tests
+
Demonstrates running testharness based tests inside a service worker.
+
The test harness should time out due to one of the tests inside the worker timing out.
+
This test assumes that the browser supports ServiceWorkers.
+
+
+
+
+
diff --git a/test/fixtures/wpt/resources/test/tests/functional/worker-shared.html b/test/fixtures/wpt/resources/test/tests/functional/worker-shared.html
new file mode 100644
index 00000000000..e26f17dec27
--- /dev/null
+++ b/test/fixtures/wpt/resources/test/tests/functional/worker-shared.html
@@ -0,0 +1,73 @@
+
+
+
+Example with a shared worker
+
+
+
+
+
Shared Web Worker Tests
+
Demonstrates running testharness based tests inside a shared worker.
+
The test harness should time out due to one of the tests in the worker timing out.
+
+ The tests in this file are executed in parallel to avoid exceeding the "long"
+ timeout duration.
+
+
+
+
diff --git a/test/fixtures/wpt/resources/test/tests/unit/exceptional-cases.html b/test/fixtures/wpt/resources/test/tests/unit/exceptional-cases.html
new file mode 100644
index 00000000000..4054d0311d2
--- /dev/null
+++ b/test/fixtures/wpt/resources/test/tests/unit/exceptional-cases.html
@@ -0,0 +1,392 @@
+
+
+
+
+
+
+ Exceptional cases
+
+
+
+
+
diff --git a/test/fixtures/wpt/resources/test/tests/unit/format-value.html b/test/fixtures/wpt/resources/test/tests/unit/format-value.html
new file mode 100644
index 00000000000..13d01b81f35
--- /dev/null
+++ b/test/fixtures/wpt/resources/test/tests/unit/format-value.html
@@ -0,0 +1,123 @@
+
+
+
+ format_value utility function
+
+
+
+
+
+
+
+
+
diff --git a/test/fixtures/wpt/resources/test/tests/unit/helpers.js b/test/fixtures/wpt/resources/test/tests/unit/helpers.js
new file mode 100644
index 00000000000..ca378a27c91
--- /dev/null
+++ b/test/fixtures/wpt/resources/test/tests/unit/helpers.js
@@ -0,0 +1,21 @@
+// Helper for testing assertion failure cases for a testharness.js API
+//
+// The `assert_throws_*` functions cannot be used for this purpose because they
+// always fail in response to AssertionError exceptions, even when this is
+// expressed as the expected error.
+function test_failure(fn, name) {
+ test(function() {
+ try {
+ fn();
+ } catch (err) {
+ if (err instanceof AssertionError) {
+ return;
+ }
+ throw new AssertionError('Expected an AssertionError, but' + err);
+ }
+ throw new AssertionError(
+ 'Expected an AssertionError, but no error was thrown'
+ );
+ }, name);
+}
+
diff --git a/test/fixtures/wpt/resources/test/tests/unit/late-test.html b/test/fixtures/wpt/resources/test/tests/unit/late-test.html
new file mode 100644
index 00000000000..c9f8ec61fe5
--- /dev/null
+++ b/test/fixtures/wpt/resources/test/tests/unit/late-test.html
@@ -0,0 +1,56 @@
+
+
+
+Test declared after harness completion
+
+
+
+
+
+
This test simulates an automated test running scenario, where the test
+results emitted by testharness.js may be interpreted after some delay. It is
+intended to demonstrate that in such cases, any additional tests which are
+executed during that delay are included in the dataset.
+
+
Although these "late tests" are likely an indication of a mistake in test
+design, they are also recorded. Previously, "late tests" were ignored.
+This test changed to assert "late tests" were no longer ignored after
+https://github.com/web-platform-tests/wpt/pull/38806 was introduced.
+
+
+
diff --git a/test/fixtures/wpt/resources/test/tests/unit/promise_setup-timeout.html b/test/fixtures/wpt/resources/test/tests/unit/promise_setup-timeout.html
new file mode 100644
index 00000000000..c4947feef42
--- /dev/null
+++ b/test/fixtures/wpt/resources/test/tests/unit/promise_setup-timeout.html
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
+ promise_setup - timeout
+
+
+
+
+
diff --git a/test/fixtures/wpt/resources/test/tests/unit/promise_setup.html b/test/fixtures/wpt/resources/test/tests/unit/promise_setup.html
new file mode 100644
index 00000000000..2abb10a476e
--- /dev/null
+++ b/test/fixtures/wpt/resources/test/tests/unit/promise_setup.html
@@ -0,0 +1,333 @@
+
+
+
+
+
+
+ promise_setup
+
+
+
+
+
diff --git a/test/fixtures/wpt/resources/test/tests/unit/single_test.html b/test/fixtures/wpt/resources/test/tests/unit/single_test.html
new file mode 100644
index 00000000000..ff766e66cec
--- /dev/null
+++ b/test/fixtures/wpt/resources/test/tests/unit/single_test.html
@@ -0,0 +1,94 @@
+
+
+
+
+
+
+
+ single_test
+
+
+
+
+
diff --git a/test/fixtures/wpt/resources/test/tests/unit/test-return-restrictions.html b/test/fixtures/wpt/resources/test/tests/unit/test-return-restrictions.html
new file mode 100644
index 00000000000..0295c5214dc
--- /dev/null
+++ b/test/fixtures/wpt/resources/test/tests/unit/test-return-restrictions.html
@@ -0,0 +1,156 @@
+
+
+
+
+
+ Restrictions on return value from `test`
+
+
+
+
+
diff --git a/test/fixtures/wpt/resources/test/tests/unit/throwing-assertions.html b/test/fixtures/wpt/resources/test/tests/unit/throwing-assertions.html
new file mode 100644
index 00000000000..a36a56043cc
--- /dev/null
+++ b/test/fixtures/wpt/resources/test/tests/unit/throwing-assertions.html
@@ -0,0 +1,268 @@
+
+
+
+
+
+
+ Test the methods that make assertions about exceptions
+
+
+
+
+
diff --git a/test/fixtures/wpt/resources/test/tests/unit/unpaired-surrogates.html b/test/fixtures/wpt/resources/test/tests/unit/unpaired-surrogates.html
new file mode 100644
index 00000000000..b2321113265
--- /dev/null
+++ b/test/fixtures/wpt/resources/test/tests/unit/unpaired-surrogates.html
@@ -0,0 +1,143 @@
+
+
+
+
+
+ Restrictions on return value from `test`
+
+
+
+
+
diff --git a/test/fixtures/wpt/resources/test/tox.ini b/test/fixtures/wpt/resources/test/tox.ini
new file mode 100644
index 00000000000..49603ef64bd
--- /dev/null
+++ b/test/fixtures/wpt/resources/test/tox.ini
@@ -0,0 +1,13 @@
+[tox]
+envlist = py38,py39,py310,py311
+skipsdist=True
+
+[testenv]
+passenv=DISPLAY # Necessary for the spawned GeckoDriver process to connect to
+ # the appropriate display.
+
+deps =
+ -r{toxinidir}/../../tools/requirements_pytest.txt
+ -r{toxinidir}/requirements.txt
+
+commands = pytest -vv {posargs}
diff --git a/test/fixtures/wpt/resources/test/wptserver.py b/test/fixtures/wpt/resources/test/wptserver.py
new file mode 100644
index 00000000000..1f913dd96d0
--- /dev/null
+++ b/test/fixtures/wpt/resources/test/wptserver.py
@@ -0,0 +1,58 @@
+import logging
+import os
+import subprocess
+import time
+import sys
+import urllib
+
+
+class WPTServer(object):
+ def __init__(self, wpt_root):
+ self.logger = logging.getLogger()
+ self.wpt_root = wpt_root
+
+ # This is a terrible hack to get the default config of wptserve.
+ sys.path.insert(0, os.path.join(wpt_root, "tools"))
+ from serve.serve import build_config
+ with build_config(self.logger) as config:
+ self.host = config["browser_host"]
+ self.http_port = config["ports"]["http"][0]
+ self.https_port = config["ports"]["https"][0]
+
+ self.base_url = 'http://%s:%s' % (self.host, self.http_port)
+ self.https_base_url = 'https://%s:%s' % (self.host, self.https_port)
+
+ def start(self, ssl_context):
+ self.devnull = open(os.devnull, 'w')
+ wptserve_cmd = [os.path.join(self.wpt_root, 'wpt'), 'serve']
+ if sys.executable:
+ wptserve_cmd[0:0] = [sys.executable]
+ self.logger.info('Executing %s' % ' '.join(wptserve_cmd))
+ self.proc = subprocess.Popen(
+ wptserve_cmd,
+ stderr=self.devnull,
+ cwd=self.wpt_root)
+
+ for retry in range(5):
+ # Exponential backoff.
+ time.sleep(2 ** retry)
+ exit_code = self.proc.poll()
+ if exit_code != None:
+ logging.warning('Command "%s" exited with %s', ' '.join(wptserve_cmd), exit_code)
+ break
+ try:
+ urllib.request.urlopen(self.base_url, timeout=1)
+ urllib.request.urlopen(self.https_base_url, timeout=1, context=ssl_context)
+ return
+ except urllib.error.URLError:
+ pass
+
+ raise Exception('Could not start wptserve on %s' % self.base_url)
+
+ def stop(self):
+ self.proc.terminate()
+ self.proc.wait()
+ self.devnull.close()
+
+ def url(self, abs_path):
+ return self.https_base_url + '/' + os.path.relpath(abs_path, self.wpt_root)
diff --git a/test/fixtures/wpt/resources/testdriver.js b/test/fixtures/wpt/resources/testdriver.js
index 2d1a89690cc..985dbb0e403 100644
--- a/test/fixtures/wpt/resources/testdriver.js
+++ b/test/fixtures/wpt/resources/testdriver.js
@@ -49,6 +49,58 @@
* @namespace {test_driver}
*/
window.test_driver = {
+ /**
+ Represents `WebDriver BiDi `_ protocol.
+ */
+ bidi: {
+ /**
+ * `log `_ module.
+ */
+ log: {
+ /**
+ * `log.entryAdded `_ event.
+ */
+ entry_added: {
+ /**
+ * Subscribe to the `log.entryAdded` event. This does not
+ * add actual listeners. To listen to the event, use the
+ * `on` or `once` methods.
+ * @param {{contexts?: null | (string | Window)[]}} params - Parameters for the subscription.
+ * * `contexts`: an array of window proxies or browsing
+ * context ids to listen to the event. If not provided, the
+ * event subscription is done for the current window's
+ * browsing context. `null` for the global subscription.
+ * @return {Promise}
+ */
+ subscribe: async function (params = {}) {
+ return window.test_driver_internal.bidi.log.entry_added.subscribe(params);
+ },
+ /**
+ * Add an event listener for the `log.entryAdded
+ * `_ event. Make sure `subscribe` is
+ * called before using this method.
+ *
+ * @param callback {function(event): void} - The callback
+ * to be called when the event is fired.
+ * @returns {function(): void} - A function to call to
+ * remove the event listener.
+ */
+ on: function (callback) {
+ return window.test_driver_internal.bidi.log.entry_added.on(callback);
+ },
+ once: function () {
+ return new Promise(resolve => {
+ const remove_handler = window.test_driver_internal.bidi.log.entry_added.on(
+ data => {
+ resolve(data);
+ remove_handler();
+ });
+ });
+ },
+ }
+ }
+ },
+
/**
* Set the context in which testharness.js is loaded
*
@@ -1066,6 +1118,29 @@
*/
clear_device_posture: function(context=null) {
return window.test_driver_internal.clear_device_posture(context);
+ },
+
+ /**
+ * Runs the `bounce tracking timer algorithm
+ * `_,
+ * which removes all hosts from the stateful bounce tracking map, without
+ * regard for the bounce tracking grace period and returns a list of the
+ * deleted hosts.
+ *
+ * Matches the `Run Bounce Tracking Mitigations
+ * https://privacycg.github.io/nav-tracking-mitigations/#run-bounce-tracking-mitigations-command`_
+ * WebDriver command.
+ *
+ * @param {WindowProxy} [context=null] - Browsing context in which to
+ * run the call, or null for the
+ * current browsing context.
+ * @returns {Promise} Fulfilled after the bounce tracking timer
+ * algorithm has finished running. Returns an array
+ * of all hosts that were in the stateful bounce
+ * tracking map before deletion occurred.
+ */
+ run_bounce_tracking_mitigations: function (context = null) {
+ return window.test_driver_internal.run_bounce_tracking_mitigations(context);
}
};
@@ -1078,6 +1153,21 @@
*/
in_automation: false,
+ bidi: {
+ log: {
+ entry_added: {
+ async subscribe() {
+ throw new Error(
+ "bidi.log.entry_added.subscribe is not implemented by testdriver-vendor.js");
+ },
+ on() {
+ throw new Error(
+ "bidi.log.entry_added.on is not implemented by testdriver-vendor.js");
+ }
+ }
+ }
+ },
+
async click(element, coords) {
if (this.in_automation) {
throw new Error("click() is not implemented by testdriver-vendor.js");
@@ -1100,6 +1190,14 @@
throw new Error("get_named_cookie() is not implemented by testdriver-vendor.js");
},
+ async get_computed_role(element) {
+ throw new Error("get_computed_role is a testdriver.js function which cannot be run in this context.");
+ },
+
+ async get_computed_name(element) {
+ throw new Error("get_computed_name is a testdriver.js function which cannot be run in this context.");
+ },
+
async send_keys(element, keys) {
if (this.in_automation) {
throw new Error("send_keys() is not implemented by testdriver-vendor.js");
@@ -1254,6 +1352,10 @@
async clear_device_posture(context=null) {
throw new Error("clear_device_posture() is not implemented by testdriver-vendor.js");
+ },
+
+ async run_bounce_tracking_mitigations(context=null) {
+ throw new Error("run_bounce_tracking_mitigations() is not implemented by testdriver-vendor.js");
}
};
})();
diff --git a/test/fixtures/wpt/resources/testharness.js b/test/fixtures/wpt/resources/testharness.js
index c5c375e1720..7fd5336bf34 100644
--- a/test/fixtures/wpt/resources/testharness.js
+++ b/test/fixtures/wpt/resources/testharness.js
@@ -857,7 +857,7 @@
promise = promiseOrConstructor;
description = descriptionOrPromise;
assert(maybeDescription === undefined,
- "Too many args pased to no-constructor version of promise_rejects_dom");
+ "Too many args passed to no-constructor version of promise_rejects_dom, or accidentally explicitly passed undefined");
}
return bring_promise_to_current_realm(promise)
.then(test.unreached_func("Should have rejected: " + description))
@@ -2174,7 +2174,7 @@
func = funcOrConstructor;
description = descriptionOrFunc;
assert(maybeDescription === undefined,
- "Too many args pased to no-constructor version of assert_throws_dom");
+ "Too many args passed to no-constructor version of assert_throws_dom, or accidentally explicitly passed undefined");
}
assert_throws_dom_impl(type, func, description, "assert_throws_dom", constructor)
}
@@ -4408,13 +4408,20 @@
{
var substitution_re = /\$\{([^ }]*)\}/g;
- function do_substitution(input) {
+ function do_substitution(input)
+ {
var components = input.split(substitution_re);
var rv = [];
- for (var i = 0; i < components.length; i += 2) {
- rv.push(components[i]);
- if (components[i + 1]) {
- rv.push(String(substitutions[components[i + 1]]));
+ if (components.length === 1) {
+ rv = components;
+ } else if (substitutions) {
+ for (var i = 0; i < components.length; i += 2) {
+ if (components[i]) {
+ rv.push(components[i]);
+ }
+ if (substitutions[components[i + 1]]) {
+ rv.push(String(substitutions[components[i + 1]]));
+ }
}
}
return rv;
diff --git a/test/fixtures/wpt/resources/webidl2/build.sh b/test/fixtures/wpt/resources/webidl2/build.sh
old mode 100644
new mode 100755
diff --git a/test/fixtures/wpt/service-workers/cache-storage/cache-abort.https.any.js b/test/fixtures/wpt/service-workers/cache-storage/cache-abort.https.any.js
index 960d1bb1bff..99f29b0a08b 100644
--- a/test/fixtures/wpt/service-workers/cache-storage/cache-abort.https.any.js
+++ b/test/fixtures/wpt/service-workers/cache-storage/cache-abort.https.any.js
@@ -73,7 +73,7 @@ for (const method in methodsToTest) {
`${method} should reject`);
// infinite-slow-response.py doesn't know when to stop.
- return fetch(`../../../fetch/api/resources/stash-put.py?key=${abortKey}`);
+ return fetch(`../../../fetch/api/resources/stash-put.py?key=${abortKey}&value=close`);
}, `${method}() followed by abort after headers received should reject ` +
`with AbortError`);
}
diff --git a/test/fixtures/wpt/service-workers/service-worker/tentative/static-router/resources/direct.css b/test/fixtures/wpt/service-workers/service-worker/resources/direct.css
similarity index 100%
rename from test/fixtures/wpt/service-workers/service-worker/tentative/static-router/resources/direct.css
rename to test/fixtures/wpt/service-workers/service-worker/resources/direct.css
diff --git a/test/fixtures/wpt/service-workers/service-worker/tentative/static-router/resources/direct.html b/test/fixtures/wpt/service-workers/service-worker/resources/direct.html
similarity index 100%
rename from test/fixtures/wpt/service-workers/service-worker/tentative/static-router/resources/direct.html
rename to test/fixtures/wpt/service-workers/service-worker/resources/direct.html
diff --git a/test/fixtures/wpt/service-workers/service-worker/tentative/static-router/resources/direct.js b/test/fixtures/wpt/service-workers/service-worker/resources/direct.js
similarity index 100%
rename from test/fixtures/wpt/service-workers/service-worker/tentative/static-router/resources/direct.js
rename to test/fixtures/wpt/service-workers/service-worker/resources/direct.js
diff --git a/test/fixtures/wpt/service-workers/service-worker/tentative/static-router/resources/direct.py b/test/fixtures/wpt/service-workers/service-worker/resources/direct.py
similarity index 100%
rename from test/fixtures/wpt/service-workers/service-worker/tentative/static-router/resources/direct.py
rename to test/fixtures/wpt/service-workers/service-worker/resources/direct.py
diff --git a/test/fixtures/wpt/service-workers/service-worker/tentative/static-router/resources/direct.txt b/test/fixtures/wpt/service-workers/service-worker/resources/direct.txt
similarity index 100%
rename from test/fixtures/wpt/service-workers/service-worker/tentative/static-router/resources/direct.txt
rename to test/fixtures/wpt/service-workers/service-worker/resources/direct.txt
diff --git a/test/fixtures/wpt/service-workers/service-worker/tentative/static-router/resources/imported-sw.js b/test/fixtures/wpt/service-workers/service-worker/resources/imported-sw.js
similarity index 100%
rename from test/fixtures/wpt/service-workers/service-worker/tentative/static-router/resources/imported-sw.js
rename to test/fixtures/wpt/service-workers/service-worker/resources/imported-sw.js
diff --git a/test/fixtures/wpt/service-workers/service-worker/tentative/static-router/resources/or-test/direct1.text b/test/fixtures/wpt/service-workers/service-worker/resources/or-test/direct1.text
similarity index 100%
rename from test/fixtures/wpt/service-workers/service-worker/tentative/static-router/resources/or-test/direct1.text
rename to test/fixtures/wpt/service-workers/service-worker/resources/or-test/direct1.text
diff --git a/test/fixtures/wpt/service-workers/service-worker/tentative/static-router/resources/or-test/direct1.text.headers b/test/fixtures/wpt/service-workers/service-worker/resources/or-test/direct1.text.headers
similarity index 100%
rename from test/fixtures/wpt/service-workers/service-worker/tentative/static-router/resources/or-test/direct1.text.headers
rename to test/fixtures/wpt/service-workers/service-worker/resources/or-test/direct1.text.headers
diff --git a/test/fixtures/wpt/service-workers/service-worker/tentative/static-router/resources/or-test/direct2.text b/test/fixtures/wpt/service-workers/service-worker/resources/or-test/direct2.text
similarity index 100%
rename from test/fixtures/wpt/service-workers/service-worker/tentative/static-router/resources/or-test/direct2.text
rename to test/fixtures/wpt/service-workers/service-worker/resources/or-test/direct2.text
diff --git a/test/fixtures/wpt/service-workers/service-worker/tentative/static-router/resources/or-test/direct2.text.headers b/test/fixtures/wpt/service-workers/service-worker/resources/or-test/direct2.text.headers
similarity index 100%
rename from test/fixtures/wpt/service-workers/service-worker/tentative/static-router/resources/or-test/direct2.text.headers
rename to test/fixtures/wpt/service-workers/service-worker/resources/or-test/direct2.text.headers
diff --git a/test/fixtures/wpt/service-workers/service-worker/tentative/static-router/resources/router-rules.js b/test/fixtures/wpt/service-workers/service-worker/resources/router-rules.js
similarity index 100%
rename from test/fixtures/wpt/service-workers/service-worker/tentative/static-router/resources/router-rules.js
rename to test/fixtures/wpt/service-workers/service-worker/resources/router-rules.js
diff --git a/test/fixtures/wpt/service-workers/service-worker/resources/shadowrealm-promise-rejection-test-worker.js b/test/fixtures/wpt/service-workers/service-worker/resources/shadowrealm-promise-rejection-test-worker.js
new file mode 100644
index 00000000000..5c9737a67aa
--- /dev/null
+++ b/test/fixtures/wpt/service-workers/service-worker/resources/shadowrealm-promise-rejection-test-worker.js
@@ -0,0 +1,11 @@
+var realm = new ShadowRealm();
+
+// Promise rejection from ShadowRealm should be handled within service
+// worker thread.
+realm.evaluate('Promise.reject("foo"); () => {}');
+
+// Nested ShadowRealms are also possible.
+realm.evaluate(`
+const innerRealm = new ShadowRealm();
+innerRealm.evaluate('Promise.reject("foo"); () => {}');
+`);
diff --git a/test/fixtures/wpt/service-workers/service-worker/tentative/static-router/resources/simple-test-for-condition-main-resource.html b/test/fixtures/wpt/service-workers/service-worker/resources/simple-test-for-condition-main-resource.html
similarity index 100%
rename from test/fixtures/wpt/service-workers/service-worker/tentative/static-router/resources/simple-test-for-condition-main-resource.html
rename to test/fixtures/wpt/service-workers/service-worker/resources/simple-test-for-condition-main-resource.html
diff --git a/test/fixtures/wpt/service-workers/service-worker/tentative/static-router/resources/simple.csv b/test/fixtures/wpt/service-workers/service-worker/resources/simple.csv
similarity index 100%
rename from test/fixtures/wpt/service-workers/service-worker/tentative/static-router/resources/simple.csv
rename to test/fixtures/wpt/service-workers/service-worker/resources/simple.csv
diff --git a/test/fixtures/wpt/service-workers/service-worker/tentative/static-router/resources/static-router-helpers.sub.js b/test/fixtures/wpt/service-workers/service-worker/resources/static-router-helpers.sub.js
similarity index 86%
rename from test/fixtures/wpt/service-workers/service-worker/tentative/static-router/resources/static-router-helpers.sub.js
rename to test/fixtures/wpt/service-workers/service-worker/resources/static-router-helpers.sub.js
index cf34e98635f..0ab1f1fae1d 100644
--- a/test/fixtures/wpt/service-workers/service-worker/tentative/static-router/resources/static-router-helpers.sub.js
+++ b/test/fixtures/wpt/service-workers/service-worker/resources/static-router-helpers.sub.js
@@ -31,15 +31,21 @@ const reset_info_in_worker =
await promise;
}
+// This script's directory name. It is used for specifying test files.
+const scriptDir = document.currentScript.src.match(/.*\//)[0];
+
// Register the ServiceWorker and wait until activated.
// {ruleKey} represents the key of routerRules defined in router-rules.js.
// {swScript} represents the service worker source URL.
-const registerAndActivate = async (test, ruleKey, swScript) => {
+// {swScope} represents the service worker resource scope.
+const registerAndActivate = async (test, ruleKey, swScript, swScope) => {
if (!swScript) {
- swScript = 'resources/static-router-sw.js'
+ swScript = scriptDir + 'static-router-sw.js'
+ }
+ if (!swScope) {
+ swScope = scriptDir;
}
const swURL = `${swScript}?key=${ruleKey}`;
- const swScope = 'resources/';
const reg = await service_worker_unregister_and_register(
test, swURL, swScope, { type: 'module' });
add_completion_callback(() => reg.unregister());
diff --git a/test/fixtures/wpt/service-workers/service-worker/tentative/static-router/resources/static-router-no-fetch-handler-sw.js b/test/fixtures/wpt/service-workers/service-worker/resources/static-router-no-fetch-handler-sw.js
similarity index 100%
rename from test/fixtures/wpt/service-workers/service-worker/tentative/static-router/resources/static-router-no-fetch-handler-sw.js
rename to test/fixtures/wpt/service-workers/service-worker/resources/static-router-no-fetch-handler-sw.js
diff --git a/test/fixtures/wpt/service-workers/service-worker/tentative/static-router/resources/static-router-race-network-and-fetch-handler-sw.js b/test/fixtures/wpt/service-workers/service-worker/resources/static-router-race-network-and-fetch-handler-sw.js
similarity index 100%
rename from test/fixtures/wpt/service-workers/service-worker/tentative/static-router/resources/static-router-race-network-and-fetch-handler-sw.js
rename to test/fixtures/wpt/service-workers/service-worker/resources/static-router-race-network-and-fetch-handler-sw.js
diff --git a/test/fixtures/wpt/service-workers/service-worker/tentative/static-router/resources/static-router-sw.js b/test/fixtures/wpt/service-workers/service-worker/resources/static-router-sw.js
similarity index 100%
rename from test/fixtures/wpt/service-workers/service-worker/tentative/static-router/resources/static-router-sw.js
rename to test/fixtures/wpt/service-workers/service-worker/resources/static-router-sw.js
diff --git a/test/fixtures/wpt/service-workers/service-worker/tentative/static-router/resources/static-router-sw.sub.js b/test/fixtures/wpt/service-workers/service-worker/resources/static-router-sw.sub.js
similarity index 100%
rename from test/fixtures/wpt/service-workers/service-worker/tentative/static-router/resources/static-router-sw.sub.js
rename to test/fixtures/wpt/service-workers/service-worker/resources/static-router-sw.sub.js
diff --git a/test/fixtures/wpt/service-workers/service-worker/shadowrealm-promise-rejection.https.html b/test/fixtures/wpt/service-workers/service-worker/shadowrealm-promise-rejection.https.html
new file mode 100644
index 00000000000..3fa2331b7f9
--- /dev/null
+++ b/test/fixtures/wpt/service-workers/service-worker/shadowrealm-promise-rejection.https.html
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+
diff --git a/test/fixtures/wpt/service-workers/service-worker/tentative/static-router/static-router-fetch-event.https.html b/test/fixtures/wpt/service-workers/service-worker/static-router-fetch-event.https.html
similarity index 100%
rename from test/fixtures/wpt/service-workers/service-worker/tentative/static-router/static-router-fetch-event.https.html
rename to test/fixtures/wpt/service-workers/service-worker/static-router-fetch-event.https.html
diff --git a/test/fixtures/wpt/service-workers/service-worker/tentative/static-router/static-router-invalid-rules.https.html b/test/fixtures/wpt/service-workers/service-worker/static-router-invalid-rules.https.html
similarity index 100%
rename from test/fixtures/wpt/service-workers/service-worker/tentative/static-router/static-router-invalid-rules.https.html
rename to test/fixtures/wpt/service-workers/service-worker/static-router-invalid-rules.https.html
diff --git a/test/fixtures/wpt/service-workers/service-worker/tentative/static-router/static-router-main-resource.https.html b/test/fixtures/wpt/service-workers/service-worker/static-router-main-resource.https.html
similarity index 100%
rename from test/fixtures/wpt/service-workers/service-worker/tentative/static-router/static-router-main-resource.https.html
rename to test/fixtures/wpt/service-workers/service-worker/static-router-main-resource.https.html
diff --git a/test/fixtures/wpt/service-workers/service-worker/tentative/static-router/static-router-multiple-router-registrations.https.html b/test/fixtures/wpt/service-workers/service-worker/static-router-multiple-router-registrations.https.html
similarity index 100%
rename from test/fixtures/wpt/service-workers/service-worker/tentative/static-router/static-router-multiple-router-registrations.https.html
rename to test/fixtures/wpt/service-workers/service-worker/static-router-multiple-router-registrations.https.html
diff --git a/test/fixtures/wpt/service-workers/service-worker/tentative/static-router/static-router-mutiple-conditions.https.html b/test/fixtures/wpt/service-workers/service-worker/static-router-mutiple-conditions.https.html
similarity index 100%
rename from test/fixtures/wpt/service-workers/service-worker/tentative/static-router/static-router-mutiple-conditions.https.html
rename to test/fixtures/wpt/service-workers/service-worker/static-router-mutiple-conditions.https.html
diff --git a/test/fixtures/wpt/service-workers/service-worker/tentative/static-router/static-router-no-fetch-handler.https.html b/test/fixtures/wpt/service-workers/service-worker/static-router-no-fetch-handler.https.html
similarity index 100%
rename from test/fixtures/wpt/service-workers/service-worker/tentative/static-router/static-router-no-fetch-handler.https.html
rename to test/fixtures/wpt/service-workers/service-worker/static-router-no-fetch-handler.https.html
diff --git a/test/fixtures/wpt/service-workers/service-worker/tentative/static-router/static-router-race-network-and-fetch-handler.https.html b/test/fixtures/wpt/service-workers/service-worker/static-router-race-network-and-fetch-handler.https.html
similarity index 100%
rename from test/fixtures/wpt/service-workers/service-worker/tentative/static-router/static-router-race-network-and-fetch-handler.https.html
rename to test/fixtures/wpt/service-workers/service-worker/static-router-race-network-and-fetch-handler.https.html
diff --git a/test/fixtures/wpt/service-workers/service-worker/tentative/static-router/static-router-request-destination.https.html b/test/fixtures/wpt/service-workers/service-worker/static-router-request-destination.https.html
similarity index 100%
rename from test/fixtures/wpt/service-workers/service-worker/tentative/static-router/static-router-request-destination.https.html
rename to test/fixtures/wpt/service-workers/service-worker/static-router-request-destination.https.html
diff --git a/test/fixtures/wpt/service-workers/service-worker/tentative/static-router/static-router-request-method.https.html b/test/fixtures/wpt/service-workers/service-worker/static-router-request-method.https.html
similarity index 100%
rename from test/fixtures/wpt/service-workers/service-worker/tentative/static-router/static-router-request-method.https.html
rename to test/fixtures/wpt/service-workers/service-worker/static-router-request-method.https.html
diff --git a/test/fixtures/wpt/service-workers/service-worker/tentative/static-router/static-router-subresource.https.html b/test/fixtures/wpt/service-workers/service-worker/static-router-subresource.https.html
similarity index 100%
rename from test/fixtures/wpt/service-workers/service-worker/tentative/static-router/static-router-subresource.https.html
rename to test/fixtures/wpt/service-workers/service-worker/static-router-subresource.https.html
diff --git a/test/fixtures/wpt/service-workers/service-worker/tentative/static-router/README.md b/test/fixtures/wpt/service-workers/service-worker/tentative/static-router/README.md
index 5429b61d40e..33e508aba2c 100644
--- a/test/fixtures/wpt/service-workers/service-worker/tentative/static-router/README.md
+++ b/test/fixtures/wpt/service-workers/service-worker/tentative/static-router/README.md
@@ -1,4 +1,4 @@
-A test suite for the ServiceWorker Static Routing API.
+A test suite for the ServiceWorker Static Routing API Resource Timing.
-WICG proposal: https://github.com/WICG/proposals/issues/102
-Specification PR: https://github.com/w3c/ServiceWorker/pull/1686
+Explainer: https://github.com/WICG/service-worker-static-routing-api/blob/main/resource-timing-api.md
+Resource-Timing Proposal: https://github.com/w3c/resource-timing/issues/389
diff --git a/test/fixtures/wpt/service-workers/service-worker/tentative/static-router/resources/simple.html b/test/fixtures/wpt/service-workers/service-worker/tentative/static-router/resources/simple.html
deleted file mode 100644
index 0c3e3e78707..00000000000
--- a/test/fixtures/wpt/service-workers/service-worker/tentative/static-router/resources/simple.html
+++ /dev/null
@@ -1,3 +0,0 @@
-
-Simple
-Here's a simple html file.
diff --git a/test/fixtures/wpt/service-workers/service-worker/tentative/static-router/resources/test-helpers.sub.js b/test/fixtures/wpt/service-workers/service-worker/tentative/static-router/resources/test-helpers.sub.js
deleted file mode 100644
index 64a7f7d24fd..00000000000
--- a/test/fixtures/wpt/service-workers/service-worker/tentative/static-router/resources/test-helpers.sub.js
+++ /dev/null
@@ -1,303 +0,0 @@
-// Copied from
-// service-workers/service-worker/resources/testharness-helpers.js to be used under tentative.
-
-// Adapter for testharness.js-style tests with Service Workers
-
-/**
- * @param options an object that represents RegistrationOptions except for scope.
- * @param options.type a WorkerType.
- * @param options.updateViaCache a ServiceWorkerUpdateViaCache.
- * @see https://w3c.github.io/ServiceWorker/#dictdef-registrationoptions
- */
-function service_worker_unregister_and_register(test, url, scope, options) {
- if (!scope || scope.length == 0)
- return Promise.reject(new Error('tests must define a scope'));
-
- if (options && options.scope)
- return Promise.reject(new Error('scope must not be passed in options'));
-
- options = Object.assign({ scope: scope }, options);
- return service_worker_unregister(test, scope)
- .then(function() {
- return navigator.serviceWorker.register(url, options);
- })
- .catch(unreached_rejection(test,
- 'unregister and register should not fail'));
-}
-
-// This unregisters the registration that precisely matches scope. Use this
-// when unregistering by scope. If no registration is found, it just resolves.
-function service_worker_unregister(test, scope) {
- var absoluteScope = (new URL(scope, window.location).href);
- return navigator.serviceWorker.getRegistration(scope)
- .then(function(registration) {
- if (registration && registration.scope === absoluteScope)
- return registration.unregister();
- })
- .catch(unreached_rejection(test, 'unregister should not fail'));
-}
-
-function service_worker_unregister_and_done(test, scope) {
- return service_worker_unregister(test, scope)
- .then(test.done.bind(test));
-}
-
-function unreached_fulfillment(test, prefix) {
- return test.step_func(function(result) {
- var error_prefix = prefix || 'unexpected fulfillment';
- assert_unreached(error_prefix + ': ' + result);
- });
-}
-
-// Rejection-specific helper that provides more details
-function unreached_rejection(test, prefix) {
- return test.step_func(function(error) {
- var reason = error.message || error.name || error;
- var error_prefix = prefix || 'unexpected rejection';
- assert_unreached(error_prefix + ': ' + reason);
- });
-}
-
-/**
- * Adds an iframe to the document and returns a promise that resolves to the
- * iframe when it finishes loading. The caller is responsible for removing the
- * iframe later if needed.
- *
- * @param {string} url
- * @returns {HTMLIFrameElement}
- */
-function with_iframe(url) {
- return new Promise(function(resolve) {
- var frame = document.createElement('iframe');
- frame.className = 'test-iframe';
- frame.src = url;
- frame.onload = function() { resolve(frame); };
- document.body.appendChild(frame);
- });
-}
-
-function normalizeURL(url) {
- return new URL(url, self.location).toString().replace(/#.*$/, '');
-}
-
-function wait_for_update(test, registration) {
- if (!registration || registration.unregister == undefined) {
- return Promise.reject(new Error(
- 'wait_for_update must be passed a ServiceWorkerRegistration'));
- }
-
- return new Promise(test.step_func(function(resolve) {
- var handler = test.step_func(function() {
- registration.removeEventListener('updatefound', handler);
- resolve(registration.installing);
- });
- registration.addEventListener('updatefound', handler);
- }));
-}
-
-// Return true if |state_a| is more advanced than |state_b|.
-function is_state_advanced(state_a, state_b) {
- if (state_b === 'installing') {
- switch (state_a) {
- case 'installed':
- case 'activating':
- case 'activated':
- case 'redundant':
- return true;
- }
- }
-
- if (state_b === 'installed') {
- switch (state_a) {
- case 'activating':
- case 'activated':
- case 'redundant':
- return true;
- }
- }
-
- if (state_b === 'activating') {
- switch (state_a) {
- case 'activated':
- case 'redundant':
- return true;
- }
- }
-
- if (state_b === 'activated') {
- switch (state_a) {
- case 'redundant':
- return true;
- }
- }
- return false;
-}
-
-function wait_for_state(test, worker, state) {
- if (!worker || worker.state == undefined) {
- return Promise.reject(new Error(
- 'wait_for_state needs a ServiceWorker object to be passed.'));
- }
- if (worker.state === state)
- return Promise.resolve(state);
-
- if (is_state_advanced(worker.state, state)) {
- return Promise.reject(new Error(
- `Waiting for ${state} but the worker is already ${worker.state}.`));
- }
- return new Promise(test.step_func(function(resolve, reject) {
- worker.addEventListener('statechange', test.step_func(function() {
- if (worker.state === state)
- resolve(state);
-
- if (is_state_advanced(worker.state, state)) {
- reject(new Error(
- `The state of the worker becomes ${worker.state} while waiting` +
- `for ${state}.`));
- }
- }));
- }));
-}
-
-// Declare a test that runs entirely in the ServiceWorkerGlobalScope. The |url|
-// is the service worker script URL. This function:
-// - Instantiates a new test with the description specified in |description|.
-// The test will succeed if the specified service worker can be successfully
-// registered and installed.
-// - Creates a new ServiceWorker registration with a scope unique to the current
-// document URL. Note that this doesn't allow more than one
-// service_worker_test() to be run from the same document.
-// - Waits for the new worker to begin installing.
-// - Imports tests results from tests running inside the ServiceWorker.
-function service_worker_test(url, description) {
- // If the document URL is https://example.com/document and the script URL is
- // https://example.com/script/worker.js, then the scope would be
- // https://example.com/script/scope/document.
- var scope = new URL('scope' + window.location.pathname,
- new URL(url, window.location)).toString();
- promise_test(function(test) {
- return service_worker_unregister_and_register(test, url, scope)
- .then(function(registration) {
- add_completion_callback(function() {
- registration.unregister();
- });
- return wait_for_update(test, registration)
- .then(function(worker) {
- return fetch_tests_from_worker(worker);
- });
- });
- }, description);
-}
-
-function base_path() {
- return location.pathname.replace(/\/[^\/]*$/, '/');
-}
-
-function test_login(test, origin, username, password, cookie) {
- return new Promise(function(resolve, reject) {
- with_iframe(
- origin + base_path() +
- 'resources/fetch-access-control-login.html')
- .then(test.step_func(function(frame) {
- var channel = new MessageChannel();
- channel.port1.onmessage = test.step_func(function() {
- frame.remove();
- resolve();
- });
- frame.contentWindow.postMessage(
- {username: username, password: password, cookie: cookie},
- origin, [channel.port2]);
- }));
- });
-}
-
-function test_websocket(test, frame, url) {
- return new Promise(function(resolve, reject) {
- var ws = new frame.contentWindow.WebSocket(url, ['echo', 'chat']);
- var openCalled = false;
- ws.addEventListener('open', test.step_func(function(e) {
- assert_equals(ws.readyState, 1, "The WebSocket should be open");
- openCalled = true;
- ws.close();
- }), true);
-
- ws.addEventListener('close', test.step_func(function(e) {
- assert_true(openCalled, "The WebSocket should be closed after being opened");
- resolve();
- }), true);
-
- ws.addEventListener('error', reject);
- });
-}
-
-function login_https(test) {
- var host_info = get_host_info();
- return test_login(test, host_info.HTTPS_REMOTE_ORIGIN,
- 'username1s', 'password1s', 'cookie1')
- .then(function() {
- return test_login(test, host_info.HTTPS_ORIGIN,
- 'username2s', 'password2s', 'cookie2');
- });
-}
-
-function websocket(test, frame) {
- return test_websocket(test, frame, get_websocket_url());
-}
-
-function get_websocket_url() {
- return 'wss://{{host}}:{{ports[wss][0]}}/echo';
-}
-
-// The navigator.serviceWorker.register() method guarantees that the newly
-// installing worker is available as registration.installing when its promise
-// resolves. However some tests test installation using a element where
-// it is possible for the installing worker to have already become the waiting
-// or active worker. So this method is used to get the newest worker when these
-// tests need access to the ServiceWorker itself.
-function get_newest_worker(registration) {
- if (registration.installing)
- return registration.installing;
- if (registration.waiting)
- return registration.waiting;
- if (registration.active)
- return registration.active;
-}
-
-function register_using_link(script, options) {
- var scope = options.scope;
- var link = document.createElement('link');
- link.setAttribute('rel', 'serviceworker');
- link.setAttribute('href', script);
- link.setAttribute('scope', scope);
- document.getElementsByTagName('head')[0].appendChild(link);
- return new Promise(function(resolve, reject) {
- link.onload = resolve;
- link.onerror = reject;
- })
- .then(() => navigator.serviceWorker.getRegistration(scope));
-}
-
-function with_sandboxed_iframe(url, sandbox) {
- return new Promise(function(resolve) {
- var frame = document.createElement('iframe');
- frame.sandbox = sandbox;
- frame.src = url;
- frame.onload = function() { resolve(frame); };
- document.body.appendChild(frame);
- });
-}
-
-// Registers, waits for activation, then unregisters on a sample scope.
-//
-// This can be used to wait for a period of time needed to register,
-// activate, and then unregister a service worker. When checking that
-// certain behavior does *NOT* happen, this is preferable to using an
-// arbitrary delay.
-async function wait_for_activation_on_sample_scope(t, window_or_workerglobalscope) {
- const script = '/service-workers/service-worker/resources/empty-worker.js';
- const scope = 'resources/there/is/no/there/there?' + Date.now();
- let registration = await window_or_workerglobalscope.navigator.serviceWorker.register(script, { scope });
- await wait_for_state(t, registration.installing, 'activated');
- await registration.unregister();
-}
-
diff --git a/test/fixtures/wpt/service-workers/service-worker/tentative/static-router/static-router-resource-timing.https.html b/test/fixtures/wpt/service-workers/service-worker/tentative/static-router/static-router-resource-timing.https.html
new file mode 100644
index 00000000000..c85c5ea3b9a
--- /dev/null
+++ b/test/fixtures/wpt/service-workers/service-worker/tentative/static-router/static-router-resource-timing.https.html
@@ -0,0 +1,331 @@
+
+
+
+ Static Router: timing information should be shown when used.
+
+
+
+
+
+
+
+
+
diff --git a/test/fixtures/wpt/storage/opaque-origin.https.window.js b/test/fixtures/wpt/storage/opaque-origin.https.window.js
index cc1d31fdf2c..b9539760db7 100644
--- a/test/fixtures/wpt/storage/opaque-origin.https.window.js
+++ b/test/fixtures/wpt/storage/opaque-origin.https.window.js
@@ -1,4 +1,7 @@
// META: title=StorageManager API and opaque origins
+// META: script=/resources/testdriver.js
+// META: script=/resources/testdriver-vendor.js
+// META: script=resources/helpers.js
function load_iframe(src, sandbox) {
return new Promise(resolve => {
@@ -49,6 +52,10 @@ function make_script(snippet) {
'<\/script>';
}
+promise_setup(async () => {
+ await tryDenyingPermission();
+});
+
['navigator.storage.persisted()',
'navigator.storage.estimate()',
// persist() can prompt, so make sure we test that last
diff --git a/test/fixtures/wpt/storage/resources/helpers.js b/test/fixtures/wpt/storage/resources/helpers.js
new file mode 100644
index 00000000000..2dc5ab00dd1
--- /dev/null
+++ b/test/fixtures/wpt/storage/resources/helpers.js
@@ -0,0 +1,9 @@
+// Try explicitly denying so that persist() won't wait for user prompt
+async function tryDenyingPermission() {
+ try {
+ await test_driver.set_permission({ name: "persistent-storage" }, "denied");
+ } catch {
+ // Not all implementations support this yet, but some implementations may
+ // still be able to continue without explicit permission
+ }
+}
diff --git a/test/fixtures/wpt/storage/storagemanager-persist-persisted-match.https.any.js b/test/fixtures/wpt/storage/storagemanager-persist-persisted-match.https.window.js
similarity index 74%
rename from test/fixtures/wpt/storage/storagemanager-persist-persisted-match.https.any.js
rename to test/fixtures/wpt/storage/storagemanager-persist-persisted-match.https.window.js
index edbe67fae2c..9a4e0d329fc 100644
--- a/test/fixtures/wpt/storage/storagemanager-persist-persisted-match.https.any.js
+++ b/test/fixtures/wpt/storage/storagemanager-persist-persisted-match.https.window.js
@@ -1,4 +1,11 @@
// META: title=StorageManager: result of persist() matches result of persisted()
+// META: script=/resources/testdriver.js
+// META: script=/resources/testdriver-vendor.js
+// META: script=resources/helpers.js
+
+promise_setup(async () => {
+ await tryDenyingPermission();
+});
promise_test(async t => {
var persistResult = await navigator.storage.persist();
diff --git a/test/fixtures/wpt/storage/storagemanager-persist.https.window.js b/test/fixtures/wpt/storage/storagemanager-persist.https.window.js
index 13e17a16e14..1bcbefd8a96 100644
--- a/test/fixtures/wpt/storage/storagemanager-persist.https.window.js
+++ b/test/fixtures/wpt/storage/storagemanager-persist.https.window.js
@@ -1,4 +1,11 @@
// META: title=StorageManager: persist()
+// META: script=/resources/testdriver.js
+// META: script=/resources/testdriver-vendor.js
+// META: script=resources/helpers.js
+
+promise_setup(async () => {
+ await tryDenyingPermission();
+});
promise_test(function() {
var promise = navigator.storage.persist();
diff --git a/test/fixtures/wpt/versions.json b/test/fixtures/wpt/versions.json
deleted file mode 100644
index 16a0c77fae6..00000000000
--- a/test/fixtures/wpt/versions.json
+++ /dev/null
@@ -1,46 +0,0 @@
-{
- "common": {
- "commit": "8bfc72a4f700cd663e737b2425a79bac9874a409",
- "path": "common"
- },
- "eventsource": {
- "commit": "93ca7d336321a45f1bf1bbd63163b1e3ec6ae01f",
- "path": "eventsource"
- },
- "fetch": {
- "commit": "1b9332c3c8a84d34e38271d29518c204ab2cfb6e",
- "path": "fetch"
- },
- "FileAPI": {
- "commit": "5aa50dd4151b5bc1d04d5505366c6e27df30af5b",
- "path": "FileAPI"
- },
- "interfaces": {
- "commit": "40d3681ef52958c19a59d5a2af6ae259bd82ce7a",
- "path": "interfaces"
- },
- "mimesniff": {
- "commit": "0e9d465d283841979b44e109ed269dc72d34a050",
- "path": "mimesniff"
- },
- "resources": {
- "commit": "34dfef83fccdcc0faa24efd6d5c9013bbd44f095",
- "path": "resources"
- },
- "service-workers": {
- "commit": "3ebc2c5109dacb76334d9e85f5eda7a4b7afbebe",
- "path": "service-workers"
- },
- "storage": {
- "commit": "9f1cfd6824f166bd08d46c061be9e507d6bb45a7",
- "path": "storage"
- },
- "websockets": {
- "commit": "a7a594d8c03a850fd99bab1fd85bb6fe310081a2",
- "path": "websockets"
- },
- "xhr": {
- "commit": "5aa50dd4151b5bc1d04d5505366c6e27df30af5b",
- "path": "xhr"
- }
-}
diff --git a/test/fixtures/wpt/websockets/handlers/basic_auth_wsh.py b/test/fixtures/wpt/websockets/handlers/basic_auth_wsh.py
old mode 100644
new mode 100755
diff --git a/test/fixtures/wpt/websockets/handlers/delayed-passive-close_wsh.py b/test/fixtures/wpt/websockets/handlers/delayed-passive-close_wsh.py
old mode 100644
new mode 100755
diff --git a/test/fixtures/wpt/websockets/handlers/echo-cookie_wsh.py b/test/fixtures/wpt/websockets/handlers/echo-cookie_wsh.py
old mode 100644
new mode 100755
diff --git a/test/fixtures/wpt/websockets/handlers/echo-query_v13_wsh.py b/test/fixtures/wpt/websockets/handlers/echo-query_v13_wsh.py
old mode 100644
new mode 100755
diff --git a/test/fixtures/wpt/websockets/handlers/echo-query_wsh.py b/test/fixtures/wpt/websockets/handlers/echo-query_wsh.py
old mode 100644
new mode 100755
diff --git a/test/fixtures/wpt/websockets/handlers/echo_close_data_wsh.py b/test/fixtures/wpt/websockets/handlers/echo_close_data_wsh.py
old mode 100644
new mode 100755
diff --git a/test/fixtures/wpt/websockets/handlers/echo_exit_wsh.py b/test/fixtures/wpt/websockets/handlers/echo_exit_wsh.py
old mode 100644
new mode 100755
diff --git a/test/fixtures/wpt/websockets/handlers/echo_raw_wsh.py b/test/fixtures/wpt/websockets/handlers/echo_raw_wsh.py
old mode 100644
new mode 100755
diff --git a/test/fixtures/wpt/websockets/handlers/echo_wsh.py b/test/fixtures/wpt/websockets/handlers/echo_wsh.py
old mode 100644
new mode 100755
diff --git a/test/fixtures/wpt/websockets/handlers/empty-message_wsh.py b/test/fixtures/wpt/websockets/handlers/empty-message_wsh.py
old mode 100644
new mode 100755
diff --git a/test/fixtures/wpt/websockets/handlers/handshake_no_extensions_wsh.py b/test/fixtures/wpt/websockets/handlers/handshake_no_extensions_wsh.py
old mode 100644
new mode 100755
diff --git a/test/fixtures/wpt/websockets/handlers/handshake_no_protocol_wsh.py b/test/fixtures/wpt/websockets/handlers/handshake_no_protocol_wsh.py
old mode 100644
new mode 100755
diff --git a/test/fixtures/wpt/websockets/handlers/handshake_protocol_wsh.py b/test/fixtures/wpt/websockets/handlers/handshake_protocol_wsh.py
old mode 100644
new mode 100755
diff --git a/test/fixtures/wpt/websockets/handlers/handshake_sleep_2_wsh.py b/test/fixtures/wpt/websockets/handlers/handshake_sleep_2_wsh.py
old mode 100644
new mode 100755
diff --git a/test/fixtures/wpt/websockets/handlers/invalid_wsh.py b/test/fixtures/wpt/websockets/handlers/invalid_wsh.py
old mode 100644
new mode 100755
diff --git a/test/fixtures/wpt/websockets/handlers/origin_wsh.py b/test/fixtures/wpt/websockets/handlers/origin_wsh.py
old mode 100644
new mode 100755
diff --git a/test/fixtures/wpt/websockets/handlers/protocol_array_wsh.py b/test/fixtures/wpt/websockets/handlers/protocol_array_wsh.py
old mode 100644
new mode 100755
diff --git a/test/fixtures/wpt/websockets/handlers/protocol_wsh.py b/test/fixtures/wpt/websockets/handlers/protocol_wsh.py
old mode 100644
new mode 100755
diff --git a/test/fixtures/wpt/websockets/handlers/receive-backpressure_wsh.py b/test/fixtures/wpt/websockets/handlers/receive-backpressure_wsh.py
old mode 100644
new mode 100755
diff --git a/test/fixtures/wpt/websockets/handlers/referrer_wsh.py b/test/fixtures/wpt/websockets/handlers/referrer_wsh.py
old mode 100644
new mode 100755
diff --git a/test/fixtures/wpt/websockets/handlers/send-backpressure_wsh.py b/test/fixtures/wpt/websockets/handlers/send-backpressure_wsh.py
old mode 100644
new mode 100755
diff --git a/test/fixtures/wpt/websockets/handlers/set-cookie-secure_wsh.py b/test/fixtures/wpt/websockets/handlers/set-cookie-secure_wsh.py
old mode 100644
new mode 100755
diff --git a/test/fixtures/wpt/websockets/handlers/set-cookie_http_wsh.py b/test/fixtures/wpt/websockets/handlers/set-cookie_http_wsh.py
old mode 100644
new mode 100755
diff --git a/test/fixtures/wpt/websockets/handlers/set-cookie_wsh.py b/test/fixtures/wpt/websockets/handlers/set-cookie_wsh.py
old mode 100644
new mode 100755
diff --git a/test/fixtures/wpt/websockets/handlers/simple_handshake_wsh.py b/test/fixtures/wpt/websockets/handlers/simple_handshake_wsh.py
old mode 100644
new mode 100755
diff --git a/test/fixtures/wpt/websockets/handlers/sleep_10_v13_wsh.py b/test/fixtures/wpt/websockets/handlers/sleep_10_v13_wsh.py
old mode 100644
new mode 100755
diff --git a/test/fixtures/wpt/websockets/handlers/stash_responder_blocking_wsh.py b/test/fixtures/wpt/websockets/handlers/stash_responder_blocking_wsh.py
old mode 100644
new mode 100755
diff --git a/test/fixtures/wpt/websockets/handlers/stash_responder_wsh.py b/test/fixtures/wpt/websockets/handlers/stash_responder_wsh.py
old mode 100644
new mode 100755
diff --git a/test/fixtures/wpt/websockets/handlers/wrong_accept_key_wsh.py b/test/fixtures/wpt/websockets/handlers/wrong_accept_key_wsh.py
old mode 100644
new mode 100755