Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[websockets] Correct failure case #16354

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion websockets/unload-a-document/001-1.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
<script>
var controller = opener || parent;
var t = controller.t;
var assert_equals = controller.asset_equals;
var assert_unreached = controller.assert_unreached;
var uuid = controller.uuid;
t.add_cleanup(function() {delete sessionStorage[uuid];});
Expand Down
8 changes: 3 additions & 5 deletions websockets/unload-a-document/002-1.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,20 @@
<script>
var controller = opener || parent;
var t = controller.t;
var assert_equals = controller.asset_equals;
var assert_unreached = controller.assert_unreached ;
var uuid = controller.token;
var uuid = controller.uuid;
t.add_cleanup(function() {delete sessionStorage[uuid];});
t.step(function() {
// this test can fail if the document is unloaded on navigation e.g. due to OOM
if (sessionStorage[uuid]) {
assert_unreached('document was discarded');
t.done();
} else {
sessionStorage[uuid] = 'true';
var ws = new WebSocket(SCHEME_DOMAIN_PORT+'/echo');
ws.onopen = t.step_func(function(e) {

t.step_timeout(function() {
assert_equals(ws.readyState, ws.CLOSED, 'ws.readyState');
t.done();
assert_unreached('document was not discarded');
}, 4000);
ws.close();
ws.onclose = t.step_func(function() {
Expand Down