Commit 37f18cb6 authored by Steven Bingler's avatar Steven Bingler Committed by Commit Bot

Make schemeful websocket test more robust

This change makes the regexp more strict and cleans up the test's
cookies when finished.

Bug: 1141450
Change-Id: I706e42f321f4dbcc58931634356bab2b1e56fb05
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2492240
Commit-Queue: Steven Bingler <bingler@chromium.org>
Reviewed-by: default avatarMike West <mkwst@chromium.org>
Cr-Commit-Position: refs/heads/master@{#819880}
parent c2acd8ef
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
<script src="/resources/testharness.js"></script> <script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script> <script src="/resources/testharnessreport.js"></script>
<script src="/cookies/resources/testharness-helpers.js"></script> <script src="/cookies/resources/testharness-helpers.js"></script>
<script src="/cookies/resources/cookie-helper.sub.js"></script>
</head> </head>
<body> <body>
<div id=log></div> <div id=log></div>
...@@ -12,6 +13,11 @@ ...@@ -12,6 +13,11 @@
async_test(function (t) { async_test(function (t) {
document.cookie = `samesite_strict=1; sameSite=strict; path=/`; document.cookie = `samesite_strict=1; sameSite=strict; path=/`;
document.cookie = `samesite_lax=1; sameSite=lax; path=/`; document.cookie = `samesite_lax=1; sameSite=lax; path=/`;
t.add_cleanup(function() {
credFetch(origin + "/cookies/resources/drop.py?name=" + "samesite_strict");
credFetch(origin + "/cookies/resources/drop.py?name=" + "samesite_lax");
});
var ws = new WebSocket("ws://{{host}}:{{ports[ws][0]}}/echo-cookie"); var ws = new WebSocket("ws://{{host}}:{{ports[ws][0]}}/echo-cookie");
ws.onclose = t.step_func_done(function () { ws.onclose = t.step_func_done(function () {
...@@ -32,10 +38,9 @@ ...@@ -32,10 +38,9 @@
ws2.onclose = null; ws2.onclose = null;
ws2.close(); ws2.close();
// Cross-scheme WebSockets shouldn't get anything. // Cross-scheme WebSockets shouldn't get anything.
assert_regexp_match(e2.data, /(none)/, "Cross-scheme"); assert_regexp_match(e2.data, /^\(none\)$/, "Cross-scheme");
}); });
}); });
}, "Cross-scheme WebSockets are cross-site"); }, "Cross-scheme WebSockets are cross-site");
</script> </script>
</body> </body>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment