Bug 1416151 - Moving websocket code and tests in dom/websocket, r=qdot
authorAndrea Marchesini <amarchesini@mozilla.com>
Fri, 10 Nov 2017 12:00:33 +0100
changeset 696312 e73ab24a3204663b97f568820e043e466084a116
parent 696311 67fe0ac257b8a1169a208bf4c7f5c2369c3239ee
child 696313 9d629ff741cfdb277d89383d1cf9bf47186e2dd6
child 696367 3b3fdb4f8f360be4e0149218ca99f2514a113f77
push id88683
push userbmo:lhansen@mozilla.com
push dateFri, 10 Nov 2017 13:30:01 +0000
reviewersqdot
bugs1416151
milestone58.0a1
Bug 1416151 - Moving websocket code and tests in dom/websocket, r=qdot
.eslintignore
dom/base/WebSocket.cpp
dom/base/WebSocket.h
dom/base/moz.build
dom/base/test/chrome.ini
dom/base/test/file_bug1384658.html
dom/base/test/file_websocket_basic_wsh.py
dom/base/test/file_websocket_bigBlob_wsh.py
dom/base/test/file_websocket_hello_wsh.py
dom/base/test/file_websocket_http_resource.txt
dom/base/test/file_websocket_permessage_deflate_disabled_wsh.py
dom/base/test/file_websocket_permessage_deflate_params_wsh.py
dom/base/test/file_websocket_permessage_deflate_rejected_wsh.py
dom/base/test/file_websocket_permessage_deflate_wsh.py
dom/base/test/file_websocket_wsh.py
dom/base/test/frame_bug1384658.html
dom/base/test/iframe_webSocket_sandbox.html
dom/base/test/mochitest.ini
dom/base/test/moz.build
dom/base/test/test_bug1081686.html
dom/base/test/test_bug1384658.html
dom/base/test/test_webSocket_sandbox.html
dom/base/test/test_websocket1.html
dom/base/test/test_websocket2.html
dom/base/test/test_websocket3.html
dom/base/test/test_websocket4.html
dom/base/test/test_websocket5.html
dom/base/test/test_websocket_basic.html
dom/base/test/test_websocket_bigBlob.html
dom/base/test/test_websocket_frame.html
dom/base/test/test_websocket_hello.html
dom/base/test/test_websocket_permessage_deflate.html
dom/base/test/websocket_helpers.js
dom/base/test/websocket_hybi/file_binary-frames_wsh.py
dom/base/test/websocket_hybi/file_check-binary-messages_wsh.py
dom/base/test/websocket_hybi/mochitest.ini
dom/base/test/websocket_hybi/test_receive-arraybuffer.html
dom/base/test/websocket_hybi/test_receive-blob.html
dom/base/test/websocket_hybi/test_send-arraybuffer.html
dom/base/test/websocket_hybi/test_send-blob.html
dom/base/test/websocket_tests.js
dom/base/test/window_bug1384658.html
dom/moz.build
dom/websocket/WebSocket.cpp
dom/websocket/WebSocket.h
dom/websocket/moz.build
dom/websocket/tests/chrome.ini
dom/websocket/tests/file_bug1384658.html
dom/websocket/tests/file_websocket_basic_wsh.py
dom/websocket/tests/file_websocket_bigBlob_wsh.py
dom/websocket/tests/file_websocket_hello_wsh.py
dom/websocket/tests/file_websocket_http_resource.txt
dom/websocket/tests/file_websocket_permessage_deflate_disabled_wsh.py
dom/websocket/tests/file_websocket_permessage_deflate_params_wsh.py
dom/websocket/tests/file_websocket_permessage_deflate_rejected_wsh.py
dom/websocket/tests/file_websocket_permessage_deflate_wsh.py
dom/websocket/tests/file_websocket_wsh.py
dom/websocket/tests/frame_bug1384658.html
dom/websocket/tests/iframe_webSocket_sandbox.html
dom/websocket/tests/mochitest.ini
dom/websocket/tests/test_bug1081686.html
dom/websocket/tests/test_bug1384658.html
dom/websocket/tests/test_webSocket_sandbox.html
dom/websocket/tests/test_webSocket_sharedWorker.html
dom/websocket/tests/test_websocket1.html
dom/websocket/tests/test_websocket2.html
dom/websocket/tests/test_websocket3.html
dom/websocket/tests/test_websocket4.html
dom/websocket/tests/test_websocket5.html
dom/websocket/tests/test_websocket_basic.html
dom/websocket/tests/test_websocket_bigBlob.html
dom/websocket/tests/test_websocket_frame.html
dom/websocket/tests/test_websocket_hello.html
dom/websocket/tests/test_websocket_permessage_deflate.html
dom/websocket/tests/test_worker_websocket1.html
dom/websocket/tests/test_worker_websocket2.html
dom/websocket/tests/test_worker_websocket3.html
dom/websocket/tests/test_worker_websocket4.html
dom/websocket/tests/test_worker_websocket5.html
dom/websocket/tests/test_worker_websocket_basic.html
dom/websocket/tests/test_worker_websocket_https.html
dom/websocket/tests/test_worker_websocket_loadgroup.html
dom/websocket/tests/webSocket_sharedWorker.js
dom/websocket/tests/websocket_basic_worker.js
dom/websocket/tests/websocket_helpers.js
dom/websocket/tests/websocket_https_worker.js
dom/websocket/tests/websocket_hybi/file_binary-frames_wsh.py
dom/websocket/tests/websocket_hybi/file_check-binary-messages_wsh.py
dom/websocket/tests/websocket_hybi/mochitest.ini
dom/websocket/tests/websocket_hybi/test_receive-arraybuffer.html
dom/websocket/tests/websocket_hybi/test_receive-blob.html
dom/websocket/tests/websocket_hybi/test_send-arraybuffer.html
dom/websocket/tests/websocket_hybi/test_send-blob.html
dom/websocket/tests/websocket_loadgroup_worker.js
dom/websocket/tests/websocket_tests.js
dom/websocket/tests/websocket_worker1.js
dom/websocket/tests/websocket_worker2.js
dom/websocket/tests/websocket_worker3.js
dom/websocket/tests/websocket_worker4.js
dom/websocket/tests/websocket_worker5.js
dom/websocket/tests/websocket_worker_helpers.js
dom/websocket/tests/websocket_worker_https.html
dom/websocket/tests/window_bug1384658.html
dom/workers/test/mochitest.ini
dom/workers/test/test_webSocket_sharedWorker.html
dom/workers/test/test_websocket1.html
dom/workers/test/test_websocket2.html
dom/workers/test/test_websocket3.html
dom/workers/test/test_websocket4.html
dom/workers/test/test_websocket5.html
dom/workers/test/test_websocket_basic.html
dom/workers/test/test_websocket_https.html
dom/workers/test/test_websocket_loadgroup.html
dom/workers/test/webSocket_sharedWorker.js
dom/workers/test/websocket_basic_worker.js
dom/workers/test/websocket_helpers.js
dom/workers/test/websocket_https.html
dom/workers/test/websocket_https_worker.js
dom/workers/test/websocket_loadgroup_worker.js
dom/workers/test/websocket_worker1.js
dom/workers/test/websocket_worker2.js
dom/workers/test/websocket_worker3.js
dom/workers/test/websocket_worker4.js
dom/workers/test/websocket_worker5.js
--- a/.eslintignore
+++ b/.eslintignore
@@ -240,16 +240,17 @@ dom/system/**
 dom/tests/**
 dom/time/**
 dom/u2f/**
 dom/url/**
 dom/vr/**
 dom/webauthn/**
 dom/webbrowserpersist/**
 dom/webidl/**
+dom/websocket/**
 dom/workers/**
 dom/worklet/**
 dom/xbl/**
 dom/xhr/**
 dom/xml/**
 dom/xslt/**
 dom/xul/**
 
--- a/dom/base/moz.build
+++ b/dom/base/moz.build
@@ -211,17 +211,16 @@ EXPORTS.mozilla.dom += [
     'SubtleCrypto.h',
     'TabGroup.h',
     'Text.h',
     'Timeout.h',
     'TimeoutHandler.h',
     'TimeoutManager.h',
     'TreeWalker.h',
     'WebKitCSSMatrix.h',
-    'WebSocket.h',
     'WindowOrientationObserver.h',
 ]
 
 if CONFIG['FUZZING']:
     EXPORTS.mozilla.dom += [
         'FuzzingFunctions.h',
     ]
 
@@ -359,17 +358,16 @@ UNIFIED_SOURCES += [
     'ThirdPartyUtil.cpp',
     'Timeout.cpp',
     'TimeoutBudgetManager.cpp',
     'TimeoutExecutor.cpp',
     'TimeoutHandler.cpp',
     'TimeoutManager.cpp',
     'TreeWalker.cpp',
     'WebKitCSSMatrix.cpp',
-    'WebSocket.cpp',
     'WindowNamedPropertiesHandler.cpp',
     'WindowOrientationObserver.cpp',
     'XPathGenerator.cpp',
 ]
 
 if CONFIG['MOZ_WEBRTC']:
     UNIFIED_SOURCES += [
         'nsDOMDataChannel.cpp',
--- a/dom/base/test/chrome.ini
+++ b/dom/base/test/chrome.ini
@@ -29,9 +29,8 @@ subsuite = clipboard
 [test_messagemanager_send_principal.html]
 skip-if = buildapp == 'mulet'
 [test_mozbrowser_apis_allowed.html]
 [test_navigator_resolve_identity_xrays.xul]
 support-files = file_navigator_resolve_identity_xrays.xul
 [test_sandboxed_blob_uri.html]
 [test_sendQueryContentAndSelectionSetEvent.html]
 [test_urgent_start.html]
-[test_websocket_frame.html]
--- a/dom/base/test/mochitest.ini
+++ b/dom/base/test/mochitest.ini
@@ -60,17 +60,16 @@ support-files =
   eventsource_redirect.resource
   eventsource_redirect.resource^headers^
   eventsource_redirect_to.resource
   eventsource_redirect_to.resource^headers^
   file_base_xbl.xml
   file_bug1091883_frame.html
   file_bug1091883_subframe.html
   file_bug1091883_target.html
-  file_bug1384658.html
   file_bug28293.sjs
   file_bug326337.xml
   file_bug326337_inner.html
   file_bug326337_outer.html
   file_bug372086.xml
   file_bug416317.xhtml
   file_bug426646-1.html
   file_bug426646-2.html
@@ -151,25 +150,16 @@ support-files =
   file_lock_orientation.html
   file_mozfiledataurl_img.jpg
   file_record_orientation.html
   file_restrictedEventSource.sjs
   file_settimeout_inner.html
   file_timer_flood.html
   file_viewport_scroll_quirks.html
   file_viewport_scroll_xml.xml
-  file_websocket_basic_wsh.py
-  file_websocket_bigBlob_wsh.py
-  file_websocket_hello_wsh.py
-  file_websocket_http_resource.txt
-  file_websocket_permessage_deflate_wsh.py
-  file_websocket_permessage_deflate_disabled_wsh.py
-  file_websocket_permessage_deflate_rejected_wsh.py
-  file_websocket_permessage_deflate_params_wsh.py
-  file_websocket_wsh.py
   file_x-frame-options_main.html
   file_x-frame-options_page.sjs
   file_xhtmlserializer_1.xhtml
   file_xhtmlserializer_1_bodyonly.xhtml
   file_xhtmlserializer_1_format.xhtml
   file_xhtmlserializer_1_linebreak.xhtml
   file_xhtmlserializer_1_links.xhtml
   file_xhtmlserializer_1_nested_body.xhtml
@@ -219,18 +209,16 @@ support-files =
   test_anonymousContent_style_csp.html^headers^
   file_explicit_user_agent.sjs
   referrer_change_server.sjs
   file_change_policy_redirect.html
   file_bug1198095.js
   file_bug1250148.sjs
   file_bug1268962.sjs
   mozbrowser_api_utils.js
-  websocket_helpers.js
-  websocket_tests.js
   !/dom/security/test/cors/file_CrossSiteXHR_server.sjs
   !/image/test/mochitest/blue.png
   script_bug1238440.js
   intersectionobserver_iframe.html
   intersectionobserver_cross_domain_iframe.html
   intersectionobserver_window.html
   object_bug353334.html
   embed_bug455472.html
@@ -245,18 +233,16 @@ support-files =
   iframe1_bug426646.html
   iframe2_bug426646.html
   file1_setting_opener.html
   file2_setting_opener.html
   file3_setting_opener.html
   file4_setting_opener.html
   PASS.html
   FAIL.html
-  window_bug1384658.html
-  frame_bug1384658.html
 
 [test_anchor_area_referrer.html]
 [test_anchor_area_referrer_changing.html]
 [test_anchor_area_referrer_invalid.html]
 [test_anchor_area_referrer_rel.html]
 [test_anonymousContent_api.html]
 [test_anonymousContent_append_after_reflow.html]
 [test_anonymousContent_canvas.html]
@@ -594,18 +580,16 @@ skip-if = stylo # bug 1293844
 [test_bug1037687.html]
 skip-if = stylo # bug 1293844
 [test_bug1043106.html]
 [test_bug1057176.html]
 [test_bug1060938.html]
 [test_bug1064481.html]
 [test_bug1070015.html]
 [test_bug1075702.html]
-[test_bug1081686.html]
-skip-if = toolkit == 'android'
 [test_bug1091883.html]
 [test_bug1101364.html]
 skip-if = toolkit == 'android'
 [test_bug1118689.html]
 [test_bug1126851.html]
 [test_bug1163743.html]
 [test_bug1165501.html]
 [test_bug1187157.html]
@@ -620,18 +604,16 @@ skip-if = toolkit == 'android'
 [test_bug1281963.html]
 [test_bug1295852.html]
 [test_bug1307730.html]
 [test_bug1308069.html]
 [test_bug1314032.html]
 [test_bug1318303.html]
 [test_bug1375050.html]
 [test_bug1381710.html]
-[test_bug1384658.html]
-skip-if = toolkit == 'android'
 [test_bug1384661.html]
 [test_bug1399603.html]
 [test_bug1399605.html]
 [test_bug1404385.html]
 [test_bug1406102.html]
 [test_caretPositionFromPoint.html]
 [test_change_policy.html]
 [test_clearTimeoutIntervalNoArg.html]
@@ -800,37 +782,16 @@ skip-if = toolkit == 'android'
 [test_w3element_traversal.html]
 [test_w3element_traversal.xhtml]
 [test_w3element_traversal_svg.html]
 [test_warning_for_blocked_cross_site_request.html]
 [test_webaudioNotification.html]
 tags = audiochannel
 [test_webaudioNotificationStopOnNavigation.html]
 tags = audiochannel
-[test_websocket_basic.html]
-skip-if = toolkit == 'android'
-[test_websocket_hello.html]
-skip-if = toolkit == 'android'
-[test_websocket_permessage_deflate.html]
-skip-if = toolkit == 'android'
-[test_webSocket_sandbox.html]
-skip-if = toolkit == 'android'
-support-files = iframe_webSocket_sandbox.html
-[test_websocket1.html]
-skip-if = toolkit == 'android'
-[test_websocket2.html]
-skip-if = toolkit == 'android'
-[test_websocket3.html]
-skip-if = toolkit == 'android'
-[test_websocket4.html]
-skip-if = toolkit == 'android'
-[test_websocket5.html]
-skip-if = toolkit == 'android'
-[test_websocket_bigBlob.html]
-skip-if = toolkit == 'android'
 [test_window_constructor.html]
 [test_window_content.html]
 [test_window_cross_origin_props.html]
 [test_window_define_nonconfigurable.html]
 [test_window_define_symbol.html]
 [test_window_element_enumeration.html]
 [test_window_enumeration.html]
 [test_window_extensible.html]
--- a/dom/base/test/moz.build
+++ b/dom/base/test/moz.build
@@ -6,17 +6,16 @@
 
 XPCSHELL_TESTS_MANIFESTS += [
     'unit/xpcshell.ini',
     'unit_ipc/xpcshell.ini',
 ]
 
 MOCHITEST_MANIFESTS += [
     'mochitest.ini',
-    'websocket_hybi/mochitest.ini',
 ]
 
 MOCHITEST_CHROME_MANIFESTS += [
     'chrome.ini',
     'chrome/chrome.ini',
 ]
 
 BROWSER_CHROME_MANIFESTS += [
--- a/dom/moz.build
+++ b/dom/moz.build
@@ -103,16 +103,17 @@ DIRS += [
     'u2f',
     'console',
     'performance',
     'webbrowserpersist',
     'xhr',
     'worklet',
     'script',
     'payments',
+    'websocket',
 ]
 
 if CONFIG['OS_ARCH'] == 'WINNT':
     DIRS += ['plugins/ipc/hangui']
 
 if CONFIG['MOZ_SECUREELEMENT']:
     DIRS += ['secureelement']
 
rename from dom/base/WebSocket.cpp
rename to dom/websocket/WebSocket.cpp
rename from dom/base/WebSocket.h
rename to dom/websocket/WebSocket.h
new file mode 100644
--- /dev/null
+++ b/dom/websocket/moz.build
@@ -0,0 +1,34 @@
+# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+with Files("**"):
+    BUG_COMPONENT = ("Core", "DOM")
+
+EXPORTS.mozilla.dom += [
+    'WebSocket.h',
+]
+
+UNIFIED_SOURCES += [
+    'WebSocket.cpp',
+]
+
+LOCAL_INCLUDES += [
+    '/dom/base',
+    '/dom/workers',
+]
+
+MOCHITEST_CHROME_MANIFESTS += [
+    'tests/chrome.ini',
+]
+
+MOCHITEST_MANIFESTS += [
+    'tests/mochitest.ini',
+    'tests/websocket_hybi/mochitest.ini',
+]
+
+include('/ipc/chromium/chromium-config.mozbuild')
+
+FINAL_LIBRARY = 'xul'
new file mode 100644
--- /dev/null
+++ b/dom/websocket/tests/chrome.ini
@@ -0,0 +1,4 @@
+[DEFAULT]
+skip-if = os == 'android'
+
+[test_websocket_frame.html]
rename from dom/base/test/file_bug1384658.html
rename to dom/websocket/tests/file_bug1384658.html
--- a/dom/base/test/file_bug1384658.html
+++ b/dom/websocket/tests/file_bug1384658.html
@@ -3,17 +3,17 @@
 <script>
   onload = function() {
     function done(success) {
       var bc = new BroadcastChannel("test_channel");
       bc.postMessage({success:success});
       bc.close();
     }
     try {
-      new WebSocket("ws://mochi.test:8888/tests/dom/base/test/file_websocket_basic");
+      new WebSocket("ws://mochi.test:8888/tests/dom/websocket/tests/file_websocket_basic");
       done(true); // no hang!
     } catch (e) {
       done(false);
     }
   }
 </script>
 </html>
 
rename from dom/base/test/file_websocket_basic_wsh.py
rename to dom/websocket/tests/file_websocket_basic_wsh.py
rename from dom/base/test/file_websocket_bigBlob_wsh.py
rename to dom/websocket/tests/file_websocket_bigBlob_wsh.py
rename from dom/base/test/file_websocket_hello_wsh.py
rename to dom/websocket/tests/file_websocket_hello_wsh.py
rename from dom/base/test/file_websocket_http_resource.txt
rename to dom/websocket/tests/file_websocket_http_resource.txt
rename from dom/base/test/file_websocket_permessage_deflate_disabled_wsh.py
rename to dom/websocket/tests/file_websocket_permessage_deflate_disabled_wsh.py
rename from dom/base/test/file_websocket_permessage_deflate_params_wsh.py
rename to dom/websocket/tests/file_websocket_permessage_deflate_params_wsh.py
rename from dom/base/test/file_websocket_permessage_deflate_rejected_wsh.py
rename to dom/websocket/tests/file_websocket_permessage_deflate_rejected_wsh.py
rename from dom/base/test/file_websocket_permessage_deflate_wsh.py
rename to dom/websocket/tests/file_websocket_permessage_deflate_wsh.py
rename from dom/base/test/file_websocket_wsh.py
rename to dom/websocket/tests/file_websocket_wsh.py
rename from dom/base/test/frame_bug1384658.html
rename to dom/websocket/tests/frame_bug1384658.html
rename from dom/base/test/iframe_webSocket_sandbox.html
rename to dom/websocket/tests/iframe_webSocket_sandbox.html
--- a/dom/base/test/iframe_webSocket_sandbox.html
+++ b/dom/websocket/tests/iframe_webSocket_sandbox.html
@@ -18,17 +18,17 @@ if (location.search == '?nested') {
   ifr.srcdoc = "<html><script>" +
     "window.open('" + url.href + "', 'foobar');" +
     "onmessage = function(e) { " +
     "  parent.postMessage(e.data, '*'); " +
     "}" +
   "</scr" + "ipt></html>";
 } else if (location.search == '?opener') {
   try{
-    var socket = new WebSocket('ws://mochi.test:8888/tests/dom/base/test/file_websocket_basic');
+    var socket = new WebSocket('ws://mochi.test:8888/tests/dom/websocket/tests/file_websocket_basic');
     socket.onerror = function(e) {
       opener.postMessage('WS onerror', '*');
       close();
     };
     socket.onopen = function(event) {
       opener.postMessage('WS onopen', '*');
       close();
     };
@@ -39,17 +39,17 @@ if (location.search == '?nested') {
       opener.postMessage('WS Throws something else!', '*');
     }
     close();
   }
 } else {
   ifr.srcdoc = `
   <html><script>
   try{
-    var socket = new WebSocket('ws://mochi.test:8888/tests/dom/base/test/file_websocket_basic');
+    var socket = new WebSocket('ws://mochi.test:8888/tests/dom/websocket/tests/file_websocket_basic');
     socket.onerror = function(e) {
       parent.postMessage('WS onerror', '*');
     };
     socket.onopen = function(event) {
       parent.postMessage('WS onopen', '*');
     };
   } catch(e) {
     if (e.name == 'SecurityError') {
new file mode 100644
--- /dev/null
+++ b/dom/websocket/tests/mochitest.ini
@@ -0,0 +1,48 @@
+[DEFAULT]
+skip-if = toolkit == 'android' # bug 982828
+support-files =
+  file_websocket_basic_wsh.py
+  file_websocket_hello_wsh.py
+  file_websocket_http_resource.txt
+  file_websocket_permessage_deflate_wsh.py
+  file_websocket_permessage_deflate_disabled_wsh.py
+  file_websocket_permessage_deflate_rejected_wsh.py
+  file_websocket_permessage_deflate_params_wsh.py
+  file_websocket_wsh.py
+  websocket_helpers.js
+  websocket_tests.js
+  websocket_worker_helpers.js
+
+[test_bug1081686.html]
+[test_bug1384658.html]
+support-files = window_bug1384658.html frame_bug1384658.html file_bug1384658.html
+[test_websocket1.html]
+[test_websocket2.html]
+[test_websocket3.html]
+[test_websocket4.html]
+[test_websocket5.html]
+[test_websocket_basic.html]
+[test_websocket_hello.html]
+[test_websocket_permessage_deflate.html]
+[test_webSocket_sandbox.html]
+support-files = iframe_webSocket_sandbox.html
+[test_worker_websocket1.html]
+support-files = websocket_worker1.js
+[test_worker_websocket2.html]
+support-files = websocket_worker2.js
+[test_worker_websocket3.html]
+support-files = websocket_worker3.js
+[test_worker_websocket4.html]
+support-files = websocket_worker4.js
+[test_worker_websocket5.html]
+support-files = websocket_worker5.js
+[test_worker_websocket_basic.html]
+support-files = websocket_basic_worker.js
+[test_worker_websocket_https.html]
+support-files = websocket_worker_https.html websocket_https_worker.js
+[test_worker_websocket_loadgroup.html]
+support-files = websocket_loadgroup_worker.js
+[test_webSocket_sharedWorker.html]
+support-files = webSocket_sharedWorker.js
+[test_websocket_bigBlob.html]
+support-files = file_websocket_bigBlob_wsh.py
rename from dom/base/test/test_bug1081686.html
rename to dom/websocket/tests/test_bug1081686.html
--- a/dom/base/test/test_bug1081686.html
+++ b/dom/websocket/tests/test_bug1081686.html
@@ -22,29 +22,29 @@ function forcegc()
   SpecialPowers.gc();
   setTimeout(function()
   {
     SpecialPowers.gc();
   }, 0);
 }
 
 function testWebSocket () {
-  ws = new WebSocket("ws://mochi.test:8888/tests/dom/base/test/file_websocket_hello");
+  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/base/test/file_websocket_hello', 'WebSocket.url is correct');
+      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!");
rename from dom/base/test/test_bug1384658.html
rename to dom/websocket/tests/test_bug1384658.html
--- a/dom/base/test/test_bug1384658.html
+++ b/dom/websocket/tests/test_bug1384658.html
@@ -18,17 +18,17 @@ function test_frameset() {
   bc.onmessage = ev => {
     ok(ev.data.success, "We didn't hang");
     bc.close();
     test_window();
   };
 }
 
 function test_window() {
-  var win = window.open("http://example.com/tests/dom/base/test/window_bug1384658.html",
+  var win = window.open("http://example.com/tests/dom/websocket/tests/window_bug1384658.html",
                         "_blank", "width=100,height=100");
   var bc = new BroadcastChannel("test_channel");
   bc.onmessage = ev => {
     ok(ev.data.success, "We didn't hang");
     bc.close();
     win.close();
     SimpleTest.finish();
   };
rename from dom/base/test/test_webSocket_sandbox.html
rename to dom/websocket/tests/test_webSocket_sandbox.html
--- a/dom/base/test/test_webSocket_sandbox.html
+++ b/dom/websocket/tests/test_webSocket_sandbox.html
@@ -4,19 +4,19 @@
   <title>Bug 1252751</title>
   <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
 </head>
 <body>
 <div id="container"></div>
 <iframe id="frame"></iframe>
 <script type="application/javascript;version=1.8">
-var urls = [ "https://example.com/tests/dom/base/test/iframe_webSocket_sandbox.html",
-             "https://example.com/tests/dom/base/test/iframe_webSocket_sandbox.html?nested",
-             "https://example.com/tests/dom/base/test/iframe_webSocket_sandbox.html?popup" ];
+var urls = [ "https://example.com/tests/dom/websocket/tests/iframe_webSocket_sandbox.html",
+             "https://example.com/tests/dom/websocket/tests/iframe_webSocket_sandbox.html?nested",
+             "https://example.com/tests/dom/websocket/tests/iframe_webSocket_sandbox.html?popup" ];
 
 onmessage = function(e) {
   is(e.data, "WS Throws!", "ws://URI cannot be used by a https iframe");
   runTest();
 }
 
 function runTest() {
   if (!urls.length) {
rename from dom/workers/test/test_webSocket_sharedWorker.html
rename to dom/websocket/tests/test_webSocket_sharedWorker.html
rename from dom/base/test/test_websocket1.html
rename to dom/websocket/tests/test_websocket1.html
rename from dom/base/test/test_websocket2.html
rename to dom/websocket/tests/test_websocket2.html
rename from dom/base/test/test_websocket3.html
rename to dom/websocket/tests/test_websocket3.html
rename from dom/base/test/test_websocket4.html
rename to dom/websocket/tests/test_websocket4.html
rename from dom/base/test/test_websocket5.html
rename to dom/websocket/tests/test_websocket5.html
rename from dom/base/test/test_websocket_basic.html
rename to dom/websocket/tests/test_websocket_basic.html
--- a/dom/base/test/test_websocket_basic.html
+++ b/dom/websocket/tests/test_websocket_basic.html
@@ -9,17 +9,17 @@
 <body onload="testWebSocket()">
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=472529">Mozilla Bug 472529</a>
 <p id="display"></p>
 <div id="content" style="display: none">
 </div>
 <pre id="test">
 <script class="testbody" type="text/javascript">
 
-const kUrl = "ws://mochi.test:8888/tests/dom/base/test/file_websocket_basic";
+const kUrl = "ws://mochi.test:8888/tests/dom/websocket/tests/file_websocket_basic";
 
 var gTestElement;
 var ws;
 
 function forcegc() {
   SpecialPowers.forceGC();
   SpecialPowers.gc();
 }
@@ -32,17 +32,17 @@ function testWebSocket() {
 
 /**
  * Sends message keywords, then receives their values.
  */
 function testWebSocket1() {
   gTestElement.textContent = "Running testWebSocket1()";
 
   var results = ["test",
-                 "/tests/dom/base/test/file_websocket_basic",
+                 "/tests/dom/websocket/tests/file_websocket_basic",
                  "http://mochi.test:8888",
                  "end"];
 
   ws = new WebSocket(kUrl, "test");
   is(ws.url, kUrl, "[1] WebSocket.url");
   ws.onopen = function(e) {
     const params = ["protocol", "resource", "origin", "end"];
 
rename from dom/base/test/test_websocket_bigBlob.html
rename to dom/websocket/tests/test_websocket_bigBlob.html
--- a/dom/base/test/test_websocket_bigBlob.html
+++ b/dom/websocket/tests/test_websocket_bigBlob.html
@@ -5,17 +5,17 @@
   <title>WebSocket test - big blob on content side</title>
   <script type="text/javascript" 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/base/test/file_websocket_bigBlob");
+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')]));
 }
 
rename from dom/base/test/test_websocket_frame.html
rename to dom/websocket/tests/test_websocket_frame.html
--- a/dom/base/test/test_websocket_frame.html
+++ b/dom/websocket/tests/test_websocket_frame.html
@@ -7,17 +7,17 @@
   <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
   <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
 </head>
 <body>
 <script class="testbody" type="text/javascript">
 
 const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
 
-const URI = "ws://mochi.test:8888/tests/dom/base/test/file_websocket_basic";
+const URI = "ws://mochi.test:8888/tests/dom/websocket/tests/file_websocket_basic";
 
 var frameReceivedCounter = 0;
 var frameSentCounter = 0;
 var webSocketCreatedCounter = 0;
 var webSocketOpenedCounter = 0;
 var webSocketMessageAvailableCounter = 0;
 var webSocketClosedCounter = 0;
 
rename from dom/base/test/test_websocket_hello.html
rename to dom/websocket/tests/test_websocket_hello.html
--- a/dom/base/test/test_websocket_hello.html
+++ b/dom/websocket/tests/test_websocket_hello.html
@@ -13,17 +13,17 @@
 <div id="content" style="display: none">
 </div>
 <pre id="test">
 <script class="testbody" type="text/javascript">
 
 var ws;
 
 function testWebSocket () {
-  ws = new WebSocket("ws://mochi.test:8888/tests/dom/base/test/file_websocket_hello");
+  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) {
   }
   ws.onerror = function(e) {
     ok(false, "onerror called!");
     SimpleTest.finish();
rename from dom/base/test/test_websocket_permessage_deflate.html
rename to dom/websocket/tests/test_websocket_permessage_deflate.html
--- a/dom/base/test/test_websocket_permessage_deflate.html
+++ b/dom/websocket/tests/test_websocket_permessage_deflate.html
@@ -16,23 +16,23 @@
 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
-  [ true, true, "ws://mochi.test:8888/tests/dom/base/test/file_websocket_permessage_deflate" ],
+  [ true, true, "ws://mochi.test:8888/tests/dom/websocket/tests/file_websocket_permessage_deflate" ],
   // disable PMCE
-  [ false, false, "ws://mochi.test:8888/tests/dom/base/test/file_websocket_permessage_deflate_disabled" ],
+  [ false, false, "ws://mochi.test:8888/tests/dom/websocket/tests/file_websocket_permessage_deflate_disabled" ],
   // server rejects offered PMCE
-  [ true, false, "ws://mochi.test:8888/tests/dom/base/test/file_websocket_permessage_deflate_rejected" ],
+  [ true, false, "ws://mochi.test:8888/tests/dom/websocket/tests/file_websocket_permessage_deflate_rejected" ],
   // server returns parameters in the handshake
-  [ true, true, "ws://mochi.test:8888/tests/dom/base/test/file_websocket_permessage_deflate_params" ]
+  [ 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);
rename from dom/workers/test/test_websocket1.html
rename to dom/websocket/tests/test_worker_websocket1.html
rename from dom/workers/test/test_websocket2.html
rename to dom/websocket/tests/test_worker_websocket2.html
rename from dom/workers/test/test_websocket3.html
rename to dom/websocket/tests/test_worker_websocket3.html
rename from dom/workers/test/test_websocket4.html
rename to dom/websocket/tests/test_worker_websocket4.html
rename from dom/workers/test/test_websocket5.html
rename to dom/websocket/tests/test_worker_websocket5.html
rename from dom/workers/test/test_websocket_basic.html
rename to dom/websocket/tests/test_worker_websocket_basic.html
rename from dom/workers/test/test_websocket_https.html
rename to dom/websocket/tests/test_worker_websocket_https.html
--- a/dom/workers/test/test_websocket_https.html
+++ b/dom/websocket/tests/test_worker_websocket_https.html
@@ -20,11 +20,11 @@
   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>
+<iframe src="https://example.com/tests/dom/websocket/tests/websocket_worker_https.html"></iframe>
 </body>
 </html>
rename from dom/workers/test/test_websocket_loadgroup.html
rename to dom/websocket/tests/test_worker_websocket_loadgroup.html
rename from dom/workers/test/webSocket_sharedWorker.js
rename to dom/websocket/tests/webSocket_sharedWorker.js
--- a/dom/workers/test/webSocket_sharedWorker.js
+++ b/dom/websocket/tests/webSocket_sharedWorker.js
@@ -1,10 +1,10 @@
 onconnect = function(evt) {
-  var ws = new WebSocket("ws://mochi.test:8888/tests/dom/base/test/file_websocket_hello");
+  var ws = new WebSocket("ws://mochi.test:8888/tests/dom/websocket/tests/file_websocket_hello");
 
   ws.onopen = function(e) {
     evt.ports[0].postMessage({type: 'status', status: true, msg: 'OnOpen called' });
     ws.send("data");
   }
 
   ws.onclose = function(e) {}
 
rename from dom/workers/test/websocket_basic_worker.js
rename to dom/websocket/tests/websocket_basic_worker.js
--- a/dom/workers/test/websocket_basic_worker.js
+++ b/dom/websocket/tests/websocket_basic_worker.js
@@ -14,17 +14,17 @@ onmessage = function(event) {
     if ((WebSocket instanceof Object)) {
       status = true;
     }
   } catch(e) {
   }
 
   postMessage({type: 'status', status: status, msg: 'WebSocket object:' + WebSocket});
 
-  var ws = new WebSocket("ws://mochi.test:8888/tests/dom/base/test/file_websocket_hello");
+  var ws = new WebSocket("ws://mochi.test:8888/tests/dom/websocket/tests/file_websocket_hello");
   ws.onopen = function(e) {
     postMessage({type: 'status', status: true, msg: 'OnOpen called' });
     ws.send("data");
   }
 
   ws.onclose = function(e) {}
 
   ws.onerror = function(e) {
rename from dom/base/test/websocket_helpers.js
rename to dom/websocket/tests/websocket_helpers.js
rename from dom/workers/test/websocket_https_worker.js
rename to dom/websocket/tests/websocket_https_worker.js
--- a/dom/workers/test/websocket_https_worker.js
+++ b/dom/websocket/tests/websocket_https_worker.js
@@ -1,9 +1,9 @@
 onmessage = function() {
   var wsCreated = true;
   try {
-    new WebSocket("ws://mochi.test:8888/tests/dom/base/test/file_websocket_hello");
+    new WebSocket("ws://mochi.test:8888/tests/dom/websocket/tests/file_websocket_hello");
   } catch(e) {
     wsCreated = false;
   }
   postMessage(wsCreated ? "created" : "not created");
 };
rename from dom/base/test/websocket_hybi/file_binary-frames_wsh.py
rename to dom/websocket/tests/websocket_hybi/file_binary-frames_wsh.py
rename from dom/base/test/websocket_hybi/file_check-binary-messages_wsh.py
rename to dom/websocket/tests/websocket_hybi/file_check-binary-messages_wsh.py
rename from dom/base/test/websocket_hybi/mochitest.ini
rename to dom/websocket/tests/websocket_hybi/mochitest.ini
rename from dom/base/test/websocket_hybi/test_receive-arraybuffer.html
rename to dom/websocket/tests/websocket_hybi/test_receive-arraybuffer.html
--- a/dom/base/test/websocket_hybi/test_receive-arraybuffer.html
+++ b/dom/websocket/tests/websocket_hybi/test_receive-arraybuffer.html
@@ -34,17 +34,17 @@ function createEmptyArrayBuffer()
 function createArrayBufferContainingAllDistinctBytes()
 {
     var array = new Uint8Array(256);
     for (var i = 0; i < 256; ++i)
         array[i] = i;
     return array.buffer;
 }
 
-var ws = new WebSocket("ws://mochi.test:8888/tests/dom/base/test/websocket_hybi/file_binary-frames");
+var ws = new WebSocket("ws://mochi.test:8888/tests/dom/websocket/tests/websocket_hybi/file_binary-frames");
 ws.binaryType = "arraybuffer";
 is(ws.binaryType, "arraybuffer", "should be equal to 'arraybuffer'");
 
 var closeEvent;
 var receivedMessages = [];
 var expectedValues = [createArrayBufferContainingHelloWorld(), createEmptyArrayBuffer(), createArrayBufferContainingAllDistinctBytes()];
 
 ws.onmessage = function(event)
rename from dom/base/test/websocket_hybi/test_receive-blob.html
rename to dom/websocket/tests/websocket_hybi/test_receive-blob.html
--- a/dom/base/test/websocket_hybi/test_receive-blob.html
+++ b/dom/websocket/tests/websocket_hybi/test_receive-blob.html
@@ -34,17 +34,17 @@ function createEmptyArrayBuffer()
 function createArrayBufferContainingAllDistinctBytes()
 {
     var array = new Uint8Array(256);
     for (var i = 0; i < 256; ++i)
         array[i] = i;
     return array.buffer;
 }
 
-var ws = new WebSocket("ws://mochi.test:8888/tests/dom/base/test/websocket_hybi/file_binary-frames");
+var ws = new WebSocket("ws://mochi.test:8888/tests/dom/websocket/tests/websocket_hybi/file_binary-frames");
 is(ws.binaryType, "blob", "should be 'blob'");
 
 var closeEvent;
 var receivedMessages = [];
 var expectedValues = [createArrayBufferContainingHelloWorld(), createEmptyArrayBuffer(), createArrayBufferContainingAllDistinctBytes()];
 
 ws.onmessage = function(event)
 {
rename from dom/base/test/websocket_hybi/test_send-arraybuffer.html
rename to dom/websocket/tests/websocket_hybi/test_send-arraybuffer.html
--- a/dom/base/test/websocket_hybi/test_send-arraybuffer.html
+++ b/dom/websocket/tests/websocket_hybi/test_send-arraybuffer.html
@@ -39,17 +39,17 @@ function createEmptyArrayBuffer()
 function createArrayBufferContainingAllDistinctBytes()
 {
     var array = new Uint8Array(256);
     for (var i = 0; i < 256; ++i)
         array[i] = i;
     return array.buffer;
 }
 
-var ws = new WebSocket("ws://mochi.test:8888/tests/dom/base/test/websocket_hybi/file_check-binary-messages");
+var ws = new WebSocket("ws://mochi.test:8888/tests/dom/websocket/tests/websocket_hybi/file_check-binary-messages");
 var closeEvent;
 
 ws.onopen = function()
 {
     ok(true, "onopen reached");
     ws.send(createArrayBufferContainingHelloWorld());
     ws.send(createEmptyArrayBuffer());
     ws.send(createArrayBufferContainingAllDistinctBytes());
rename from dom/base/test/websocket_hybi/test_send-blob.html
rename to dom/websocket/tests/websocket_hybi/test_send-blob.html
--- a/dom/base/test/websocket_hybi/test_send-blob.html
+++ b/dom/websocket/tests/websocket_hybi/test_send-blob.html
@@ -30,17 +30,17 @@ function distinctBytes()
 
 var filesToCreate = [
   {name: "hellofile", data: "Hello, world!"},
   {name: "emptyfile"},
   {name: "allchars", data: distinctBytes()},
 ];
 
 SpecialPowers.createFiles(filesToCreate, function (files) {
-  var ws = new WebSocket("ws://mochi.test:8888/tests/dom/base/test/websocket_hybi/file_check-binary-messages");
+  var ws = new WebSocket("ws://mochi.test:8888/tests/dom/websocket/tests/websocket_hybi/file_check-binary-messages");
   var closeEvent;
 
   ws.onopen = function()
   {
       ws.send(files[0]);
       ws.send(files[1]);
       ws.send(files[2]);
   };
rename from dom/workers/test/websocket_loadgroup_worker.js
rename to dom/websocket/tests/websocket_loadgroup_worker.js
--- a/dom/workers/test/websocket_loadgroup_worker.js
+++ b/dom/websocket/tests/websocket_loadgroup_worker.js
@@ -4,17 +4,17 @@ onmessage = function(event) {
     worker.onmessage = function(event) {
       postMessage(event.data);
     }
 
     worker.postMessage(event.data - 1);
     return;
   }
 
-  var ws = new WebSocket("ws://mochi.test:8888/tests/dom/base/test/file_websocket_hello");
+  var ws = new WebSocket("ws://mochi.test:8888/tests/dom/websocket/tests/file_websocket_hello");
   ws.onopen = function(e) {
     postMessage('opened');
   }
 
   ws.onclose = function(e) {
     postMessage('closed');
   }
 
rename from dom/base/test/websocket_tests.js
rename to dom/websocket/tests/websocket_tests.js
--- a/dom/base/test/websocket_tests.js
+++ b/dom/websocket/tests/websocket_tests.js
@@ -1,13 +1,13 @@
 // test1: client tries to connect to a http scheme location;
 function test1() {
   return new Promise(function(resolve, reject) {
     try {
-      var ws = CreateTestWS("http://mochi.test:8888/tests/dom/base/test/file_websocket");
+      var ws = CreateTestWS("http://mochi.test:8888/tests/dom/websocket/tests/file_websocket");
       ok(false, "test1 failed");
     } catch (e) {
       ok(true, "test1 failed");
     }
 
     resolve();
   });
 }
@@ -15,18 +15,18 @@ function test1() {
 // test2: assure serialization of the connections;
 // this test expects that the serialization list to connect to the proxy
 // is empty.
 function test2() {
   return new Promise(function(resolve, reject) {
     var waitTest2Part1 = true;
     var waitTest2Part2 = true;
 
-    var ws1 = CreateTestWS("ws://sub2.test2.example.com/tests/dom/base/test/file_websocket", "test-2.1");
-    var ws2 = CreateTestWS("ws://sub2.test2.example.com/tests/dom/base/test/file_websocket", "test-2.2");
+    var ws1 = CreateTestWS("ws://sub2.test2.example.com/tests/dom/websocket/tests/file_websocket", "test-2.1");
+    var ws2 = CreateTestWS("ws://sub2.test2.example.com/tests/dom/websocket/tests/file_websocket", "test-2.2");
 
     var ws2CanConnect = false;
 
     function maybeFinished() {
       if (!waitTest2Part1 && !waitTest2Part2) {
         resolve();
       }
     }
@@ -88,44 +88,44 @@ function test4() {
     resolve();
   });
 }
 
 // test5: client uses an invalid protocol value;
 function test5() {
   return new Promise(function(resolve, reject) {
     try {
-      var ws = CreateTestWS("ws://mochi.test:8888/tests/dom/base/test/file_websocket", "");
+      var ws = CreateTestWS("ws://mochi.test:8888/tests/dom/websocket/tests/file_websocket", "");
       ok(false, "couldn't accept an empty string in the protocol parameter");
     } catch (e) {
       ok(true, "couldn't accept an empty string in the protocol parameter");
     }
 
     try {
-      var ws = CreateTestWS("ws://mochi.test:8888/tests/dom/base/test/file_websocket", "\n");
+      var ws = CreateTestWS("ws://mochi.test:8888/tests/dom/websocket/tests/file_websocket", "\n");
       ok(false, "couldn't accept any not printable ASCII character in the protocol parameter");
     } catch (e) {
       ok(true, "couldn't accept any not printable ASCII character in the protocol parameter");
     }
 
     try {
-      var ws = CreateTestWS("ws://mochi.test:8888/tests/dom/base/test/file_websocket", "test 5");
+      var ws = CreateTestWS("ws://mochi.test:8888/tests/dom/websocket/tests/file_websocket", "test 5");
       ok(false, "U+0020 not acceptable in protocol parameter");
     } catch (e) {
       ok(true, "U+0020 not acceptable in protocol parameter");
     }
 
     resolve();
   });
 }
 
 // test6: counter and encoding check;
 function test6() {
   return new Promise(function(resolve, reject) {
-    var ws = CreateTestWS("ws://mochi.test:8888/tests/dom/base/test/file_websocket", "test-6");
+    var ws = CreateTestWS("ws://mochi.test:8888/tests/dom/websocket/tests/file_websocket", "test-6");
     var counter = 1;
 
     ws.onopen = function() {
       ws.send(counter);
     }
 
     ws.onmessage = function(e) {
       if (counter == 5) {
@@ -143,17 +143,17 @@ function test6() {
       resolve();
     }
   });
 }
 
 // test7: onmessage event origin property check
 function test7() {
   return new Promise(function(resolve, reject) {
-    var ws = CreateTestWS("ws://sub2.test2.example.org/tests/dom/base/test/file_websocket", "test-7");
+    var ws = CreateTestWS("ws://sub2.test2.example.org/tests/dom/websocket/tests/file_websocket", "test-7");
     var gotmsg = false;
 
     ws.onopen = function() {
       ok(true, "test 7 open");
     }
 
     ws.onmessage = function(e) {
       ok(true, "test 7 message");
@@ -169,17 +169,17 @@ function test7() {
     }
   });
 }
 
 // test8: client calls close() and the server sends the close frame (with no
 //        code or reason) in acknowledgement;
 function test8() {
   return new Promise(function(resolve, reject) {
-    var ws = CreateTestWS("ws://mochi.test:8888/tests/dom/base/test/file_websocket", "test-8");
+    var ws = CreateTestWS("ws://mochi.test:8888/tests/dom/websocket/tests/file_websocket", "test-8");
 
     ws.onopen = function() {
       is(ws.protocol, "test-8", "test-8 subprotocol selection");
       ws.close();
     }
 
     ws.onclose = function(e) {
       shouldCloseCleanly(e);
@@ -190,17 +190,17 @@ function test8() {
       resolve();
     }
   });
 }
 
 // test9: client closes the connection before the ws connection is established;
 function test9() {
   return new Promise(function(resolve, reject) {
-    var ws = CreateTestWS("ws://test2.example.org/tests/dom/base/test/file_websocket", "test-9");
+    var ws = CreateTestWS("ws://test2.example.org/tests/dom/websocket/tests/file_websocket", "test-9");
 
     ws._receivedErrorEvent = false;
 
     ws.onopen = shouldNotOpen;
 
     ws.onerror = function(e) {
       ws._receivedErrorEvent = true;
     }
@@ -213,17 +213,17 @@ function test9() {
 
     ws.close();
   });
 }
 
 // test10: client sends a message before the ws connection is established;
 function test10() {
   return new Promise(function(resolve, reject) {
-    var ws = CreateTestWS("ws://sub1.test1.example.com/tests/dom/base/test/file_websocket", "test-10");
+    var ws = CreateTestWS("ws://sub1.test1.example.com/tests/dom/websocket/tests/file_websocket", "test-10");
 
     ws.onclose = function(e) {
       shouldCloseCleanly(e);
       resolve();
     }
 
     try {
       ws.send("client data");
@@ -238,17 +238,17 @@ function test10() {
       ws.close();
     }
   });
 }
 
 // test11: a simple hello echo;
 function test11() {
   return new Promise(function(resolve, reject) {
-    var ws = CreateTestWS("ws://mochi.test:8888/tests/dom/base/test/file_websocket", "test-11");
+    var ws = CreateTestWS("ws://mochi.test:8888/tests/dom/websocket/tests/file_websocket", "test-11");
     is(ws.readyState, 0, "create bad readyState in test-11!");
 
     ws.onopen = function() {
       is(ws.readyState, 1, "open bad readyState in test-11!");
       ws.send("client data");
     }
 
     ws.onmessage = function(e) {
@@ -268,17 +268,17 @@ function test11() {
       resolve();
     }
   });
 }
 
 // test12: client sends a message containing unpaired surrogates
 function test12() {
   return new Promise(function(resolve, reject) {
-    var ws = CreateTestWS("ws://mochi.test:8888/tests/dom/base/test/file_websocket", "test-12");
+    var ws = CreateTestWS("ws://mochi.test:8888/tests/dom/websocket/tests/file_websocket", "test-12");
 
     ws.onopen = function() {
       try {
         // send an unpaired surrogate
         ws._gotMessage = false;
         ws.send("a\ud800b");
         ok(true, "ok to send an unpaired surrogate");
       } catch (e) {
@@ -306,17 +306,17 @@ function test12() {
 
 // test13: server sends an invalid message;
 function test13() {
   return new Promise(function(resolve, reject) {
     // previous versions of this test counted the number of protocol errors
     // returned, but the protocol stack typically closes down after reporting a
     // protocol level error - trying to resync is too dangerous
 
-    var ws = CreateTestWS("ws://mochi.test:8888/tests/dom/base/test/file_websocket", "test-13");
+    var ws = CreateTestWS("ws://mochi.test:8888/tests/dom/websocket/tests/file_websocket", "test-13");
     ws._timesCalledOnError = 0;
 
     ws.onerror = function() {
       ws._timesCalledOnError++;
     }
 
     ws.onclose = function(e) {
       ok(ws._timesCalledOnError > 0, "no error events");
@@ -324,17 +324,17 @@ function test13() {
     }
   });
 }
 
 // test14: server sends the close frame, it doesn't close the tcp connection
 //         and it keeps sending normal ws messages;
 function test14() {
   return new Promise(function(resolve, reject) {
-    var ws = CreateTestWS("ws://mochi.test:8888/tests/dom/base/test/file_websocket", "test-14");
+    var ws = CreateTestWS("ws://mochi.test:8888/tests/dom/websocket/tests/file_websocket", "test-14");
 
     ws.onmessage = function() {
       ok(false, "shouldn't received message after the server sent the close frame");
     }
 
     ws.onclose = function(e) {
       shouldCloseCleanly(e);
       resolve();
@@ -346,32 +346,32 @@ function test14() {
 //         frame;
 function test15() {
   return new Promise(function(resolve, reject) {
     /*
      * DISABLED: see comments for test-15 case in file_websocket_wsh.py
      */
    resolve();
 
-    var ws = CreateTestWS("ws://mochi.test:8888/tests/dom/base/test/file_websocket", "test-15");
+    var ws = CreateTestWS("ws://mochi.test:8888/tests/dom/websocket/tests/file_websocket", "test-15");
     ws.onclose = function(e) {
       shouldCloseNotCleanly(e);
       resolve();
     }
 
     // termination of the connection might cause an error event if it happens in OPEN
     ws.onerror = function() {
     }
   });
 }
 
 // test16: client calls close() and tries to send a message;
 function test16() {
   return new Promise(function(resolve, reject) {
-    var ws = CreateTestWS("ws://mochi.test:8888/tests/dom/base/test/file_websocket", "test-16");
+    var ws = CreateTestWS("ws://mochi.test:8888/tests/dom/websocket/tests/file_websocket", "test-16");
 
     ws.onopen = function() {
       ws.close();
       ok(!ws.send("client data"), "shouldn't send message after calling close()");
     }
 
     ws.onmessage = function() {
       ok(false, "shouldn't send message after calling close()");
@@ -387,17 +387,17 @@ function test16() {
 }
 
 // test17: see bug 572975 - all event listeners set
 function test17() {
   return new Promise(function(resolve, reject) {
     var status_test17 = "not started";
 
     var test17func = function() {
-      var local_ws = new WebSocket("ws://sub1.test2.example.org/tests/dom/base/test/file_websocket", "test-17");
+      var local_ws = new WebSocket("ws://sub1.test2.example.org/tests/dom/websocket/tests/file_websocket", "test-17");
       status_test17 = "started";
 
       local_ws.onopen = function(e) {
         status_test17 = "opened";
         e.target.send("client data");
         forcegc();
       };
 
@@ -430,47 +430,47 @@ function test17() {
 
 // The tests that expects that their websockets neither open nor close MUST
 // be in the end of the tests, i.e. HERE, in order to prevent blocking the other
 // tests.
 
 // test18: client tries to connect to an http resource;
 function test18() {
   return new Promise(function(resolve, reject) {
-    var ws = CreateTestWS("ws://mochi.test:8888/tests/dom/base/test/file_websocket_http_resource.txt");
+    var ws = CreateTestWS("ws://mochi.test:8888/tests/dom/websocket/tests/file_websocket_http_resource.txt");
     ws.onopen = shouldNotOpen;
     ws.onerror = ignoreError;
     ws.onclose = function(e)
     {
       shouldCloseNotCleanly(e);
       resolve();
     }
   });
 }
 
 // test19: server closes the tcp connection before establishing the ws
 //         connection;
 function test19() {
   return new Promise(function(resolve, reject) {
-    var ws = CreateTestWS("ws://mochi.test:8888/tests/dom/base/test/file_websocket", "test-19");
+    var ws = CreateTestWS("ws://mochi.test:8888/tests/dom/websocket/tests/file_websocket", "test-19");
     ws.onopen = shouldNotOpen;
     ws.onerror = ignoreError;
     ws.onclose = function(e)
     {
       shouldCloseNotCleanly(e);
       resolve();
     }
   });
 }
 
 // test20: see bug 572975 - only on error and onclose event listeners set
 function test20() {
   return new Promise(function(resolve, reject) {
     var test20func = function() {
-      var local_ws = new WebSocket("ws://sub1.test1.example.org/tests/dom/base/test/file_websocket", "test-20");
+      var local_ws = new WebSocket("ws://sub1.test1.example.org/tests/dom/websocket/tests/file_websocket", "test-20");
 
       local_ws.onerror = function() {
         ok(false, "onerror called on test " + current_test + "!");
       }
 
       local_ws.onclose = function(e) {
         ok(true, "test 20 closed despite gc");
         resolve();
@@ -486,17 +486,17 @@ function test20() {
   });
 }
 
 // test21: see bug 572975 - same as test 17, but delete strong event listeners
 //         when receiving the message event;
 function test21() {
   return new Promise(function(resolve, reject) {
     var test21func = function() {
-      var local_ws = new WebSocket("ws://mochi.test:8888/tests/dom/base/test/file_websocket", "test-21");
+      var local_ws = new WebSocket("ws://mochi.test:8888/tests/dom/websocket/tests/file_websocket", "test-21");
       var received_message = false;
 
       local_ws.onopen = function(e) {
         e.target.send("client data");
         forcegc();
         e.target.onopen = null;
         forcegc();
       }
@@ -530,17 +530,17 @@ function test21() {
 }
 
 // test22: server takes too long to establish the ws connection;
 function test22() {
   return new Promise(function(resolve, reject) {
     const pref_open = "network.websocket.timeout.open";
     SpecialPowers.setIntPref(pref_open, 5);
 
-    var ws = CreateTestWS("ws://sub2.test2.example.org/tests/dom/base/test/file_websocket", "test-22");
+    var ws = CreateTestWS("ws://sub2.test2.example.org/tests/dom/websocket/tests/file_websocket", "test-22");
 
     ws.onopen = shouldNotOpen;
     ws.onerror = ignoreError;
 
     ws.onclose = function(e) {
       shouldCloseNotCleanly(e);
       resolve();
     }
@@ -555,17 +555,17 @@ function test23() {
     ok("WebSocket" in window, "WebSocket should be available on window object");
     resolve();
   });
 }
 
 // test24: server rejects sub-protocol string
 function test24() {
   return new Promise(function(resolve, reject) {
-    var ws = CreateTestWS("ws://mochi.test:8888/tests/dom/base/test/file_websocket", "test-does-not-exist");
+    var ws = CreateTestWS("ws://mochi.test:8888/tests/dom/websocket/tests/file_websocket", "test-does-not-exist");
 
     ws.onopen = shouldNotOpen;
     ws.onclose = function(e) {
       shouldCloseNotCleanly(e);
       resolve();
     }
 
     ws.onerror = function() {
@@ -573,17 +573,17 @@ function test24() {
   });
 }
 
 // test25: ctor with valid empty sub-protocol array
 function test25() {
   return new Promise(function(resolve, reject) {
     var prots=[];
 
-    var ws = CreateTestWS("ws://mochi.test:8888/tests/dom/base/test/file_websocket", prots);
+    var ws = CreateTestWS("ws://mochi.test:8888/tests/dom/websocket/tests/file_websocket", prots);
 
     // This test errors because the server requires a sub-protocol, but
     // the test just wants to ensure that the ctor doesn't generate an
     // exception
     ws.onerror = ignoreError;
     ws.onopen = shouldNotOpen;
 
     ws.onclose = function(e) {
@@ -595,49 +595,49 @@ function test25() {
 }
 
 // test26: ctor with invalid sub-protocol array containing 1 empty element
 function test26() {
   return new Promise(function(resolve, reject) {
     var prots=[""];
 
     try {
-      var ws = CreateTestWS("ws://mochi.test:8888/tests/dom/base/test/file_websocket", prots);
+      var ws = CreateTestWS("ws://mochi.test:8888/tests/dom/websocket/tests/file_websocket", prots);
       ok(false, "testing empty element sub protocol array");
     } catch (e) {
       ok(true, "testing empty sub element protocol array");
     }
 
     resolve();
   });
 }
 
 // test27: ctor with invalid sub-protocol array containing an empty element in
 //         list
 function test27() {
   return new Promise(function(resolve, reject) {
     var prots=["test27", ""];
 
     try {
-      var ws = CreateTestWS("ws://mochi.test:8888/tests/dom/base/test/file_websocket", prots);
+      var ws = CreateTestWS("ws://mochi.test:8888/tests/dom/websocket/tests/file_websocket", prots);
       ok(false, "testing empty element mixed sub protocol array");
     } catch (e) {
       ok(true, "testing empty element mixed sub protocol array");
     }
 
     resolve();
   });
 }
 
 // test28: ctor using valid 1 element sub-protocol array
 function test28() {
   return new Promise(function(resolve, reject) {
     var prots=["test28"];
 
-    var ws = CreateTestWS("ws://mochi.test:8888/tests/dom/base/test/file_websocket", prots);
+    var ws = CreateTestWS("ws://mochi.test:8888/tests/dom/websocket/tests/file_websocket", prots);
 
     ws.onopen = function(e) {
       ok(true, "test 28 protocol array open");
       ws.close();
     }
 
     ws.onclose = function(e) {
       is(ws.protocol, "test28", "test28 subprotocol selection");
@@ -647,17 +647,17 @@ function test28() {
   });
 }
 
 // test29: ctor using all valid 5 element sub-protocol array
 function test29() {
   return new Promise(function(resolve, reject) {
     var prots=["test29a", "test29b"];
 
-    var ws = CreateTestWS("ws://mochi.test:8888/tests/dom/base/test/file_websocket", prots);
+    var ws = CreateTestWS("ws://mochi.test:8888/tests/dom/websocket/tests/file_websocket", prots);
 
     ws.onopen = function(e) {
       ok(true, "test 29 protocol array open");
       ws.close();
     }
 
     ws.onclose = function(e) {
       ok(true, "test 29 protocol array close");
@@ -666,17 +666,17 @@ function test29() {
   });
 }
 
 // test30: ctor using valid 1 element sub-protocol array with element server
 //         will reject
 function test30() {
   return new Promise(function(resolve, reject) {
     var prots=["test-does-not-exist"];
-    var ws = CreateTestWS("ws://mochi.test:8888/tests/dom/base/test/file_websocket", prots);
+    var ws = CreateTestWS("ws://mochi.test:8888/tests/dom/websocket/tests/file_websocket", prots);
 
     ws.onopen = shouldNotOpen;
 
     ws.onclose = function(e) {
       shouldCloseNotCleanly(e);
       resolve();
     }
 
@@ -685,17 +685,17 @@ function test30() {
   });
 }
 
 // test31: ctor using valid 2 element sub-protocol array with 1 element server
 //         will reject and one server will accept
 function test31() {
   return new Promise(function(resolve, reject) {
     var prots=["test-does-not-exist", "test31"];
-    var ws = CreateTestWS("ws://mochi.test:8888/tests/dom/base/test/file_websocket", prots);
+    var ws = CreateTestWS("ws://mochi.test:8888/tests/dom/websocket/tests/file_websocket", prots);
 
     ws.onopen = function(e) {
       ok(true, "test 31 protocol array open");
       ws.close();
     }
 
     ws.onclose = function(e) {
       is(ws.protocol, "test31", "test31 subprotocol selection");
@@ -706,32 +706,32 @@ function test31() {
 }
 
 // test32: ctor using invalid sub-protocol array that contains duplicate items
 function test32() {
   return new Promise(function(resolve, reject) {
     var prots=["test32","test32"];
 
     try {
-      var ws = CreateTestWS("ws://mochi.test:8888/tests/dom/base/test/file_websocket", prots);
+      var ws = CreateTestWS("ws://mochi.test:8888/tests/dom/websocket/tests/file_websocket", prots);
       ok(false, "testing duplicated element sub protocol array");
     } catch (e) {
       ok(true, "testing duplicated sub element protocol array");
     }
 
     resolve();
   });
 }
 
 // test33: test for sending/receiving custom close code (but no close reason)
 function test33() {
   return new Promise(function(resolve, reject) {
     var prots=["test33"];
 
-    var ws = CreateTestWS("ws://mochi.test:8888/tests/dom/base/test/file_websocket", prots);
+    var ws = CreateTestWS("ws://mochi.test:8888/tests/dom/websocket/tests/file_websocket", prots);
 
     ws.onopen = function(e) {
       ok(true, "test 33 open");
       ws.close(3131);   // pass code but not reason
     }
 
     ws.onclose = function(e) {
       ok(true, "test 33 close");
@@ -743,17 +743,17 @@ function test33() {
   });
 }
 
 // test34: test for receiving custom close code and reason
 function test34() {
   return new Promise(function(resolve, reject) {
     var prots=["test-34"];
 
-    var ws = CreateTestWS("ws://mochi.test:8888/tests/dom/base/test/file_websocket", prots);
+    var ws = CreateTestWS("ws://mochi.test:8888/tests/dom/websocket/tests/file_websocket", prots);
 
     ws.onopen = function(e) {
       ok(true, "test 34 open");
       ws.close();
     }
 
     ws.onclose = function(e)
     {
@@ -764,27 +764,27 @@ function test34() {
       resolve();
     }
   });
 }
 
 // test35: test for sending custom close code and reason
 function test35() {
   return new Promise(function(resolve, reject) {
-    var ws = CreateTestWS("ws://mochi.test:8888/tests/dom/base/test/file_websocket", "test-35a");
+    var ws = CreateTestWS("ws://mochi.test:8888/tests/dom/websocket/tests/file_websocket", "test-35a");
 
     ws.onopen = function(e) {
       ok(true, "test 35a open");
       ws.close(3500, "my code");
     }
 
     ws.onclose = function(e) {
       ok(true, "test 35a close");
       ok(e.wasClean, "test 35a closed cleanly");
-      var wsb = CreateTestWS("ws://mochi.test:8888/tests/dom/base/test/file_websocket", "test-35b");
+      var wsb = CreateTestWS("ws://mochi.test:8888/tests/dom/websocket/tests/file_websocket", "test-35b");
 
       wsb.onopen = function(e) {
         ok(true, "test 35b open");
         wsb.close();
       }
 
       wsb.onclose = function(e) {
         ok(true, "test 35b close");
@@ -797,17 +797,17 @@ function test35() {
   });
 }
 
 // test36: negative test for sending out of range close code
 function test36() {
   return new Promise(function(resolve, reject) {
     var prots=["test-36"];
 
-    var ws = CreateTestWS("ws://mochi.test:8888/tests/dom/base/test/file_websocket", prots);
+    var ws = CreateTestWS("ws://mochi.test:8888/tests/dom/websocket/tests/file_websocket", prots);
 
     ws.onopen = function(e) {
       ok(true, "test 36 open");
 
       try {
         ws.close(13200);
         ok(false, "testing custom close code out of range");
        } catch (e) {
@@ -824,17 +824,17 @@ function test36() {
   });
 }
 
 // test37: negative test for too long of a close reason
 function test37() {
   return new Promise(function(resolve, reject) {
     var prots=["test-37"];
 
-    var ws = CreateTestWS("ws://mochi.test:8888/tests/dom/base/test/file_websocket", prots);
+    var ws = CreateTestWS("ws://mochi.test:8888/tests/dom/websocket/tests/file_websocket", prots);
 
     ws.onopen = function(e) {
       ok(true, "test 37 open");
 
       try {
 	ws.close(3100,"0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123");
         ok(false, "testing custom close reason out of range");
        } catch (e) {
@@ -842,17 +842,17 @@ function test37() {
          ws.close(3100,"012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012");
        }
     }
 
     ws.onclose = function(e) {
       ok(true, "test 37 close");
       ok(e.wasClean, "test 37 closed cleanly");
 
-      var wsb = CreateTestWS("ws://mochi.test:8888/tests/dom/base/test/file_websocket", "test-37b");
+      var wsb = CreateTestWS("ws://mochi.test:8888/tests/dom/websocket/tests/file_websocket", "test-37b");
 
       wsb.onopen = function(e) {
         // now test that a rejected close code and reason dont persist
         ok(true, "test 37b open");
         try {
           wsb.close(3101,"0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123");
           ok(false, "testing custom close reason out of range 37b");
         } catch (e) {
@@ -860,17 +860,17 @@ function test37() {
           wsb.close();
         }
       }
 
       wsb.onclose = function(e) {
         ok(true, "test 37b close");
         ok(e.wasClean, "test 37b closed cleanly");
 
-        var wsc = CreateTestWS("ws://mochi.test:8888/tests/dom/base/test/file_websocket", "test-37c");
+        var wsc = CreateTestWS("ws://mochi.test:8888/tests/dom/websocket/tests/file_websocket", "test-37c");
 
         wsc.onopen = function(e) {
           ok(true, "test 37c open");
           wsc.close();
         }
 
         wsc.onclose = function(e) {
           isnot(e.code, 3101, "test 37c custom server code not present");
@@ -882,17 +882,17 @@ function test37() {
   });
 }
 
 // test38: ensure extensions attribute is defined
 function test38() {
   return new Promise(function(resolve, reject) {
     var prots=["test-38"];
 
-    var ws = CreateTestWS("ws://mochi.test:8888/tests/dom/base/test/file_websocket", prots);
+    var ws = CreateTestWS("ws://mochi.test:8888/tests/dom/websocket/tests/file_websocket", prots);
 
     ws.onopen = function(e) {
       ok(true, "test 38 open");
       isnot(ws.extensions, undefined, "extensions attribute defined");
       //  is(ws.extensions, "deflate-stream", "extensions attribute deflate-stream");
       ws.close();
     }
 
@@ -903,17 +903,17 @@ function test38() {
   });
 }
 
 // test39: a basic wss:// connectivity test
 function test39() {
   return new Promise(function(resolve, reject) {
     var prots=["test-39"];
 
-    var ws = CreateTestWS("wss://example.com/tests/dom/base/test/file_websocket", prots);
+    var ws = CreateTestWS("wss://example.com/tests/dom/websocket/tests/file_websocket", prots);
     status_test39 = "started";
 
     ws.onopen = function(e) {
       status_test39 = "opened";
       ok(true, "test 39 open");
       ws.close();
     }
 
@@ -925,17 +925,17 @@ function test39() {
   });
 }
 
 // test40: negative test for wss:// with no cert
 function test40() {
   return new Promise(function(resolve, reject) {
     var prots=["test-40"];
 
-    var ws = CreateTestWS("wss://nocert.example.com/tests/dom/base/test/file_websocket", prots);
+    var ws = CreateTestWS("wss://nocert.example.com/tests/dom/websocket/tests/file_websocket", prots);
 
     status_test40 = "started";
     ws.onerror = ignoreError;
 
     ws.onopen = function(e) {
       status_test40 = "opened";
       ok(false, "test 40 open");
       ws.close();
@@ -947,45 +947,45 @@ function test40() {
       resolve();
     }
   });
 }
 
 // test41: HSTS
 function test41() {
   return new Promise(function(resolve, reject) {
-    var ws = CreateTestWS("ws://example.com/tests/dom/base/test/file_websocket", "test-41a", 1);
+    var ws = CreateTestWS("ws://example.com/tests/dom/websocket/tests/file_websocket", "test-41a", 1);
 
     ws.onopen = function(e) {
       ok(true, "test 41a open");
-      is(ws.url, "ws://example.com/tests/dom/base/test/file_websocket",
+      is(ws.url, "ws://example.com/tests/dom/websocket/tests/file_websocket",
          "test 41a initial ws should not be redirected");
       ws.close();
     }
 
     ws.onclose = function(e) {
       ok(true, "test 41a close");
 
       // establish a hsts policy for example.com
-      var wsb = CreateTestWS("wss://example.com/tests/dom/base/test/file_websocket", "test-41b", 1);
+      var wsb = CreateTestWS("wss://example.com/tests/dom/websocket/tests/file_websocket", "test-41b", 1);
 
       wsb.onopen = function(e) {
         ok(true, "test 41b open");
         wsb.close();
       }
 
       wsb.onclose = function(e) {
         ok(true, "test 41b close");
 
         // try ws:// again, it should be done over wss:// now due to hsts
-        var wsc = CreateTestWS("ws://example.com/tests/dom/base/test/file_websocket", "test-41c");
+        var wsc = CreateTestWS("ws://example.com/tests/dom/websocket/tests/file_websocket", "test-41c");
 
         wsc.onopen = function(e) {
           ok(true, "test 41c open");
-          is(wsc.url, "wss://example.com/tests/dom/base/test/file_websocket",
+          is(wsc.url, "wss://example.com/tests/dom/websocket/tests/file_websocket",
              "test 41c ws should be redirected by hsts to wss");
           wsc.close();
         }
 
         wsc.onclose = function(e) {
           ok(true, "test 41c close");
 
           // clean up the STS state
@@ -1005,17 +1005,17 @@ function test41() {
   });
 }
 
 // test42: non-char utf-8 sequences
 function test42() {
   return new Promise(function(resolve, reject) {
     // test some utf-8 non-characters. They should be allowed in the
     // websockets context. Test via round trip echo.
-    var ws = CreateTestWS("ws://mochi.test:8888/tests/dom/base/test/file_websocket", "test-42");
+    var ws = CreateTestWS("ws://mochi.test:8888/tests/dom/websocket/tests/file_websocket", "test-42");
     var data = ["U+FFFE \ufffe",
 		"U+FFFF \uffff",
 		"U+10FFFF \udbff\udfff"];
     var index = 0;
 
     ws.onopen = function() {
       ws.send(data[0]);
       ws.send(data[1]);
@@ -1036,17 +1036,17 @@ function test42() {
   });
 }
 
 // test43: Test setting binaryType attribute
 function test43() {
   return new Promise(function(resolve, reject) {
     var prots=["test-43"];
 
-    var ws = CreateTestWS("ws://mochi.test:8888/tests/dom/base/test/file_websocket", prots);
+    var ws = CreateTestWS("ws://mochi.test:8888/tests/dom/websocket/tests/file_websocket", prots);
 
     ws.onopen = function(e) {
       ok(true, "test 43 open");
       // Test binaryType setting
       ws.binaryType = "arraybuffer";
       ws.binaryType = "blob";
       ws.binaryType = "";  // illegal
       is(ws.binaryType, "blob");
@@ -1064,17 +1064,17 @@ function test43() {
       resolve();
     }
   });
 }
 
 // test44: Test sending/receving binary ArrayBuffer
 function test44() {
   return new Promise(function(resolve, reject) {
-    var ws = CreateTestWS("ws://mochi.test:8888/tests/dom/base/test/file_websocket", "test-44");
+    var ws = CreateTestWS("ws://mochi.test:8888/tests/dom/websocket/tests/file_websocket", "test-44");
     is(ws.readyState, 0, "bad readyState in test-44!");
     ws.binaryType = "arraybuffer";
 
     ws.onopen = function() {
       is(ws.readyState, 1, "open bad readyState in test-44!");
       var buf = new ArrayBuffer(3);
       // create byte view
       var view = new Uint8Array(buf);
@@ -1098,17 +1098,17 @@ function test44() {
     }
   });
 }
 
 // test45: Test sending/receving binary Blob
 function test45() {
   return new Promise(function(resolve, reject) {
     function test45Real(blobFile) {
-      var ws = CreateTestWS("ws://mochi.test:8888/tests/dom/base/test/file_websocket", "test-45");
+      var ws = CreateTestWS("ws://mochi.test:8888/tests/dom/websocket/tests/file_websocket", "test-45");
       is(ws.readyState, 0, "bad readyState in test-45!");
       // ws.binaryType = "blob";  // Don't need to specify: blob is the default
 
       ws.onopen = function() {
         is(ws.readyState, 1, "open bad readyState in test-45!");
         ws.send(blobFile);
       }
 
@@ -1153,17 +1153,17 @@ function test45() {
       resolve();
     });
   });
 }
 
 // test46: Test that we don't dispatch incoming msgs once in CLOSING state
 function test46() {
   return new Promise(function(resolve, reject) {
-    var ws = CreateTestWS("ws://mochi.test:8888/tests/dom/base/test/file_websocket", "test-46");
+    var ws = CreateTestWS("ws://mochi.test:8888/tests/dom/websocket/tests/file_websocket", "test-46");
     is(ws.readyState, 0, "create bad readyState in test-46!");
 
     ws.onopen = function() {
       is(ws.readyState, 1, "open bad readyState in test-46!");
       ws.close()
       is(ws.readyState, 2, "close must set readyState to 2 in test-46!");
     }
 
@@ -1216,17 +1216,17 @@ function test47() {
 
 // test48: see bug 1227136 - client calls close() from onopen() and waits until
 // WebSocketChannel::mSocketIn is nulled out on socket thread.
 function test48() {
   return new Promise(function(resolve, reject) {
     const pref_close = "network.websocket.timeout.close";
     SpecialPowers.setIntPref(pref_close, 1);
 
-    var ws = CreateTestWS("ws://mochi.test:8888/tests/dom/base/test/file_websocket", "test-48");
+    var ws = CreateTestWS("ws://mochi.test:8888/tests/dom/websocket/tests/file_websocket", "test-48");
 
     ws.onopen = function() {
       ws.close();
 
       var date = new Date();
       var curDate = null;
       do {
         curDate = new Date();
@@ -1241,17 +1241,17 @@ function test48() {
 
     SpecialPowers.clearUserPref(pref_close);
   });
 }
 
 function test49()
 {
   return new Promise(function(resolve, reject) {
-    var ws = CreateTestWS("ws://mochi.test:8888/tests/dom/base/test/file_websocket", "test-49");
+    var ws = CreateTestWS("ws://mochi.test:8888/tests/dom/websocket/tests/file_websocket", "test-49");
     var gotError = 0;
     ok(ws.readyState == 0, "create bad readyState in test-49!");
 
     ws.onopen = function()
     {
       ok(false, "Connection must fail in test-49")
     }
 
rename from dom/workers/test/websocket_worker1.js
rename to dom/websocket/tests/websocket_worker1.js
--- a/dom/workers/test/websocket_worker1.js
+++ b/dom/websocket/tests/websocket_worker1.js
@@ -1,11 +1,11 @@
-importScripts('../../../dom/base/test/websocket_helpers.js');
-importScripts('../../../dom/base/test/websocket_tests.js');
 importScripts('websocket_helpers.js');
+importScripts('websocket_tests.js');
+importScripts('websocket_worker_helpers.js');
 
 var tests = [
   test1,  // client tries to connect to a http scheme location;
   test2,  // assure serialization of the connections;
   test3,  // client tries to connect to an non-existent ws server;
   test4,  // client tries to connect using a relative url;
   test5,  // client uses an invalid protocol value;
   test6,  // counter and encoding check;
rename from dom/workers/test/websocket_worker2.js
rename to dom/websocket/tests/websocket_worker2.js
--- a/dom/workers/test/websocket_worker2.js
+++ b/dom/websocket/tests/websocket_worker2.js
@@ -1,11 +1,11 @@
-importScripts('../../../dom/base/test/websocket_helpers.js');
-importScripts('../../../dom/base/test/websocket_tests.js');
 importScripts('websocket_helpers.js');
+importScripts('websocket_tests.js');
+importScripts('websocket_worker_helpers.js');
 
 var tests = [
   test11, // a simple hello echo;
   test12, // client sends a message containing unpaired surrogates
   test13, //server sends an invalid message;
   test14, // server sends the close frame, it doesn't close the tcp connection
           // and it keeps sending normal ws messages;
   test15, // server closes the tcp connection, but it doesn't send the close
rename from dom/workers/test/websocket_worker3.js
rename to dom/websocket/tests/websocket_worker3.js
--- a/dom/workers/test/websocket_worker3.js
+++ b/dom/websocket/tests/websocket_worker3.js
@@ -1,11 +1,11 @@
-importScripts('../../../dom/base/test/websocket_helpers.js');
-importScripts('../../../dom/base/test/websocket_tests.js');
 importScripts('websocket_helpers.js');
+importScripts('websocket_tests.js');
+importScripts('websocket_worker_helpers.js');
 
 var tests = [
  test24, // server rejects sub-protocol string
  test25, // ctor with valid empty sub-protocol array
  test26, // ctor with invalid sub-protocol array containing 1 empty element
  test27, // ctor with invalid sub-protocol array containing an empty element in
          // list
  test28, // ctor using valid 1 element sub-protocol array
rename from dom/workers/test/websocket_worker4.js
rename to dom/websocket/tests/websocket_worker4.js
--- a/dom/workers/test/websocket_worker4.js
+++ b/dom/websocket/tests/websocket_worker4.js
@@ -1,11 +1,11 @@
-importScripts('../../../dom/base/test/websocket_helpers.js');
-importScripts('../../../dom/base/test/websocket_tests.js');
 importScripts('websocket_helpers.js');
+importScripts('websocket_tests.js');
+importScripts('websocket_worker_helpers.js');
 
 var tests = [
   test31, // ctor using valid 2 element sub-protocol array with 1 element server
           // will reject and one server will accept
   test32, // ctor using invalid sub-protocol array that contains duplicate items
   test33, // test for sending/receiving custom close code (but no close reason)
   test34, // test for receiving custom close code and reason
   test35, // test for sending custom close code and reason
rename from dom/workers/test/websocket_worker5.js
rename to dom/websocket/tests/websocket_worker5.js
--- a/dom/workers/test/websocket_worker5.js
+++ b/dom/websocket/tests/websocket_worker5.js
@@ -1,11 +1,11 @@
-importScripts('../../../dom/base/test/websocket_helpers.js');
-importScripts('../../../dom/base/test/websocket_tests.js');
 importScripts('websocket_helpers.js');
+importScripts('websocket_tests.js');
+importScripts('websocket_worker_helpers.js');
 
 var tests = [
   test42, // non-char utf-8 sequences
   test43, // Test setting binaryType attribute
   test44, // Test sending/receving binary ArrayBuffer
   test46, // Test that we don't dispatch incoming msgs once in CLOSING state
   test47, // Make sure onerror/onclose aren't called during close()
   test49, // Test that we fail if subprotocol returned from server doesn't match 
new file mode 100644
--- /dev/null
+++ b/dom/websocket/tests/websocket_worker_helpers.js
@@ -0,0 +1,19 @@
+function feedback() {
+  postMessage({type: 'feedback', msg: "executing test: " + (current_test+1) + " of " + tests.length + " tests." });
+}
+
+function ok(status, msg) {
+  postMessage({type: 'status', status: !!status, msg: msg});
+}
+
+function is(a, b, msg) {
+  ok(a === b, msg);
+}
+
+function isnot(a, b, msg) {
+  ok(a != b, msg);
+}
+
+function finish() {
+  postMessage({type: 'finish'});
+}
rename from dom/workers/test/websocket_https.html
rename to dom/websocket/tests/websocket_worker_https.html
--- a/dom/workers/test/websocket_https.html
+++ b/dom/websocket/tests/websocket_worker_https.html
@@ -1,11 +1,11 @@
 <!DOCTYPE html>
 <script>
-  var worker = new Worker("https://example.com/tests/dom/workers/test/websocket_https_worker.js");
+  var worker = new Worker("https://example.com/tests/dom/websocket/tests/websocket_https_worker.js");
 
   worker.onmessage = function(event) {
     parent.postMessage(event.data, "*");
   };
 
   worker.onerror = function(event) {
     parent.postMessage("error", "*");
   };
rename from dom/base/test/window_bug1384658.html
rename to dom/websocket/tests/window_bug1384658.html
--- a/dom/base/test/window_bug1384658.html
+++ b/dom/websocket/tests/window_bug1384658.html
@@ -1,17 +1,17 @@
 <!DOCTYPE html>
 <html>
 <head>
 <script>
   onload = function() {
     if (window.location.search == "") {
       window.open("window_bug1384658.html?opened", "_top", "");
     } else {
-      var iframeURL = "http://mochi.test:8888/tests/dom/base/test/file_bug1384658.html";
+      var iframeURL = "http://mochi.test:8888/tests/dom/websocket/tests/file_bug1384658.html";
       var iframe = document.createElement("iframe");
       iframe.src = iframeURL;
       document.body.appendChild(iframe);
     }
   };
 </script>
 </head>
 <body>
--- a/dom/workers/test/mochitest.ini
+++ b/dom/workers/test/mochitest.ini
@@ -66,61 +66,40 @@ support-files =
   threadErrors_worker1.js
   threadErrors_worker2.js
   threadErrors_worker3.js
   threadErrors_worker4.js
   threadTimeouts_worker.js
   throwingOnerror_worker.js
   timeoutTracing_worker.js
   transferable_worker.js
-  websocket_basic_worker.js
-  websocket_loadgroup_worker.js
-  websocket_worker1.js
-  websocket_worker2.js
-  websocket_worker3.js
-  websocket_worker4.js
-  websocket_worker5.js
-  websocket_helpers.js
   workersDisabled_worker.js
   test_worker_interfaces.js
   worker_driver.js
   worker_wrapper.js
   bug1060621_worker.js
   bug1062920_worker.js
-  webSocket_sharedWorker.js
   bug1104064_worker.js
   worker_consoleAndBlobs.js
   bug1132395_sharedWorker.js
   bug1132924_worker.js
   empty.html
   referrer.sjs
   referrer_test_server.sjs
   sharedWorker_ports.js
   sharedWorker_lifetime.js
   worker_referrer.js
-  websocket_https.html
-  websocket_https_worker.js
   importScripts_3rdParty_worker.js
   worker_bug1278777.js
   worker_setTimeoutWith0.js
   worker_bug1301094.js
   script_createFile.js
   worker_suspended.js
   window_suspended.html
   !/dom/base/test/file_bug945152.jar
-  !/dom/base/test/file_websocket_basic_wsh.py
-  !/dom/base/test/file_websocket_hello_wsh.py
-  !/dom/base/test/file_websocket_http_resource.txt
-  !/dom/base/test/file_websocket_permessage_deflate_disabled_wsh.py
-  !/dom/base/test/file_websocket_permessage_deflate_params_wsh.py
-  !/dom/base/test/file_websocket_permessage_deflate_rejected_wsh.py
-  !/dom/base/test/file_websocket_permessage_deflate_wsh.py
-  !/dom/base/test/file_websocket_wsh.py
-  !/dom/base/test/websocket_helpers.js
-  !/dom/base/test/websocket_tests.js
   !/dom/tests/mochitest/notification/MockServices.js
   !/dom/tests/mochitest/notification/NotificationTest.js
   !/dom/xhr/tests/relativeLoad_import.js
   !/dom/xhr/tests/relativeLoad_worker.js
   !/dom/xhr/tests/relativeLoad_worker2.js
   !/dom/xhr/tests/subdir/relativeLoad_sub_worker.js
   !/dom/xhr/tests/subdir/relativeLoad_sub_worker2.js
   !/dom/xhr/tests/subdir/relativeLoad_sub_import.js
@@ -196,33 +175,16 @@ support-files =
 [test_simpleThread.html]
 [test_suspend.html]
 [test_terminate.html]
 [test_threadErrors.html]
 [test_threadTimeouts.html]
 [test_throwingOnerror.html]
 [test_timeoutTracing.html]
 [test_transferable.html]
-[test_websocket1.html]
-skip-if = toolkit == 'android' #bug 982828
-[test_websocket2.html]
-skip-if = toolkit == 'android' #bug 982828
-[test_websocket3.html]
-skip-if = toolkit == 'android' #bug 982828
-[test_websocket4.html]
-skip-if = toolkit == 'android' #bug 982828
-[test_websocket5.html]
-skip-if = toolkit == 'android' #bug 982828
-[test_websocket_basic.html]
-skip-if = toolkit == 'android' #bug 982828
-[test_websocket_https.html]
-[test_websocket_loadgroup.html]
-skip-if = toolkit == 'android' #bug 982828
-[test_webSocket_sharedWorker.html]
-skip-if = toolkit == 'android' #bug 982828
 [test_worker_interfaces.html]
 [test_worker_interfaces_secureContext.html]
 scheme=https
 [test_workersDisabled.html]
 [test_referrer.html]
 [test_referrer_header_worker.html]
 [test_importScripts_3rdparty.html]
 [test_sharedWorker_ports.html]
deleted file mode 100644
--- a/dom/workers/test/websocket_helpers.js
+++ /dev/null
@@ -1,19 +0,0 @@
-function feedback() {
-  postMessage({type: 'feedback', msg: "executing test: " + (current_test+1) + " of " + tests.length + " tests." });
-}
-
-function ok(status, msg) {
-  postMessage({type: 'status', status: !!status, msg: msg});
-}
-
-function is(a, b, msg) {
-  ok(a === b, msg);
-}
-
-function isnot(a, b, msg) {
-  ok(a != b, msg);
-}
-
-function finish() {
-  postMessage({type: 'finish'});
-}