зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1204269 - Part 2: Add unit tests; r=smaug
This commit is contained in:
Родитель
bc25c907d6
Коммит
6fc6fe1c47
|
@ -117,6 +117,8 @@ support-files =
|
|||
sharedWorker_ports.js
|
||||
sharedWorker_lifetime.js
|
||||
worker_referrer.js
|
||||
websocket_https.html
|
||||
websocket_https_worker.js
|
||||
|
||||
[test_404.html]
|
||||
[test_atob.html]
|
||||
|
@ -210,6 +212,8 @@ skip-if = (toolkit == 'gonk' && debug) # Bug 1176223
|
|||
skip-if = buildapp == 'b2g' || toolkit == 'android' #bug 982828
|
||||
[test_websocket_basic.html]
|
||||
skip-if = buildapp == 'b2g' || toolkit == 'android' #bug 982828
|
||||
[test_websocket_https.html]
|
||||
skip-if = buildapp == 'b2g' # no https on b2g
|
||||
[test_websocket_loadgroup.html]
|
||||
skip-if = buildapp == 'b2g' || toolkit == 'android' #bug 982828
|
||||
[test_webSocket_sharedWorker.html]
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
<!--
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/
|
||||
-->
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test that creating insecure websockets from https workers is not possible</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script class="testbody" language="javascript">
|
||||
|
||||
onmessage = function(event) {
|
||||
is(event.data, "not created", "WebSocket object must not be created");
|
||||
SimpleTest.finish();
|
||||
};
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
<iframe src="https://example.com/tests/dom/workers/test/websocket_https.html"></iframe>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,14 @@
|
|||
<!DOCTYPE html>
|
||||
<script>
|
||||
var worker = new Worker("https://example.com/tests/dom/workers/test/websocket_https_worker.js");
|
||||
|
||||
worker.onmessage = function(event) {
|
||||
parent.postMessage(event.data, "*");
|
||||
};
|
||||
|
||||
worker.onerror = function(event) {
|
||||
parent.postMessage("error", "*");
|
||||
};
|
||||
|
||||
worker.postMessage("start");
|
||||
</script>
|
|
@ -0,0 +1,9 @@
|
|||
onmessage = function() {
|
||||
var wsCreated = true;
|
||||
try {
|
||||
new WebSocket("ws://mochi.test:8888/tests/dom/base/test/file_websocket_hello");
|
||||
} catch(e) {
|
||||
wsCreated = false;
|
||||
}
|
||||
postMessage(wsCreated ? "created" : "not created");
|
||||
};
|
Загрузка…
Ссылка в новой задаче