blob: 86a50215f2e2ad7e523ce8c1c9d1359be5e7b374 [file] [log] [blame]
<!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_INVALID_OR_CONDITION_DEPTH =
'condition-invalid-or-condition-depth';
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_INVALID_OR_CONDITION_DEPTH);
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 or condition exceeds the depth limit');
</script>
</body>