Bug 1269162 - part 3 - Move XHR code into dom/xhr, r=smaug
authorAndrea Marchesini <amarchesini@mozilla.com>
Mon, 27 Jun 2016 19:13:40 +0200
changeset 302716 55a63a62c0dd798ba7ea9c5ab08d49a48588a0d4
parent 302715 c01653e7ad7c25b718e9245e6495ef8c1d8822dc
child 302717 e03db893b8da2247b1a5ed9aafc968ff2d874c90
push id78843
push useramarchesini@mozilla.com
push dateMon, 27 Jun 2016 17:15:05 +0000
treeherdermozilla-inbound@9f1e2864e569 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1269162
milestone50.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1269162 - part 3 - Move XHR code into dom/xhr, r=smaug
b2g/installer/package-manifest.in
browser/installer/package-manifest.in
dom/base/moz.build
dom/base/nsIXMLHttpRequest.idl
dom/base/nsXMLHttpRequest.cpp
dom/base/nsXMLHttpRequest.h
dom/base/test/echo.sjs
dom/base/test/file_XHRDocURI.html
dom/base/test/file_XHRDocURI.html^headers^
dom/base/test/file_XHRDocURI.sjs
dom/base/test/file_XHRDocURI.text
dom/base/test/file_XHRDocURI.text^headers^
dom/base/test/file_XHRDocURI.xml
dom/base/test/file_XHRDocURI.xml^headers^
dom/base/test/file_XHRResponseURL.js
dom/base/test/file_XHRResponseURL.sjs
dom/base/test/file_XHRResponseURL.text
dom/base/test/file_XHRResponseURL.text^headers^
dom/base/test/file_XHRResponseURL_nocors.text
dom/base/test/file_XHRSendData.sjs
dom/base/test/file_XHRSendData_doc.xml
dom/base/test/file_XHRSendData_doc.xml^headers^
dom/base/test/file_XHR_anon.sjs
dom/base/test/file_XHR_binary1.bin
dom/base/test/file_XHR_binary1.bin^headers^
dom/base/test/file_XHR_binary2.bin
dom/base/test/file_XHR_fail1.txt
dom/base/test/file_XHR_fail1.txt^headers^
dom/base/test/file_XHR_fail1b.txt
dom/base/test/file_XHR_header.sjs
dom/base/test/file_XHR_pass1.xml
dom/base/test/file_XHR_pass2.txt
dom/base/test/file_XHR_pass3.txt
dom/base/test/file_XHR_pass3.txt^headers^
dom/base/test/file_XHR_system_redirect.html
dom/base/test/file_XHR_system_redirect.html^headers^
dom/base/test/file_XHR_timeout.sjs
dom/base/test/file_html_in_xhr.html
dom/base/test/file_html_in_xhr.sjs
dom/base/test/file_html_in_xhr2.html
dom/base/test/file_html_in_xhr3.html
dom/base/test/fileutils.js
dom/base/test/mochitest.ini
dom/base/test/progressserver.sjs
dom/base/test/responseIdentical.sjs
dom/base/test/test_XHR.html
dom/base/test/test_XHRDocURI.html
dom/base/test/test_XHRResponseURL.html
dom/base/test/test_XHRSendData.html
dom/base/test/test_XHR_anon.html
dom/base/test/test_XHR_header.html
dom/base/test/test_XHR_onuploadprogress.html
dom/base/test/test_XHR_parameters.html
dom/base/test/test_XHR_system.html
dom/base/test/test_XHR_timeout.html
dom/base/test/test_XHR_timeout.js
dom/base/test/test_html_in_xhr.html
dom/base/test/test_sync_xhr_timer.xhtml
dom/base/test/test_xhr_abort_after_load.html
dom/base/test/test_xhr_forbidden_headers.html
dom/base/test/test_xhr_overridemimetype_throws_on_invalid_state.html
dom/base/test/test_xhr_progressevents.html
dom/base/test/test_xhr_send.html
dom/base/test/test_xhr_send_readystate.html
dom/base/test/test_xhr_withCredentials.html
dom/moz.build
dom/tests/mochitest/fetch/mochitest.ini
dom/tests/mochitest/fetch/test_fetch_basic_http.js
dom/workers/WorkerRunnable.cpp
dom/workers/WorkerRunnable.h
dom/workers/XMLHttpRequestUploadWorker.cpp
dom/workers/XMLHttpRequestUploadWorker.h
dom/workers/XMLHttpRequestWorker.cpp
dom/workers/XMLHttpRequestWorker.h
dom/workers/moz.build
dom/workers/test/file_getcookie.sjs
dom/workers/test/mochitest.ini
dom/workers/test/promise_worker.js
dom/workers/test/relativeLoad_import.js
dom/workers/test/relativeLoad_worker.js
dom/workers/test/relativeLoad_worker2.js
dom/workers/test/subdir/relativeLoad_sub_import.js
dom/workers/test/subdir/relativeLoad_sub_worker.js
dom/workers/test/subdir/relativeLoad_sub_worker2.js
dom/workers/test/terminateSyncXHR_frame.html
dom/workers/test/terminateSyncXHR_worker.js
dom/workers/test/testXHR.txt
dom/workers/test/test_relativeLoad.html
dom/workers/test/test_terminateSyncXHR.html
dom/workers/test/test_xhr.html
dom/workers/test/test_xhr2.html
dom/workers/test/test_xhrAbort.html
dom/workers/test/test_xhr_3rdparty.html
dom/workers/test/test_xhr_cors_redirect.html
dom/workers/test/test_xhr_headers.html
dom/workers/test/test_xhr_implicit_cancel.html
dom/workers/test/test_xhr_parameters.html
dom/workers/test/test_xhr_parameters.js
dom/workers/test/test_xhr_responseURL.html
dom/workers/test/test_xhr_system.html
dom/workers/test/test_xhr_system.js
dom/workers/test/test_xhr_timeout.html
dom/workers/test/xhr2_worker.js
dom/workers/test/xhrAbort_worker.js
dom/workers/test/xhr_cors_redirect.js
dom/workers/test/xhr_cors_redirect.sjs
dom/workers/test/xhr_headers_server.sjs
dom/workers/test/xhr_headers_worker.js
dom/workers/test/xhr_implicit_cancel_worker.js
dom/workers/test/xhr_worker.js
dom/xhr/XMLHttpRequestUploadWorker.cpp
dom/xhr/XMLHttpRequestUploadWorker.h
dom/xhr/XMLHttpRequestWorker.cpp
dom/xhr/XMLHttpRequestWorker.h
dom/xhr/moz.build
dom/xhr/nsIXMLHttpRequest.idl
dom/xhr/nsXMLHttpRequest.cpp
dom/xhr/nsXMLHttpRequest.h
dom/xhr/tests/echo.sjs
dom/xhr/tests/file_XHRDocURI.html
dom/xhr/tests/file_XHRDocURI.html^headers^
dom/xhr/tests/file_XHRDocURI.sjs
dom/xhr/tests/file_XHRDocURI.text
dom/xhr/tests/file_XHRDocURI.text^headers^
dom/xhr/tests/file_XHRDocURI.xml
dom/xhr/tests/file_XHRDocURI.xml^headers^
dom/xhr/tests/file_XHRResponseURL.js
dom/xhr/tests/file_XHRResponseURL.sjs
dom/xhr/tests/file_XHRResponseURL.text
dom/xhr/tests/file_XHRResponseURL.text^headers^
dom/xhr/tests/file_XHRResponseURL_nocors.text
dom/xhr/tests/file_XHRSendData.sjs
dom/xhr/tests/file_XHRSendData_doc.xml
dom/xhr/tests/file_XHRSendData_doc.xml^headers^
dom/xhr/tests/file_XHR_anon.sjs
dom/xhr/tests/file_XHR_binary1.bin
dom/xhr/tests/file_XHR_binary1.bin^headers^
dom/xhr/tests/file_XHR_binary2.bin
dom/xhr/tests/file_XHR_fail1.txt
dom/xhr/tests/file_XHR_fail1.txt^headers^
dom/xhr/tests/file_XHR_fail1b.txt
dom/xhr/tests/file_XHR_header.sjs
dom/xhr/tests/file_XHR_pass1.xml
dom/xhr/tests/file_XHR_pass2.txt
dom/xhr/tests/file_XHR_pass3.txt
dom/xhr/tests/file_XHR_pass3.txt^headers^
dom/xhr/tests/file_XHR_system_redirect.html
dom/xhr/tests/file_XHR_system_redirect.html^headers^
dom/xhr/tests/file_XHR_timeout.sjs
dom/xhr/tests/file_html_in_xhr.html
dom/xhr/tests/file_html_in_xhr.sjs
dom/xhr/tests/file_html_in_xhr2.html
dom/xhr/tests/file_html_in_xhr3.html
dom/xhr/tests/mochitest.ini
dom/xhr/tests/progressserver.sjs
dom/xhr/tests/relativeLoad_import.js
dom/xhr/tests/relativeLoad_worker.js
dom/xhr/tests/relativeLoad_worker2.js
dom/xhr/tests/responseIdentical.sjs
dom/xhr/tests/subdir/relativeLoad_sub_import.js
dom/xhr/tests/subdir/relativeLoad_sub_worker.js
dom/xhr/tests/subdir/relativeLoad_sub_worker2.js
dom/xhr/tests/terminateSyncXHR_worker.js
dom/xhr/tests/test_XHR.html
dom/xhr/tests/test_XHRDocURI.html
dom/xhr/tests/test_XHRResponseURL.html
dom/xhr/tests/test_XHRSendData.html
dom/xhr/tests/test_XHR_anon.html
dom/xhr/tests/test_XHR_header.html
dom/xhr/tests/test_XHR_onuploadprogress.html
dom/xhr/tests/test_XHR_parameters.html
dom/xhr/tests/test_XHR_system.html
dom/xhr/tests/test_XHR_timeout.html
dom/xhr/tests/test_XHR_timeout.js
dom/xhr/tests/test_html_in_xhr.html
dom/xhr/tests/test_relativeLoad.html
dom/xhr/tests/test_sync_xhr_timer.xhtml
dom/xhr/tests/test_worker_terminateSyncXHR.html
dom/xhr/tests/test_worker_xhr.html
dom/xhr/tests/test_worker_xhr2.html
dom/xhr/tests/test_worker_xhrAbort.html
dom/xhr/tests/test_worker_xhr_3rdparty.html
dom/xhr/tests/test_worker_xhr_cors_redirect.html
dom/xhr/tests/test_worker_xhr_headers.html
dom/xhr/tests/test_worker_xhr_implicit_cancel.html
dom/xhr/tests/test_worker_xhr_parameters.html
dom/xhr/tests/test_worker_xhr_parameters.js
dom/xhr/tests/test_worker_xhr_responseURL.html
dom/xhr/tests/test_worker_xhr_system.html
dom/xhr/tests/test_worker_xhr_system.js
dom/xhr/tests/test_worker_xhr_timeout.html
dom/xhr/tests/test_xhr_abort_after_load.html
dom/xhr/tests/test_xhr_forbidden_headers.html
dom/xhr/tests/test_xhr_overridemimetype_throws_on_invalid_state.html
dom/xhr/tests/test_xhr_progressevents.html
dom/xhr/tests/test_xhr_send.html
dom/xhr/tests/test_xhr_send_readystate.html
dom/xhr/tests/test_xhr_withCredentials.html
dom/xhr/tests/worker_file_getcookie.sjs
dom/xhr/tests/worker_terminateSyncXHR_frame.html
dom/xhr/tests/worker_testXHR.txt
dom/xhr/tests/worker_xhr_cors_redirect.js
dom/xhr/tests/worker_xhr_cors_redirect.sjs
dom/xhr/tests/worker_xhr_headers_server.sjs
dom/xhr/tests/worker_xhr_headers_worker.js
dom/xhr/tests/xhr2_worker.js
dom/xhr/tests/xhrAbort_worker.js
dom/xhr/tests/xhr_implicit_cancel_worker.js
dom/xhr/tests/xhr_worker.js
mobile/android/installer/package-manifest.in
--- a/b2g/installer/package-manifest.in
+++ b/b2g/installer/package-manifest.in
@@ -208,16 +208,17 @@
 @RESPATH@/components/dom_tv.xpt
 @RESPATH@/components/dom_inputport.xpt
 @RESPATH@/components/dom_views.xpt
 @RESPATH@/components/dom_voicemail.xpt
 #ifdef MOZ_WEBSPEECH
 @RESPATH@/components/dom_webspeechrecognition.xpt
 #endif
 @RESPATH@/components/dom_xbl.xpt
+@RESPATH@/components/dom_xhr.xpt
 @RESPATH@/components/dom_xpath.xpt
 @RESPATH@/components/dom_xul.xpt
 @RESPATH@/components/dom_time.xpt
 @RESPATH@/components/dom_presentation.xpt
 @RESPATH@/components/downloads.xpt
 @RESPATH@/components/editor.xpt
 @RESPATH@/components/embed_base.xpt
 @RESPATH@/components/extensions.xpt
--- a/browser/installer/package-manifest.in
+++ b/browser/installer/package-manifest.in
@@ -211,16 +211,17 @@
 @RESPATH@/components/dom_traversal.xpt
 @RESPATH@/components/dom_tv.xpt
 @RESPATH@/components/dom_voicemail.xpt
 #ifdef MOZ_WEBSPEECH
 @RESPATH@/components/dom_webspeechrecognition.xpt
 #endif
 @RESPATH@/components/dom_workers.xpt
 @RESPATH@/components/dom_xbl.xpt
+@RESPATH@/components/dom_xhr.xpt
 @RESPATH@/components/dom_xpath.xpt
 @RESPATH@/components/dom_xul.xpt
 #ifdef MOZ_GAMEPAD
 @RESPATH@/components/dom_gamepad.xpt
 #endif
 @RESPATH@/components/dom_payment.xpt
 @RESPATH@/components/dom_presentation.xpt
 @RESPATH@/components/downloads.xpt
--- a/dom/base/moz.build
+++ b/dom/base/moz.build
@@ -30,17 +30,16 @@ XPIDL_SOURCES += [
     'nsISelection.idl',
     'nsISelectionController.idl',
     'nsISelectionDisplay.idl',
     'nsISelectionListener.idl',
     'nsISelectionPrivate.idl',
     'nsISimpleContentPolicy.idl',
     'nsISiteSpecificUserAgent.idl',
     'nsISlowScriptDebug.idl',
-    'nsIXMLHttpRequest.idl',
 ]
 
 XPIDL_MODULE = 'dom'
 
 EXPORTS += [
     'AutocompleteFieldList.h',
     'Crypto.h',
     'HTMLSplitOnSpacesTokenizer.h',
@@ -317,17 +316,16 @@ UNIFIED_SOURCES += [
     'nsTraversal.cpp',
     'nsTreeSanitizer.cpp',
     'nsViewportInfo.cpp',
     'nsWindowMemoryReporter.cpp',
     'nsWindowRoot.cpp',
     'nsWrapperCache.cpp',
     'nsXHTMLContentSerializer.cpp',
     'nsXMLContentSerializer.cpp',
-    'nsXMLHttpRequest.cpp',
     'nsXMLNameSpaceMap.cpp',
     'PostMessageEvent.cpp',
     'ProcessGlobal.cpp',
     'ResponsiveImageSelector.cpp',
     'SameProcessMessageQueue.cpp',
     'ScreenOrientation.cpp',
     'ScriptSettings.cpp',
     'ShadowRoot.cpp',
--- a/dom/base/test/fileutils.js
+++ b/dom/base/test/fileutils.js
@@ -44,17 +44,17 @@ function testFile(file, contents, test) 
   var fd = new FormData;
   fd.append("hello", "world");
   fd.append("myfile", file);
   xhr.send(fd);
   expectedTestCount++;
 
   // Send file to server using plain XMLHttpRequest
   var xhr = new XMLHttpRequest;
-  xhr.open("POST", "file_XHRSendData.sjs");
+  xhr.open("POST", "../../../dom/xhr/tests/file_XHRSendData.sjs");
   xhr.onload = function (event) {
     is(event.target.getResponseHeader("Result-Content-Type"),
        file.type ? file.type : null,
        "request content-type in XMLHttpRequest send of " + test);
     is(event.target.getResponseHeader("Result-Content-Length"),
        String(file.size),
        "request content-length in XMLHttpRequest send of " + test);
   };
--- a/dom/base/test/mochitest.ini
+++ b/dom/base/test/mochitest.ini
@@ -53,52 +53,22 @@ support-files =
   bug696301-script-2.js
   bug704320.sjs
   bug704320_counter.sjs
   bug819051.sjs
   chrome/bug418986-1.js
   copypaste.js
   create_file_objects.js
   delayedServerEvents.sjs
-  echo.sjs
   eventsource.resource
   eventsource.resource^headers^
   eventsource_redirect.resource
   eventsource_redirect.resource^headers^
   eventsource_redirect_to.resource
   eventsource_redirect_to.resource^headers^
-  file_XHRDocURI.text
-  file_XHRDocURI.text^headers^
-  file_XHRDocURI.xml
-  file_XHRDocURI.xml^headers^
-  file_XHRDocURI.html
-  file_XHRDocURI.html^headers^
-  file_XHRDocURI.sjs
-  file_XHRResponseURL.js
-  file_XHRResponseURL.sjs
-  file_XHRResponseURL.text
-  file_XHRResponseURL.text^headers^
-  file_XHRResponseURL_nocors.text
-  file_XHRSendData.sjs
-  file_XHRSendData_doc.xml
-  file_XHRSendData_doc.xml^headers^
-  file_XHR_anon.sjs
-  file_XHR_binary1.bin
-  file_XHR_binary1.bin^headers^
-  file_XHR_binary2.bin
-  file_XHR_fail1.txt
-  file_XHR_fail1.txt^headers^
-  file_XHR_header.sjs
-  file_XHR_pass1.xml
-  file_XHR_pass2.txt
-  file_XHR_pass3.txt
-  file_XHR_pass3.txt^headers^
-  file_XHR_system_redirect.html
-  file_XHR_system_redirect.html^headers^
-  file_XHR_timeout.sjs
   file_base_xbl.xml
   file_bug1091883_frame.html
   file_bug1091883_subframe.html
   file_bug1091883_target.html
   file_bug28293.sjs
   file_bug326337.xml
   file_bug326337_inner.html
   file_bug326337_outer.html
@@ -157,20 +127,16 @@ support-files =
   file_bug902350.html
   file_bug902350_frame.html
   file_bug907892.html
   file_bug945152.jar
   file_bug1263696_frame_pass.html
   file_bug1263696_frame_fail.html
   file_bug1274806.html
   file_general_document.html
-  file_html_in_xhr.html
-  file_html_in_xhr.sjs
-  file_html_in_xhr2.html
-  file_html_in_xhr3.html
   file_htmlserializer_1.html
   file_htmlserializer_1_bodyonly.html
   file_htmlserializer_1_format.html
   file_htmlserializer_1_linebreak.html
   file_htmlserializer_1_links.html
   file_htmlserializer_1_nested_body.html
   file_htmlserializer_1_no_body.html
   file_htmlserializer_1_noflag.html
@@ -227,18 +193,16 @@ support-files =
   fileutils.js
   forRemoval.resource
   forRemoval.resource^headers^
   formReset.html
   invalid_accesscontrol.resource
   invalid_accesscontrol.resource^headers^
   mutationobserver_dialog.html
   orientationcommon.js
-  progressserver.sjs
-  responseIdentical.sjs
   script-1_bug597345.sjs
   script-2_bug597345.js
   script_bug602838.sjs
   send_gzip_content.sjs
   somedatas.resource
   somedatas.resource^headers^
   variable_style_sheet.sjs
   viewport_helpers.js
@@ -264,27 +228,26 @@ support-files =
   file_bug1198095.js
   file_bug1250148.sjs
   mozbrowser_api_utils.js
   websocket_helpers.js
   websocket_tests.js
   !/dom/html/test/form_submit_server.sjs
   !/dom/security/test/cors/file_CrossSiteXHR_server.sjs
   !/image/test/mochitest/blue.png
+  !/dom/xhr/tests/file_XHRSendData.sjs
   script_bug1238440.js
 
 [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]
-[test_xhr_overridemimetype_throws_on_invalid_state.html]
-skip-if = buildapp == 'b2g' # Requires webgl support
 [test_anonymousContent_insert.html]
 [test_anonymousContent_manipulate_content.html]
 [test_anonymousContent_style_csp.html]
 [test_applet_alternate_content.html]
 [test_appname_override.html]
 [test_async_setTimeout_stack.html]
 [test_async_setTimeout_stack_across_globals.html]
 [test_audioWindowUtils.html]
@@ -721,17 +684,16 @@ skip-if = e10s || os != 'linux' || build
 [test_gsp-qualified.html]
 [test_gsp-quirks.html]
 [test_gsp-standards.html]
 [test_hasFeature.html]
 [test_history_document_open.html]
 [test_history_state_null.html]
 [test_html_colors_quirks.html]
 [test_html_colors_standards.html]
-[test_html_in_xhr.html]
 [test_htmlcopyencoder.html]
 [test_htmlcopyencoder.xhtml]
 [test_iframe_referrer.html]
 [test_iframe_referrer_changing.html]
 [test_iframe_referrer_invalid.html]
 [test_Image_constructor.html]
 [test_img_referrer.html]
 [test_innersize_scrollport.html]
@@ -822,18 +784,16 @@ skip-if = toolkit == 'android'
 [test_setInterval_uncatchable_exception.html]
 skip-if = debug == false
 [test_settimeout_extra_arguments.html]
 [test_settimeout_inner.html]
 [test_setting_opener.html]
 skip-if = (buildapp == 'b2g' && toolkit != 'gonk') #Bug 931116, b2g desktop specific, initial triage
 [test_simplecontentpolicy.html]
 skip-if = e10s || buildapp == 'b2g' # Bug 1156489.
-[test_sync_xhr_timer.xhtml]
-skip-if = toolkit == 'android'
 [test_text_wholeText.html]
 [test_textnode_normalize_in_selection.html]
 [test_textnode_split_in_selection.html]
 [test_title.html]
 [test_treewalker_nextsibling.xml]
 [test_unknown_url_origin.html]
 [test_url.html]
 [test_url_data.html]
@@ -884,32 +844,10 @@ skip-if = release_build
 [test_window_indexing.html]
 [test_window_named_frame_enumeration.html]
 [test_window_orientation.html]
 skip-if = toolkit != 'gonk'
 [test_window_proto.html]
 [test_writable-replaceable.html]
 [test_x-frame-options.html]
 [test_xbl_userdata.xhtml]
-[test_XHR.html]
-[test_xhr_abort_after_load.html]
-skip-if = toolkit == 'android'
-[test_XHR_anon.html]
-[test_xhr_forbidden_headers.html]
-[test_XHR_header.html]
-[test_XHR_onuploadprogress.html]
-[test_XHR_parameters.html]
-skip-if = buildapp == 'b2g' # b2g(86 total, 4 failing - testing mozAnon - got false, expected true) b2g-debug(86 total, 4 failing - testing mozAnon - got false, expected true) b2g-desktop(86 total, 4 failing - testing mozAnon - got false, expected true)
-[test_xhr_progressevents.html]
-skip-if = toolkit == 'android'
-[test_xhr_send.html]
-[test_xhr_send_readystate.html]
-[test_XHR_system.html]
-skip-if = (buildapp == 'b2g' && (toolkit != 'gonk' || debug)) # b2g-debug(12 total, 2 failing - .mozSystem == true - got false, expected true + ) b2g-desktop(12 total, 2 failing - .mozSystem == true - got false, expected true + )
-[test_XHR_timeout.html]
-skip-if = buildapp == 'b2g' || (android_version == '18' && debug) # b2g(flaky on B2G, bug 960743) b2g-debug(flaky on B2G, bug 960743) b2g-desktop(flaky on B2G, bug 960743)
-support-files = test_XHR_timeout.js
-[test_xhr_withCredentials.html]
-[test_XHRDocURI.html]
-[test_XHRResponseURL.html]
-[test_XHRSendData.html]
 [test_youtube_flash_embed.html]
 # Please keep alphabetical order.
--- a/dom/moz.build
+++ b/dom/moz.build
@@ -109,16 +109,17 @@ DIRS += [
     'xul',
     'resourcestats',
     'manifest',
     'vr',
     'newapps',
     'u2f',
     'console',
     'performance',
+    'xhr',
 ]
 
 if CONFIG['OS_ARCH'] == 'WINNT':
     DIRS += ['plugins/ipc/hangui']
 
 if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
     DIRS += [
         'speakermanager',
--- a/dom/tests/mochitest/fetch/mochitest.ini
+++ b/dom/tests/mochitest/fetch/mochitest.ini
@@ -14,24 +14,24 @@ support-files =
   worker_wrapper.js
   message_receiver.html
   reroute.html
   reroute.js
   reroute.js^headers^
   sw_reroute.js
   empty.js
   empty.js^headers^
-  !/dom/base/test/file_XHR_binary1.bin
-  !/dom/base/test/file_XHR_binary1.bin^headers^
-  !/dom/base/test/file_XHR_binary2.bin
-  !/dom/base/test/file_XHR_pass1.xml
-  !/dom/base/test/file_XHR_pass2.txt
-  !/dom/base/test/file_XHR_pass3.txt
-  !/dom/base/test/file_XHR_pass3.txt^headers^
-  !/dom/base/test/responseIdentical.sjs
+  !/dom/xhr/tests/file_XHR_binary1.bin
+  !/dom/xhr/tests/file_XHR_binary1.bin^headers^
+  !/dom/xhr/tests/file_XHR_binary2.bin
+  !/dom/xhr/tests/file_XHR_pass1.xml
+  !/dom/xhr/tests/file_XHR_pass2.txt
+  !/dom/xhr/tests/file_XHR_pass3.txt
+  !/dom/xhr/tests/file_XHR_pass3.txt^headers^
+  !/dom/xhr/tests/responseIdentical.sjs
   !/dom/html/test/form_submit_server.sjs
   !/dom/security/test/cors/file_CrossSiteXHR_server.sjs
 
 [test_headers.html]
 [test_headers_sw_reroute.html]
 skip-if = buildapp == 'b2g' # Bug 1137683
 [test_headers_mainthread.html]
 [test_fetch_app_protocol.html]
--- a/dom/tests/mochitest/fetch/test_fetch_basic_http.js
+++ b/dom/tests/mochitest/fetch/test_fetch_basic_http.js
@@ -1,9 +1,9 @@
-var path = "/tests/dom/base/test/";
+var path = "/tests/dom/xhr/tests/";
 
 var passFiles = [['file_XHR_pass1.xml', 'GET', 200, 'OK', 'text/xml'],
                  ['file_XHR_pass2.txt', 'GET', 200, 'OK', 'text/plain'],
                  ['file_XHR_pass3.txt', 'GET', 200, 'OK', 'text/plain'],
                  ];
 
 function testURL() {
   var promises = [];
--- a/dom/workers/WorkerRunnable.cpp
+++ b/dom/workers/WorkerRunnable.cpp
@@ -26,58 +26,16 @@
 USING_WORKERS_NAMESPACE
 
 namespace {
 
 const nsIID kWorkerRunnableIID = {
   0x320cc0b5, 0xef12, 0x4084, { 0x88, 0x6e, 0xca, 0x6a, 0x81, 0xe4, 0x1d, 0x68 }
 };
 
-// This runnable is used to stop a sync loop and it's meant to be used on the
-// main-thread only. As sync loops keep the busy count incremented as long as
-// they run this runnable does not modify the busy count
-// in any way.
-class MainThreadStopSyncLoopRunnable : public WorkerSyncRunnable
-{
-  bool mResult;
-
-public:
-  // Passing null for aSyncLoopTarget is not allowed.
-  MainThreadStopSyncLoopRunnable(
-                               WorkerPrivate* aWorkerPrivate,
-                               already_AddRefed<nsIEventTarget>&& aSyncLoopTarget,
-                               bool aResult);
-
-  // By default StopSyncLoopRunnables cannot be canceled since they could leave
-  // a sync loop spinning forever.
-  nsresult
-  Cancel() override;
-
-protected:
-  virtual ~MainThreadStopSyncLoopRunnable()
-  { }
-
-private:
-  virtual bool
-  PreDispatch(WorkerPrivate* aWorkerPrivate) override final
-  {
-    AssertIsOnMainThread();
-    return true;
-  }
-
-  virtual void
-  PostDispatch(WorkerPrivate* aWorkerPrivate, bool aDispatchResult) override;
-
-  virtual bool
-  WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate) override;
-
-  virtual bool
-  DispatchInternal() override final;
-};
-
 } // namespace
 
 #ifdef DEBUG
 WorkerRunnable::WorkerRunnable(WorkerPrivate* aWorkerPrivate,
                                TargetAndBusyBehavior aBehavior)
 : mWorkerPrivate(aWorkerPrivate), mBehavior(aBehavior), mCanceled(0),
   mCallingCancelWithinRun(false)
 {
--- a/dom/workers/WorkerRunnable.h
+++ b/dom/workers/WorkerRunnable.h
@@ -424,11 +424,53 @@ public:
   virtual
   ~WorkerCheckAPIExposureOnMainThreadRunnable();
 
   // Returns whether the dispatch succeeded.  If this returns false, the API
   // should not be exposed.
   bool Dispatch();
 };
 
+// This runnable is used to stop a sync loop and it's meant to be used on the
+// main-thread only. As sync loops keep the busy count incremented as long as
+// they run this runnable does not modify the busy count
+// in any way.
+class MainThreadStopSyncLoopRunnable : public WorkerSyncRunnable
+{
+  bool mResult;
+
+public:
+  // Passing null for aSyncLoopTarget is not allowed.
+  MainThreadStopSyncLoopRunnable(
+                               WorkerPrivate* aWorkerPrivate,
+                               already_AddRefed<nsIEventTarget>&& aSyncLoopTarget,
+                               bool aResult);
+
+  // By default StopSyncLoopRunnables cannot be canceled since they could leave
+  // a sync loop spinning forever.
+  nsresult
+  Cancel() override;
+
+protected:
+  virtual ~MainThreadStopSyncLoopRunnable()
+  { }
+
+private:
+  virtual bool
+  PreDispatch(WorkerPrivate* aWorkerPrivate) override final
+  {
+    AssertIsOnMainThread();
+    return true;
+  }
+
+  virtual void
+  PostDispatch(WorkerPrivate* aWorkerPrivate, bool aDispatchResult) override;
+
+  virtual bool
+  WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate) override;
+
+  virtual bool
+  DispatchInternal() override final;
+};
+
 END_WORKERS_NAMESPACE
 
 #endif // mozilla_dom_workers_workerrunnable_h__
--- a/dom/workers/moz.build
+++ b/dom/workers/moz.build
@@ -34,18 +34,16 @@ EXPORTS.mozilla.dom.workers += [
 EXPORTS.mozilla.dom.workers.bindings += [
     'ServiceWorker.h',
     'ServiceWorkerClient.h',
     'ServiceWorkerClients.h',
     'ServiceWorkerWindowClient.h',
     'SharedWorker.h',
     'URL.h',
     'WorkerHolder.h',
-    'XMLHttpRequestUploadWorker.h',
-    'XMLHttpRequestWorker.h',
 ]
 
 XPIDL_MODULE = 'dom_workers'
 
 XPIDL_SOURCES += [
     'nsIWorkerDebugger.idl',
     'nsIWorkerDebuggerManager.idl',
 ]
@@ -84,18 +82,16 @@ UNIFIED_SOURCES += [
     'WorkerDebuggerManager.cpp',
     'WorkerHolder.cpp',
     'WorkerLocation.cpp',
     'WorkerNavigator.cpp',
     'WorkerPrivate.cpp',
     'WorkerRunnable.cpp',
     'WorkerScope.cpp',
     'WorkerThread.cpp',
-    'XMLHttpRequestUploadWorker.cpp',
-    'XMLHttpRequestWorker.cpp',
 ]
 
 IPDL_SOURCES += [
     'PServiceWorkerManager.ipdl',
     'ServiceWorkerRegistrarTypes.ipdlh',
 ]
 
 LOCAL_INCLUDES += [
--- a/dom/workers/test/mochitest.ini
+++ b/dom/workers/test/mochitest.ini
@@ -20,17 +20,16 @@ support-files =
   csp_worker.js
   404_server.sjs
   errorPropagation_iframe.html
   errorPropagation_worker.js
   errorwarning_worker.js
   eventDispatch_worker.js
   fibonacci_worker.js
   file_bug1010784_worker.js
-  file_getcookie.sjs
   foreign.js
   importForeignScripts_worker.js
   importScripts_mixedcontent.html
   importScripts_worker.js
   importScripts_worker_imported1.js
   importScripts_worker_imported2.js
   importScripts_worker_imported3.js
   importScripts_worker_imported4.js
@@ -51,33 +50,25 @@ support-files =
   notification_permission_worker.js
   onLine_worker.js
   onLine_worker_child.js
   onLine_worker_head.js
   promise_worker.js
   recursion_worker.js
   recursiveOnerror_worker.js
   redirect_to_foreign.sjs
-  relativeLoad_import.js
-  relativeLoad_worker.js
-  relativeLoad_worker2.js
   rvals_worker.js
   sharedWorker_console.js
   sharedWorker_sharedWorker.js
   simpleThread_worker.js
   suspend_iframe.html
   suspend_worker.js
   terminate_worker.js
-  terminateSyncXHR_frame.html
-  terminateSyncXHR_worker.js
-  testXHR.txt
   test_csp.html^headers^
   test_csp.js
-  test_xhr_parameters.js
-  test_xhr_system.js
   threadErrors_worker1.js
   threadErrors_worker2.js
   threadErrors_worker3.js
   threadErrors_worker4.js
   threadTimeouts_worker.js
   throwingOnerror_worker.js
   timeoutTracing_worker.js
   transferable_worker.js
@@ -87,28 +78,18 @@ support-files =
   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
-  xhr2_worker.js
-  xhrAbort_worker.js
-  xhr_implicit_cancel_worker.js
-  xhr_worker.js
-  xhr_headers_worker.js
-  xhr_headers_server.sjs
-  xhr_cors_redirect.js
   url_exceptions_worker.js
   urlSearchParams_worker.js
-  subdir/relativeLoad_sub_worker.js
-  subdir/relativeLoad_sub_worker2.js
-  subdir/relativeLoad_sub_import.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
@@ -119,38 +100,35 @@ support-files =
   sharedWorker_ports.js
   sharedWorker_lifetime.js
   worker_referrer.js
   websocket_https.html
   websocket_https_worker.js
   worker_fileReader.js
   fileapi_chromeScript.js
   importScripts_3rdParty_worker.js
-  xhr_cors_redirect.sjs
   worker_bug1278777.js
-  !/dom/base/test/file_XHRResponseURL.js
-  !/dom/base/test/file_XHRResponseURL.sjs
-  !/dom/base/test/file_XHRResponseURL.text
-  !/dom/base/test/file_XHRResponseURL.text^headers^
-  !/dom/base/test/file_XHRResponseURL_nocors.text
-  !/dom/base/test/file_XHR_timeout.sjs
   !/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/test_XHR_system.html
-  !/dom/base/test/test_XHR_timeout.js
   !/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
 
 [test_404.html]
 [test_atob.html]
 [test_blobConstructor.html]
 [test_blobWorkers.html]
 [test_bug949946.html]
 [test_bug978260.html]
 [test_bug998474.html]
@@ -207,27 +185,24 @@ skip-if = buildapp == 'mulet'
 [test_notification_child.html]
 [test_notification_permission.html]
 [test_onLine.html]
 skip-if = (toolkit == 'gonk' && debug) #debug-only failure
 [test_promise.html]
 [test_promise_resolved_with_string.html]
 [test_recursion.html]
 [test_recursiveOnerror.html]
-[test_relativeLoad.html]
-skip-if = buildapp == 'b2g' # b2g(Failed to load script: relativeLoad_import.js) b2g-debug(Failed to load script: relativeLoad_import.js) b2g-desktop(Failed to load script: relativeLoad_import.js)
 [test_resolveWorker.html]
 [test_resolveWorker-assignment.html]
 [test_rvals.html]
 [test_sharedWorker.html]
 skip-if = (toolkit == 'gonk' && debug) # Bug 1176223
 [test_simpleThread.html]
 [test_suspend.html]
 [test_terminate.html]
-[test_terminateSyncXHR.html]
 [test_threadErrors.html]
 [test_threadTimeouts.html]
 [test_throwingOnerror.html]
 [test_timeoutTracing.html]
 [test_transferable.html]
 [test_url.html]
 [test_url_exceptions.html]
 [test_urlApi.html]
@@ -247,29 +222,15 @@ skip-if = buildapp == 'b2g' || toolkit =
 [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]
 skip-if = buildapp == 'b2g' || toolkit == 'android' #bug 982828
 [test_worker_interfaces.html]
 [test_workersDisabled.html]
-[test_xhr.html]
-[test_xhr2.html]
-[test_xhr_3rdparty.html]
-[test_xhr_headers.html]
-[test_xhr_implicit_cancel.html]
-[test_xhr_parameters.html]
-skip-if = buildapp == 'b2g'
-[test_xhr_responseURL.html]
-[test_xhr_system.html]
-[test_xhr_cors_redirect.html]
-skip-if = buildapp == 'b2g'
-[test_xhr_timeout.html]
-skip-if = (os == "win") || (os == "mac") || toolkit == 'android' #bug 798220
-[test_xhrAbort.html]
 [test_referrer.html]
 [test_importScripts_3rdparty.html]
 [test_sharedWorker_ports.html]
 [test_sharedWorker_lifetime.html]
 [test_fileReader.html]
 [test_navigator_workers_hardwareConcurrency.html]
 [test_bug1278777.html]
--- a/dom/workers/test/promise_worker.js
+++ b/dom/workers/test/promise_worker.js
@@ -167,17 +167,17 @@ function promiseAsync_SyncXHRAndImportSc
   ok(!handlerExecuted, "Handlers are not called until the next microtask.");
 
   var xhr = new XMLHttpRequest();
   xhr.open("GET", "testXHR.txt", false);
   xhr.send(null);
 
   ok(!handlerExecuted, "Sync XHR should not trigger microtask execution.");
 
-  importScripts("relativeLoad_import.js");
+  importScripts("../../../dom/xhr/tests/relativeLoad_import.js");
 
   ok(!handlerExecuted, "importScripts should not trigger microtask execution.");
 }
 
 function promiseDoubleThen() {
   var steps = 0;
   var promise = new Promise(function(r1, r2) {
     r1(42);
rename from dom/workers/XMLHttpRequestUploadWorker.cpp
rename to dom/xhr/XMLHttpRequestUploadWorker.cpp
rename from dom/workers/XMLHttpRequestUploadWorker.h
rename to dom/xhr/XMLHttpRequestUploadWorker.h
rename from dom/workers/XMLHttpRequestWorker.cpp
rename to dom/xhr/XMLHttpRequestWorker.cpp
rename from dom/workers/XMLHttpRequestWorker.h
rename to dom/xhr/XMLHttpRequestWorker.h
new file mode 100644
--- /dev/null
+++ b/dom/xhr/moz.build
@@ -0,0 +1,37 @@
+# -*- Mode: python; c-basic-offset: 4; 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/.
+
+XPIDL_SOURCES += [
+    'nsIXMLHttpRequest.idl',
+]
+
+XPIDL_MODULE = 'dom_xhr'
+
+# Stuff needed for the bindings, not really public though.
+EXPORTS.mozilla.dom.workers.bindings += [
+    'XMLHttpRequestUploadWorker.h',
+    'XMLHttpRequestWorker.h',
+]
+
+EXPORTS += [
+    'nsXMLHttpRequest.h',
+]
+
+UNIFIED_SOURCES += [
+    'nsXMLHttpRequest.cpp',
+    'XMLHttpRequestUploadWorker.cpp',
+    'XMLHttpRequestWorker.cpp',
+]
+
+LOCAL_INCLUDES += [
+    '/dom/base',
+    '/dom/workers',
+    '/netwerk/base',
+]
+
+MOCHITEST_MANIFESTS += [ 'tests/mochitest.ini' ]
+
+FINAL_LIBRARY = 'xul'
rename from dom/base/nsIXMLHttpRequest.idl
rename to dom/xhr/nsIXMLHttpRequest.idl
rename from dom/base/nsXMLHttpRequest.cpp
rename to dom/xhr/nsXMLHttpRequest.cpp
--- a/dom/base/nsXMLHttpRequest.cpp
+++ b/dom/xhr/nsXMLHttpRequest.cpp
@@ -78,16 +78,17 @@
 #include "nsITimedChannel.h"
 #include "nsWrapperCacheInlines.h"
 #include "nsZipArchive.h"
 #include "mozilla/Preferences.h"
 #include "private/pprio.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
+using namespace mozilla::net;
 
 // Maximum size that we'll grow an ArrayBuffer instead of doubling,
 // once doubling reaches this threshold
 #define XML_HTTP_REQUEST_ARRAYBUFFER_MAX_GROWTH (32*1024*1024)
 // start at 32k to avoid lots of doubling right at the start
 #define XML_HTTP_REQUEST_ARRAYBUFFER_MIN_SIZE (32*1024)
 // the maximum Content-Length that we'll preallocate.  1GB.  Must fit
 // in an int32_t!
rename from dom/base/nsXMLHttpRequest.h
rename to dom/xhr/nsXMLHttpRequest.h
rename from dom/base/test/echo.sjs
rename to dom/xhr/tests/echo.sjs
rename from dom/base/test/file_XHRDocURI.html
rename to dom/xhr/tests/file_XHRDocURI.html
rename from dom/base/test/file_XHRDocURI.html^headers^
rename to dom/xhr/tests/file_XHRDocURI.html^headers^
rename from dom/base/test/file_XHRDocURI.sjs
rename to dom/xhr/tests/file_XHRDocURI.sjs
rename from dom/base/test/file_XHRDocURI.text
rename to dom/xhr/tests/file_XHRDocURI.text
rename from dom/base/test/file_XHRDocURI.text^headers^
rename to dom/xhr/tests/file_XHRDocURI.text^headers^
rename from dom/base/test/file_XHRDocURI.xml
rename to dom/xhr/tests/file_XHRDocURI.xml
rename from dom/base/test/file_XHRDocURI.xml^headers^
rename to dom/xhr/tests/file_XHRDocURI.xml^headers^
rename from dom/base/test/file_XHRResponseURL.js
rename to dom/xhr/tests/file_XHRResponseURL.js
--- a/dom/base/test/file_XHRResponseURL.js
+++ b/dom/xhr/tests/file_XHRResponseURL.js
@@ -81,85 +81,85 @@ function createSequentialRequest(aParame
 function testSuccessResponse() {
   var blob = new Blob(["data"], {type: "text/plain"});
   var blobURL = URL.createObjectURL(blob);
 
   var parameters = [
     // tests that start with same-origin request
     {
       message: "request to same-origin without redirect",
-      requestURL: "http://mochi.test:8888/tests/dom/base/test/file_XHRResponseURL.text",
-      responseURL: "http://mochi.test:8888/tests/dom/base/test/file_XHRResponseURL.text"
+      requestURL: "http://mochi.test:8888/tests/dom/xhr/tests/file_XHRResponseURL.text",
+      responseURL: "http://mochi.test:8888/tests/dom/xhr/tests/file_XHRResponseURL.text"
     },
     {
       message: "request to same-origin redirect to same-origin URL",
-      requestURL: "http://mochi.test:8888/tests/dom/base/test/file_XHRResponseURL.sjs?url=http://mochi.test:8888/tests/dom/base/test/file_XHRResponseURL.text",
-      responseURL: "http://mochi.test:8888/tests/dom/base/test/file_XHRResponseURL.text"
+      requestURL: "http://mochi.test:8888/tests/dom/xhr/tests/file_XHRResponseURL.sjs?url=http://mochi.test:8888/tests/dom/xhr/tests/file_XHRResponseURL.text",
+      responseURL: "http://mochi.test:8888/tests/dom/xhr/tests/file_XHRResponseURL.text"
     },
     {
       message: "request to same-origin redirects several times and finally go to same-origin URL",
-      requestURL: "http://mochi.test:8888/tests/dom/base/test/file_XHRResponseURL.sjs?url=" + encodeURIComponent("http://mochi.test:8888/tests/dom/base/test/file_XHRResponseURL.sjs?url=http://mochi.test:8888/tests/dom/base/test/file_XHRResponseURL.text"),
-      responseURL: "http://mochi.test:8888/tests/dom/base/test/file_XHRResponseURL.text"
+      requestURL: "http://mochi.test:8888/tests/dom/xhr/tests/file_XHRResponseURL.sjs?url=" + encodeURIComponent("http://mochi.test:8888/tests/dom/xhr/tests/file_XHRResponseURL.sjs?url=http://mochi.test:8888/tests/dom/xhr/tests/file_XHRResponseURL.text"),
+      responseURL: "http://mochi.test:8888/tests/dom/xhr/tests/file_XHRResponseURL.text"
     },
     {
       message: "request to same-origin redirect to cross-origin URL",
-      requestURL: "http://mochi.test:8888/tests/dom/base/test/file_XHRResponseURL.sjs?url=http://example.com/tests/dom/base/test/file_XHRResponseURL.text",
-      responseURL: "http://example.com/tests/dom/base/test/file_XHRResponseURL.text",
+      requestURL: "http://mochi.test:8888/tests/dom/xhr/tests/file_XHRResponseURL.sjs?url=http://example.com/tests/dom/xhr/tests/file_XHRResponseURL.text",
+      responseURL: "http://example.com/tests/dom/xhr/tests/file_XHRResponseURL.text",
     },
     {
       message: "request to same-origin redirects several times and finally go to cross-origin URL",
-      requestURL: "http://mochi.test:8888/tests/dom/base/test/file_XHRResponseURL.sjs?url=" + encodeURIComponent("http://mochi.test:8888/tests/dom/base/test/file_XHRResponseURL.sjs?url=http://example.com/tests/dom/base/test/file_XHRResponseURL.text"),
-      responseURL: "http://example.com/tests/dom/base/test/file_XHRResponseURL.text",
+      requestURL: "http://mochi.test:8888/tests/dom/xhr/tests/file_XHRResponseURL.sjs?url=" + encodeURIComponent("http://mochi.test:8888/tests/dom/xhr/tests/file_XHRResponseURL.sjs?url=http://example.com/tests/dom/xhr/tests/file_XHRResponseURL.text"),
+      responseURL: "http://example.com/tests/dom/xhr/tests/file_XHRResponseURL.text",
     },
 
     // tests that start with cross-origin request
     {
       message: "request to cross-origin without redirect",
-      requestURL: "http://example.com/tests/dom/base/test/file_XHRResponseURL.text",
-      responseURL: "http://example.com/tests/dom/base/test/file_XHRResponseURL.text"
+      requestURL: "http://example.com/tests/dom/xhr/tests/file_XHRResponseURL.text",
+      responseURL: "http://example.com/tests/dom/xhr/tests/file_XHRResponseURL.text"
     },
     {
       message: "request to cross-origin redirect back to same-origin URL",
-      requestURL: "http://example.com/tests/dom/base/test/file_XHRResponseURL.sjs?url=http://mochi.test:8888/tests/dom/base/test/file_XHRResponseURL.text",
-      responseURL: "http://mochi.test:8888/tests/dom/base/test/file_XHRResponseURL.text"
+      requestURL: "http://example.com/tests/dom/xhr/tests/file_XHRResponseURL.sjs?url=http://mochi.test:8888/tests/dom/xhr/tests/file_XHRResponseURL.text",
+      responseURL: "http://mochi.test:8888/tests/dom/xhr/tests/file_XHRResponseURL.text"
     },
     {
       message: "request to cross-origin redirect to the same cross-origin URL",
-      requestURL: "http://example.com/tests/dom/base/test/file_XHRResponseURL.sjs?url=http://example.com/tests/dom/base/test/file_XHRResponseURL.text",
-      responseURL: "http://example.com/tests/dom/base/test/file_XHRResponseURL.text",
+      requestURL: "http://example.com/tests/dom/xhr/tests/file_XHRResponseURL.sjs?url=http://example.com/tests/dom/xhr/tests/file_XHRResponseURL.text",
+      responseURL: "http://example.com/tests/dom/xhr/tests/file_XHRResponseURL.text",
     },
     {
       message: "request to cross-origin redirect to another cross-origin URL",
-      requestURL: "http://example.com/tests/dom/base/test/file_XHRResponseURL.sjs?url=http://example.org/tests/dom/base/test/file_XHRResponseURL.text",
-      responseURL: "http://example.org/tests/dom/base/test/file_XHRResponseURL.text",
+      requestURL: "http://example.com/tests/dom/xhr/tests/file_XHRResponseURL.sjs?url=http://example.org/tests/dom/xhr/tests/file_XHRResponseURL.text",
+      responseURL: "http://example.org/tests/dom/xhr/tests/file_XHRResponseURL.text",
     },
     {
       message: "request to cross-origin redirects several times and finally go to same-origin URL",
-      requestURL: "http://example.com/tests/dom/base/test/file_XHRResponseURL.sjs?url=" + encodeURIComponent("http://example.com/tests/dom/base/test/file_XHRResponseURL.sjs?url=http://mochi.test:8888/tests/dom/base/test/file_XHRResponseURL.text"),
-      responseURL: "http://mochi.test:8888/tests/dom/base/test/file_XHRResponseURL.text",
+      requestURL: "http://example.com/tests/dom/xhr/tests/file_XHRResponseURL.sjs?url=" + encodeURIComponent("http://example.com/tests/dom/xhr/tests/file_XHRResponseURL.sjs?url=http://mochi.test:8888/tests/dom/xhr/tests/file_XHRResponseURL.text"),
+      responseURL: "http://mochi.test:8888/tests/dom/xhr/tests/file_XHRResponseURL.text",
     },
     {
       message: "request to cross-origin redirects several times and finally go to the same cross-origin URL",
-      requestURL: "http://example.com/tests/dom/base/test/file_XHRResponseURL.sjs?url=" + encodeURIComponent("http://example.com/tests/dom/base/test/file_XHRResponseURL.sjs?url=http://example.com/tests/dom/base/test/file_XHRResponseURL.text"),
-      responseURL: "http://example.com/tests/dom/base/test/file_XHRResponseURL.text",
+      requestURL: "http://example.com/tests/dom/xhr/tests/file_XHRResponseURL.sjs?url=" + encodeURIComponent("http://example.com/tests/dom/xhr/tests/file_XHRResponseURL.sjs?url=http://example.com/tests/dom/xhr/tests/file_XHRResponseURL.text"),
+      responseURL: "http://example.com/tests/dom/xhr/tests/file_XHRResponseURL.text",
     },
     {
       message: "request to cross-origin redirects several times and finally go to another cross-origin URL",
-      requestURL: "http://example.com/tests/dom/base/test/file_XHRResponseURL.sjs?url=" + encodeURIComponent("http://example.com/tests/dom/base/test/file_XHRResponseURL.sjs?url=http://example.org/tests/dom/base/test/file_XHRResponseURL.text"),
-      responseURL: "http://example.org/tests/dom/base/test/file_XHRResponseURL.text",
+      requestURL: "http://example.com/tests/dom/xhr/tests/file_XHRResponseURL.sjs?url=" + encodeURIComponent("http://example.com/tests/dom/xhr/tests/file_XHRResponseURL.sjs?url=http://example.org/tests/dom/xhr/tests/file_XHRResponseURL.text"),
+      responseURL: "http://example.org/tests/dom/xhr/tests/file_XHRResponseURL.text",
     },
     {
       message: "request to cross-origin redirects to another cross-origin and finally go to the other cross-origin URL",
-      requestURL: "http://example.com/tests/dom/base/test/file_XHRResponseURL.sjs?url=" + encodeURIComponent("http://example.org/tests/dom/base/test/file_XHRResponseURL.sjs?url=http://test1.example.com/tests/dom/base/test/file_XHRResponseURL.text"),
-      responseURL: "http://test1.example.com/tests/dom/base/test/file_XHRResponseURL.text",
+      requestURL: "http://example.com/tests/dom/xhr/tests/file_XHRResponseURL.sjs?url=" + encodeURIComponent("http://example.org/tests/dom/xhr/tests/file_XHRResponseURL.sjs?url=http://test1.example.com/tests/dom/xhr/tests/file_XHRResponseURL.text"),
+      responseURL: "http://test1.example.com/tests/dom/xhr/tests/file_XHRResponseURL.text",
     },
     {
       message: "request URL has fragment",
-      requestURL: "http://mochi.test:8888/tests/dom/base/test/file_XHRResponseURL.text#fragment",
-      responseURL: "http://mochi.test:8888/tests/dom/base/test/file_XHRResponseURL.text"
+      requestURL: "http://mochi.test:8888/tests/dom/xhr/tests/file_XHRResponseURL.text#fragment",
+      responseURL: "http://mochi.test:8888/tests/dom/xhr/tests/file_XHRResponseURL.text"
     },
 
     // tests for non-http(s) URL
     {
       message: "request to data: URL",
       requestURL: "data:text/plain,data",
       responseURL: "data:text/plain,data"
     },
@@ -182,21 +182,21 @@ function testSuccessResponse() {
   return sequence;
 }
 
 function testFailedResponse() {
   info("test not to leak responseURL for denied cross-origin request");
   var parameters = [
     {
       message: "should be empty for denied cross-origin request without redirect",
-      requestURL: "http://example.com/tests/dom/base/test/file_XHRResponseURL_nocors.text"
+      requestURL: "http://example.com/tests/dom/xhr/tests/file_XHRResponseURL_nocors.text"
     },
     {
       message: "should be empty for denied cross-origin request with redirect",
-      requestURL: "http://mochi.test:8888/tests/dom/base/test/file_XHRResponseURL.sjs?url=http://example.com/tests/dom/base/test/file_XHRResponseURL_nocors.text"
+      requestURL: "http://mochi.test:8888/tests/dom/xhr/tests/file_XHRResponseURL.sjs?url=http://example.com/tests/dom/xhr/tests/file_XHRResponseURL_nocors.text"
     }
   ];
 
   var sequence = createSequentialRequest(parameters, function (aXHR, aParam) {
     ok(!aXHR.succeeded, "assert request failed");
     is(aXHR.responseURL, "" , aParam.message);
   });
 
@@ -220,17 +220,17 @@ function testNotToLeakResponseURLWhileDo
       is(xhr.readyState, XMLHttpRequest.OPENED, "assert for XHR state");
       is(xhr.responseURL, "",
          "responseURL should return empty string before HEADERS_RECEIVED");
     }
   };
   SpecialPowers.addObserver(requestObserver, "specialpowers-http-notify-request", false);
 
   return new Promise(function (aResolve, aReject) {
-    xhr.open("GET", "http://mochi.test:8888/tests/dom/base/test/file_XHRResponseURL.sjs?url=http://mochi.test:8888/tests/dom/base/test/file_XHRResponseURL.text");
+    xhr.open("GET", "http://mochi.test:8888/tests/dom/xhr/tests/file_XHRResponseURL.sjs?url=http://mochi.test:8888/tests/dom/xhr/tests/file_XHRResponseURL.text");
     xhr.addEventListener("load", function () {
       SpecialPowers.removeObserver(requestObserver, "specialpowers-http-notify-request");
       aResolve();
     });
     xhr.addEventListener("error", function () {
       ok(false, "unexpected request falilure");
       SpecialPowers.removeObserver(requestObserver, "specialpowers-http-notify-request");
       aResolve();
@@ -246,17 +246,17 @@ function testNotToLeakResponseURLWhileDo
       is(xhr.responseURL, "",
          "responseURL should return empty string before HEADERS_RECEIVED");
     }
   };
 
   return new Promise(function (aResolve, aReject) {
     self.addEventListener("message", testRedirect);
     message({type: "redirect_test", status: "start"});
-    xhr.open("GET", "http://mochi.test:8888/tests/dom/base/test/file_XHRResponseURL.sjs?url=http://mochi.test:8888/tests/dom/base/test/file_XHRResponseURL.text");
+    xhr.open("GET", "http://mochi.test:8888/tests/dom/xhr/tests/file_XHRResponseURL.sjs?url=http://mochi.test:8888/tests/dom/xhr/tests/file_XHRResponseURL.text");
     xhr.addEventListener("load", function () {
       self.removeEventListener("message", testRedirect);
       message({type: "redirect_test", status: "end"});
       aResolve();
     });
     xhr.addEventListener("error", function (e) {
       ok(false, "unexpected request falilure");
       self.removeEventListener("message", testRedirect);
rename from dom/base/test/file_XHRResponseURL.sjs
rename to dom/xhr/tests/file_XHRResponseURL.sjs
rename from dom/base/test/file_XHRResponseURL.text
rename to dom/xhr/tests/file_XHRResponseURL.text
rename from dom/base/test/file_XHRResponseURL.text^headers^
rename to dom/xhr/tests/file_XHRResponseURL.text^headers^
rename from dom/base/test/file_XHRResponseURL_nocors.text
rename to dom/xhr/tests/file_XHRResponseURL_nocors.text
rename from dom/base/test/file_XHRSendData.sjs
rename to dom/xhr/tests/file_XHRSendData.sjs
rename from dom/base/test/file_XHRSendData_doc.xml
rename to dom/xhr/tests/file_XHRSendData_doc.xml
rename from dom/base/test/file_XHRSendData_doc.xml^headers^
rename to dom/xhr/tests/file_XHRSendData_doc.xml^headers^
rename from dom/base/test/file_XHR_anon.sjs
rename to dom/xhr/tests/file_XHR_anon.sjs
rename from dom/base/test/file_XHR_binary1.bin
rename to dom/xhr/tests/file_XHR_binary1.bin
rename from dom/base/test/file_XHR_binary1.bin^headers^
rename to dom/xhr/tests/file_XHR_binary1.bin^headers^
rename from dom/base/test/file_XHR_binary2.bin
rename to dom/xhr/tests/file_XHR_binary2.bin
rename from dom/base/test/file_XHR_fail1.txt
rename to dom/xhr/tests/file_XHR_fail1.txt
rename from dom/base/test/file_XHR_fail1.txt^headers^
rename to dom/xhr/tests/file_XHR_fail1.txt^headers^
--- a/dom/base/test/file_XHR_fail1.txt^headers^
+++ b/dom/xhr/tests/file_XHR_fail1.txt^headers^
@@ -1,2 +1,2 @@
 HTTP 301 Moved Permanently
-Location: http://example.com/tests/dom/base/test/file_XHR_pass2.txt
+Location: http://example.com/tests/dom/xhr/tests/file_XHR_pass2.txt
rename from dom/base/test/file_XHR_fail1b.txt
rename to dom/xhr/tests/file_XHR_fail1b.txt
rename from dom/base/test/file_XHR_header.sjs
rename to dom/xhr/tests/file_XHR_header.sjs
rename from dom/base/test/file_XHR_pass1.xml
rename to dom/xhr/tests/file_XHR_pass1.xml
rename from dom/base/test/file_XHR_pass2.txt
rename to dom/xhr/tests/file_XHR_pass2.txt
rename from dom/base/test/file_XHR_pass3.txt
rename to dom/xhr/tests/file_XHR_pass3.txt
rename from dom/base/test/file_XHR_pass3.txt^headers^
rename to dom/xhr/tests/file_XHR_pass3.txt^headers^
rename from dom/base/test/file_XHR_system_redirect.html
rename to dom/xhr/tests/file_XHR_system_redirect.html
rename from dom/base/test/file_XHR_system_redirect.html^headers^
rename to dom/xhr/tests/file_XHR_system_redirect.html^headers^
rename from dom/base/test/file_XHR_timeout.sjs
rename to dom/xhr/tests/file_XHR_timeout.sjs
rename from dom/base/test/file_html_in_xhr.html
rename to dom/xhr/tests/file_html_in_xhr.html
rename from dom/base/test/file_html_in_xhr.sjs
rename to dom/xhr/tests/file_html_in_xhr.sjs
rename from dom/base/test/file_html_in_xhr2.html
rename to dom/xhr/tests/file_html_in_xhr2.html
rename from dom/base/test/file_html_in_xhr3.html
rename to dom/xhr/tests/file_html_in_xhr3.html
new file mode 100644
--- /dev/null
+++ b/dom/xhr/tests/mochitest.ini
@@ -0,0 +1,103 @@
+[DEFAULT]
+support-files =
+  echo.sjs
+  file_html_in_xhr.html
+  file_html_in_xhr.sjs
+  file_html_in_xhr2.html
+  file_html_in_xhr3.html
+  file_XHRDocURI.text
+  file_XHRDocURI.text^headers^
+  file_XHRDocURI.xml
+  file_XHRDocURI.xml^headers^
+  file_XHRDocURI.html
+  file_XHRDocURI.html^headers^
+  file_XHRDocURI.sjs
+  file_XHRResponseURL.js
+  file_XHRResponseURL.sjs
+  file_XHRResponseURL.text
+  file_XHRResponseURL.text^headers^
+  file_XHRResponseURL_nocors.text
+  file_XHRSendData.sjs
+  file_XHRSendData_doc.xml
+  file_XHRSendData_doc.xml^headers^
+  file_XHR_anon.sjs
+  file_XHR_binary1.bin
+  file_XHR_binary1.bin^headers^
+  file_XHR_binary2.bin
+  file_XHR_fail1.txt
+  file_XHR_fail1.txt^headers^
+  file_XHR_header.sjs
+  file_XHR_pass1.xml
+  file_XHR_pass2.txt
+  file_XHR_pass3.txt
+  file_XHR_pass3.txt^headers^
+  file_XHR_system_redirect.html
+  file_XHR_system_redirect.html^headers^
+  file_XHR_timeout.sjs
+  progressserver.sjs
+  worker_terminateSyncXHR_frame.html
+  terminateSyncXHR_worker.js
+  worker_testXHR.txt
+  xhr_worker.js
+  xhr2_worker.js
+  xhrAbort_worker.js
+  test_worker_xhr_parameters.js
+  test_worker_xhr_system.js
+  worker_xhr_cors_redirect.js
+  worker_xhr_cors_redirect.sjs
+  worker_xhr_headers_server.sjs
+  worker_xhr_headers_worker.js
+  worker_file_getcookie.sjs
+  xhr_implicit_cancel_worker.js
+  relativeLoad_import.js
+  relativeLoad_worker.js
+  relativeLoad_worker2.js
+  responseIdentical.sjs
+  subdir/relativeLoad_sub_worker.js
+  subdir/relativeLoad_sub_worker2.js
+  subdir/relativeLoad_sub_import.js
+
+[test_xhr_overridemimetype_throws_on_invalid_state.html]
+skip-if = buildapp == 'b2g' # Requires webgl support
+[test_html_in_xhr.html]
+[test_sync_xhr_timer.xhtml]
+skip-if = toolkit == 'android'
+[test_xhr_abort_after_load.html]
+skip-if = toolkit == 'android'
+[test_xhr_forbidden_headers.html]
+[test_xhr_progressevents.html]
+skip-if = toolkit == 'android'
+[test_xhr_send.html]
+[test_xhr_send_readystate.html]
+[test_xhr_withCredentials.html]
+[test_XHR.html]
+[test_XHR_anon.html]
+[test_XHR_header.html]
+[test_XHR_onuploadprogress.html]
+[test_XHR_parameters.html]
+skip-if = buildapp == 'b2g' # b2g(86 total, 4 failing - testing mozAnon - got false, expected true) b2g-debug(86 total, 4 failing - testing mozAnon - got false, expected true) b2g-desktop(86 total, 4 failing - testing mozAnon - got false, expected true)
+[test_XHR_system.html]
+skip-if = (buildapp == 'b2g' && (toolkit != 'gonk' || debug)) # b2g-debug(12 total, 2 failing - .mozSystem == true - got false, expected true + ) b2g-desktop(12 total, 2 failing - .mozSystem == true - got false, expected true + )
+[test_XHR_timeout.html]
+skip-if = buildapp == 'b2g' || (android_version == '18' && debug) # b2g(flaky on B2G, bug 960743) b2g-debug(flaky on B2G, bug 960743) b2g-desktop(flaky on B2G, bug 960743)
+support-files = test_XHR_timeout.js
+[test_XHRDocURI.html]
+[test_XHRResponseURL.html]
+[test_XHRSendData.html]
+[test_worker_terminateSyncXHR.html]
+[test_worker_xhr2.html]
+[test_worker_xhr_3rdparty.html]
+[test_worker_xhrAbort.html]
+[test_worker_xhr_cors_redirect.html]
+skip-if = buildapp == 'b2g'
+[test_worker_xhr_headers.html]
+[test_worker_xhr.html]
+[test_worker_xhr_implicit_cancel.html]
+[test_worker_xhr_parameters.html]
+skip-if = buildapp == 'b2g'
+[test_worker_xhr_responseURL.html]
+[test_worker_xhr_system.html]
+[test_worker_xhr_timeout.html]
+skip-if = (os == "win") || (os == "mac") || toolkit == 'android' #bug 798220
+[test_relativeLoad.html]
+skip-if = buildapp == 'b2g' # b2g(Failed to load script: relativeLoad_import.js) b2g-debug(Failed to load script: relativeLoad_import.js) b2g-desktop(Failed to load script: relativeLoad_import.js)
rename from dom/base/test/progressserver.sjs
rename to dom/xhr/tests/progressserver.sjs
--- a/dom/base/test/progressserver.sjs
+++ b/dom/xhr/tests/progressserver.sjs
@@ -1,20 +1,20 @@
 const CC = Components.Constructor;
 const BinaryInputStream = CC("@mozilla.org/binaryinputstream;1",
                              "nsIBinaryInputStream",
                              "setInputStream");
 
 function setReq(req) {
-  setObjectState("dom/base/test/progressserver", req);
+  setObjectState("dom/xhr/tests/progressserver", req);
 }
 
 function getReq() {
   var req;
-  getObjectState("dom/base/test/progressserver", function(v) {
+  getObjectState("dom/xhr/tests/progressserver", function(v) {
     req = v;
   });
   return req;
 }
 
 function handleRequest(request, response)
 {
   var pairs = request.queryString.split('&');
rename from dom/workers/test/relativeLoad_import.js
rename to dom/xhr/tests/relativeLoad_import.js
rename from dom/workers/test/relativeLoad_worker.js
rename to dom/xhr/tests/relativeLoad_worker.js
--- a/dom/workers/test/relativeLoad_worker.js
+++ b/dom/xhr/tests/relativeLoad_worker.js
@@ -1,17 +1,17 @@
 /**
  * Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/
  */
 const importURL = "relativeLoad_import.js";
 
 onmessage = function(event) {
   var xhr = new XMLHttpRequest();
-  xhr.open("GET", "testXHR.txt", false);
+  xhr.open("GET", "worker_testXHR.txt", false);
   xhr.send(null);
   if (xhr.status != 200 ||
       xhr.responseText != "A noisy noise annoys an oyster.") {
     throw "Couldn't get xhr text from where we wanted it!";
   }
 
   importScripts(importURL);
   var worker = new Worker("relativeLoad_worker2.js");
rename from dom/workers/test/relativeLoad_worker2.js
rename to dom/xhr/tests/relativeLoad_worker2.js
rename from dom/base/test/responseIdentical.sjs
rename to dom/xhr/tests/responseIdentical.sjs
rename from dom/workers/test/subdir/relativeLoad_sub_import.js
rename to dom/xhr/tests/subdir/relativeLoad_sub_import.js
rename from dom/workers/test/subdir/relativeLoad_sub_worker.js
rename to dom/xhr/tests/subdir/relativeLoad_sub_worker.js
rename from dom/workers/test/subdir/relativeLoad_sub_worker2.js
rename to dom/xhr/tests/subdir/relativeLoad_sub_worker2.js
rename from dom/workers/test/terminateSyncXHR_worker.js
rename to dom/xhr/tests/terminateSyncXHR_worker.js
--- a/dom/workers/test/terminateSyncXHR_worker.js
+++ b/dom/xhr/tests/terminateSyncXHR_worker.js
@@ -3,17 +3,17 @@
  * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 onmessage = function(event) {
   throw "No messages should reach me!";
 }
 
 var xhr = new XMLHttpRequest();
-xhr.open("GET", "testXHR.txt", false);
+xhr.open("GET", "worker_testXHR.txt", false);
 xhr.addEventListener("loadstart", function ()
 {
   // Tell the parent to terminate us.
   postMessage("TERMINATE");
   // And wait for it to do so.
   while(1) { true; }
 });
 xhr.send(null);
rename from dom/base/test/test_XHR.html
rename to dom/xhr/tests/test_XHR.html
--- a/dom/base/test/test_XHR.html
+++ b/dom/xhr/tests/test_XHR.html
@@ -15,17 +15,17 @@
 "use strict";
 SimpleTest.waitForExplicitFinish();
 
 var gen = runTests();
 function continueTest() { gen.next(); }
 
 function runTests() {
 
-var path = "/tests/dom/base/test/";
+var path = "/tests/dom/xhr/tests/";
 
 var passFiles = [['file_XHR_pass1.xml', 'GET', 200, 'OK', 'text/xml'],
                  ['file_XHR_pass2.txt', 'GET', 200, 'OK', 'text/plain'],
                  ['file_XHR_pass3.txt', 'GET', 200, 'OK', 'text/plain'],
                  ['data:text/xml,%3Cres%3Ehello%3C/res%3E%0A', 'GET', 200, 'OK', 'text/xml'],
                  ['data:text/plain,hello%20pass%0A', 'GET', 200, 'OK', 'text/plain'],
                  ['data:,foo', 'GET', 200, 'OK', 'text/plain;charset=US-ASCII', 'foo'],
                  ['data:text/plain;base64,Zm9v', 'GET', 200, 'OK', 'text/plain', 'foo'],
rename from dom/base/test/test_XHRDocURI.html
rename to dom/xhr/tests/test_XHRDocURI.html
--- a/dom/base/test/test_XHRDocURI.html
+++ b/dom/xhr/tests/test_XHRDocURI.html
@@ -101,198 +101,198 @@ function testCloneDocURI(aDoc) {
   is(clone.baseURI, aDoc.baseURI, "wrong base (clone)");
 }
 
 function runTest() {
   is(document.baseURI, "http://example.org/", "wrong doc baseURI");
 
   // use content XHR and access URI properties from content privileged script
   xhr = new XMLHttpRequest;
-  xhr.open("GET", "http://mochi.test:8888/tests/dom/base/test/file_XHRDocURI.xml");
+  xhr.open("GET", "http://mochi.test:8888/tests/dom/xhr/tests/file_XHRDocURI.xml");
   xhr.onreadystatechange = function(e) {
     if (!xhr.responseXML) {
       return;
     }
     var expects = {
-      documentURI: "http://mochi.test:8888/tests/dom/base/test/file_XHRDocURI.xml",
-      baseURI: "http://mochi.test:8888/tests/dom/base/test/file_XHRDocURI.xml",
+      documentURI: "http://mochi.test:8888/tests/dom/xhr/tests/file_XHRDocURI.xml",
+      baseURI: "http://mochi.test:8888/tests/dom/xhr/tests/file_XHRDocURI.xml",
       elementBaseURI: "http://www.example.com/"
     };
     testXMLDocURI(xhr.responseXML, expects);
     if (xhr.readyState == 4) {
       gen.next();
     }
   };
   xhr.send();
   yield undefined;
 
   xhr = new XMLHttpRequest;
-  xhr.open("GET", "http://mochi.test:8888/tests/dom/base/test/file_XHRDocURI.html");
+  xhr.open("GET", "http://mochi.test:8888/tests/dom/xhr/tests/file_XHRDocURI.html");
   xhr.responseType = "document";
   xhr.onreadystatechange = function(e) {
     if (!xhr.response) {
       return;
     }
     var expects = {
-      documentURI: "http://mochi.test:8888/tests/dom/base/test/file_XHRDocURI.html",
-      baseURI: "http://mochi.test:8888/tests/dom/base/test/file_XHRDocURI.html"
+      documentURI: "http://mochi.test:8888/tests/dom/xhr/tests/file_XHRDocURI.html",
+      baseURI: "http://mochi.test:8888/tests/dom/xhr/tests/file_XHRDocURI.html"
     };
     testHTMLDocURI(xhr.response, expects);
     if (xhr.readyState == 4) {
       gen.next();
     }
   };
   xhr.send();
   yield undefined;
 
   xhr = new XMLHttpRequest;
-  xhr.open("GET", "http://mochi.test:8888/tests/dom/base/test/file_XHRDocURI.text");
+  xhr.open("GET", "http://mochi.test:8888/tests/dom/xhr/tests/file_XHRDocURI.text");
   xhr.onreadystatechange = function(e) {
     is(xhr.responseXML, null, "should not have document");
     if (xhr.readyState == 4) {
       gen.next();
     }
   };
   xhr.send();
   yield undefined;
 
   xhr = new XMLHttpRequest;
-  xhr.open("GET", "http://example.com/tests/dom/base/test/file_XHRDocURI.xml");
+  xhr.open("GET", "http://example.com/tests/dom/xhr/tests/file_XHRDocURI.xml");
   xhr.onreadystatechange = function(e) {
     if (!xhr.responseXML) {
       return;
     }
     var expects = {
-      documentURI: "http://example.com/tests/dom/base/test/file_XHRDocURI.xml",
-      baseURI: "http://example.com/tests/dom/base/test/file_XHRDocURI.xml",
+      documentURI: "http://example.com/tests/dom/xhr/tests/file_XHRDocURI.xml",
+      baseURI: "http://example.com/tests/dom/xhr/tests/file_XHRDocURI.xml",
       elementBaseURI: "http://www.example.com/"
     };
     testXMLDocURI(xhr.responseXML, expects);
     if (xhr.readyState == 4) {
       gen.next();
     }
   };
   xhr.send();
   yield undefined;
 
   xhr = new XMLHttpRequest;
-  xhr.open("GET", "http://example.com/tests/dom/base/test/file_XHRDocURI.html");
+  xhr.open("GET", "http://example.com/tests/dom/xhr/tests/file_XHRDocURI.html");
   xhr.responseType = "document";
   xhr.onreadystatechange = function(e) {
     if (!xhr.response) {
       return;
     }
     var expects = {
-      documentURI: "http://example.com/tests/dom/base/test/file_XHRDocURI.html",
-      baseURI: "http://example.com/tests/dom/base/test/file_XHRDocURI.html"
+      documentURI: "http://example.com/tests/dom/xhr/tests/file_XHRDocURI.html",
+      baseURI: "http://example.com/tests/dom/xhr/tests/file_XHRDocURI.html"
     };
     testHTMLDocURI(xhr.response, expects);
     if (xhr.readyState == 4) {
       gen.next();
     }
   };
   xhr.send();
   yield undefined;
 
   xhr = new XMLHttpRequest;
-  xhr.open("GET", "http://mochi.test:8888/tests/dom/base/test/file_XHRDocURI.sjs?url=http://example.com/tests/dom/base/test/file_XHRDocURI.xml");
+  xhr.open("GET", "http://mochi.test:8888/tests/dom/xhr/tests/file_XHRDocURI.sjs?url=http://example.com/tests/dom/xhr/tests/file_XHRDocURI.xml");
   xhr.onreadystatechange = function(e) {
     if (!xhr.responseXML) {
       return;
     }
     var expects = {
-      documentURI: "http://example.com/tests/dom/base/test/file_XHRDocURI.xml",
-      baseURI: "http://example.com/tests/dom/base/test/file_XHRDocURI.xml",
+      documentURI: "http://example.com/tests/dom/xhr/tests/file_XHRDocURI.xml",
+      baseURI: "http://example.com/tests/dom/xhr/tests/file_XHRDocURI.xml",
       elementBaseURI: "http://www.example.com/"
     };
     testXMLDocURI(xhr.responseXML, expects);
     if (xhr.readyState == 4) {
       gen.next();
     }
   };
   xhr.send();
   yield undefined;
 
   xhr = new XMLHttpRequest;
-  xhr.open("GET", "http://mochi.test:8888/tests/dom/base/test/file_XHRDocURI.sjs?url=http://example.com/tests/dom/base/test/file_XHRDocURI.html");
+  xhr.open("GET", "http://mochi.test:8888/tests/dom/xhr/tests/file_XHRDocURI.sjs?url=http://example.com/tests/dom/xhr/tests/file_XHRDocURI.html");
   xhr.responseType = "document";
   xhr.onreadystatechange = function(e) {
     if (!xhr.response) {
       return;
     }
     var expects = {
-      documentURI: "http://example.com/tests/dom/base/test/file_XHRDocURI.html",
-      baseURI: "http://example.com/tests/dom/base/test/file_XHRDocURI.html"
+      documentURI: "http://example.com/tests/dom/xhr/tests/file_XHRDocURI.html",
+      baseURI: "http://example.com/tests/dom/xhr/tests/file_XHRDocURI.html"
     };
     testHTMLDocURI(xhr.response, expects);
     if (xhr.readyState == 4) {
       gen.next();
     }
   };
   xhr.send();
   yield undefined;
 
   xhr = new XMLHttpRequest;
-  xhr.open("GET", "http://example.com/tests/dom/base/test/file_XHRDocURI.text");
+  xhr.open("GET", "http://example.com/tests/dom/xhr/tests/file_XHRDocURI.text");
   xhr.onreadystatechange = function(e) {
     is(xhr.responseXML, null, "should not have document");
     if (xhr.readyState == 4) {
       gen.next();
     }
   };
   xhr.send();
   yield undefined;
 
 
   // use content XHR and access URI properties from chrome privileged script
 
   xhr = new XMLHttpRequest;
-  xhr.open("GET", "http://mochi.test:8888/tests/dom/base/test/file_XHRDocURI.xml");
+  xhr.open("GET", "http://mochi.test:8888/tests/dom/xhr/tests/file_XHRDocURI.xml");
   xhr.onreadystatechange = function(e) {
     if (!xhr.responseXML) {
       return;
     }
     var expects = {
-      documentURI: "http://mochi.test:8888/tests/dom/base/test/file_XHRDocURI.xml",
-      baseURI: "http://mochi.test:8888/tests/dom/base/test/file_XHRDocURI.xml",
+      documentURI: "http://mochi.test:8888/tests/dom/xhr/tests/file_XHRDocURI.xml",
+      baseURI: "http://mochi.test:8888/tests/dom/xhr/tests/file_XHRDocURI.xml",
       elementBaseURI: "http://www.example.com/"
     };
     var xml = SpecialPowers.wrap(xhr.responseXML);
     testChromeXMLDocURI(xml, expects);
     testCloneDocURI(xml);
     if (xhr.readyState == 4) {
       gen.next();
     }
   };
   xhr.send();
   yield undefined;
 
   xhr = new XMLHttpRequest;
-  xhr.open("GET", "http://mochi.test:8888/tests/dom/base/test/file_XHRDocURI.html");
+  xhr.open("GET", "http://mochi.test:8888/tests/dom/xhr/tests/file_XHRDocURI.html");
   xhr.responseType = "document";
   xhr.onreadystatechange = function(e) {
     if (!xhr.response) {
       return;
     }
     var expects = {
-      documentURI: "http://mochi.test:8888/tests/dom/base/test/file_XHRDocURI.html",
-      baseURI: "http://mochi.test:8888/tests/dom/base/test/file_XHRDocURI.html"
+      documentURI: "http://mochi.test:8888/tests/dom/xhr/tests/file_XHRDocURI.html",
+      baseURI: "http://mochi.test:8888/tests/dom/xhr/tests/file_XHRDocURI.html"
     };
     var doc = SpecialPowers.wrap(xhr.response);
-    testChromeHTMLDocURI(doc, "http://mochi.test:8888/tests/dom/base/test/file_XHRDocURI.html", expects);
+    testChromeHTMLDocURI(doc, "http://mochi.test:8888/tests/dom/xhr/tests/file_XHRDocURI.html", expects);
     testCloneDocURI(doc);
     if (xhr.readyState == 4) {
       gen.next();
     }
   };
   xhr.send();
   yield undefined;
 
   xhr = new XMLHttpRequest;
-  xhr.open("GET", "http://example.com/tests/dom/base/test/file_XHRDocURI.xml");
+  xhr.open("GET", "http://example.com/tests/dom/xhr/tests/file_XHRDocURI.xml");
   xhr.onreadystatechange = function(e) {
     if (!xhr.responseXML) {
       return;
     }
     var expects = {
       documentURI: document.documentURI,
       baseURI: document.baseURI,
       elementBaseURI: "http://www.example.com/"
@@ -303,38 +303,38 @@ function runTest() {
     if (xhr.readyState == 4) {
       gen.next();
     }
   };
   xhr.send();
   yield undefined;
 
   xhr = new XMLHttpRequest;
-  xhr.open("GET", "http://example.com/tests/dom/base/test/file_XHRDocURI.html");
+  xhr.open("GET", "http://example.com/tests/dom/xhr/tests/file_XHRDocURI.html");
   xhr.responseType = "document";
   xhr.onreadystatechange = function(e) {
     if (!xhr.response) {
       return;
     }
     var expects = {
       documentURI: document.documentURI,
       baseURI: document.baseURI
     };
     var doc = SpecialPowers.wrap(xhr.response);
-    testChromeHTMLDocURI(doc, "http://example.com/tests/dom/base/test/file_XHRDocURI.html", expects);
+    testChromeHTMLDocURI(doc, "http://example.com/tests/dom/xhr/tests/file_XHRDocURI.html", expects);
     testCloneDocURI(doc);
     if (xhr.readyState == 4) {
       gen.next();
     }
   };
   xhr.send();
   yield undefined;
 
   xhr = new XMLHttpRequest;
-  xhr.open("GET", "http://mochi.test:8888/tests/dom/base/test/file_XHRDocURI.sjs?url=http://example.com/tests/dom/base/test/file_XHRDocURI.xml");
+  xhr.open("GET", "http://mochi.test:8888/tests/dom/xhr/tests/file_XHRDocURI.sjs?url=http://example.com/tests/dom/xhr/tests/file_XHRDocURI.xml");
   xhr.onreadystatechange = function(e) {
     if (!xhr.responseXML) {
       return;
     }
     var expects = {
       documentURI: document.documentURI,
       baseURI: document.baseURI,
       elementBaseURI: "http://www.example.com/"
@@ -345,144 +345,144 @@ function runTest() {
     if (xhr.readyState == 4) {
       gen.next();
     }
   };
   xhr.send();
   yield undefined;
 
   xhr = new XMLHttpRequest;
-  xhr.open("GET", "http://mochi.test:8888/tests/dom/base/test/file_XHRDocURI.sjs?url=http://example.com/tests/dom/base/test/file_XHRDocURI.html");
+  xhr.open("GET", "http://mochi.test:8888/tests/dom/xhr/tests/file_XHRDocURI.sjs?url=http://example.com/tests/dom/xhr/tests/file_XHRDocURI.html");
   xhr.responseType = "document";
   xhr.onreadystatechange = function(e) {
     if (!xhr.response) {
       return;
     }
     var expects = {
       documentURI: document.documentURI,
       baseURI: document.baseURI
     };
     var doc = SpecialPowers.wrap(xhr.response);
-    testChromeHTMLDocURI(doc, "http://example.com/tests/dom/base/test/file_XHRDocURI.html", expects);
+    testChromeHTMLDocURI(doc, "http://example.com/tests/dom/xhr/tests/file_XHRDocURI.html", expects);
     testCloneDocURI(doc);
     if (xhr.readyState == 4) {
       gen.next();
     }
   };
   xhr.send();
   yield undefined;
 
 
   // use the systemXHR special privilege
   SpecialPowers.addPermission("systemXHR", true, document);
   xhr = new XMLHttpRequest({mozAnon: false, mozSystem: true});
-  xhr.open("GET", "http://mochi.test:8888/tests/dom/base/test/file_XHRDocURI.xml");
+  xhr.open("GET", "http://mochi.test:8888/tests/dom/xhr/tests/file_XHRDocURI.xml");
   xhr.onreadystatechange = function(e) {
     if (!xhr.responseXML) {
       return;
     }
     var expects = {
-      documentURI: "http://mochi.test:8888/tests/dom/base/test/file_XHRDocURI.xml",
-      baseURI: "http://mochi.test:8888/tests/dom/base/test/file_XHRDocURI.xml",
+      documentURI: "http://mochi.test:8888/tests/dom/xhr/tests/file_XHRDocURI.xml",
+      baseURI: "http://mochi.test:8888/tests/dom/xhr/tests/file_XHRDocURI.xml",
       elementBaseURI: "http://www.example.com/"
     };
     testXMLDocURI(xhr.responseXML, expects);
     if (xhr.readyState == 4) {
       gen.next();
     }
   };
   xhr.send();
   yield undefined;
 
   xhr = new XMLHttpRequest({mozAnon: false, mozSystem: true});
-  xhr.open("GET", "http://mochi.test:8888/tests/dom/base/test/file_XHRDocURI.html");
+  xhr.open("GET", "http://mochi.test:8888/tests/dom/xhr/tests/file_XHRDocURI.html");
   xhr.responseType = "document";
   xhr.onreadystatechange = function(e) {
     if (!xhr.response) {
       return;
     }
     var expects = {
-      documentURI: "http://mochi.test:8888/tests/dom/base/test/file_XHRDocURI.html",
-      baseURI: "http://mochi.test:8888/tests/dom/base/test/file_XHRDocURI.html"
+      documentURI: "http://mochi.test:8888/tests/dom/xhr/tests/file_XHRDocURI.html",
+      baseURI: "http://mochi.test:8888/tests/dom/xhr/tests/file_XHRDocURI.html"
     };
     testHTMLDocURI(xhr.response, expects);
     if (xhr.readyState == 4) {
       gen.next();
     }
   };
   xhr.send();
   yield undefined;
 
   xhr = new XMLHttpRequest({mozAnon: false, mozSystem: true});
-  xhr.open("GET", "http://example.com/tests/dom/base/test/file_XHRDocURI.xml");
+  xhr.open("GET", "http://example.com/tests/dom/xhr/tests/file_XHRDocURI.xml");
   xhr.onreadystatechange = function(e) {
     if (!xhr.responseXML) {
       return;
     }
     var expects = {
-      documentURI: "http://example.com/tests/dom/base/test/file_XHRDocURI.xml",
-      baseURI: "http://example.com/tests/dom/base/test/file_XHRDocURI.xml",
+      documentURI: "http://example.com/tests/dom/xhr/tests/file_XHRDocURI.xml",
+      baseURI: "http://example.com/tests/dom/xhr/tests/file_XHRDocURI.xml",
       elementBaseURI: "http://www.example.com/"
     };
     testXMLDocURI(xhr.responseXML, expects);
     if (xhr.readyState == 4) {
       gen.next();
     }
   };
   xhr.send();
   yield undefined;
 
   xhr = new XMLHttpRequest({mozAnon: false, mozSystem: true});
-  xhr.open("GET", "http://example.com/tests/dom/base/test/file_XHRDocURI.html");
+  xhr.open("GET", "http://example.com/tests/dom/xhr/tests/file_XHRDocURI.html");
   xhr.responseType = "document";
   xhr.onreadystatechange = function(e) {
     if (!xhr.response) {
       return;
     }
     var expects = {
-      documentURI: "http://example.com/tests/dom/base/test/file_XHRDocURI.html",
-      baseURI: "http://example.com/tests/dom/base/test/file_XHRDocURI.html"
+      documentURI: "http://example.com/tests/dom/xhr/tests/file_XHRDocURI.html",
+      baseURI: "http://example.com/tests/dom/xhr/tests/file_XHRDocURI.html"
     };
     testHTMLDocURI(xhr.response, expects);
     if (xhr.readyState == 4) {
       gen.next();
     }
   };
   xhr.send();
   yield undefined;
 
   xhr = new XMLHttpRequest({mozAnon: false, mozSystem: true});
-  xhr.open("GET", "http://mochi.test:8888/tests/dom/base/test/file_XHRDocURI.sjs?url=http://example.com/tests/dom/base/test/file_XHRDocURI.xml");
+  xhr.open("GET", "http://mochi.test:8888/tests/dom/xhr/tests/file_XHRDocURI.sjs?url=http://example.com/tests/dom/xhr/tests/file_XHRDocURI.xml");
   xhr.onreadystatechange = function(e) {
     if (!xhr.responseXML) {
       return;
     }
     var expects = {
-      documentURI: "http://example.com/tests/dom/base/test/file_XHRDocURI.xml",
-      baseURI: "http://example.com/tests/dom/base/test/file_XHRDocURI.xml",
+      documentURI: "http://example.com/tests/dom/xhr/tests/file_XHRDocURI.xml",
+      baseURI: "http://example.com/tests/dom/xhr/tests/file_XHRDocURI.xml",
       elementBaseURI: "http://www.example.com/"
     };
     testXMLDocURI(xhr.responseXML, expects);
     if (xhr.readyState == 4) {
       gen.next();
     }
   };
   xhr.send();
   yield undefined;
 
   xhr = new XMLHttpRequest({mozAnon: false, mozSystem: true});
-  xhr.open("GET", "http://mochi.test:8888/tests/dom/base/test/file_XHRDocURI.sjs?url=http://example.com/tests/dom/base/test/file_XHRDocURI.html");
+  xhr.open("GET", "http://mochi.test:8888/tests/dom/xhr/tests/file_XHRDocURI.sjs?url=http://example.com/tests/dom/xhr/tests/file_XHRDocURI.html");
   xhr.responseType = "document";
   xhr.onreadystatechange = function(e) {
     if (!xhr.response) {
       return;
     }
     var expects = {
-      documentURI: "http://example.com/tests/dom/base/test/file_XHRDocURI.html",
-      baseURI: "http://example.com/tests/dom/base/test/file_XHRDocURI.html"
+      documentURI: "http://example.com/tests/dom/xhr/tests/file_XHRDocURI.html",
+      baseURI: "http://example.com/tests/dom/xhr/tests/file_XHRDocURI.html"
     };
     testHTMLDocURI(xhr.response, expects);
     if (xhr.readyState == 4) {
       gen.next();
     }
   };
   xhr.send();
   yield undefined;
rename from dom/base/test/test_XHRResponseURL.html
rename to dom/xhr/tests/test_XHRResponseURL.html
rename from dom/base/test/test_XHRSendData.html
rename to dom/xhr/tests/test_XHRSendData.html
rename from dom/base/test/test_XHR_anon.html
rename to dom/xhr/tests/test_XHR_anon.html
--- a/dom/base/test/test_XHR_anon.html
+++ b/dom/xhr/tests/test_XHR_anon.html
@@ -12,17 +12,17 @@
 </p>
 <div id="content" style="display: none">
   
 </div>
 <pre id="test">
 <script class="testbody" type="application/javascript;version=1.8">
 
 // An XHR with the anon flag set will not send cookie and auth information.
-const TEST_URL = "http://example.com/tests/dom/base/test/file_XHR_anon.sjs";
+const TEST_URL = "http://example.com/tests/dom/xhr/tests/file_XHR_anon.sjs";
 document.cookie = "foo=bar";
 
 let am = {
   authMgr: null,
 
   init: function() {
     this.authMgr = SpecialPowers.Cc["@mozilla.org/network/http-auth-manager;1"]
                                 .getService(SpecialPowers.Ci.nsIHttpAuthManager)
@@ -38,16 +38,19 @@ let am = {
   },
 }
 
 var tests = [ test1, test2, test2a, test3, test3, test3, test4, test4, test4, test5, test5, test5 ];
 
 function runTests() {
   if (!tests.length) {
     am.tearDown();
+
+    // Resetting the cookie.
+    document.cookie = "foo=; expires=Thu, 01 Jan 1970 00:00:00 GMT";
     SimpleTest.finish();
     return;
   }
 
   var test = tests.shift();
   test();
 }
 
rename from dom/base/test/test_XHR_header.html
rename to dom/xhr/tests/test_XHR_header.html
rename from dom/base/test/test_XHR_onuploadprogress.html
rename to dom/xhr/tests/test_XHR_onuploadprogress.html
rename from dom/base/test/test_XHR_parameters.html
rename to dom/xhr/tests/test_XHR_parameters.html
rename from dom/base/test/test_XHR_system.html
rename to dom/xhr/tests/test_XHR_system.html
--- a/dom/base/test/test_XHR_system.html
+++ b/dom/xhr/tests/test_XHR_system.html
@@ -13,18 +13,18 @@
   
 </div>
 <pre id="test">
 <script class="testbody" type="application/javascript;version=1.8">
 
 let tests = [];
 
 const PROTECTED_URL = "file:///etc/passwd";
-const REDIRECT_URL = window.location.protocol + "//" + window.location.host + "/tests/dom/base/test/file_XHR_system_redirect.html";
-const CROSSSITE_URL = "http://example.com/tests/dom/base/test/test_XHR_system.html";
+const REDIRECT_URL = window.location.protocol + "//" + window.location.host + "/tests/dom/xhr/tests/file_XHR_system_redirect.html";
+const CROSSSITE_URL = "http://example.com/tests/dom/xhr/tests/test_XHR_system.html";
 
 tests.push(function test_cross_origin() {
   // System XHR can load cross-origin resources.
 
   is(window.location.hostname, "mochi.test", "correct origin");
 
   let xhr = new XMLHttpRequest({mozSystem: true});
   is(xhr.mozSystem, true, ".mozSystem == true");
rename from dom/base/test/test_XHR_timeout.html
rename to dom/xhr/tests/test_XHR_timeout.html
rename from dom/base/test/test_XHR_timeout.js
rename to dom/xhr/tests/test_XHR_timeout.js
rename from dom/base/test/test_html_in_xhr.html
rename to dom/xhr/tests/test_html_in_xhr.html
rename from dom/workers/test/test_relativeLoad.html
rename to dom/xhr/tests/test_relativeLoad.html
rename from dom/base/test/test_sync_xhr_timer.xhtml
rename to dom/xhr/tests/test_sync_xhr_timer.xhtml
rename from dom/workers/test/test_terminateSyncXHR.html
rename to dom/xhr/tests/test_worker_terminateSyncXHR.html
--- a/dom/workers/test/test_terminateSyncXHR.html
+++ b/dom/xhr/tests/test_worker_terminateSyncXHR.html
@@ -11,17 +11,17 @@ Tests of DOM Worker Threads XHR(Bug 4504
   <title>Test for DOM Worker Threads XHR (Bug 450452 )</title>
   <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
 </head>
 <body>
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=450452">DOM Worker Threads XHR (Bug 450452)</a>
 <p id="display"></p>
 <div id="content">
-  <iframe id="iframe" src="terminateSyncXHR_frame.html"></iframe>
+  <iframe id="iframe" src="worker_terminateSyncXHR_frame.html"></iframe>
 </div>
 <pre id="test">
 <script class="testbody" type="text/javascript">
   var ifr = document.getElementById("iframe");
 
   window.onmessage = function(event) {
     if (event.data == "TERMINATE") {
       ok(true, "Got TERMINATE");
rename from dom/workers/test/test_xhr.html
rename to dom/xhr/tests/test_worker_xhr.html
--- a/dom/workers/test/test_xhr.html
+++ b/dom/xhr/tests/test_worker_xhr.html
@@ -57,17 +57,17 @@ Tests of DOM Worker Threads XHR(Bug 4504
   };
 
   worker.onerror = function(event) {
     is(event.target, worker);
     ok(false, "Worker had an error:" + event.message);
     SimpleTest.finish();
   }
 
-  worker.postMessage("testXHR.txt");
+  worker.postMessage("worker_testXHR.txt");
 
   SimpleTest.waitForExplicitFinish();
 
 </script>
 </pre>
 </body>
 </html>
 
rename from dom/workers/test/test_xhr2.html
rename to dom/xhr/tests/test_worker_xhr2.html
--- a/dom/workers/test/test_xhr2.html
+++ b/dom/xhr/tests/test_worker_xhr2.html
@@ -22,17 +22,17 @@ Tests of DOM Worker Threads XHR(Bug 4504
 <script class="testbody" type="text/javascript">
 
   var worker = new Worker("xhr2_worker.js");
 
   worker.onmessage = function(event) {
     is(event.data, "done", "Got correct result");
     SimpleTest.finish();
   }
-  worker.postMessage("testXHR.txt");
+  worker.postMessage("worker_testXHR.txt");
 
   SimpleTest.waitForExplicitFinish();
 
 </script>
 </pre>
 </body>
 </html>
 
rename from dom/workers/test/test_xhrAbort.html
rename to dom/xhr/tests/test_worker_xhrAbort.html
rename from dom/workers/test/test_xhr_3rdparty.html
rename to dom/xhr/tests/test_worker_xhr_3rdparty.html
--- a/dom/workers/test/test_xhr_3rdparty.html
+++ b/dom/xhr/tests/test_worker_xhr_3rdparty.html
@@ -59,16 +59,16 @@ Tests of DOM Worker Threads XHR(Bug 4504
   worker.onerror = function(event) {
     is(event.target, worker);
     ok(false, "Worker had an error:" + event.message);
     SimpleTest.finish();
   }
 
   document.cookie = "a=cookie_is_set";
   SpecialPowers.pushPrefEnv({ set: [[ "network.cookie.cookieBehavior", 1 ]] },
-                            () => worker.postMessage("file_getcookie.sjs"));
+                            () => worker.postMessage("worker_file_getcookie.sjs"));
 
   SimpleTest.waitForExplicitFinish();
 
 </script>
 </pre>
 </body>
 </html>
rename from dom/workers/test/test_xhr_cors_redirect.html
rename to dom/xhr/tests/test_worker_xhr_cors_redirect.html
--- a/dom/workers/test/test_xhr_cors_redirect.html
+++ b/dom/xhr/tests/test_worker_xhr_cors_redirect.html
@@ -4,25 +4,25 @@
   <meta charset="utf-8">
   <title>Test for Bug 1206121</title>
   <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
   <script type="application/javascript">
 
 "use strict";
 
-var worker = new Worker("xhr_cors_redirect.js");
+var worker = new Worker("worker_xhr_cors_redirect.js");
 worker.onmessage = function(e) {
   is(e.data, 200, "We want to read 200 here.");
   runTests();
 };
 
-var tests = [ 'http://example.com/tests/dom/workers/test/xhr_cors_redirect.sjs',
-              'http://example.com/tests/dom/workers/test/xhr_cors_redirect.sjs?redirect',
-              'xhr_cors_redirect.sjs?redirect' ];
+var tests = [ 'http://example.com/tests/dom/xhr/tests/worker_xhr_cors_redirect.sjs',
+              'http://example.com/tests/dom/xhr/tests/worker_xhr_cors_redirect.sjs?redirect',
+              'worker_xhr_cors_redirect.sjs?redirect' ];
 function runTests() {
   if (!tests.length) {
     SimpleTest.finish();
     return;
   }
 
   worker.postMessage(tests.shift());
 }
rename from dom/workers/test/test_xhr_headers.html
rename to dom/xhr/tests/test_worker_xhr_headers.html
--- a/dom/workers/test/test_xhr_headers.html
+++ b/dom/xhr/tests/test_worker_xhr_headers.html
@@ -16,17 +16,17 @@
     <pre id="test">
       <script class="testbody">
 "use strict";
 
 SimpleTest.waitForExplicitFinish();
 
 var path =
   location.pathname.substring(0, location.pathname.lastIndexOf("/") + 1);
-var filenamePrefix = "xhr_headers_";
+var filenamePrefix = "worker_xhr_headers_";
 var serverFilename = filenamePrefix + "server.sjs";
 var workerFilename = filenamePrefix + "worker.js";
 var otherHost = "example.com";
 
 info("Informing server about the current host");
 
 var xhr = new XMLHttpRequest();
 xhr.open("POST", path + serverFilename);
rename from dom/workers/test/test_xhr_implicit_cancel.html
rename to dom/xhr/tests/test_worker_xhr_implicit_cancel.html
rename from dom/workers/test/test_xhr_parameters.html
rename to dom/xhr/tests/test_worker_xhr_parameters.html
--- a/dom/workers/test/test_xhr_parameters.html
+++ b/dom/xhr/tests/test_worker_xhr_parameters.html
@@ -21,28 +21,28 @@ function message(event) {
   else if(event.data.test == 'is')
     is(event.data.a, event.data.b, event.data.event);
   else if(event.data.test == 'finish') {
     run();
   }
 };
 
 function test1() {
-  var worker = new Worker("test_xhr_parameters.js");
+  var worker = new Worker("test_worker_xhr_parameters.js");
   worker.onmessage = message;
 
   // Run the tests once without API privileges...
   worker.postMessage(false);
 }
 
 function test2() {
   // ...and once with privileges.
   SpecialPowers.pushPermissions([{type: "systemXHR", allow: true, context: document}],
     function () {
-      var worker = new Worker("test_xhr_parameters.js");
+      var worker = new Worker("test_worker_xhr_parameters.js");
       worker.onmessage = message;
       worker.postMessage(true);
     }
   );
 }
 
 var tests = [ test1, test2 ];
 function run() {
rename from dom/workers/test/test_xhr_parameters.js
rename to dom/xhr/tests/test_worker_xhr_parameters.js
--- a/dom/workers/test/test_xhr_parameters.js
+++ b/dom/xhr/tests/test_worker_xhr_parameters.js
@@ -1,17 +1,17 @@
 function ok(what, msg) {
   postMessage({ event: msg, test: 'ok', a: what });
 }
 
 function is(a, b, msg) {
   postMessage({ event: msg, test: 'is', a: a, b: b });
 }
 
-// This is a copy of dom/base/test/test_XHR_parameters.js
+// This is a copy of dom/xhr/tests/test_XHR_parameters.js
 var validParameters = [
   undefined,
   null,
   {},
   {mozSystem: ""},
   {mozSystem: 0},
   {mozAnon: 1},
   {mozAnon: []},
rename from dom/workers/test/test_xhr_responseURL.html
rename to dom/xhr/tests/test_worker_xhr_responseURL.html
--- a/dom/workers/test/test_xhr_responseURL.html
+++ b/dom/xhr/tests/test_worker_xhr_responseURL.html
@@ -8,17 +8,17 @@ https://bugzilla.mozilla.org/show_bug.cg
   <title>Test for Bug 998076</title>
   <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
   <script type="application/javascript">
 
 /** Test for Bug 998076 **/
 "use strict";
 
-var worker = new Worker("../../../dom/base/test/file_XHRResponseURL.js");
+var worker = new Worker("../../../dom/xhr/tests/file_XHRResponseURL.js");
 
 var requestObserver = {
   observe: function (aSubject, aTopic, aData) {
     worker.postMessage("request");
   }
 };
 
 worker.addEventListener("message", function (aEvent) {
rename from dom/workers/test/test_xhr_system.html
rename to dom/xhr/tests/test_worker_xhr_system.html
--- a/dom/workers/test/test_xhr_system.html
+++ b/dom/xhr/tests/test_worker_xhr_system.html
@@ -21,17 +21,17 @@ function message(event) {
   else if(event.data.test == 'is')
     is(event.data.a, event.data.b, event.data.event);
   else if(event.data.test == 'finish') {
     run();
   }
 };
 
 function test1() {
-  var worker = new Worker("test_xhr_system.js");
+  var worker = new Worker("test_worker_xhr_system.js");
   worker.onmessage = message;
   worker.postMessage(true);
 }
 
 var tests = [ test1 ];
 function run() {
   if (!tests.length) {
     SimpleTest.finish();
rename from dom/workers/test/test_xhr_system.js
rename to dom/xhr/tests/test_worker_xhr_system.js
--- a/dom/workers/test/test_xhr_system.js
+++ b/dom/xhr/tests/test_worker_xhr_system.js
@@ -5,17 +5,17 @@ function ok(what, msg) {
 function is(a, b, msg) {
   postMessage({ event: msg, test: 'is', a: a, b: b });
 }
 
 self.onmessage = function onmessage(event) {
 
   // An XHR with system privileges will be able to do cross-site calls.
 
-  const TEST_URL = "http://example.com/tests/dom/base/test/test_XHR_system.html";
+  const TEST_URL = "http://example.com/tests/dom/xhr/tests/test_XHR_system.html";
   is(location.hostname, "mochi.test", "hostname should be mochi.test");
 
   var xhr = new XMLHttpRequest({mozSystem: true});
   is(xhr.mozSystem, true, ".mozSystem == true");
   xhr.open("GET", TEST_URL);
   xhr.onload = function onload() {
     is(xhr.status, 200);
     ok(xhr.responseText != null);
rename from dom/workers/test/test_xhr_timeout.html
rename to dom/xhr/tests/test_worker_xhr_timeout.html
--- a/dom/workers/test/test_xhr_timeout.html
+++ b/dom/xhr/tests/test_worker_xhr_timeout.html
@@ -19,17 +19,17 @@ https://bugzilla.mozilla.org/show_bug.cg
    href="https://bugzilla.mozilla.org/show_bug.cgi?id=498998"
   >Mozilla Bug 498998 (Worker XMLHttpRequest timeout)</a>
 <p id="display"></p>
 <div id="content">
   This test takes over 1 minute to run, probably over 2 minutes.
 </div>
 <pre id="test">
 <script type="text/javascript">
-  var worker = new Worker("../../../dom/base/test/test_XHR_timeout.js");
+  var worker = new Worker("../../../dom/xhr/tests/test_XHR_timeout.js");
 
   worker.addEventListener("message", function (event) {
     if (event.data == "done") {
       SimpleTest.finish();
       return;
     }
     if (event.data == "start") {
       return;
rename from dom/base/test/test_xhr_abort_after_load.html
rename to dom/xhr/tests/test_xhr_abort_after_load.html
rename from dom/base/test/test_xhr_forbidden_headers.html
rename to dom/xhr/tests/test_xhr_forbidden_headers.html
rename from dom/base/test/test_xhr_overridemimetype_throws_on_invalid_state.html
rename to dom/xhr/tests/test_xhr_overridemimetype_throws_on_invalid_state.html
rename from dom/base/test/test_xhr_progressevents.html
rename to dom/xhr/tests/test_xhr_progressevents.html
rename from dom/base/test/test_xhr_send.html
rename to dom/xhr/tests/test_xhr_send.html
rename from dom/base/test/test_xhr_send_readystate.html
rename to dom/xhr/tests/test_xhr_send_readystate.html
rename from dom/base/test/test_xhr_withCredentials.html
rename to dom/xhr/tests/test_xhr_withCredentials.html
rename from dom/workers/test/file_getcookie.sjs
rename to dom/xhr/tests/worker_file_getcookie.sjs
rename from dom/workers/test/terminateSyncXHR_frame.html
rename to dom/xhr/tests/worker_terminateSyncXHR_frame.html
rename from dom/workers/test/testXHR.txt
rename to dom/xhr/tests/worker_testXHR.txt
rename from dom/workers/test/xhr_cors_redirect.js
rename to dom/xhr/tests/worker_xhr_cors_redirect.js
rename from dom/workers/test/xhr_cors_redirect.sjs
rename to dom/xhr/tests/worker_xhr_cors_redirect.sjs
--- a/dom/workers/test/xhr_cors_redirect.sjs
+++ b/dom/xhr/tests/worker_xhr_cors_redirect.sjs
@@ -1,10 +1,10 @@
 function handleRequest(request, response) {
   response.setHeader("Access-Control-Allow-Origin", "*");
 
   if (request.queryString == 'redirect') {
     response.setStatusLine("1.1", 302, "Found");
-    response.setHeader("Location", "xhr_cors_redirect.sjs");
+    response.setHeader("Location", "worker_xhr_cors_redirect.sjs");
   } else {
     response.write("'hello world'");
   }
 }
rename from dom/workers/test/xhr_headers_server.sjs
rename to dom/xhr/tests/worker_xhr_headers_server.sjs
rename from dom/workers/test/xhr_headers_worker.js
rename to dom/xhr/tests/worker_xhr_headers_worker.js
rename from dom/workers/test/xhr2_worker.js
rename to dom/xhr/tests/xhr2_worker.js
rename from dom/workers/test/xhrAbort_worker.js
rename to dom/xhr/tests/xhrAbort_worker.js
--- a/dom/workers/test/xhrAbort_worker.js
+++ b/dom/xhr/tests/xhrAbort_worker.js
@@ -69,17 +69,17 @@ function runTest() {
 
   xhr.onreadystatechange = function(event) {
     pushEvent(event);
     if (xhr.readyState == xhr.HEADERS_RECEIVED) {
       xhr.abort();
     }
   };
 
-  xhr.open("GET", "testXHR.txt");
+  xhr.open("GET", "worker_testXHR.txt");
   xhr.overrideMimeType("text/plain");
   xhr.send(null);
 }
 
 function messageListener(event) {
   switch (event.data) {
     case "start":
       runTest();
rename from dom/workers/test/xhr_implicit_cancel_worker.js
rename to dom/xhr/tests/xhr_implicit_cancel_worker.js
--- a/dom/workers/test/xhr_implicit_cancel_worker.js
+++ b/dom/xhr/tests/xhr_implicit_cancel_worker.js
@@ -1,10 +1,10 @@
 /**
  * Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/
  */
 var xhr = new XMLHttpRequest();
-xhr.open("GET", "testXHR.txt");
+xhr.open("GET", "worker_testXHR.txt");
 xhr.send(null);
-xhr.open("GET", "testXHR.txt");
+xhr.open("GET", "worker_testXHR.txt");
 xhr.send(null);
 postMessage("done");
rename from dom/workers/test/xhr_worker.js
rename to dom/xhr/tests/xhr_worker.js
--- a/mobile/android/installer/package-manifest.in
+++ b/mobile/android/installer/package-manifest.in
@@ -141,16 +141,17 @@
 @BINPATH@/components/dom_stylesheets.xpt
 @BINPATH@/components/dom_system.xpt
 @BINPATH@/components/dom_traversal.xpt
 @BINPATH@/components/dom_tv.xpt
 #ifdef MOZ_WEBSPEECH
 @BINPATH@/components/dom_webspeechrecognition.xpt
 #endif
 @BINPATH@/components/dom_xbl.xpt
+@BINPATH@/components/dom_xhr.xpt
 @BINPATH@/components/dom_xpath.xpt
 @BINPATH@/components/dom_xul.xpt
 #ifdef MOZ_GAMEPAD
 @BINPATH@/components/dom_gamepad.xpt
 #endif
 @BINPATH@/components/dom_presentation.xpt
 @BINPATH@/components/downloads.xpt
 @BINPATH@/components/editor.xpt