gecko-dev/dom/websocket/tests/test_websocket_permessage_d...

111 строки
2.9 KiB
HTML
Исходник Обычный вид История

<!DOCTYPE HTML>
<html>
<head>
<title>Basic test of permessage compression websocket extension</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body onload="loadDeflate()">
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=792831">Mozilla Bug </a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
var ws;
var textMessage = "This is a text message";
var binaryMessage = "This is a binary message";
var testIdx = 0;
var sendText = true;
tests = [
// enable PMCE
Bug 1416151 - Moving websocket code and tests in dom/websocket, r=qdot --HG-- rename : dom/base/WebSocket.cpp => dom/websocket/WebSocket.cpp rename : dom/base/WebSocket.h => dom/websocket/WebSocket.h rename : dom/base/test/file_bug1384658.html => dom/websocket/tests/file_bug1384658.html rename : dom/base/test/file_websocket_basic_wsh.py => dom/websocket/tests/file_websocket_basic_wsh.py rename : dom/base/test/file_websocket_bigBlob_wsh.py => dom/websocket/tests/file_websocket_bigBlob_wsh.py rename : dom/base/test/file_websocket_hello_wsh.py => dom/websocket/tests/file_websocket_hello_wsh.py rename : dom/base/test/file_websocket_http_resource.txt => dom/websocket/tests/file_websocket_http_resource.txt rename : dom/base/test/file_websocket_permessage_deflate_disabled_wsh.py => dom/websocket/tests/file_websocket_permessage_deflate_disabled_wsh.py rename : dom/base/test/file_websocket_permessage_deflate_params_wsh.py => dom/websocket/tests/file_websocket_permessage_deflate_params_wsh.py rename : dom/base/test/file_websocket_permessage_deflate_rejected_wsh.py => dom/websocket/tests/file_websocket_permessage_deflate_rejected_wsh.py rename : dom/base/test/file_websocket_permessage_deflate_wsh.py => dom/websocket/tests/file_websocket_permessage_deflate_wsh.py rename : dom/base/test/file_websocket_wsh.py => dom/websocket/tests/file_websocket_wsh.py rename : dom/base/test/frame_bug1384658.html => dom/websocket/tests/frame_bug1384658.html rename : dom/base/test/iframe_webSocket_sandbox.html => dom/websocket/tests/iframe_webSocket_sandbox.html rename : dom/base/test/test_bug1081686.html => dom/websocket/tests/test_bug1081686.html rename : dom/base/test/test_bug1384658.html => dom/websocket/tests/test_bug1384658.html rename : dom/base/test/test_webSocket_sandbox.html => dom/websocket/tests/test_webSocket_sandbox.html rename : dom/workers/test/test_webSocket_sharedWorker.html => dom/websocket/tests/test_webSocket_sharedWorker.html rename : dom/base/test/test_websocket1.html => dom/websocket/tests/test_websocket1.html rename : dom/base/test/test_websocket2.html => dom/websocket/tests/test_websocket2.html rename : dom/base/test/test_websocket3.html => dom/websocket/tests/test_websocket3.html rename : dom/base/test/test_websocket4.html => dom/websocket/tests/test_websocket4.html rename : dom/base/test/test_websocket5.html => dom/websocket/tests/test_websocket5.html rename : dom/base/test/test_websocket_basic.html => dom/websocket/tests/test_websocket_basic.html rename : dom/base/test/test_websocket_bigBlob.html => dom/websocket/tests/test_websocket_bigBlob.html rename : dom/base/test/test_websocket_frame.html => dom/websocket/tests/test_websocket_frame.html rename : dom/base/test/test_websocket_hello.html => dom/websocket/tests/test_websocket_hello.html rename : dom/base/test/test_websocket_permessage_deflate.html => dom/websocket/tests/test_websocket_permessage_deflate.html rename : dom/workers/test/test_websocket1.html => dom/websocket/tests/test_worker_websocket1.html rename : dom/workers/test/test_websocket2.html => dom/websocket/tests/test_worker_websocket2.html rename : dom/workers/test/test_websocket3.html => dom/websocket/tests/test_worker_websocket3.html rename : dom/workers/test/test_websocket4.html => dom/websocket/tests/test_worker_websocket4.html rename : dom/workers/test/test_websocket5.html => dom/websocket/tests/test_worker_websocket5.html rename : dom/workers/test/test_websocket_basic.html => dom/websocket/tests/test_worker_websocket_basic.html rename : dom/workers/test/test_websocket_https.html => dom/websocket/tests/test_worker_websocket_https.html rename : dom/workers/test/test_websocket_loadgroup.html => dom/websocket/tests/test_worker_websocket_loadgroup.html rename : dom/workers/test/webSocket_sharedWorker.js => dom/websocket/tests/webSocket_sharedWorker.js rename : dom/workers/test/websocket_basic_worker.js => dom/websocket/tests/websocket_basic_worker.js rename : dom/base/test/websocket_helpers.js => dom/websocket/tests/websocket_helpers.js rename : dom/workers/test/websocket_https_worker.js => dom/websocket/tests/websocket_https_worker.js rename : dom/base/test/websocket_hybi/file_binary-frames_wsh.py => dom/websocket/tests/websocket_hybi/file_binary-frames_wsh.py rename : dom/base/test/websocket_hybi/file_check-binary-messages_wsh.py => dom/websocket/tests/websocket_hybi/file_check-binary-messages_wsh.py rename : dom/base/test/websocket_hybi/mochitest.ini => dom/websocket/tests/websocket_hybi/mochitest.ini rename : dom/base/test/websocket_hybi/test_receive-arraybuffer.html => dom/websocket/tests/websocket_hybi/test_receive-arraybuffer.html rename : dom/base/test/websocket_hybi/test_receive-blob.html => dom/websocket/tests/websocket_hybi/test_receive-blob.html rename : dom/base/test/websocket_hybi/test_send-arraybuffer.html => dom/websocket/tests/websocket_hybi/test_send-arraybuffer.html rename : dom/base/test/websocket_hybi/test_send-blob.html => dom/websocket/tests/websocket_hybi/test_send-blob.html rename : dom/workers/test/websocket_loadgroup_worker.js => dom/websocket/tests/websocket_loadgroup_worker.js rename : dom/base/test/websocket_tests.js => dom/websocket/tests/websocket_tests.js rename : dom/workers/test/websocket_worker1.js => dom/websocket/tests/websocket_worker1.js rename : dom/workers/test/websocket_worker2.js => dom/websocket/tests/websocket_worker2.js rename : dom/workers/test/websocket_worker3.js => dom/websocket/tests/websocket_worker3.js rename : dom/workers/test/websocket_worker4.js => dom/websocket/tests/websocket_worker4.js rename : dom/workers/test/websocket_worker5.js => dom/websocket/tests/websocket_worker5.js rename : dom/workers/test/websocket_https.html => dom/websocket/tests/websocket_worker_https.html rename : dom/base/test/window_bug1384658.html => dom/websocket/tests/window_bug1384658.html
2017-11-10 14:00:33 +03:00
[ true, true, "ws://mochi.test:8888/tests/dom/websocket/tests/file_websocket_permessage_deflate" ],
// disable PMCE
Bug 1416151 - Moving websocket code and tests in dom/websocket, r=qdot --HG-- rename : dom/base/WebSocket.cpp => dom/websocket/WebSocket.cpp rename : dom/base/WebSocket.h => dom/websocket/WebSocket.h rename : dom/base/test/file_bug1384658.html => dom/websocket/tests/file_bug1384658.html rename : dom/base/test/file_websocket_basic_wsh.py => dom/websocket/tests/file_websocket_basic_wsh.py rename : dom/base/test/file_websocket_bigBlob_wsh.py => dom/websocket/tests/file_websocket_bigBlob_wsh.py rename : dom/base/test/file_websocket_hello_wsh.py => dom/websocket/tests/file_websocket_hello_wsh.py rename : dom/base/test/file_websocket_http_resource.txt => dom/websocket/tests/file_websocket_http_resource.txt rename : dom/base/test/file_websocket_permessage_deflate_disabled_wsh.py => dom/websocket/tests/file_websocket_permessage_deflate_disabled_wsh.py rename : dom/base/test/file_websocket_permessage_deflate_params_wsh.py => dom/websocket/tests/file_websocket_permessage_deflate_params_wsh.py rename : dom/base/test/file_websocket_permessage_deflate_rejected_wsh.py => dom/websocket/tests/file_websocket_permessage_deflate_rejected_wsh.py rename : dom/base/test/file_websocket_permessage_deflate_wsh.py => dom/websocket/tests/file_websocket_permessage_deflate_wsh.py rename : dom/base/test/file_websocket_wsh.py => dom/websocket/tests/file_websocket_wsh.py rename : dom/base/test/frame_bug1384658.html => dom/websocket/tests/frame_bug1384658.html rename : dom/base/test/iframe_webSocket_sandbox.html => dom/websocket/tests/iframe_webSocket_sandbox.html rename : dom/base/test/test_bug1081686.html => dom/websocket/tests/test_bug1081686.html rename : dom/base/test/test_bug1384658.html => dom/websocket/tests/test_bug1384658.html rename : dom/base/test/test_webSocket_sandbox.html => dom/websocket/tests/test_webSocket_sandbox.html rename : dom/workers/test/test_webSocket_sharedWorker.html => dom/websocket/tests/test_webSocket_sharedWorker.html rename : dom/base/test/test_websocket1.html => dom/websocket/tests/test_websocket1.html rename : dom/base/test/test_websocket2.html => dom/websocket/tests/test_websocket2.html rename : dom/base/test/test_websocket3.html => dom/websocket/tests/test_websocket3.html rename : dom/base/test/test_websocket4.html => dom/websocket/tests/test_websocket4.html rename : dom/base/test/test_websocket5.html => dom/websocket/tests/test_websocket5.html rename : dom/base/test/test_websocket_basic.html => dom/websocket/tests/test_websocket_basic.html rename : dom/base/test/test_websocket_bigBlob.html => dom/websocket/tests/test_websocket_bigBlob.html rename : dom/base/test/test_websocket_frame.html => dom/websocket/tests/test_websocket_frame.html rename : dom/base/test/test_websocket_hello.html => dom/websocket/tests/test_websocket_hello.html rename : dom/base/test/test_websocket_permessage_deflate.html => dom/websocket/tests/test_websocket_permessage_deflate.html rename : dom/workers/test/test_websocket1.html => dom/websocket/tests/test_worker_websocket1.html rename : dom/workers/test/test_websocket2.html => dom/websocket/tests/test_worker_websocket2.html rename : dom/workers/test/test_websocket3.html => dom/websocket/tests/test_worker_websocket3.html rename : dom/workers/test/test_websocket4.html => dom/websocket/tests/test_worker_websocket4.html rename : dom/workers/test/test_websocket5.html => dom/websocket/tests/test_worker_websocket5.html rename : dom/workers/test/test_websocket_basic.html => dom/websocket/tests/test_worker_websocket_basic.html rename : dom/workers/test/test_websocket_https.html => dom/websocket/tests/test_worker_websocket_https.html rename : dom/workers/test/test_websocket_loadgroup.html => dom/websocket/tests/test_worker_websocket_loadgroup.html rename : dom/workers/test/webSocket_sharedWorker.js => dom/websocket/tests/webSocket_sharedWorker.js rename : dom/workers/test/websocket_basic_worker.js => dom/websocket/tests/websocket_basic_worker.js rename : dom/base/test/websocket_helpers.js => dom/websocket/tests/websocket_helpers.js rename : dom/workers/test/websocket_https_worker.js => dom/websocket/tests/websocket_https_worker.js rename : dom/base/test/websocket_hybi/file_binary-frames_wsh.py => dom/websocket/tests/websocket_hybi/file_binary-frames_wsh.py rename : dom/base/test/websocket_hybi/file_check-binary-messages_wsh.py => dom/websocket/tests/websocket_hybi/file_check-binary-messages_wsh.py rename : dom/base/test/websocket_hybi/mochitest.ini => dom/websocket/tests/websocket_hybi/mochitest.ini rename : dom/base/test/websocket_hybi/test_receive-arraybuffer.html => dom/websocket/tests/websocket_hybi/test_receive-arraybuffer.html rename : dom/base/test/websocket_hybi/test_receive-blob.html => dom/websocket/tests/websocket_hybi/test_receive-blob.html rename : dom/base/test/websocket_hybi/test_send-arraybuffer.html => dom/websocket/tests/websocket_hybi/test_send-arraybuffer.html rename : dom/base/test/websocket_hybi/test_send-blob.html => dom/websocket/tests/websocket_hybi/test_send-blob.html rename : dom/workers/test/websocket_loadgroup_worker.js => dom/websocket/tests/websocket_loadgroup_worker.js rename : dom/base/test/websocket_tests.js => dom/websocket/tests/websocket_tests.js rename : dom/workers/test/websocket_worker1.js => dom/websocket/tests/websocket_worker1.js rename : dom/workers/test/websocket_worker2.js => dom/websocket/tests/websocket_worker2.js rename : dom/workers/test/websocket_worker3.js => dom/websocket/tests/websocket_worker3.js rename : dom/workers/test/websocket_worker4.js => dom/websocket/tests/websocket_worker4.js rename : dom/workers/test/websocket_worker5.js => dom/websocket/tests/websocket_worker5.js rename : dom/workers/test/websocket_https.html => dom/websocket/tests/websocket_worker_https.html rename : dom/base/test/window_bug1384658.html => dom/websocket/tests/window_bug1384658.html
2017-11-10 14:00:33 +03:00
[ false, false, "ws://mochi.test:8888/tests/dom/websocket/tests/file_websocket_permessage_deflate_disabled" ],
// server rejects offered PMCE
Bug 1416151 - Moving websocket code and tests in dom/websocket, r=qdot --HG-- rename : dom/base/WebSocket.cpp => dom/websocket/WebSocket.cpp rename : dom/base/WebSocket.h => dom/websocket/WebSocket.h rename : dom/base/test/file_bug1384658.html => dom/websocket/tests/file_bug1384658.html rename : dom/base/test/file_websocket_basic_wsh.py => dom/websocket/tests/file_websocket_basic_wsh.py rename : dom/base/test/file_websocket_bigBlob_wsh.py => dom/websocket/tests/file_websocket_bigBlob_wsh.py rename : dom/base/test/file_websocket_hello_wsh.py => dom/websocket/tests/file_websocket_hello_wsh.py rename : dom/base/test/file_websocket_http_resource.txt => dom/websocket/tests/file_websocket_http_resource.txt rename : dom/base/test/file_websocket_permessage_deflate_disabled_wsh.py => dom/websocket/tests/file_websocket_permessage_deflate_disabled_wsh.py rename : dom/base/test/file_websocket_permessage_deflate_params_wsh.py => dom/websocket/tests/file_websocket_permessage_deflate_params_wsh.py rename : dom/base/test/file_websocket_permessage_deflate_rejected_wsh.py => dom/websocket/tests/file_websocket_permessage_deflate_rejected_wsh.py rename : dom/base/test/file_websocket_permessage_deflate_wsh.py => dom/websocket/tests/file_websocket_permessage_deflate_wsh.py rename : dom/base/test/file_websocket_wsh.py => dom/websocket/tests/file_websocket_wsh.py rename : dom/base/test/frame_bug1384658.html => dom/websocket/tests/frame_bug1384658.html rename : dom/base/test/iframe_webSocket_sandbox.html => dom/websocket/tests/iframe_webSocket_sandbox.html rename : dom/base/test/test_bug1081686.html => dom/websocket/tests/test_bug1081686.html rename : dom/base/test/test_bug1384658.html => dom/websocket/tests/test_bug1384658.html rename : dom/base/test/test_webSocket_sandbox.html => dom/websocket/tests/test_webSocket_sandbox.html rename : dom/workers/test/test_webSocket_sharedWorker.html => dom/websocket/tests/test_webSocket_sharedWorker.html rename : dom/base/test/test_websocket1.html => dom/websocket/tests/test_websocket1.html rename : dom/base/test/test_websocket2.html => dom/websocket/tests/test_websocket2.html rename : dom/base/test/test_websocket3.html => dom/websocket/tests/test_websocket3.html rename : dom/base/test/test_websocket4.html => dom/websocket/tests/test_websocket4.html rename : dom/base/test/test_websocket5.html => dom/websocket/tests/test_websocket5.html rename : dom/base/test/test_websocket_basic.html => dom/websocket/tests/test_websocket_basic.html rename : dom/base/test/test_websocket_bigBlob.html => dom/websocket/tests/test_websocket_bigBlob.html rename : dom/base/test/test_websocket_frame.html => dom/websocket/tests/test_websocket_frame.html rename : dom/base/test/test_websocket_hello.html => dom/websocket/tests/test_websocket_hello.html rename : dom/base/test/test_websocket_permessage_deflate.html => dom/websocket/tests/test_websocket_permessage_deflate.html rename : dom/workers/test/test_websocket1.html => dom/websocket/tests/test_worker_websocket1.html rename : dom/workers/test/test_websocket2.html => dom/websocket/tests/test_worker_websocket2.html rename : dom/workers/test/test_websocket3.html => dom/websocket/tests/test_worker_websocket3.html rename : dom/workers/test/test_websocket4.html => dom/websocket/tests/test_worker_websocket4.html rename : dom/workers/test/test_websocket5.html => dom/websocket/tests/test_worker_websocket5.html rename : dom/workers/test/test_websocket_basic.html => dom/websocket/tests/test_worker_websocket_basic.html rename : dom/workers/test/test_websocket_https.html => dom/websocket/tests/test_worker_websocket_https.html rename : dom/workers/test/test_websocket_loadgroup.html => dom/websocket/tests/test_worker_websocket_loadgroup.html rename : dom/workers/test/webSocket_sharedWorker.js => dom/websocket/tests/webSocket_sharedWorker.js rename : dom/workers/test/websocket_basic_worker.js => dom/websocket/tests/websocket_basic_worker.js rename : dom/base/test/websocket_helpers.js => dom/websocket/tests/websocket_helpers.js rename : dom/workers/test/websocket_https_worker.js => dom/websocket/tests/websocket_https_worker.js rename : dom/base/test/websocket_hybi/file_binary-frames_wsh.py => dom/websocket/tests/websocket_hybi/file_binary-frames_wsh.py rename : dom/base/test/websocket_hybi/file_check-binary-messages_wsh.py => dom/websocket/tests/websocket_hybi/file_check-binary-messages_wsh.py rename : dom/base/test/websocket_hybi/mochitest.ini => dom/websocket/tests/websocket_hybi/mochitest.ini rename : dom/base/test/websocket_hybi/test_receive-arraybuffer.html => dom/websocket/tests/websocket_hybi/test_receive-arraybuffer.html rename : dom/base/test/websocket_hybi/test_receive-blob.html => dom/websocket/tests/websocket_hybi/test_receive-blob.html rename : dom/base/test/websocket_hybi/test_send-arraybuffer.html => dom/websocket/tests/websocket_hybi/test_send-arraybuffer.html rename : dom/base/test/websocket_hybi/test_send-blob.html => dom/websocket/tests/websocket_hybi/test_send-blob.html rename : dom/workers/test/websocket_loadgroup_worker.js => dom/websocket/tests/websocket_loadgroup_worker.js rename : dom/base/test/websocket_tests.js => dom/websocket/tests/websocket_tests.js rename : dom/workers/test/websocket_worker1.js => dom/websocket/tests/websocket_worker1.js rename : dom/workers/test/websocket_worker2.js => dom/websocket/tests/websocket_worker2.js rename : dom/workers/test/websocket_worker3.js => dom/websocket/tests/websocket_worker3.js rename : dom/workers/test/websocket_worker4.js => dom/websocket/tests/websocket_worker4.js rename : dom/workers/test/websocket_worker5.js => dom/websocket/tests/websocket_worker5.js rename : dom/workers/test/websocket_https.html => dom/websocket/tests/websocket_worker_https.html rename : dom/base/test/window_bug1384658.html => dom/websocket/tests/window_bug1384658.html
2017-11-10 14:00:33 +03:00
[ true, false, "ws://mochi.test:8888/tests/dom/websocket/tests/file_websocket_permessage_deflate_rejected" ],
// server returns parameters in the handshake
Bug 1416151 - Moving websocket code and tests in dom/websocket, r=qdot --HG-- rename : dom/base/WebSocket.cpp => dom/websocket/WebSocket.cpp rename : dom/base/WebSocket.h => dom/websocket/WebSocket.h rename : dom/base/test/file_bug1384658.html => dom/websocket/tests/file_bug1384658.html rename : dom/base/test/file_websocket_basic_wsh.py => dom/websocket/tests/file_websocket_basic_wsh.py rename : dom/base/test/file_websocket_bigBlob_wsh.py => dom/websocket/tests/file_websocket_bigBlob_wsh.py rename : dom/base/test/file_websocket_hello_wsh.py => dom/websocket/tests/file_websocket_hello_wsh.py rename : dom/base/test/file_websocket_http_resource.txt => dom/websocket/tests/file_websocket_http_resource.txt rename : dom/base/test/file_websocket_permessage_deflate_disabled_wsh.py => dom/websocket/tests/file_websocket_permessage_deflate_disabled_wsh.py rename : dom/base/test/file_websocket_permessage_deflate_params_wsh.py => dom/websocket/tests/file_websocket_permessage_deflate_params_wsh.py rename : dom/base/test/file_websocket_permessage_deflate_rejected_wsh.py => dom/websocket/tests/file_websocket_permessage_deflate_rejected_wsh.py rename : dom/base/test/file_websocket_permessage_deflate_wsh.py => dom/websocket/tests/file_websocket_permessage_deflate_wsh.py rename : dom/base/test/file_websocket_wsh.py => dom/websocket/tests/file_websocket_wsh.py rename : dom/base/test/frame_bug1384658.html => dom/websocket/tests/frame_bug1384658.html rename : dom/base/test/iframe_webSocket_sandbox.html => dom/websocket/tests/iframe_webSocket_sandbox.html rename : dom/base/test/test_bug1081686.html => dom/websocket/tests/test_bug1081686.html rename : dom/base/test/test_bug1384658.html => dom/websocket/tests/test_bug1384658.html rename : dom/base/test/test_webSocket_sandbox.html => dom/websocket/tests/test_webSocket_sandbox.html rename : dom/workers/test/test_webSocket_sharedWorker.html => dom/websocket/tests/test_webSocket_sharedWorker.html rename : dom/base/test/test_websocket1.html => dom/websocket/tests/test_websocket1.html rename : dom/base/test/test_websocket2.html => dom/websocket/tests/test_websocket2.html rename : dom/base/test/test_websocket3.html => dom/websocket/tests/test_websocket3.html rename : dom/base/test/test_websocket4.html => dom/websocket/tests/test_websocket4.html rename : dom/base/test/test_websocket5.html => dom/websocket/tests/test_websocket5.html rename : dom/base/test/test_websocket_basic.html => dom/websocket/tests/test_websocket_basic.html rename : dom/base/test/test_websocket_bigBlob.html => dom/websocket/tests/test_websocket_bigBlob.html rename : dom/base/test/test_websocket_frame.html => dom/websocket/tests/test_websocket_frame.html rename : dom/base/test/test_websocket_hello.html => dom/websocket/tests/test_websocket_hello.html rename : dom/base/test/test_websocket_permessage_deflate.html => dom/websocket/tests/test_websocket_permessage_deflate.html rename : dom/workers/test/test_websocket1.html => dom/websocket/tests/test_worker_websocket1.html rename : dom/workers/test/test_websocket2.html => dom/websocket/tests/test_worker_websocket2.html rename : dom/workers/test/test_websocket3.html => dom/websocket/tests/test_worker_websocket3.html rename : dom/workers/test/test_websocket4.html => dom/websocket/tests/test_worker_websocket4.html rename : dom/workers/test/test_websocket5.html => dom/websocket/tests/test_worker_websocket5.html rename : dom/workers/test/test_websocket_basic.html => dom/websocket/tests/test_worker_websocket_basic.html rename : dom/workers/test/test_websocket_https.html => dom/websocket/tests/test_worker_websocket_https.html rename : dom/workers/test/test_websocket_loadgroup.html => dom/websocket/tests/test_worker_websocket_loadgroup.html rename : dom/workers/test/webSocket_sharedWorker.js => dom/websocket/tests/webSocket_sharedWorker.js rename : dom/workers/test/websocket_basic_worker.js => dom/websocket/tests/websocket_basic_worker.js rename : dom/base/test/websocket_helpers.js => dom/websocket/tests/websocket_helpers.js rename : dom/workers/test/websocket_https_worker.js => dom/websocket/tests/websocket_https_worker.js rename : dom/base/test/websocket_hybi/file_binary-frames_wsh.py => dom/websocket/tests/websocket_hybi/file_binary-frames_wsh.py rename : dom/base/test/websocket_hybi/file_check-binary-messages_wsh.py => dom/websocket/tests/websocket_hybi/file_check-binary-messages_wsh.py rename : dom/base/test/websocket_hybi/mochitest.ini => dom/websocket/tests/websocket_hybi/mochitest.ini rename : dom/base/test/websocket_hybi/test_receive-arraybuffer.html => dom/websocket/tests/websocket_hybi/test_receive-arraybuffer.html rename : dom/base/test/websocket_hybi/test_receive-blob.html => dom/websocket/tests/websocket_hybi/test_receive-blob.html rename : dom/base/test/websocket_hybi/test_send-arraybuffer.html => dom/websocket/tests/websocket_hybi/test_send-arraybuffer.html rename : dom/base/test/websocket_hybi/test_send-blob.html => dom/websocket/tests/websocket_hybi/test_send-blob.html rename : dom/workers/test/websocket_loadgroup_worker.js => dom/websocket/tests/websocket_loadgroup_worker.js rename : dom/base/test/websocket_tests.js => dom/websocket/tests/websocket_tests.js rename : dom/workers/test/websocket_worker1.js => dom/websocket/tests/websocket_worker1.js rename : dom/workers/test/websocket_worker2.js => dom/websocket/tests/websocket_worker2.js rename : dom/workers/test/websocket_worker3.js => dom/websocket/tests/websocket_worker3.js rename : dom/workers/test/websocket_worker4.js => dom/websocket/tests/websocket_worker4.js rename : dom/workers/test/websocket_worker5.js => dom/websocket/tests/websocket_worker5.js rename : dom/workers/test/websocket_https.html => dom/websocket/tests/websocket_worker_https.html rename : dom/base/test/window_bug1384658.html => dom/websocket/tests/window_bug1384658.html
2017-11-10 14:00:33 +03:00
[ true, true, "ws://mochi.test:8888/tests/dom/websocket/tests/file_websocket_permessage_deflate_params" ]
]
function ab2str(buf) {
return String.fromCharCode.apply(null, new Uint16Array(buf));
}
function str2ab(str) {
var buf = new ArrayBuffer(str.length*2);
var bufView = new Uint16Array(buf);
for (var i=0, strLen=str.length; i<strLen; i++) {
bufView[i] = str.charCodeAt(i);
}
return buf;
}
function sendMessage() {
if (sendText) {
ws.send(textMessage);
} else {
ws.binaryType = "arraybuffer";
ws.send(str2ab(binaryMessage));
}
}
function testDeflate() {
ws = new WebSocket(tests[testIdx][2]);
ws.onopen = function(e) {
if (tests[testIdx][1]) {
is(ws.extensions, "permessage-deflate", "permessage-deflate not negotiated!");
} else {
is(ws.extensions, "", "permessage-deflate should not be negotiated!");
}
sendMessage();
}
ws.onclose = function(e) {
if (!e.wasClean) {
ok(false, "Connection should be closed cleanly!");
SimpleTest.finish();
}
}
ws.onerror = function(e) {
ok(false, "onerror called!");
SimpleTest.finish();
}
ws.onmessage = function(e) {
if (sendText) {
is(e.data, textMessage, "Text message not received successfully!");
sendText = false;
sendMessage();
} else {
ok(e.data instanceof ArrayBuffer, "Should receive an arraybuffer!");
is(ab2str(e.data), binaryMessage, "Binary message not received successfully!");
ws.close();
sendText = true;
testIdx++;
if (testIdx < tests.length) {
loadDeflate();
} else {
SimpleTest.finish();
}
}
}
}
function loadDeflate() {
SpecialPowers.pushPrefEnv({"set":[['network.websocket.extensions.permessage-deflate', tests[testIdx][0]]]}, testDeflate);
}
SimpleTest.waitForExplicitFinish();
</script>
</pre>
</body>
</html>