diff --git a/dom/workers/test/mochitest.ini b/dom/workers/test/mochitest.ini index 9dc5dba75df3..daaed889a151 100644 --- a/dom/workers/test/mochitest.ini +++ b/dom/workers/test/mochitest.ini @@ -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] diff --git a/dom/workers/test/test_websocket_https.html b/dom/workers/test/test_websocket_https.html new file mode 100644 index 000000000000..aa94141fd46d --- /dev/null +++ b/dom/workers/test/test_websocket_https.html @@ -0,0 +1,30 @@ + + + + + Test that creating insecure websockets from https workers is not possible + + + + +

+ +
+
+
+ + + diff --git a/dom/workers/test/websocket_https.html b/dom/workers/test/websocket_https.html new file mode 100644 index 000000000000..549147a33279 --- /dev/null +++ b/dom/workers/test/websocket_https.html @@ -0,0 +1,14 @@ + + diff --git a/dom/workers/test/websocket_https_worker.js b/dom/workers/test/websocket_https_worker.js new file mode 100644 index 000000000000..2592ed6d0d11 --- /dev/null +++ b/dom/workers/test/websocket_https_worker.js @@ -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"); +};