Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test has a WPT meta file that expects 3 subtest issues.
- This WPT test may be referenced by the following Test IDs:
- /service-workers/service-worker/static-router-invalid-rules.https.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<meta charset="utf-8">
<title>
Static Router: registration of invalid rules should raise.
</title>
<script src="/common/get-host-info.sub.js"></script>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/service-workers/service-worker/resources/test-helpers.sub.js">
</script>
<script src="resources/static-router-helpers.sub.js">
</script>
<body>
<script>
const ROUTER_RULE_KEY_INVALID_REQUEST_METHOD =
'condition-invalid-request-method';
const ROUTER_RULE_KEY_LACK_OF_CONDITION =
'condition-lack-of-condition';
const ROUTER_RULE_KEY_LACK_OF_SOURCE =
'condition-lack-of-source';
promise_test(async t => {
const worker = await registerAndActivate(t, ROUTER_RULE_KEY_INVALID_REQUEST_METHOD);
t.add_cleanup(() => {reset_info_in_worker(worker)});
const {errors} = await get_info_from_worker(worker);
assert_equals(errors.length, 1);
}, 'addRoutes should raise for invalid request method.');
promise_test(async t => {
const worker = await registerAndActivate(t, ROUTER_RULE_KEY_LACK_OF_CONDITION);
t.add_cleanup(() => {reset_info_in_worker(worker)});
const {errors} = await get_info_from_worker(worker);
assert_equals(errors.length, 1);
}, 'addRoutes should raise if the conditon does not exist in the rule');
promise_test(async t => {
const worker = await registerAndActivate(t, ROUTER_RULE_KEY_LACK_OF_SOURCE);
t.add_cleanup(() => {reset_info_in_worker(worker)});
const {errors} = await get_info_from_worker(worker);
assert_equals(errors.length, 1);
}, 'addRoutes should raise if the source does not exiswt in the rule');
</script>
</body>