diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
commit | 6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch) | |
tree | a68f146d7fa01f0134297619fbe7e33db084e0aa /dom/websocket/tests/test_bug1081686.html | |
parent | Initial commit. (diff) | |
download | thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.tar.xz thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.zip |
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/websocket/tests/test_bug1081686.html')
-rw-r--r-- | dom/websocket/tests/test_bug1081686.html | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/dom/websocket/tests/test_bug1081686.html b/dom/websocket/tests/test_bug1081686.html new file mode 100644 index 0000000000..debcd97184 --- /dev/null +++ b/dom/websocket/tests/test_bug1081686.html @@ -0,0 +1,71 @@ +<!DOCTYPE HTML> +<html> +<!-- +--> +<head> + <title>bug 1081686</title> + <script src="/tests/SimpleTest/SimpleTest.js"></script> + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> +</head> +<body onload="testWebSocket()"> +<p id="display"></p> +<div id="content" style="display: none"> +</div> +<pre id="test"> +<script class="testbody" type="text/javascript"> + +var ws; + +function forcegc() +{ + SpecialPowers.forceGC(); + SpecialPowers.gc(); + setTimeout(function() + { + SpecialPowers.gc(); + }, 0); +} + +function testWebSocket () { + ws = new WebSocket("ws://mochi.test:8888/tests/dom/websocket/tests/file_websocket_hello"); + ws.onopen = function(e) { + ws.send("data"); + } + ws.onclose = function(e) { + forcegc(); + setTimeout(function() { + is(ws.readyState, 3, 'WebSocket is closed'); + is(ws.bufferedAmount, 0, 'WebSocket.bufferedAmount should be empty.'); + is(ws.binaryType, 'blob', 'WebSocket.binaryType is blob'); + ws.binaryType = 'arraybuffer'; + is(ws.binaryType, 'arraybuffer', 'WebSocket.binaryType is arraybuffer'); + is(ws.url, 'ws://mochi.test:8888/tests/dom/websocket/tests/file_websocket_hello', 'WebSocket.url is correct'); + ws.close(); + ws.send('foobar'); + SimpleTest.finish(); + }, 1000); + } + + ws.onerror = function(e) { + ok(false, "onerror called!"); + SimpleTest.finish(); + } + ws.onmessage = function(e) { + is(e.data, "Hello world!", "Wrong data"); + ws.close(); + } +} + +SimpleTest.waitForExplicitFinish(); +SimpleTest.requestFlakyTimeout("untriaged"); + +</script> +</pre> +<div> + + +</div> + + +</body> +</html> |