mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 21:01:08 +00:00
0d460e3432
This is split from the previous changeset since if we include dom/ the file size is too large for phabricator to handle. This is an autogenerated commit to handle scripts loading mochitest harness files, in the simple case where the script src is on the same line as the tag. This was generated with https://bug1544322.bmoattachments.org/attachment.cgi?id=9058170 using the `--part 2` argument. Differential Revision: https://phabricator.services.mozilla.com/D27457 --HG-- extra : moz-landing-system : lando
56 lines
1.6 KiB
HTML
56 lines
1.6 KiB
HTML
<!DOCTYPE HTML>
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"></meta>
|
|
<title>WebSocket test - big blob on content side</title>
|
|
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
<script type="text/javascript" src="websocket_helpers.js"></script>
|
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
|
</head>
|
|
<body>
|
|
<script class="testbody" type="text/javascript">
|
|
|
|
var ws = CreateTestWS("ws://mochi.test:8888/tests/dom/websocket/tests/file_websocket_bigBlob");
|
|
is(ws.readyState, 0, "Initial readyState is 0");
|
|
ws.binaryType = "blob";
|
|
|
|
ws.onopen = function() {
|
|
is(ws.readyState, 1, "Open readyState is 1");
|
|
ws.send(new Blob([new Array(1024*1024).join('123456789ABCDEF')]));
|
|
}
|
|
|
|
let receivedBlob;
|
|
ws.onmessage = function(e) {
|
|
ok(e.data instanceof Blob, "We should be receiving a Blob");
|
|
receivedBlob = e.data;
|
|
ws.close();
|
|
}
|
|
|
|
ws.onclose = function(e) {
|
|
is(ws.readyState, 3, "Close readyState is 3");
|
|
|
|
// check blob contents
|
|
var reader = new FileReader();
|
|
reader.onload = function(event) {
|
|
is(reader.result, new Array(1024*1024).join('123456789ABCDEF'), "All data matches");
|
|
}
|
|
|
|
reader.onerror = function(event) {
|
|
ok(false, "Something bad happen.");
|
|
}
|
|
|
|
reader.onloadend = function(event) {
|
|
SimpleTest.finish();
|
|
}
|
|
|
|
reader.readAsBinaryString(receivedBlob);
|
|
}
|
|
|
|
SimpleTest.requestFlakyTimeout("The web socket tests are really fragile, but avoiding timeouts might be hard, since it's testing stuff on the network. " +
|
|
"Expect all sorts of flakiness in this test...");
|
|
SimpleTest.waitForExplicitFinish();
|
|
|
|
</script>
|
|
</body>
|
|
</html>
|