Merge m-c to fx-team
authorWes Kocher <wkocher@mozilla.com>
Tue, 11 Mar 2014 18:40:27 -0700
changeset 191361 bbf22e4ffe07824d46e9734da77a56c2df61cb6f
parent 191360 662beba6065324fa8c9dd8f48d0dcb99b2e025b8 (current diff)
parent 191301 69fbe69ddb8c0c5c936a20914260269b8676ffe3 (diff)
child 191362 42572c7fdbcd96dcdb2bd0e704db8ab6db8a85cf
push id474
push userasasaki@mozilla.com
push dateMon, 02 Jun 2014 21:01:02 +0000
treeherdermozilla-release@967f4cf1b31c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone30.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
Merge m-c to fx-team
build/autoconf/nspr-build.m4
dom/devicestorage/test/test_fs_app_permissions.html
dom/devicestorage/test/test_fs_basic.html
dom/devicestorage/test/test_fs_createDirectory.html
dom/devicestorage/test/test_fs_get.html
dom/filesystem/CreateDirectoryTask.cpp
dom/filesystem/CreateDirectoryTask.h
dom/filesystem/DeviceStorageFileSystem.cpp
dom/filesystem/DeviceStorageFileSystem.h
dom/filesystem/Directory.cpp
dom/filesystem/Directory.h
dom/filesystem/FileSystemBase.cpp
dom/filesystem/FileSystemBase.h
dom/filesystem/FileSystemPermissionRequest.cpp
dom/filesystem/FileSystemPermissionRequest.h
dom/filesystem/FileSystemRequestParent.cpp
dom/filesystem/FileSystemRequestParent.h
dom/filesystem/FileSystemTaskBase.cpp
dom/filesystem/FileSystemTaskBase.h
dom/filesystem/FileSystemUtils.cpp
dom/filesystem/FileSystemUtils.h
dom/filesystem/GetFileOrDirectoryTask.cpp
dom/filesystem/GetFileOrDirectoryTask.h
dom/filesystem/PFileSystemRequest.ipdl
dom/filesystem/moz.build
dom/webidl/Directory.webidl
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -6,17 +6,16 @@ dnl
 builtin(include, build/autoconf/hotfixes.m4)dnl
 builtin(include, build/autoconf/acwinpaths.m4)dnl
 builtin(include, build/autoconf/hooks.m4)dnl
 builtin(include, build/autoconf/config.status.m4)dnl
 builtin(include, build/autoconf/toolchain.m4)dnl
 builtin(include, build/autoconf/ccache.m4)dnl
 builtin(include, build/autoconf/wrapper.m4)dnl
 builtin(include, build/autoconf/nspr.m4)dnl
-builtin(include, build/autoconf/nspr-build.m4)dnl
 builtin(include, build/autoconf/nss.m4)dnl
 builtin(include, build/autoconf/pkg.m4)dnl
 builtin(include, build/autoconf/codeset.m4)dnl
 builtin(include, build/autoconf/altoptions.m4)dnl
 builtin(include, build/autoconf/mozprog.m4)dnl
 builtin(include, build/autoconf/mozheader.m4)dnl
 builtin(include, build/autoconf/mozcommonheader.m4)dnl
 builtin(include, build/autoconf/lto.m4)dnl
--- a/b2g/config/emulator-ics/sources.xml
+++ b/b2g/config/emulator-ics/sources.xml
@@ -14,17 +14,17 @@
   <!--original fetch url was git://github.com/apitrace/-->
   <remote fetch="https://git.mozilla.org/external/apitrace" name="apitrace"/>
   <default remote="caf" revision="refs/tags/android-4.0.4_r2.1" sync-j="4"/>
   <!-- Gonk specific things and forks -->
   <project name="platform_build" path="build" remote="b2g" revision="1ad48c4be51b279f7f63c1a13025b52fe087d231">
     <copyfile dest="Makefile" src="core/root.mk"/>
   </project>
   <project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
-  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="3005269d4dcabcc7d27eaf72bda44a969873af8c"/>
+  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="6c93da506e79bd7641f2cc0958b531ab84ceefe1"/>
   <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="353d422fcbd0b41b76e1262f0992a832420a7567"/>
   <project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
   <project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="d11f524d00cacf5ba0dfbf25e4aa2158b1c3a036"/>
   <project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="456499c44d1ef39b602ea02e9ed460b6aab85b44"/>
   <project name="moztt" path="external/moztt" remote="b2g" revision="cf1dcc0704c0c1845f8a0a0b44838f7e0c0362c9"/>
   <project name="apitrace" path="external/apitrace" remote="apitrace" revision="485846b2a40d8ac7d6c1c5f8af6d15b0c10af19d"/>
   <!-- Stock Android things -->
   <project name="platform/abi/cpp" path="abi/cpp" revision="dd924f92906085b831bf1cbbc7484d3c043d613c"/>
--- a/b2g/config/emulator-jb/sources.xml
+++ b/b2g/config/emulator-jb/sources.xml
@@ -12,17 +12,17 @@
   <!--original fetch url was https://git.mozilla.org/releases-->
   <remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/>
   <!-- B2G specific things. -->
   <project name="platform_build" path="build" remote="b2g" revision="97a5b461686757dbb8ecab2aac5903e41d2e1afe">
     <copyfile dest="Makefile" src="core/root.mk"/>
   </project>
   <project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
   <project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
-  <project name="gaia" path="gaia" remote="mozillaorg" revision="3005269d4dcabcc7d27eaf72bda44a969873af8c"/>
+  <project name="gaia" path="gaia" remote="mozillaorg" revision="6c93da506e79bd7641f2cc0958b531ab84ceefe1"/>
   <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="353d422fcbd0b41b76e1262f0992a832420a7567"/>
   <project name="moztt" path="external/moztt" remote="b2g" revision="cf1dcc0704c0c1845f8a0a0b44838f7e0c0362c9"/>
   <project name="apitrace" path="external/apitrace" remote="apitrace" revision="485846b2a40d8ac7d6c1c5f8af6d15b0c10af19d"/>
   <project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
   <project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
   <!-- Stock Android things -->
   <project groups="linux" name="platform/prebuilts/clang/linux-x86/3.1" path="prebuilts/clang/linux-x86/3.1" revision="5c45f43419d5582949284eee9cef0c43d866e03b"/>
   <project groups="linux" name="platform/prebuilts/clang/linux-x86/3.2" path="prebuilts/clang/linux-x86/3.2" revision="3748b4168e7bd8d46457d4b6786003bc6a5223ce"/>
--- a/b2g/config/emulator-kk/sources.xml
+++ b/b2g/config/emulator-kk/sources.xml
@@ -10,17 +10,17 @@
   <!--original fetch url was git://codeaurora.org/-->
   <remote fetch="https://git.mozilla.org/external/caf" name="caf"/>
   <!--original fetch url was https://git.mozilla.org/releases-->
   <remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/>
   <!-- B2G specific things. -->
   <project name="platform_build" path="build" remote="b2g" revision="a9e08b91e9cd1f0930f16cfc49ec72f63575d5fe">
     <copyfile dest="Makefile" src="core/root.mk"/>
   </project>
-  <project name="gaia" path="gaia" remote="mozillaorg" revision="3005269d4dcabcc7d27eaf72bda44a969873af8c"/>
+  <project name="gaia" path="gaia" remote="mozillaorg" revision="6c93da506e79bd7641f2cc0958b531ab84ceefe1"/>
   <project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
   <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="353d422fcbd0b41b76e1262f0992a832420a7567"/>
   <project name="moztt" path="external/moztt" remote="b2g" revision="cf1dcc0704c0c1845f8a0a0b44838f7e0c0362c9"/>
   <project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
   <project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
   <project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
   <project name="apitrace" path="external/apitrace" remote="apitrace" revision="485846b2a40d8ac7d6c1c5f8af6d15b0c10af19d"/>
   <!-- Stock Android things -->
--- a/b2g/config/emulator/sources.xml
+++ b/b2g/config/emulator/sources.xml
@@ -14,17 +14,17 @@
   <!--original fetch url was git://github.com/apitrace/-->
   <remote fetch="https://git.mozilla.org/external/apitrace" name="apitrace"/>
   <default remote="caf" revision="refs/tags/android-4.0.4_r2.1" sync-j="4"/>
   <!-- Gonk specific things and forks -->
   <project name="platform_build" path="build" remote="b2g" revision="1ad48c4be51b279f7f63c1a13025b52fe087d231">
     <copyfile dest="Makefile" src="core/root.mk"/>
   </project>
   <project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
-  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="3005269d4dcabcc7d27eaf72bda44a969873af8c"/>
+  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="6c93da506e79bd7641f2cc0958b531ab84ceefe1"/>
   <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="353d422fcbd0b41b76e1262f0992a832420a7567"/>
   <project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
   <project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="d11f524d00cacf5ba0dfbf25e4aa2158b1c3a036"/>
   <project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="456499c44d1ef39b602ea02e9ed460b6aab85b44"/>
   <project name="moztt" path="external/moztt" remote="b2g" revision="cf1dcc0704c0c1845f8a0a0b44838f7e0c0362c9"/>
   <project name="apitrace" path="external/apitrace" remote="apitrace" revision="485846b2a40d8ac7d6c1c5f8af6d15b0c10af19d"/>
   <!-- Stock Android things -->
   <project name="platform/abi/cpp" path="abi/cpp" revision="dd924f92906085b831bf1cbbc7484d3c043d613c"/>
--- a/b2g/config/gaia.json
+++ b/b2g/config/gaia.json
@@ -1,9 +1,9 @@
 {
     "git": {
         "remote": "", 
         "branch": "", 
         "revision": ""
     }, 
-    "revision": "93de9c5bcb90ae32bd3599b185f4bbf67e4529ff", 
+    "revision": "82537f452462222ac77bb22f19a6ceb89aeade95", 
     "repo_path": "/integration/gaia-central"
 }
--- a/b2g/config/hamachi/sources.xml
+++ b/b2g/config/hamachi/sources.xml
@@ -12,17 +12,17 @@
   <!--original fetch url was git://github.com/apitrace/-->
   <remote fetch="https://git.mozilla.org/external/apitrace" name="apitrace"/>
   <default remote="caf" revision="b2g/ics_strawberry" sync-j="4"/>
   <!-- Gonk specific things and forks -->
   <project name="platform_build" path="build" remote="b2g" revision="1ad48c4be51b279f7f63c1a13025b52fe087d231">
     <copyfile dest="Makefile" src="core/root.mk"/>
   </project>
   <project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
-  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="3005269d4dcabcc7d27eaf72bda44a969873af8c"/>
+  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="6c93da506e79bd7641f2cc0958b531ab84ceefe1"/>
   <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="353d422fcbd0b41b76e1262f0992a832420a7567"/>
   <project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
   <project name="librecovery" path="librecovery" remote="b2g" revision="1f6a1fe07f81c5bc5e1d079c9b60f7f78ca2bf4f"/>
   <project name="moztt" path="external/moztt" remote="b2g" revision="cf1dcc0704c0c1845f8a0a0b44838f7e0c0362c9"/>
   <project name="apitrace" path="external/apitrace" remote="apitrace" revision="485846b2a40d8ac7d6c1c5f8af6d15b0c10af19d"/>
   <!-- Stock Android things -->
   <project name="platform/abi/cpp" path="abi/cpp" revision="6426040f1be4a844082c9769171ce7f5341a5528"/>
   <project name="platform/bionic" path="bionic" revision="d2eb6c7b6e1bc7643c17df2d9d9bcb1704d0b9ab"/>
--- a/b2g/config/helix/sources.xml
+++ b/b2g/config/helix/sources.xml
@@ -10,17 +10,17 @@
   <!--original fetch url was https://git.mozilla.org/releases-->
   <remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/>
   <default remote="caf" revision="b2g/ics_strawberry" sync-j="4"/>
   <!-- Gonk specific things and forks -->
   <project name="platform_build" path="build" remote="b2g" revision="1ad48c4be51b279f7f63c1a13025b52fe087d231">
     <copyfile dest="Makefile" src="core/root.mk"/>
   </project>
   <project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
-  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="3005269d4dcabcc7d27eaf72bda44a969873af8c"/>
+  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="6c93da506e79bd7641f2cc0958b531ab84ceefe1"/>
   <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="353d422fcbd0b41b76e1262f0992a832420a7567"/>
   <project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
   <project name="librecovery" path="librecovery" remote="b2g" revision="1f6a1fe07f81c5bc5e1d079c9b60f7f78ca2bf4f"/>
   <project name="moztt" path="external/moztt" remote="b2g" revision="cf1dcc0704c0c1845f8a0a0b44838f7e0c0362c9"/>
   <project name="gonk-patches" path="patches" remote="b2g" revision="223a2421006e8f5da33f516f6891c87cae86b0f6"/>
   <!-- Stock Android things -->
   <project name="platform/abi/cpp" path="abi/cpp" revision="6426040f1be4a844082c9769171ce7f5341a5528"/>
   <project name="platform/bionic" path="bionic" revision="d2eb6c7b6e1bc7643c17df2d9d9bcb1704d0b9ab"/>
--- a/b2g/config/inari/sources.xml
+++ b/b2g/config/inari/sources.xml
@@ -14,17 +14,17 @@
   <!--original fetch url was git://github.com/apitrace/-->
   <remote fetch="https://git.mozilla.org/external/apitrace" name="apitrace"/>
   <default remote="caf" revision="ics_chocolate_rb4.2" sync-j="4"/>
   <!-- Gonk specific things and forks -->
   <project name="platform_build" path="build" remote="b2g" revision="1ad48c4be51b279f7f63c1a13025b52fe087d231">
     <copyfile dest="Makefile" src="core/root.mk"/>
   </project>
   <project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
-  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="3005269d4dcabcc7d27eaf72bda44a969873af8c"/>
+  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="6c93da506e79bd7641f2cc0958b531ab84ceefe1"/>
   <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="353d422fcbd0b41b76e1262f0992a832420a7567"/>
   <project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
   <project name="librecovery" path="librecovery" remote="b2g" revision="1f6a1fe07f81c5bc5e1d079c9b60f7f78ca2bf4f"/>
   <project name="moztt" path="external/moztt" remote="b2g" revision="cf1dcc0704c0c1845f8a0a0b44838f7e0c0362c9"/>
   <project name="apitrace" path="external/apitrace" remote="apitrace" revision="485846b2a40d8ac7d6c1c5f8af6d15b0c10af19d"/>
   <!-- Stock Android things -->
   <project name="platform/abi/cpp" path="abi/cpp" revision="6426040f1be4a844082c9769171ce7f5341a5528"/>
   <project name="platform/bionic" path="bionic" revision="cd5dfce80bc3f0139a56b58aca633202ccaee7f8"/>
--- a/b2g/config/leo/sources.xml
+++ b/b2g/config/leo/sources.xml
@@ -12,17 +12,17 @@
   <!--original fetch url was git://github.com/apitrace/-->
   <remote fetch="https://git.mozilla.org/external/apitrace" name="apitrace"/>
   <default remote="caf" revision="b2g/ics_strawberry" sync-j="4"/>
   <!-- Gonk specific things and forks -->
   <project name="platform_build" path="build" remote="b2g" revision="1ad48c4be51b279f7f63c1a13025b52fe087d231">
     <copyfile dest="Makefile" src="core/root.mk"/>
   </project>
   <project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
-  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="3005269d4dcabcc7d27eaf72bda44a969873af8c"/>
+  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="6c93da506e79bd7641f2cc0958b531ab84ceefe1"/>
   <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="353d422fcbd0b41b76e1262f0992a832420a7567"/>
   <project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
   <project name="librecovery" path="librecovery" remote="b2g" revision="1f6a1fe07f81c5bc5e1d079c9b60f7f78ca2bf4f"/>
   <project name="moztt" path="external/moztt" remote="b2g" revision="cf1dcc0704c0c1845f8a0a0b44838f7e0c0362c9"/>
   <project name="apitrace" path="external/apitrace" remote="apitrace" revision="485846b2a40d8ac7d6c1c5f8af6d15b0c10af19d"/>
   <project name="gonk-patches" path="patches" remote="b2g" revision="223a2421006e8f5da33f516f6891c87cae86b0f6"/>
   <!-- Stock Android things -->
   <project name="platform/abi/cpp" path="abi/cpp" revision="6426040f1be4a844082c9769171ce7f5341a5528"/>
--- a/b2g/config/mako/sources.xml
+++ b/b2g/config/mako/sources.xml
@@ -12,17 +12,17 @@
   <!--original fetch url was https://git.mozilla.org/releases-->
   <remote fetch="https://git.mozilla.org/releases" name="mozillaorg"/>
   <!-- B2G specific things. -->
   <project name="platform_build" path="build" remote="b2g" revision="97a5b461686757dbb8ecab2aac5903e41d2e1afe">
     <copyfile dest="Makefile" src="core/root.mk"/>
   </project>
   <project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
   <project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
-  <project name="gaia" path="gaia" remote="mozillaorg" revision="3005269d4dcabcc7d27eaf72bda44a969873af8c"/>
+  <project name="gaia" path="gaia" remote="mozillaorg" revision="6c93da506e79bd7641f2cc0958b531ab84ceefe1"/>
   <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="353d422fcbd0b41b76e1262f0992a832420a7567"/>
   <project name="moztt" path="external/moztt" remote="b2g" revision="cf1dcc0704c0c1845f8a0a0b44838f7e0c0362c9"/>
   <project name="apitrace" path="external/apitrace" remote="apitrace" revision="485846b2a40d8ac7d6c1c5f8af6d15b0c10af19d"/>
   <project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
   <project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
   <!-- Stock Android things -->
   <project groups="linux" name="platform/prebuilts/clang/linux-x86/3.1" path="prebuilts/clang/linux-x86/3.1" revision="5c45f43419d5582949284eee9cef0c43d866e03b"/>
   <project groups="linux" name="platform/prebuilts/clang/linux-x86/3.2" path="prebuilts/clang/linux-x86/3.2" revision="3748b4168e7bd8d46457d4b6786003bc6a5223ce"/>
--- a/b2g/config/wasabi/sources.xml
+++ b/b2g/config/wasabi/sources.xml
@@ -12,17 +12,17 @@
   <!--original fetch url was git://github.com/apitrace/-->
   <remote fetch="https://git.mozilla.org/external/apitrace" name="apitrace"/>
   <default remote="caf" revision="ics_chocolate_rb4.2" sync-j="4"/>
   <!-- Gonk specific things and forks -->
   <project name="platform_build" path="build" remote="b2g" revision="1ad48c4be51b279f7f63c1a13025b52fe087d231">
     <copyfile dest="Makefile" src="core/root.mk"/>
   </project>
   <project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
-  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="3005269d4dcabcc7d27eaf72bda44a969873af8c"/>
+  <project name="gaia.git" path="gaia" remote="mozillaorg" revision="6c93da506e79bd7641f2cc0958b531ab84ceefe1"/>
   <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="353d422fcbd0b41b76e1262f0992a832420a7567"/>
   <project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
   <project name="librecovery" path="librecovery" remote="b2g" revision="1f6a1fe07f81c5bc5e1d079c9b60f7f78ca2bf4f"/>
   <project name="moztt" path="external/moztt" remote="b2g" revision="cf1dcc0704c0c1845f8a0a0b44838f7e0c0362c9"/>
   <project name="apitrace" path="external/apitrace" remote="apitrace" revision="485846b2a40d8ac7d6c1c5f8af6d15b0c10af19d"/>
   <project name="gonk-patches" path="patches" remote="b2g" revision="223a2421006e8f5da33f516f6891c87cae86b0f6"/>
   <!-- Stock Android things -->
   <project name="platform/abi/cpp" path="abi/cpp" revision="6426040f1be4a844082c9769171ce7f5341a5528"/>
deleted file mode 100644
--- a/build/autoconf/nspr-build.m4
+++ /dev/null
@@ -1,235 +0,0 @@
-dnl This Source Code Form is subject to the terms of the Mozilla Public
-dnl License, v. 2.0. If a copy of the MPL was not distributed with this
-dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-AC_DEFUN([MOZ_CONFIG_NSPR], [
-
-ifelse([$1],[],,[define(CONFIGURING_JS,yes)])
-
-dnl Possible ways this can be called:
-dnl   from toplevel configure:
-dnl     JS_STANDALONE=  BUILDING_JS=
-dnl   from js/src/configure invoked by toplevel configure:
-dnl     JS_STANDALONE=  BUILDING_JS=1
-dnl   from standalone js/src/configure:
-dnl     JS_STANDALONE=1 BUILDING_JS=1
-
-dnl ========================================================
-dnl = Find the right NSPR to use.
-dnl ========================================================
-MOZ_ARG_WITH_STRING(nspr-cflags,
-[  --with-nspr-cflags=FLAGS
-                          Pass FLAGS to CC when building code that uses NSPR.
-                          Use this when there's no accurate nspr-config
-                          script available.  This is the case when building
-                          SpiderMonkey as part of the Mozilla tree: the
-                          top-level configure script computes NSPR flags
-                          that accomodate the quirks of that environment.],
-    NSPR_CFLAGS=$withval)
-MOZ_ARG_WITH_STRING(nspr-libs,
-[  --with-nspr-libs=LIBS   Pass LIBS to LD when linking code that uses NSPR.
-                          See --with-nspr-cflags for more details.],
-    NSPR_LIBS=$withval)
-
-ifdef([CONFIGURING_JS],[
-  MOZ_ARG_ENABLE_BOOL(nspr-build,
-[  --enable-nspr-build     Configure and build NSPR from source tree],
-    MOZ_BUILD_NSPR=1,
-    MOZ_BUILD_NSPR=)
-])
-
-if test -z "$BUILDING_JS" || test -n "$JS_STANDALONE"; then
-  _IS_OUTER_CONFIGURE=1
-fi
-
-MOZ_ARG_WITH_BOOL(system-nspr,
-[  --with-system-nspr      Use an NSPR that is already built and installed.
-                          Use the 'nspr-config' script in the current path,
-                          or look for the script in the directories given with
-                          --with-nspr-exec-prefix or --with-nspr-prefix.
-                          (Those flags are only checked if you specify
-                          --with-system-nspr.)],
-    _USE_SYSTEM_NSPR=1 )
-
-JS_POSIX_NSPR=unset
-ifdef([CONFIGURING_JS],[
-  if test -n "$JS_STANDALONE"; then
-    case "$target" in
-      *linux*|*darwin*|*dragonfly*|*freebsd*|*netbsd*|*openbsd*)
-        if test -z "$_HAS_NSPR" && test "$JS_THREADSAFE"; then
-          JS_POSIX_NSPR_DEFAULT=1
-        fi
-        ;;
-    esac
-  fi
-
-  MOZ_ARG_ENABLE_BOOL(posix-nspr-emulation,
-[  --enable-posix-nspr-emulation
-                          Enable emulation of NSPR for POSIX systems],
-    JS_POSIX_NSPR=1,
-    JS_POSIX_NSPR=)
-]) dnl ifdef CONFIGURING_JS
-
-dnl Pass at most one of
-dnl   --with-system-nspr
-dnl   --with-nspr-cflags/libs
-dnl   --enable-nsprpub
-dnl   --enable-posix-nspr-emulation
-
-AC_MSG_CHECKING([NSPR selection])
-nspr_opts=
-which_nspr=default
-if test "$_USE_SYSTEM_NSPR"; then
-    nspr_opts="x$nspr_opts"
-    which_nspr="system"
-fi
-if test -n "$NSPR_CFLAGS" -o -n "$NSPR_LIBS"; then
-    nspr_opts="x$nspr_opts"
-    which_nspr="command-line"
-fi
-if test -n "$MOZ_BUILD_NSPR"; then
-    nspr_opts="x$nspr_opts"
-    which_nspr="source-tree"
-fi
-if test "$JS_POSIX_NSPR" != unset; then
-    nspr_opts="x$nspr_opts"
-    which_nspr="posix-wrapper"
-fi
-if test -z "$nspr_opts" || test "$nspr_opts" = x; then
-    AC_MSG_RESULT($which_nspr)
-else
-    AC_MSG_ERROR([only one way of using NSPR may be selected. See 'configure --help'.])
-fi
-
-if test -z "$nspr_opts"; then
-  if test -z "$BUILDING_JS"; then
-    dnl Toplevel configure defaults to using nsprpub from the source tree
-    MOZ_BUILD_NSPR=1
-  else
-    dnl JS configure defaults to emulated NSPR if available, falling back to nsprpub
-    JS_POSIX_NSPR="$JS_POSIX_NSPR_DEFAULT"
-    if test -z "$JS_POSIX_NSPR"; then
-      MOZ_BUILD_NSPR=1
-    fi
-  fi
-fi
-
-AC_SUBST(MOZ_BUILD_NSPR)
-
-if test "$JS_POSIX_NSPR" = unset; then
-  JS_POSIX_NSPR=
-fi
-
-if test -n "$BUILDING_JS"; then
-  if test "$JS_POSIX_NSPR" = 1; then
-    AC_DEFINE(JS_POSIX_NSPR)
-  fi
-  AC_SUBST(JS_POSIX_NSPR)
-fi
-
-if test -n "$_IS_OUTER_CONFIGURE"; then
-
-if test -n "$_USE_SYSTEM_NSPR" -o -n "$NSPR_CFLAGS" -o -n "$NSPR_LIBS"; then
-    AM_PATH_NSPR($NSPR_MINVER, [MOZ_NATIVE_NSPR=1], [AC_MSG_ERROR([you do not have NSPR installed or your version is older than $NSPR_MINVER.])])
-fi
-
-if test -n "$MOZ_NATIVE_NSPR"; then
-    _SAVE_CFLAGS=$CFLAGS
-    CFLAGS="$CFLAGS $NSPR_CFLAGS"
-    AC_TRY_COMPILE([#include "prtypes.h"],
-                [#ifndef PR_STATIC_ASSERT
-                 #error PR_STATIC_ASSERT not defined or requires including prtypes.h
-                 #endif],
-                ,
-                AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT or including prtypes.h does not provide it]))
-    AC_TRY_COMPILE([#include "prtypes.h"],
-                [#ifndef PR_UINT64
-                 #error PR_UINT64 not defined or requires including prtypes.h
-                 #endif],
-                ,
-                AC_MSG_ERROR([system NSPR does not support PR_UINT64 or including prtypes.h does not provide it]))
-    CFLAGS=$_SAVE_CFLAGS
-elif test -z "$JS_POSIX_NSPR"; then
-    if test -z "$LIBXUL_SDK"; then
-        NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
-        if test -n "$GNU_CC"; then
-            NSPR_LIBS="-L${LIBXUL_DIST}/lib -lnspr${NSPR_VERSION} -lplc${NSPR_VERSION} -lplds${NSPR_VERSION}"
-        else
-            NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
-        fi
-    else
-        NSPR_CFLAGS=`"${LIBXUL_DIST}"/sdk/bin/nspr-config --prefix="${LIBXUL_DIST}" --includedir="${LIBXUL_DIST}/include/nspr" --cflags`
-        NSPR_LIBS=`"${LIBXUL_DIST}"/sdk/bin/nspr-config --prefix="${LIBXUL_DIST}" --libdir="${LIBXUL_DIST}"/lib --libs`
-    fi
-fi
-
-AC_SUBST(NSPR_CFLAGS)
-AC_SUBST(NSPR_LIBS)
-
-NSPR_PKGCONF_CHECK="nspr"
-if test -n "$MOZ_NATIVE_NSPR"; then
-    # piggy back on $MOZ_NATIVE_NSPR to set a variable for the nspr check for js.pc
-    NSPR_PKGCONF_CHECK="nspr >= $NSPR_MINVER"
-
-    _SAVE_CFLAGS=$CFLAGS
-    CFLAGS="$CFLAGS $NSPR_CFLAGS"
-    AC_TRY_COMPILE([#include "prlog.h"],
-                [#ifndef PR_STATIC_ASSERT
-                 #error PR_STATIC_ASSERT not defined
-                 #endif],
-                ,
-                AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT]))
-    CFLAGS=$_SAVE_CFLAGS
-fi
-AC_SUBST(NSPR_PKGCONF_CHECK)
-
-fi # _IS_OUTER_CONFIGURE
-
-])
-
-AC_DEFUN([MOZ_SUBCONFIGURE_NSPR], [
-
-if test -z "$MOZ_NATIVE_NSPR"; then
-    ac_configure_args="$_SUBDIR_CONFIG_ARGS --with-dist-prefix=$MOZ_BUILD_ROOT/dist --with-mozilla"
-    if test -z "$MOZ_DEBUG"; then
-        ac_configure_args="$ac_configure_args --disable-debug"
-    else
-        ac_configure_args="$ac_configure_args --enable-debug"
-    fi
-    if test "$MOZ_OPTIMIZE" = "1"; then
-        ac_configure_args="$ac_configure_args --enable-optimize"
-    elif test -z "$MOZ_OPTIMIZE"; then
-        ac_configure_args="$ac_configure_args --disable-optimize"
-    fi
-    if test -n "$HAVE_64BIT_OS"; then
-        ac_configure_args="$ac_configure_args --enable-64bit"
-    fi
-    if test -n "$USE_ARM_KUSER"; then
-        ac_configure_args="$ac_configure_args --with-arm-kuser"
-    fi
-    ac_configure_args="$ac_configure_args $NSPR_CONFIGURE_ARGS"
-
-    # Save these, so we can mess with them for the subconfigure ..
-    _SAVE_CFLAGS="$CFLAGS"
-    _SAVE_CPPFLAGS="$CPPFLAGS"
-    _SAVE_LDFLAGS="$LDFLAGS"
-
-    if test -n "$MOZ_LINKER" -a "$ac_cv_func_dladdr" = no ; then
-      # dladdr is supported by the new linker, even when the system linker doesn't
-      # support it. Trick nspr into using dladdr when it's not supported.
-      export CPPFLAGS="-include $_topsrcdir/mozglue/linker/dladdr.h $CPPFLAGS"
-    fi
-    export LDFLAGS="$LDFLAGS $NSPR_LDFLAGS"
-    export CFLAGS="$CFLAGS $MOZ_FRAMEPTR_FLAGS"
-
-    AC_OUTPUT_SUBDIRS(nsprpub)
-
-    # .. and restore them
-    CFLAGS="$_SAVE_CFLAGS"
-    CPPFLAGS="$_SAVE_CPPFLAGS"
-    LDFLAGS="$_SAVE_LDFLAGS"
-
-    ac_configure_args="$_SUBDIR_CONFIG_ARGS"
-fi
-
-])
--- a/configure.in
+++ b/configure.in
@@ -48,17 +48,16 @@ dnl ====================================
 _SUBDIR_HOST_LDFLAGS="$HOST_LDFLAGS"
 _SUBDIR_CONFIG_ARGS="$ac_configure_args"
 
 dnl Set the version number of the libs included with mozilla
 dnl ========================================================
 MOZJPEG=62
 MOZPNG=10609
 NSPR_VERSION=4
-NSPR_MINVER=4.10.3
 NSS_VERSION=3
 
 dnl Set the minimum version of toolkit libs used by mozilla
 dnl ========================================================
 GLIB_VERSION=1.2.0
 PERL_VERSION=5.006
 CAIRO_VERSION=1.10
 PANGO_VERSION=1.22.0
@@ -127,17 +126,17 @@ if test "$_conflict_files"; then
   *   To clean up the source tree:
   *     1. cd $_topsrcdir
   *     2. gmake distclean
   ***
 EOF
   exit 1
   break
 fi
-MOZ_BUILD_ROOT=`pwd -W 2>/dev/null || pwd`
+MOZ_BUILD_ROOT=`pwd`
 
 MOZ_PYTHON
 
 MOZ_DEFAULT_COMPILER
 
 COMPILE_ENVIRONMENT=1
 MOZ_ARG_DISABLE_BOOL(compile-environment,
 [  --disable-compile-environment
@@ -2187,16 +2186,17 @@ ia64*-hpux*)
     TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
 
     dnl set NO_X11 defines here as the general check is skipped on win32
     no_x=yes
     AC_DEFINE(NO_X11)
 
     case "$host" in
     *-mingw*)
+        MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
         if test -n "$L10NBASEDIR"; then
             L10NBASEDIR=`cd $L10NBASEDIR && pwd -W`
         fi
         ;;
     esac
 
     case "$host" in
     *-mingw*)
@@ -3500,17 +3500,57 @@ fi
 AC_SUBST(LIBXUL_DIST)
 
 SYSTEM_LIBXUL=
 
 MOZ_ARG_WITH_BOOL(system-libxul,
 [  --with-system-libxul    Use system installed libxul SDK],
     SYSTEM_LIBXUL=1)
 
-MOZ_CONFIG_NSPR()
+dnl ========================================================
+dnl = If NSPR was not detected in the system,
+dnl = use the one in the source tree (mozilla/nsprpub)
+dnl ========================================================
+MOZ_ARG_WITH_BOOL(system-nspr,
+[  --with-system-nspr      Use system installed NSPR],
+    _USE_SYSTEM_NSPR=1 )
+
+if test -n "$_USE_SYSTEM_NSPR"; then
+    AM_PATH_NSPR(4.10.3, [MOZ_NATIVE_NSPR=1], [AC_MSG_ERROR([your don't have NSPR installed or your version is too old])])
+fi
+
+if test -n "$MOZ_NATIVE_NSPR"; then
+    _SAVE_CFLAGS=$CFLAGS
+    CFLAGS="$CFLAGS $NSPR_CFLAGS"
+    AC_TRY_COMPILE([#include "prtypes.h"],
+                [#ifndef PR_STATIC_ASSERT
+                 #error PR_STATIC_ASSERT not defined or requires including prtypes.h
+                 #endif],
+                [MOZ_NATIVE_NSPR=1],
+                AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT or including prtypes.h does not provide it]))
+    AC_TRY_COMPILE([#include "prtypes.h"],
+                [#ifndef PR_UINT64
+                 #error PR_UINT64 not defined or requires including prtypes.h
+                 #endif],
+                [MOZ_NATIVE_NSPR=1],
+                AC_MSG_ERROR([system NSPR does not support PR_UINT64 or including prtypes.h does not provide it]))
+    CFLAGS=$_SAVE_CFLAGS
+else
+    if test -z "$LIBXUL_SDK"; then
+        NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
+        if test -n "$GNU_CC"; then
+            NSPR_LIBS="-L${LIBXUL_DIST}/lib -lnspr${NSPR_VERSION} -lplc${NSPR_VERSION} -lplds${NSPR_VERSION}"
+        else
+            NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
+        fi
+    else
+        NSPR_CFLAGS=`"${LIBXUL_DIST}"/sdk/bin/nspr-config --prefix="${LIBXUL_DIST}" --includedir="${LIBXUL_DIST}/include/nspr" --cflags`
+        NSPR_LIBS=`"${LIBXUL_DIST}"/sdk/bin/nspr-config --prefix="${LIBXUL_DIST}" --libdir="${LIBXUL_DIST}"/lib --libs`
+    fi
+fi
 
 dnl set GRE_MILESTONE
 dnl ========================================================
 if test -n "$LIBXUL_SDK"; then
     GRE_MILESTONE=`$PYTHON "$_topsrcdir"/config/printconfigsetting.py "$LIBXUL_DIST"/bin/platform.ini Build Milestone`
 else
     GRE_MILESTONE=`tail -n 1 "$_topsrcdir"/config/milestone.txt 2>/dev/null || tail -1 "$_topsrcdir"/config/milestone.txt`
 fi
@@ -8920,17 +8960,58 @@ if test "$COMPILE_ENVIRONMENT" -a -z "$L
 
 export WRAP_LDFLAGS
 
 if test -n "$_WRAP_MALLOC"; then
     # Avoid doubling wrap malloc arguments
     _SUBDIR_CONFIG_ARGS="`echo $_SUBDIR_CONFIG_ARGS | sed -e 's/--enable-wrap-malloc *//'`"
 fi
 
-MOZ_SUBCONFIGURE_NSPR()
+if test -z "$MOZ_NATIVE_NSPR"; then
+    ac_configure_args="$_SUBDIR_CONFIG_ARGS --with-dist-prefix=$MOZ_BUILD_ROOT/dist --with-mozilla"
+    if test -z "$MOZ_DEBUG"; then
+        ac_configure_args="$ac_configure_args --disable-debug"
+    else
+        ac_configure_args="$ac_configure_args --enable-debug"
+    fi
+    if test "$MOZ_OPTIMIZE" = "1"; then
+        ac_configure_args="$ac_configure_args --enable-optimize"
+    elif test -z "$MOZ_OPTIMIZE"; then
+        ac_configure_args="$ac_configure_args --disable-optimize"
+    fi
+    if test -n "$HAVE_64BIT_OS"; then
+        ac_configure_args="$ac_configure_args --enable-64bit"
+    fi
+    if test -n "$USE_ARM_KUSER"; then
+        ac_configure_args="$ac_configure_args --with-arm-kuser"
+    fi
+    ac_configure_args="$ac_configure_args $NSPR_CONFIGURE_ARGS"
+
+    # Save these, so we can mess with them for the subconfigure ..
+    _SAVE_CFLAGS="$CFLAGS"
+    _SAVE_CPPFLAGS="$CPPFLAGS"
+    _SAVE_LDFLAGS="$LDFLAGS"
+
+    if test -n "$MOZ_LINKER" -a "$ac_cv_func_dladdr" = no ; then
+      # dladdr is supported by the new linker, even when the system linker doesn't
+      # support it. Trick nspr into using dladdr when it's not supported.
+      export CPPFLAGS="-include $_topsrcdir/mozglue/linker/dladdr.h $CPPFLAGS"
+    fi
+    export LDFLAGS="$LDFLAGS $NSPR_LDFLAGS"
+    export CFLAGS="$CFLAGS $MOZ_FRAMEPTR_FLAGS"
+
+    AC_OUTPUT_SUBDIRS(nsprpub)
+
+    # .. and restore them
+    CFLAGS="$_SAVE_CFLAGS"
+    CPPFLAGS="$_SAVE_CPPFLAGS"
+    LDFLAGS="$_SAVE_LDFLAGS"
+
+    ac_configure_args="$_SUBDIR_CONFIG_ARGS"
+fi
 
 dnl ========================================================
 dnl = Setup a nice relatively clean build environment for
 dnl = sub-configures.
 dnl ========================================================
 CC="$_SUBDIR_CC"
 CXX="$_SUBDIR_CXX"
 CFLAGS="$_SUBDIR_CFLAGS"
--- a/dom/base/domerr.msg
+++ b/dom/base/domerr.msg
@@ -64,24 +64,16 @@ DOM4_MSG_DEF(InvalidStateError, "A mutat
 DOM4_MSG_DEF(AbortError, "A request was aborted, for example through a call to IDBTransaction.abort.", NS_ERROR_DOM_INDEXEDDB_ABORT_ERR)
 DOM4_MSG_DEF(TimeoutError, "A lock for the transaction could not be obtained in a reasonable time.", NS_ERROR_DOM_INDEXEDDB_TIMEOUT_ERR)
 DOM4_MSG_DEF(QuotaExceededError, "The current transaction exceeded its quota limitations.", NS_ERROR_DOM_INDEXEDDB_QUOTA_ERR)
 
 /* A Non-standard IndexedDB error */
 
 DOM_MSG_DEF(NS_ERROR_DOM_INDEXEDDB_RECOVERABLE_ERR, "The operation failed because the database was prevented from taking an action. The operation might be able to succeed if the application performs some recovery steps and retries the entire transaction. For example, there was not enough remaining storage space, or the storage quota was reached and the user declined to give more space to the database.")
 
-/* FileSystem DOM errors. */
-DOM4_MSG_DEF(InvalidAccessError, "Invalid file system path.", NS_ERROR_DOM_FILESYSTEM_INVALID_PATH_ERR)
-DOM4_MSG_DEF(InvalidModificationError, "Failed to modify the file.", NS_ERROR_DOM_FILESYSTEM_INVALID_MODIFICATION_ERR)
-DOM4_MSG_DEF(NoModificationAllowedError, "Modifications are not allowed for this file", NS_ERROR_DOM_FILESYSTEM_NO_MODIFICATION_ALLOWED_ERR)
-DOM4_MSG_DEF(AbortError, "File already exists.", NS_ERROR_DOM_FILESYSTEM_PATH_EXISTS_ERR)
-DOM4_MSG_DEF(TypeMismatchError, "The type of the file is incompatible with the expected type.", NS_ERROR_DOM_FILESYSTEM_TYPE_MISMATCH_ERR)
-DOM4_MSG_DEF(UnknownError, "The operation failed for reasons unrelated to the file system itself and not covered by any other error code.", NS_ERROR_DOM_FILESYSTEM_UNKNOWN_ERR)
-
 /* DOM error codes defined by us */
 
 /* XXX string should be specified by norris */
 DOM_MSG_DEF(NS_ERROR_DOM_SECMAN_ERR, "Unable to obtain security manager")
 DOM_MSG_DEF(NS_ERROR_DOM_WRONG_TYPE_ERR, "Object is of wrong type")
 DOM_MSG_DEF(NS_ERROR_DOM_NOT_OBJECT_ERR, "Parameter is not an object")
 DOM_MSG_DEF(NS_ERROR_DOM_NOT_XPC_OBJECT_ERR, "Parameter is not a XPConnect object")
 DOM_MSG_DEF(NS_ERROR_DOM_NOT_NUMBER_ERR, "Parameter is not a number")
--- a/dom/devicestorage/DeviceStorage.h
+++ b/dom/devicestorage/DeviceStorage.h
@@ -26,18 +26,16 @@
 class DeviceStorageFile;
 class nsIInputStream;
 
 namespace mozilla {
 namespace dom {
 class DeviceStorageEnumerationParameters;
 class DOMCursor;
 class DOMRequest;
-class Promise;
-class DeviceStorageFileSystem;
 } // namespace dom
 namespace ipc {
 class FileDescriptor;
 }
 } // namespace mozilla
 
 class DeviceStorageFile MOZ_FINAL
   : public nsISupports {
@@ -154,18 +152,16 @@ class nsDOMDeviceStorage MOZ_FINAL
   , public nsIDOMDeviceStorage
   , public nsIObserver
 {
   typedef mozilla::ErrorResult ErrorResult;
   typedef mozilla::dom::DeviceStorageEnumerationParameters
     EnumerationParameters;
   typedef mozilla::dom::DOMCursor DOMCursor;
   typedef mozilla::dom::DOMRequest DOMRequest;
-  typedef mozilla::dom::Promise Promise;
-  typedef mozilla::dom::DeviceStorageFileSystem DeviceStorageFileSystem;
 public:
   typedef nsTArray<nsString> VolumeNameArray;
 
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_NSIDOMDEVICESTORAGE
 
   NS_DECL_NSIOBSERVER
   NS_DECL_NSIDOMEVENTTARGET
@@ -254,19 +250,16 @@ public:
   already_AddRefed<DOMRequest> StorageStatus(ErrorResult& aRv);
   already_AddRefed<DOMRequest> Mount(ErrorResult& aRv);
   already_AddRefed<DOMRequest> Unmount(ErrorResult& aRv);
 
   bool Default();
 
   // Uses XPCOM GetStorageName
 
-  already_AddRefed<Promise>
-  GetRoot();
-
   static void
   CreateDeviceStorageFor(nsPIDOMWindow* aWin,
                          const nsAString& aType,
                          nsDOMDeviceStorage** aStore);
 
   static void
   CreateDeviceStoragesFor(nsPIDOMWindow* aWin,
                           const nsAString& aType,
@@ -334,13 +327,11 @@ private:
 #endif
 
   // nsIDOMDeviceStorage.type
   enum {
       DEVICE_STORAGE_TYPE_DEFAULT = 0,
       DEVICE_STORAGE_TYPE_SHARED,
       DEVICE_STORAGE_TYPE_EXTERNAL
   };
-
-  nsRefPtr<DeviceStorageFileSystem> mFileSystem;
 };
 
 #endif
--- a/dom/devicestorage/nsDeviceStorage.cpp
+++ b/dom/devicestorage/nsDeviceStorage.cpp
@@ -6,25 +6,21 @@
 
 #include "nsDeviceStorage.h"
 
 #include "mozilla/Attributes.h"
 #include "mozilla/ClearOnShutdown.h"
 #include "mozilla/DebugOnly.h"
 #include "mozilla/dom/ContentChild.h"
 #include "mozilla/dom/DeviceStorageBinding.h"
-#include "mozilla/dom/DeviceStorageFileSystem.h"
 #include "mozilla/dom/devicestorage/PDeviceStorageRequestChild.h"
-#include "mozilla/dom/Directory.h"
-#include "mozilla/dom/FileSystemUtils.h"
 #include "mozilla/dom/ipc/Blob.h"
 #include "mozilla/dom/PBrowserChild.h"
 #include "mozilla/dom/PContentPermissionRequestChild.h"
 #include "mozilla/dom/PermissionMessageUtils.h"
-#include "mozilla/dom/Promise.h"
 #include "mozilla/LazyIdleThread.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/Scoped.h"
 #include "mozilla/Services.h"
 
 #include "nsAutoPtr.h"
 #include "nsServiceManagerUtils.h"
 #include "nsIFile.h"
@@ -890,17 +886,24 @@ DeviceStorageFile::IsSafePath(const nsAS
       return false;
     }
   }
   return true;
 }
 
 void
 DeviceStorageFile::NormalizeFilePath() {
-  FileSystemUtils::LocalPathToNormalizedPath(mPath, mPath);
+#if defined(XP_WIN)
+  char16_t* cur = mPath.BeginWriting();
+  char16_t* end = mPath.EndWriting();
+  for (; cur < end; ++cur) {
+    if (char16_t('\\') == *cur)
+      *cur = char16_t('/');
+  }
+#endif
 }
 
 void
 DeviceStorageFile::AppendRelativePath(const nsAString& aPath) {
   if (!mFile) {
     return;
   }
   if (!IsSafePath(aPath)) {
@@ -908,19 +911,33 @@ DeviceStorageFile::AppendRelativePath(co
     // valid and return PERMISSION_DENIED if a non-safe path is entered.
     // This check is done in the parent and prevents a compromised
     // child from bypassing the check. It shouldn't be possible for this
     // code path to be taken with a non-compromised child.
     NS_WARNING("Unsafe path detected - ignoring");
     NS_WARNING(NS_LossyConvertUTF16toASCII(aPath).get());
     return;
   }
-  nsString localPath;
-  FileSystemUtils::NormalizedPathToLocalPath(aPath, localPath);
-  mFile->AppendRelativePath(localPath);
+#if defined(XP_WIN)
+  // replace forward slashes with backslashes,
+  // since nsLocalFileWin chokes on them
+  nsString temp;
+  temp.Assign(aPath);
+
+  char16_t* cur = temp.BeginWriting();
+  char16_t* end = temp.EndWriting();
+
+  for (; cur < end; ++cur) {
+    if (char16_t('/') == *cur)
+      *cur = char16_t('\\');
+  }
+  mFile->AppendRelativePath(temp);
+#else
+  mFile->AppendRelativePath(aPath);
+#endif
 }
 
 nsresult
 DeviceStorageFile::CreateFileDescriptor(FileDescriptor& aFileDescriptor)
 {
   ScopedPRFileDesc fd;
   nsresult rv = mFile->OpenNSPRFileDesc(PR_RDWR | PR_CREATE_FILE,
                                         0660, &fd.rwget());
@@ -3051,21 +3068,16 @@ nsDOMDeviceStorage::~nsDOMDeviceStorage(
 {
 }
 
 void
 nsDOMDeviceStorage::Shutdown()
 {
   MOZ_ASSERT(NS_IsMainThread());
 
-  if (mFileSystem) {
-    mFileSystem->SetDeviceStorage(nullptr);
-    mFileSystem = nullptr;
-  }
-
   if (!mStorageName.IsEmpty()) {
     UnregisterForSDCardChanges(this);
   }
 
   nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
   obs->RemoveObserver(this, "file-watcher-update");
   obs->RemoveObserver(this, "disk-space-watcher");
 }
@@ -3794,26 +3806,16 @@ nsDOMDeviceStorage::CreateFileDescriptor
 bool
 nsDOMDeviceStorage::Default()
 {
   nsString defaultStorageName;
   GetDefaultStorageName(mStorageType, defaultStorageName);
   return mStorageName.Equals(defaultStorageName);
 }
 
-already_AddRefed<Promise>
-nsDOMDeviceStorage::GetRoot()
-{
-  if (!mFileSystem) {
-    mFileSystem = new DeviceStorageFileSystem(mStorageType, mStorageName);
-    mFileSystem->SetDeviceStorage(this);
-  }
-  return mozilla::dom::Directory::GetRoot(mFileSystem);
-}
-
 NS_IMETHODIMP
 nsDOMDeviceStorage::GetDefault(bool* aDefault)
 {
   *aDefault = Default();
   return NS_OK;
 }
 
 NS_IMETHODIMP
--- a/dom/devicestorage/test/chrome.ini
+++ b/dom/devicestorage/test/chrome.ini
@@ -1,4 +1,3 @@
 [DEFAULT]
 
 [test_app_permissions.html]
-[test_fs_app_permissions.html]
--- a/dom/devicestorage/test/mochitest.ini
+++ b/dom/devicestorage/test/mochitest.ini
@@ -16,13 +16,8 @@ support-files = devicestorage_common.js
 [test_enumerateOptions.html]
 [test_freeSpace.html]
 [test_lastModificationFilter.html]
 [test_overwrite.html]
 [test_sanity.html]
 [test_usedSpace.html]
 [test_watch.html]
 [test_watchOther.html]
-
-# FileSystem API tests
-[test_fs_basic.html]
-[test_fs_createDirectory.html]
-[test_fs_get.html]
deleted file mode 100644
--- a/dom/devicestorage/test/test_fs_app_permissions.html
+++ /dev/null
@@ -1,428 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=910412
--->
-<head>
-  <meta charset="utf-8">
-  <title>Permission test of FileSystem API for Device Storage</title>
-  <script type="application/javascript"
-           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
-  <link rel="stylesheet" type="text/css"
-         href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
-</head>
-<body>
-<a target="_blank"
-    href="https://bugzilla.mozilla.org/show_bug.cgi?id=910412">Mozilla Bug 910412</a>
-<p id="display"></p>
-<div id="content">
-
-</div>
-<pre id="test">
-<script type="application/javascript;version=1.7">
-
-function randomFilename(l) {
-  let set = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZ";
-  let result = "";
-  for (let i=0; i<l; i++) {
-    let r = Math.floor(set.length * Math.random());
-    result += set.substring(r, r + 1);
-  }
-  return result;
-}
-
-let MockPermissionPrompt = SpecialPowers.MockPermissionPrompt;
-MockPermissionPrompt.init();
-
-SimpleTest.waitForExplicitFinish();
-
-function TestCreateDirectory(iframe, data) {
-  function cbError(e) {
-    is(e.name, "SecurityError", "[TestCreateDirectory] Should fire a SecurityError for type " + data.type);
-    is(data.shouldPass, false, "[TestCreateDirectory] Error callback was called for type " + data.type + '. Error: ' + e.name);
-    testComplete(iframe, data);
-  }
-
-  let storage = iframe.contentDocument.defaultView.navigator.getDeviceStorage(data.type);
-  isnot(storage, null, "[TestCreateDirectory] Should be able to get storage object for " + data.type);
-
-  if (!storage) {
-    testComplete(iframe, data);
-    return;
-  }
-
-  storage.getRoot().then(function(root) {
-    is(data.shouldPass, true, "[TestCreateDirectory] Success callback was called for type " + data.type);
-    let filename = randomFilename(100);
-    root.createDirectory(filename).then(function(d) {
-      let passed = d && (d.name === filename);
-      is(data.shouldPass, passed, "[TestCreateDirectory] Success callback was called for type " + data.type);
-      testComplete(iframe, data);
-    }, cbError);
-  }, cbError);
-}
-
-function TestGet(iframe, data) {
-  function cbError(e) {
-    is(e.name, "SecurityError", "[TestGet] Should fire a SecurityError for type " + data.type);
-    is(data.shouldPass, false, "[TestGet] Error callback was called for type " + data.type + '. Error: ' + e.name);
-    testComplete(iframe, data);
-  }
-
-  createTestFile(data.fileExtension);
-
-  let storage = iframe.contentDocument.defaultView.navigator.getDeviceStorage(data.type);
-  isnot(storage, null, "[TestGet] Should be able to get storage object for " + data.type);
-
-  if (!storage) {
-    testComplete(iframe, data);
-    return;
-  }
-
-  storage.getRoot().then(function(root) {
-    ok(true, "[TestGet] Success callback of getRoot was called for type " + data.type);
-    root.get("testfile" + data.fileExtension).then(function() {
-      is(data.shouldPass, true, "[TestGet] Success callback was called for type " + data.type);
-      testComplete(iframe, data);
-    }, cbError);
-  }, cbError);
-}
-
-let gTestUri = "https://example.com/tests/dom/devicestorage/test/test_fs_app_permissions.html"
-
-let gData = [
-
-  // Directory#get
-
-  // Web applications with no permissions
-  {
-    type: 'pictures',
-    shouldPass: false,
-    fileExtension: '.png',
-    test: TestGet
-  },
-  {
-    type: 'videos',
-    shouldPass: false,
-    fileExtension: '.ogv',
-    test: TestGet
-  },
-  {
-    type: 'videos',
-    shouldPass: false,
-    fileExtension: '.ogg',
-    test: TestGet
-  },
-  {
-    type: 'music',
-    shouldPass: false,
-    fileExtension: '.ogg',
-    test: TestGet
-  },
-  {
-    type: 'music',
-    shouldPass: false,
-    fileExtension: '.txt',
-    test: TestGet
-  },
-  {
-    type: 'sdcard',
-    shouldPass: false,
-    fileExtension: '.txt',
-    test: TestGet
-  },
-
-  // Web applications with permission granted
-  {
-    type: 'pictures',
-    shouldPass: true,
-    fileExtension: '.png',
-
-    permissions: ["device-storage:pictures"],
-
-    test: TestGet
-  },
-  {
-    type: 'videos',
-    shouldPass: true,
-    fileExtension: '.ogv',
-
-    permissions: ["device-storage:videos"],
-
-    test: TestGet
-  },
-  {
-    type: 'videos',
-    shouldPass: true,
-    fileExtension: '.ogg',
-
-    permissions: ["device-storage:videos"],
-
-    test: TestGet
-  },
-  {
-    type: 'music',
-    shouldPass: true,
-    fileExtension: '.ogg',
-
-    permissions: ["device-storage:music"],
-
-    test: TestGet
-  },
-  {
-    type: 'music',
-    shouldPass: false,
-    fileExtension: '.txt',
-
-    permissions: ["device-storage:music"],
-
-    test: TestGet
-  },
-  {
-    type: 'sdcard',
-    shouldPass: true,
-    fileExtension: '.txt',
-
-    permissions: ["device-storage:sdcard"],
-
-    test: TestGet
-  },
-
-  // Certified application with permision granted
-  {
-    type: 'pictures',
-    shouldPass: true,
-    fileExtension: '.png',
-
-    app: "https://example.com/manifest_cert.webapp",
-    permissions: ["device-storage:pictures"],
-
-    test: TestGet
-  },
-  {
-    type: 'videos',
-    shouldPass: true,
-    fileExtension: '.ogv',
-
-    app: "https://example.com/manifest_cert.webapp",
-    permissions: ["device-storage:videos"],
-
-    test: TestGet
-  },
-  {
-    type: 'videos',
-    shouldPass: true,
-    fileExtension: '.ogg',
-
-    app: "https://example.com/manifest_cert.webapp",
-    permissions: ["device-storage:videos"],
-
-    test: TestGet
-  },
-  {
-    type: 'music',
-    shouldPass: true,
-    fileExtension: '.ogg',
-
-    app: "https://example.com/manifest_cert.webapp",
-    permissions: ["device-storage:music"],
-
-    test: TestGet
-  },
-  {
-    type: 'music',
-    shouldPass: false,
-    fileExtension: '.txt',
-
-    app: "https://example.com/manifest_cert.webapp",
-    permissions: ["device-storage:music"],
-
-    test: TestGet
-  },
-  {
-    type: 'sdcard',
-    shouldPass: true,
-    fileExtension: '.txt',
-
-    app: "https://example.com/manifest_cert.webapp",
-    permissions: ["device-storage:sdcard"],
-
-    test: TestGet
-  },
-
-  // Directory#createDirectory
-
-  // Web applications with no permissions
-  {
-    type: 'pictures',
-    shouldPass: false,
-    test: TestCreateDirectory
-  },
-  {
-    type: 'videos',
-    shouldPass: false,
-    test: TestCreateDirectory
-  },
-  {
-    type: 'music',
-    shouldPass: false,
-    test: TestCreateDirectory
-  },
-  {
-    type: 'sdcard',
-    shouldPass: false,
-    test: TestCreateDirectory
-  },
-
-  // Web applications with permission granted
-  {
-    type: 'pictures',
-    shouldPass: true,
-
-    permissions: ["device-storage:pictures"],
-
-    test: TestCreateDirectory
-  },
-  {
-    type: 'videos',
-    shouldPass: true,
-
-    permissions: ["device-storage:videos"],
-
-    test: TestCreateDirectory
-  },
-  {
-    type: 'music',
-    shouldPass: true,
-
-    permissions: ["device-storage:music"],
-
-    test: TestCreateDirectory
-  },
-  {
-    type: 'sdcard',
-    shouldPass: true,
-
-    permissions: ["device-storage:sdcard"],
-
-    test: TestCreateDirectory
-  },
-
-  // Certified application with permision granted
-  {
-    type: 'pictures',
-    shouldPass: true,
-
-    app: "https://example.com/manifest_cert.webapp",
-    permissions: ["device-storage:pictures"],
-
-    test: TestCreateDirectory
-  },
-  {
-    type: 'videos',
-    shouldPass: true,
-
-    app: "https://example.com/manifest_cert.webapp",
-    permissions: ["device-storage:videos"],
-
-    test: TestCreateDirectory
-  },
-  {
-    type: 'music',
-    shouldPass: true,
-
-    app: "https://example.com/manifest_cert.webapp",
-    permissions: ["device-storage:music"],
-
-    test: TestCreateDirectory
-  },
-  {
-    type: 'sdcard',
-    shouldPass: true,
-
-    app: "https://example.com/manifest_cert.webapp",
-    permissions: ["device-storage:sdcard"],
-
-    test: TestCreateDirectory
-  }
-
-];
-
-function setupTest(iframe,data) {
-  if (data.permissions) {
-    for (let j in data.permissions) {
-      SpecialPowers.addPermission(data.permissions[j], true, iframe.contentDocument);
-    }
-  }
-}
-
-function testComplete(iframe, data) {
-  if (data.permissions) {
-    for (let j in data.permissions) {
-      SpecialPowers.removePermission(data.permissions[j], iframe.contentDocument);
-    }
-  }
-
-  document.getElementById('content').removeChild(iframe);
-
-  if (gData.length == 0) {
-    SimpleTest.finish();
-  } else {
-    gTestRunner.next();
-  }
-}
-
-function runTest() {
-  while (gData.length > 0) {
-    let iframe = document.createElement('iframe');
-    let data = gData.shift();
-
-    iframe.setAttribute('mozbrowser', '');
-    if (data.app) {
-      iframe.setAttribute('mozapp', data.app);
-    }
-
-    iframe.src = gTestUri;
-
-    iframe.addEventListener('load', function(e) {
-      setupTest(iframe, data)
-      data.test(iframe, data);
-    });
-
-    document.getElementById('content').appendChild(iframe);
-    yield undefined;
-  }
-}
-
-function createTestFile(extension) {
-  try {
-    const Cc = SpecialPowers.Cc;
-    const Ci = SpecialPowers.Ci;
-    let directoryService = Cc["@mozilla.org/file/directory_service;1"].getService(Ci.nsIProperties);
-    let f = directoryService.get("TmpD", Ci.nsIFile);
-    f.appendRelativePath("device-storage-testing");
-    f.remove(true);
-    f.appendRelativePath("testfile" + extension);
-    f.create(Ci.nsIFile.NORMAL_FILE_TYPE, 0666);
-  } catch(e) {}
-}
-
-let gTestRunner = runTest();
-SpecialPowers.addPermission("browser", true, gTestUri);
-
-// We are more permissive with CSP in our testing environment....
-const DEFAULT_CSP_PRIV = "default-src *; script-src 'self'; style-src 'self' 'unsafe-inline'; object-src 'none'";
-const DEFAULT_CSP_CERT = "default-src *; script-src 'self'; style-src 'self'; object-src 'none'";
-
-SpecialPowers.pushPrefEnv({'set': [["dom.mozBrowserFramesEnabled", true],
-                                   ["device.storage.enabled", true],
-                                   ["device.storage.testing", true],
-                                   ["device.storage.prompt.testing", false],
-                                   ["security.apps.privileged.CSP.default", DEFAULT_CSP_PRIV],
-                                   ["security.apps.certified.CSP.default", DEFAULT_CSP_CERT]]},
-  function() { gTestRunner.next(); });
-
-</script>
-</pre>
-</body>
-</html>
deleted file mode 100644
--- a/dom/devicestorage/test/test_fs_basic.html
+++ /dev/null
@@ -1,70 +0,0 @@
-<!--
-  Any copyright is dedicated to the Public Domain.
-  http://creativecommons.org/publicdomain/zero/1.0/
--->
-<!DOCTYPE HTML>
-<html> <!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=910412
--->
-<head>
-  <title>Test for the FileSystem API for device storage</title>
-  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <script type="text/javascript" src="devicestorage_common.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=910412">Mozilla Bug 910412</a>
-<p id="display"></p>
-<div id="content" style="display: none">
-</div>
-<pre id="test">
-<script class="testbody" type="text/javascript">
-
-devicestorage_setup();
-
-var gFileName = randomFilename(12);
-
-// The root directory object.
-var gRoot;
-
-function getRootSuccess(r) {
-  ok(r && r.name === storage.storageName, "Failed to get the root directory.");
-
-  gRoot = r;
-
-  // Create a new directory under the root.
-  gRoot.createDirectory(gFileName).then(createDirectorySuccess, cbError);
-}
-
-function createDirectorySuccess(d) {
-  ok(d.name === gFileName, "Failed to create directory: name mismatch.");
-
-  // Get the new created directory from the root.
-  gRoot.get(gFileName).then(getSuccess, cbError);
-}
-
-function getSuccess(d) {
-  ok(d.name === gFileName, "Should get directory - " + gFileName + ".");
-  devicestorage_cleanup();
-}
-
-function cbError(e) {
-  ok(false,  "Should not arrive here! Error: " + e.name);
-  devicestorage_cleanup();
-}
-
-ok(navigator.getDeviceStorage, "Should have getDeviceStorage");
-
-var storage = navigator.getDeviceStorage("pictures");
-ok(storage, "Should have gotten a storage");
-
-var promise = storage.getRoot();
-ok(promise, "Should have a non-null promise");
-
-promise.then(getRootSuccess, cbError);
-</script>
-</pre>
-</body>
-</html>
-
deleted file mode 100644
--- a/dom/devicestorage/test/test_fs_createDirectory.html
+++ /dev/null
@@ -1,105 +0,0 @@
-<!--
-  Any copyright is dedicated to the Public Domain.
-  http://creativecommons.org/publicdomain/zero/1.0/
--->
-<!DOCTYPE HTML>
-<html> <!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=910412
--->
-<head>
-  <title>Test createDirectory of the FileSystem API for device storage</title>
-  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <script type="text/javascript" src="devicestorage_common.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=910412">Mozilla Bug 910412</a>
-<p id="display"></p>
-<div id="content" style="display: none">
-</div>
-<pre id="test">
-<script class="testbody" type="text/javascript">
-
-devicestorage_setup();
-
-// The root directory object.
-var gRoot;
-var gTestCount = 0;
-var gPath = '';
-var gName = '';
-
-function testCreateDirectory(rootDir, path) {
-  rootDir.createDirectory(path).then(createDirectorySuccess, cbError);
-}
-
-function createDirectorySuccess(d) {
-  ok(d.name === gName, "Failed to create directory: name mismatch.");
-
-  // Get the new created directory from the root.
-  gRoot.get(gPath).then(getSuccess, cbError);
-}
-
-function getSuccess(d) {
-  ok(d.name === gName, "Should get directory - " + (gPath || "[root]") + ".");
-  switch (gTestCount) {
-    case 0:
-      gRoot = d;
-      // Create a new directory under the root.
-      gName = gPath = randomFilename(12);
-      testCreateDirectory(gRoot, gName);
-      break;
-    case 1:
-      // Create a sub-directory under current directory.
-      gName = randomFilename(12);
-      gPath = gPath + '/' + gName;
-      testCreateDirectory(d, gName);
-      break;
-    case 2:
-      // Create directory with an existing path.
-      gRoot.createDirectory(gPath).then(function(what) {
-        ok(false, "Should not overwrite an existing directory.");
-        devicestorage_cleanup();
-      }, function(e) {
-        ok(true, "Creating directory should fail if it already exists.");
-
-        // Create a directory whose intermediate directory doesn't exit.
-        gName = randomFilename(12);
-        gPath = 'sub1/sub2/' + gName;
-        testCreateDirectory(gRoot, gPath);
-      });
-      break;
-    default:
-      // Create the parent directory.
-      d.createDirectory('..').then(function(what) {
-        ok(false, "Should not overwrite an existing directory.");
-        devicestorage_cleanup();
-      }, function(e) {
-        ok(true, "Accessing parent directory with '..' is not allowed.");
-        devicestorage_cleanup();
-      });
-      break;
-  }
-  gTestCount++;
-}
-
-function cbError(e) {
-  ok(false, e.name + " error should not arrive here!");
-  devicestorage_cleanup();
-}
-
-ok(navigator.getDeviceStorage, "Should have getDeviceStorage.");
-
-var storage = navigator.getDeviceStorage("pictures");
-ok(storage, "Should have gotten a storage.");
-
-var promise = storage.getRoot();
-ok(promise, "Should have a non-null promise for getRoot.");
-
-gName = storage.storageName;
-promise.then(getSuccess, cbError);
-</script>
-</pre>
-</body>
-</html>
-
deleted file mode 100644
--- a/dom/devicestorage/test/test_fs_get.html
+++ /dev/null
@@ -1,204 +0,0 @@
-<!--
-  Any copyright is dedicated to the Public Domain.
-  http://creativecommons.org/publicdomain/zero/1.0/
--->
-<!DOCTYPE HTML>
-<html> <!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=910412
--->
-<head>
-  <title>Test Directory#get of the FileSystem API for device storage</title>
-  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <script type="text/javascript" src="devicestorage_common.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=910412">Mozilla Bug 910412</a>
-<p id="display"></p>
-<div id="content" style="display: none">
-</div>
-<pre id="test">
-<script class="testbody" type="text/javascript">
-
-devicestorage_setup();
-SimpleTest.requestCompleteLog();
-
-// The root directory object.
-var gRoot = null;
-var gSub1 = null;
-var gSub2 = null;
-var gTestCount = 0;
-var gPath = "/";
-
-function testGetSuccess(dir, path) {
-  dir.get(path).then(getSuccess, cbError);
-}
-
-function testGetFailure(dir, path) {
-  dir.get(path).then(cbSuccess, getFailure);
-}
-
-function getSuccess(r) {
-  ok(r, "[" + gTestCount +"] Should get the file - " + gPath + ".");
-  switch (gTestCount) {
-    case 0:
-      gRoot = r;
-      // Get sub1/sub2/text.png from root.
-      gPath = "sub1/sub2/test.png";
-      testGetSuccess(gRoot, "sub1/sub2/test.png");
-      break;
-    case 1:
-      // Get sub1 from root.
-      gPath = "sub1";
-      testGetSuccess(gRoot, "sub1");
-      break;
-    case 2:
-      // Get sub1/sub2 from root.
-      gSub1 = r;
-      gPath = "sub1/sub2";
-      testGetSuccess(gRoot, "sub1/sub2");
-      break;
-    case 3:
-      // Get sub1/sub2 from sub2.
-      gSub2 = r;
-      gPath = "sub1/sub2";
-      testGetSuccess(gSub1, "sub2");
-      break;
-    case 4:
-      // Test path with leading and trailing white spaces.
-      gPath = "sub1/sub2";
-      testGetSuccess(gSub1, "\t sub2 ");
-      break;
-    case 5:
-      // Get sub1 from sub1/sub2 with "..".
-      gPath = "sub1/sub2/..";
-      testGetFailure(gSub2, "..");
-      break;
-    default:
-      ok(false, "Should not arrive at getSuccess!");
-      devicestorage_cleanup();
-      break;
-  }
-  gTestCount++;
-}
-
-function getFailure(e) {
-  ok(true, "[" + gTestCount +"] Should not get the file - " + gPath + ". Error: " + e.name);
-  switch (gTestCount) {
-    case 6:
-      // Test special path "..".
-      gPath = "sub1/sub2/../sub2";
-      testGetFailure(gSub2, "../sub2");
-      break;
-    case 7:
-      gPath = "sub1/sub2/../sub2";
-      testGetFailure(gRoot, "sub1/sub2/../sub2");
-      break;
-    case 8:
-      // Test special path ".".
-      gPath = "sub1/./sub2";
-      testGetFailure(gRoot, "sub1/./sub2");
-      break;
-    case 9:
-      gPath = "./sub1/sub2";
-      testGetFailure(gRoot, "./sub1/sub2");
-      break;
-    case 10:
-      gPath = "././sub1/sub2";
-      testGetFailure(gRoot, "././sub1/sub2");
-      break;
-    case 11:
-      gPath = "sub1/sub2/.";
-      testGetFailure(gRoot, "sub1/sub2/.");
-      break;
-    case 12:
-      gPath = "sub1/.";
-      testGetFailure(gSub1, "./");
-      break;
-    case 13:
-      // Test path starting with "/".
-      gPath = "sub1/";
-      testGetFailure(gSub1, "/");
-      break;
-    case 14:
-      // Test path ending with "/".
-      gPath = "sub1/";
-      testGetFailure(gSub1, "sub2/");
-      break;
-    case 15:
-      // Test empty path.
-      gPath = "sub2";
-      testGetFailure(gSub2, "");
-      break;
-    case 16:
-      // Test special path "//".
-      gPath = "sub1//sub2";
-      testGetFailure(gRoot, "sub1//sub2");
-      break;
-    case 17:
-      devicestorage_cleanup();
-      break;
-    default:
-      ok(false, "Should not arrive here!");
-      devicestorage_cleanup();
-      break;
-  }
-  gTestCount++;
-}
-
-function cbError(e) {
-  ok(false, "Should not arrive at cbError! Error: " + e.name);
-  devicestorage_cleanup();
-}
-
-function cbSuccess(e) {
-  ok(false, "Should not arrive at cbSuccess!");
-  devicestorage_cleanup();
-}
-
-ok(navigator.getDeviceStorage, "Should have getDeviceStorage.");
-
-var gStorage = navigator.getDeviceStorage("pictures");
-ok(gStorage, "Should have gotten a storage.");
-
-function createTestFile(path, callback) {
-  function addNamed() {
-    var req = gStorage.addNamed(createRandomBlob("image/png"), path);
-
-    req.onsuccess = function() {
-      ok(true, path + " was created.");
-      callback();
-    };
-
-    req.onerror = function(e) {
-      ok(false, "Failed to create " + path + ": " + e.target.error.name);
-      devicestorage_cleanup();
-    };
-  }
-
-  // Bug 980136. Check if the file exists before we create.
-  var req = gStorage.get(path);
-
-  req.onsuccess = function() {
-    ok(true, path + " exists. Do not need to create.");
-    callback();
-  };
-
-  req.onerror = function(e) {
-    ok(true, path + " does not exists: " + e.target.error.name);
-    addNamed();
-  };
-}
-
-createTestFile("sub1/sub2/test.png", function() {
-  var promise = gStorage.getRoot();
-  ok(promise, "Should have a non-null promise for getRoot.");
-  promise.then(getSuccess, cbError);
-});
-
-</script>
-</pre>
-</body>
-</html>
-
--- a/dom/events/ContentEventHandler.cpp
+++ b/dom/events/ContentEventHandler.cpp
@@ -1002,20 +1002,31 @@ ContentEventHandler::GetFlatTextOffsetOf
   NS_ASSERTION(aNativeOffset, "param is invalid");
 
   nsRefPtr<nsRange> prev = new nsRange(aRootContent);
   nsCOMPtr<nsIDOMNode> rootDOMNode(do_QueryInterface(aRootContent));
   prev->SetStart(rootDOMNode, 0);
 
   nsCOMPtr<nsIDOMNode> startDOMNode(do_QueryInterface(aNode));
   NS_ASSERTION(startDOMNode, "startNode doesn't have nsIDOMNode");
-  prev->SetEnd(startDOMNode, aNodeOffset);
 
   nsCOMPtr<nsIContentIterator> iter = NS_NewContentIterator();
-  iter->Init(prev);
+
+  if (aNode->Length() >= static_cast<uint32_t>(aNodeOffset)) {
+    // Offset is within node's length; set end of range to that offset
+    prev->SetEnd(startDOMNode, aNodeOffset);
+    iter->Init(prev);
+  } else if (aNode != static_cast<nsINode*>(aRootContent)) {
+    // Offset is past node's length; set end of range to end of node
+    prev->SetEndAfter(startDOMNode);
+    iter->Init(prev);
+  } else {
+    // Offset is past the root node; set end of range to end of root node
+    iter->Init(aRootContent);
+  }
 
   nsCOMPtr<nsINode> startNode = do_QueryInterface(startDOMNode);
   nsINode* endNode = aNode;
 
   *aNativeOffset = 0;
   for (; !iter->IsDone(); iter->Next()) {
     nsINode* node = iter->GetCurrentNode();
     if (!node) {
deleted file mode 100644
--- a/dom/filesystem/CreateDirectoryTask.cpp
+++ /dev/null
@@ -1,150 +0,0 @@
-/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
-/* vim: set ts=2 et sw=2 tw=80: */
-/* 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/. */
-
-#include "CreateDirectoryTask.h"
-
-#include "DOMError.h"
-#include "mozilla/dom/Directory.h"
-#include "mozilla/dom/FileSystemBase.h"
-#include "mozilla/dom/FileSystemUtils.h"
-#include "mozilla/dom/Promise.h"
-#include "nsIFile.h"
-#include "nsStringGlue.h"
-
-namespace mozilla {
-namespace dom {
-
-CreateDirectoryTask::CreateDirectoryTask(FileSystemBase* aFileSystem,
-                                         const nsAString& aPath)
-  : FileSystemTaskBase(aFileSystem)
-  , mTargetRealPath(aPath)
-{
-  MOZ_ASSERT(NS_IsMainThread(), "Only call on main thread!");
-  if (!aFileSystem) {
-    return;
-  }
-  nsCOMPtr<nsIGlobalObject> globalObject =
-    do_QueryInterface(aFileSystem->GetWindow());
-  if (!globalObject) {
-    return;
-  }
-  mPromise = new Promise(globalObject);
-}
-
-CreateDirectoryTask::CreateDirectoryTask(
-  FileSystemBase* aFileSystem,
-  const FileSystemCreateDirectoryParams& aParam,
-  FileSystemRequestParent* aParent)
-  : FileSystemTaskBase(aFileSystem, aParam, aParent)
-{
-  MOZ_ASSERT(FileSystemUtils::IsParentProcess(),
-             "Only call from parent process!");
-  MOZ_ASSERT(NS_IsMainThread(), "Only call on main thread!");
-  mTargetRealPath = aParam.realPath();
-}
-
-CreateDirectoryTask::~CreateDirectoryTask()
-{
-  MOZ_ASSERT(!mPromise || NS_IsMainThread(),
-             "mPromise should be released on main thread!");
-}
-
-already_AddRefed<Promise>
-CreateDirectoryTask::GetPromise()
-{
-  MOZ_ASSERT(NS_IsMainThread(), "Only call on main thread!");
-  return nsRefPtr<Promise>(mPromise).forget();
-}
-
-FileSystemParams
-CreateDirectoryTask::GetRequestParams(const nsString& aFileSystem) const
-{
-  MOZ_ASSERT(NS_IsMainThread(), "Only call on main thread!");
-  return FileSystemCreateDirectoryParams(aFileSystem, mTargetRealPath);
-}
-
-FileSystemResponseValue
-CreateDirectoryTask::GetSuccessRequestResult() const
-{
-  MOZ_ASSERT(NS_IsMainThread(), "Only call on main thread!");
-  return FileSystemDirectoryResponse(mTargetRealPath);
-}
-
-void
-CreateDirectoryTask::SetSuccessRequestResult(const FileSystemResponseValue& aValue)
-{
-  MOZ_ASSERT(NS_IsMainThread(), "Only call on main thread!");
-  FileSystemDirectoryResponse r = aValue;
-  mTargetRealPath = r.realPath();
-}
-
-void
-CreateDirectoryTask::Work()
-{
-  MOZ_ASSERT(FileSystemUtils::IsParentProcess(),
-             "Only call from parent process!");
-  MOZ_ASSERT(!NS_IsMainThread(), "Only call on worker thread!");
-
-  nsRefPtr<FileSystemBase> filesystem = do_QueryReferent(mFileSystem);
-  if (!filesystem) {
-    return;
-  }
-
-  nsCOMPtr<nsIFile> file = filesystem->GetLocalFile(mTargetRealPath);
-  if (!file) {
-    SetError(NS_ERROR_DOM_FILESYSTEM_INVALID_PATH_ERR);
-    return;
-  }
-
-  bool ret;
-  nsresult rv = file->Exists(&ret);
-  if (NS_FAILED(rv)) {
-    SetError(rv);
-    return;
-  }
-
-  if (ret) {
-    SetError(NS_ERROR_DOM_FILESYSTEM_PATH_EXISTS_ERR);
-    return;
-  }
-
-  rv = file->Create(nsIFile::DIRECTORY_TYPE, 0777);
-  if (NS_FAILED(rv)) {
-    SetError(rv);
-    return;
-  }
-}
-
-void
-CreateDirectoryTask::HandlerCallback()
-{
-  MOZ_ASSERT(NS_IsMainThread(), "Only call on main thread!");
-  nsRefPtr<FileSystemBase> filesystem = do_QueryReferent(mFileSystem);
-  if (!filesystem) {
-    mPromise = nullptr;
-    return;
-  }
-
-  if (HasError()) {
-    nsRefPtr<DOMError> domError = new DOMError(filesystem->GetWindow(),
-      mErrorValue);
-    mPromise->MaybeReject(domError);
-    mPromise = nullptr;
-    return;
-  }
-  nsRefPtr<Directory> dir = new Directory(filesystem, mTargetRealPath);
-  mPromise->MaybeResolve(dir);
-  mPromise = nullptr;
-}
-
-void
-CreateDirectoryTask::GetPermissionAccessType(nsCString& aAccess) const
-{
-  aAccess.AssignLiteral("create");
-}
-
-} // namespace dom
-} // namespace mozilla
deleted file mode 100644
--- a/dom/filesystem/CreateDirectoryTask.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
-/* vim: set ts=2 et sw=2 tw=80: */
-/* 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/. */
-
-#ifndef mozilla_dom_CreateDirectoryTask_h
-#define mozilla_dom_CreateDirectoryTask_h
-
-#include "mozilla/dom/FileSystemTaskBase.h"
-#include "nsAutoPtr.h"
-
-class nsCString;
-class nsString;
-
-namespace mozilla {
-namespace dom {
-
-class Directory;
-class FileSystemBase;
-class FileSystemCreateDirectoryParams;
-class Promise;
-
-class CreateDirectoryTask MOZ_FINAL
-  : public FileSystemTaskBase
-{
-public:
-  CreateDirectoryTask(FileSystemBase* aFileSystem,
-                      const nsAString& aPath);
-  CreateDirectoryTask(FileSystemBase* aFileSystem,
-                      const FileSystemCreateDirectoryParams& aParam,
-                      FileSystemRequestParent* aParent);
-
-  virtual
-  ~CreateDirectoryTask();
-
-  already_AddRefed<Promise>
-  GetPromise();
-
-  virtual void
-  GetPermissionAccessType(nsCString& aAccess) const MOZ_OVERRIDE;
-
-protected:
-  virtual FileSystemParams
-  GetRequestParams(const nsString& aFileSystem) const MOZ_OVERRIDE;
-
-  virtual FileSystemResponseValue
-  GetSuccessRequestResult() const MOZ_OVERRIDE;
-
-  virtual void
-  SetSuccessRequestResult(const FileSystemResponseValue& aValue) MOZ_OVERRIDE;
-
-  virtual void
-  Work() MOZ_OVERRIDE;
-
-  virtual void
-  HandlerCallback() MOZ_OVERRIDE;
-
-private:
-  nsRefPtr<Promise> mPromise;
-  nsString mTargetRealPath;
-};
-
-} // namespace dom
-} // namespace mozilla
-
-#endif // mozilla_dom_CreateDirectoryTask_h
deleted file mode 100644
--- a/dom/filesystem/DeviceStorageFileSystem.cpp
+++ /dev/null
@@ -1,137 +0,0 @@
-/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
-/* vim: set ts=2 et sw=2 tw=80: */
-/* 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/. */
-
-#include "mozilla/dom/DeviceStorageFileSystem.h"
-
-#include "DeviceStorage.h"
-#include "mozilla/Preferences.h"
-#include "mozilla/dom/Directory.h"
-#include "mozilla/dom/FileSystemUtils.h"
-#include "nsCOMPtr.h"
-#include "nsDebug.h"
-#include "nsDeviceStorage.h"
-#include "nsIFile.h"
-#include "nsPIDOMWindow.h"
-
-namespace mozilla {
-namespace dom {
-
-DeviceStorageFileSystem::DeviceStorageFileSystem(
-  const nsAString& aStorageType,
-  const nsAString& aStorageName)
-  : mDeviceStorage(nullptr)
-{
-  MOZ_ASSERT(NS_IsMainThread(), "Only call on main thread!");
-
-  mStorageType = aStorageType;
-  mStorageName = aStorageName;
-
-  // Generate the string representation of the file system.
-  mString.AppendLiteral("devicestorage-");
-  mString.Append(mStorageType);
-  mString.AppendLiteral("-");
-  mString.Append(mStorageName);
-
-  mIsTesting =
-    mozilla::Preferences::GetBool("device.storage.prompt.testing", false);
-
-  // Get the permission name required to access the file system.
-  nsresult rv =
-    DeviceStorageTypeChecker::GetPermissionForType(mStorageType, mPermission);
-  NS_WARN_IF(NS_FAILED(rv));
-
-  // Get the local path of the file system root.
-  // Since the child process is not allowed to access the file system, we only
-  // do this from the parent process.
-  if (!FileSystemUtils::IsParentProcess()) {
-    return;
-  }
-  nsCOMPtr<nsIFile> rootFile;
-  DeviceStorageFile::GetRootDirectoryForType(aStorageType,
-                                             aStorageName,
-                                             getter_AddRefs(rootFile));
-
-  NS_WARN_IF(!rootFile || NS_FAILED(rootFile->GetPath(mLocalRootPath)));
-  FileSystemUtils::LocalPathToNormalizedPath(mLocalRootPath,
-    mNormalizedLocalRootPath);
-
-  // DeviceStorageTypeChecker is a singleton object and must be initialized on
-  // the main thread. We initialize it here so that we can use it on the worker
-  // thread.
-  DebugOnly<DeviceStorageTypeChecker*> typeChecker
-    = DeviceStorageTypeChecker::CreateOrGet();
-  MOZ_ASSERT(typeChecker);
-}
-
-DeviceStorageFileSystem::~DeviceStorageFileSystem()
-{
-}
-
-void
-DeviceStorageFileSystem::SetDeviceStorage(nsDOMDeviceStorage* aDeviceStorage)
-{
-  MOZ_ASSERT(NS_IsMainThread(), "Only call on main thread!");
-  mDeviceStorage = aDeviceStorage;
-}
-
-nsPIDOMWindow*
-DeviceStorageFileSystem::GetWindow() const
-{
-  MOZ_ASSERT(NS_IsMainThread(), "Only call on main thread!");
-  if (!mDeviceStorage) {
-    return nullptr;
-  }
-  return mDeviceStorage->GetOwner();
-}
-
-already_AddRefed<nsIFile>
-DeviceStorageFileSystem::GetLocalFile(const nsAString& aRealPath) const
-{
-  MOZ_ASSERT(FileSystemUtils::IsParentProcess(),
-             "Should be on parent process!");
-  nsAutoString localPath;
-  FileSystemUtils::NormalizedPathToLocalPath(aRealPath, localPath);
-  localPath = mLocalRootPath + localPath;
-  nsCOMPtr<nsIFile> file;
-  nsresult rv = NS_NewLocalFile(localPath, false, getter_AddRefs(file));
-  if (NS_WARN_IF(NS_FAILED(rv))) {
-    return nullptr;
-  }
-  return file.forget();
-}
-
-const nsAString&
-DeviceStorageFileSystem::GetRootName() const
-{
-  return mStorageName;
-}
-
-bool
-DeviceStorageFileSystem::IsSafeFile(nsIFile* aFile) const
-{
-  MOZ_ASSERT(FileSystemUtils::IsParentProcess(),
-             "Should be on parent process!");
-  MOZ_ASSERT(aFile);
-
-  // Check if this file belongs to this storage.
-  nsAutoString path;
-  if (NS_FAILED(aFile->GetPath(path))) {
-    return false;
-  }
-  FileSystemUtils::LocalPathToNormalizedPath(path, path);
-  if (!FileSystemUtils::IsDescendantPath(mNormalizedLocalRootPath, path)) {
-    return false;
-  }
-
-  // Check if the file type is compatible with the storage type.
-  DeviceStorageTypeChecker* typeChecker
-    = DeviceStorageTypeChecker::CreateOrGet();
-  MOZ_ASSERT(typeChecker);
-  return typeChecker->Check(mStorageType, aFile);
-}
-
-} // namespace dom
-} // namespace mozilla
deleted file mode 100644
--- a/dom/filesystem/DeviceStorageFileSystem.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
-/* vim: set ts=2 et sw=2 tw=80: */
-/* 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/. */
-
-#ifndef mozilla_dom_DeviceStorageFileSystem_h
-#define mozilla_dom_DeviceStorageFileSystem_h
-
-#include "mozilla/dom/FileSystemBase.h"
-#include "nsString.h"
-
-class nsDOMDeviceStorage;
-
-namespace mozilla {
-namespace dom {
-
-class DeviceStorageFileSystem
-  : public FileSystemBase
-{
-public:
-  DeviceStorageFileSystem(const nsAString& aStorageType,
-                          const nsAString& aStorageName);
-
-  void
-  SetDeviceStorage(nsDOMDeviceStorage* aDeviceStorage);
-
-  // Overrides FileSystemBase
-
-  virtual nsPIDOMWindow*
-  GetWindow() const MOZ_OVERRIDE;
-
-  virtual already_AddRefed<nsIFile>
-  GetLocalFile(const nsAString& aRealPath) const MOZ_OVERRIDE;
-
-  virtual const nsAString&
-  GetRootName() const MOZ_OVERRIDE;
-
-  virtual bool
-  IsSafeFile(nsIFile* aFile) const MOZ_OVERRIDE;
-
-private:
-  virtual
-  ~DeviceStorageFileSystem();
-
-  nsString mStorageType;
-  nsString mStorageName;
-
-  // The local path of the root. Only available in the parent process.
-  // In the child process, we don't use it and its value should be empty.
-  nsString mLocalRootPath;
-  nsString mNormalizedLocalRootPath;
-  nsDOMDeviceStorage* mDeviceStorage;
-};
-
-} // namespace dom
-} // namespace mozilla
-
-#endif // mozilla_dom_DeviceStorageFileSystem_h
deleted file mode 100644
--- a/dom/filesystem/Directory.cpp
+++ /dev/null
@@ -1,184 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=2 et sw=2 tw=80: */
-/* 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/. */
-
-#include "mozilla/dom/Directory.h"
-
-#include "CreateDirectoryTask.h"
-#include "FileSystemPermissionRequest.h"
-#include "GetFileOrDirectoryTask.h"
-
-#include "nsCharSeparatedTokenizer.h"
-#include "nsStringGlue.h"
-#include "mozilla/dom/DirectoryBinding.h"
-#include "mozilla/dom/FileSystemBase.h"
-#include "mozilla/dom/FileSystemUtils.h"
-
-// Resolve the name collision of Microsoft's API name with macros defined in
-// Windows header files. Undefine the macro of CreateDirectory to avoid
-// Directory#CreateDirectory being replaced by Directory#CreateDirectoryW.
-#ifdef CreateDirectory
-#undef CreateDirectory
-#endif
-
-namespace mozilla {
-namespace dom {
-
-NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_0(Directory)
-NS_IMPL_CYCLE_COLLECTING_ADDREF(Directory)
-NS_IMPL_CYCLE_COLLECTING_RELEASE(Directory)
-NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(Directory)
-  NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
-  NS_INTERFACE_MAP_ENTRY(nsISupports)
-NS_INTERFACE_MAP_END
-
-// static
-already_AddRefed<Promise>
-Directory::GetRoot(FileSystemBase* aFileSystem)
-{
-  nsRefPtr<GetFileOrDirectoryTask> task = new GetFileOrDirectoryTask(
-    aFileSystem, EmptyString(), true);
-  FileSystemPermissionRequest::RequestForTask(task);
-  return task->GetPromise();
-}
-
-Directory::Directory(FileSystemBase* aFileSystem,
-                     const nsAString& aPath)
-  : mPath(aPath)
-{
-  MOZ_ASSERT(aFileSystem, "aFileSystem should not be null.");
-  mFileSystem = do_GetWeakReference(aFileSystem);
-  // Remove the trailing "/".
-  mPath.Trim(FILESYSTEM_DOM_PATH_SEPARATOR, false, true);
-
-  SetIsDOMBinding();
-}
-
-Directory::~Directory()
-{
-}
-
-nsPIDOMWindow*
-Directory::GetParentObject() const
-{
-  nsRefPtr<FileSystemBase> fs = do_QueryReferent(mFileSystem);
-  if (!fs) {
-    return nullptr;
-  }
-  return fs->GetWindow();
-}
-
-JSObject*
-Directory::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope)
-{
-  return DirectoryBinding::Wrap(aCx, aScope, this);
-}
-
-void
-Directory::GetName(nsString& aRetval) const
-{
-  aRetval.Truncate();
-
-  nsRefPtr<FileSystemBase> fs = do_QueryReferent(mFileSystem);
-  if (mPath.IsEmpty() && fs) {
-    aRetval = fs->GetRootName();
-    return;
-  }
-
-  aRetval = Substring(mPath,
-                      mPath.RFindChar(FileSystemUtils::kSeparatorChar) + 1);
-}
-
-already_AddRefed<Promise>
-Directory::CreateDirectory(const nsAString& aPath)
-{
-  nsresult error = NS_OK;
-  nsString realPath;
-  if (!DOMPathToRealPath(aPath, realPath)) {
-    error = NS_ERROR_DOM_FILESYSTEM_INVALID_PATH_ERR;
-  }
-  nsRefPtr<FileSystemBase> fs = do_QueryReferent(mFileSystem);
-  nsRefPtr<CreateDirectoryTask> task = new CreateDirectoryTask(
-    fs, realPath);
-  task->SetError(error);
-  FileSystemPermissionRequest::RequestForTask(task);
-  return task->GetPromise();
-}
-
-already_AddRefed<Promise>
-Directory::Get(const nsAString& aPath)
-{
-  nsresult error = NS_OK;
-  nsString realPath;
-  if (!DOMPathToRealPath(aPath, realPath)) {
-    error = NS_ERROR_DOM_FILESYSTEM_INVALID_PATH_ERR;
-  }
-  nsRefPtr<FileSystemBase> fs = do_QueryReferent(mFileSystem);
-  nsRefPtr<GetFileOrDirectoryTask> task = new GetFileOrDirectoryTask(
-      fs, realPath, false);
-  task->SetError(error);
-  FileSystemPermissionRequest::RequestForTask(task);
-  return task->GetPromise();
-}
-
-bool
-Directory::DOMPathToRealPath(const nsAString& aPath, nsAString& aRealPath) const
-{
-  aRealPath.Truncate();
-
-  nsString relativePath;
-  relativePath = aPath;
-
-  // Trim white spaces.
-  static const char kWhitespace[] = "\b\t\r\n ";
-  relativePath.Trim(kWhitespace);
-
-  if (!IsValidRelativePath(relativePath)) {
-    return false;
-  }
-
-  aRealPath = mPath + NS_LITERAL_STRING(FILESYSTEM_DOM_PATH_SEPARATOR) +
-    relativePath;
-
-  return true;
-}
-
-// static
-bool
-Directory::IsValidRelativePath(const nsString& aPath)
-{
-  // We don't allow empty relative path to access the root.
-  if (aPath.IsEmpty()) {
-    return false;
-  }
-
-  // Leading and trailing "/" are not allowed.
-  if (aPath.First() == FileSystemUtils::kSeparatorChar ||
-      aPath.Last() == FileSystemUtils::kSeparatorChar) {
-    return false;
-  }
-
-  NS_NAMED_LITERAL_STRING(kCurrentDir, ".");
-  NS_NAMED_LITERAL_STRING(kParentDir, "..");
-
-  // Split path and check each path component.
-  nsCharSeparatedTokenizer tokenizer(aPath, FileSystemUtils::kSeparatorChar);
-  while (tokenizer.hasMoreTokens()) {
-    nsDependentSubstring pathComponent = tokenizer.nextToken();
-    // The path containing empty components, such as "foo//bar", is invalid.
-    // We don't allow paths, such as "../foo", "foo/./bar" and "foo/../bar",
-    // to walk up the directory.
-    if (pathComponent.IsEmpty() ||
-        pathComponent.Equals(kCurrentDir) ||
-        pathComponent.Equals(kParentDir)) {
-      return false;
-    }
-  }
-
-  return true;
-}
-
-} // namespace dom
-} // namespace mozilla
deleted file mode 100644
--- a/dom/filesystem/Directory.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=2 et sw=2 tw=80: */
-/* 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/. */
-
-#ifndef mozilla_dom_Directory_h
-#define mozilla_dom_Directory_h
-
-#include "mozilla/Attributes.h"
-#include "mozilla/dom/BindingDeclarations.h"
-#include "nsAutoPtr.h"
-#include "nsCycleCollectionParticipant.h"
-#include "nsPIDOMWindow.h"
-#include "nsWeakReference.h"
-#include "nsWrapperCache.h"
-
-// Resolve the name collision of Microsoft's API name with macros defined in
-// Windows header files. Undefine the macro of CreateDirectory to avoid
-// Directory#CreateDirectory being replaced by Directory#CreateDirectoryW.
-#ifdef CreateDirectory
-#undef CreateDirectory
-#endif
-
-namespace mozilla {
-namespace dom {
-
-class FileSystemBase;
-class Promise;
-
-class Directory MOZ_FINAL
-  : public nsISupports
-  , public nsWrapperCache
-{
-public:
-  NS_DECL_CYCLE_COLLECTING_ISUPPORTS
-  NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(Directory)
-
-public:
-  static already_AddRefed<Promise>
-  GetRoot(FileSystemBase* aFileSystem);
-
-  Directory(FileSystemBase* aFileSystem, const nsAString& aPath);
-  ~Directory();
-
-  // ========= Begin WebIDL bindings. ===========
-
-  nsPIDOMWindow*
-  GetParentObject() const;
-
-  virtual JSObject*
-  WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;
-
-  void
-  GetName(nsString& aRetval) const;
-
-  already_AddRefed<Promise>
-  CreateDirectory(const nsAString& aPath);
-
-  already_AddRefed<Promise>
-  Get(const nsAString& aPath);
-
-  // =========== End WebIDL bindings.============
-private:
-  static bool
-  IsValidRelativePath(const nsString& aPath);
-
-  /*
-   * Convert relative DOM path to the absolute real path.
-   * @return true if succeed. false if the DOM path is invalid.
-   */
-  bool
-  DOMPathToRealPath(const nsAString& aPath, nsAString& aRealPath) const;
-
-  nsWeakPtr mFileSystem;
-  nsString mPath;
-};
-
-} // namespace dom
-} // namespace mozilla
-
-#endif // mozilla_dom_Directory_h
deleted file mode 100644
--- a/dom/filesystem/FileSystemBase.cpp
+++ /dev/null
@@ -1,67 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=2 et sw=2 tw=80: */
-/* 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/. */
-
-#include "mozilla/dom/FileSystemBase.h"
-
-#include "DeviceStorageFileSystem.h"
-#include "nsCharSeparatedTokenizer.h"
-
-namespace mozilla {
-namespace dom {
-
-NS_IMPL_ISUPPORTS1(FileSystemBase, nsISupportsWeakReference)
-
-// static
-already_AddRefed<FileSystemBase>
-FileSystemBase::FromString(const nsAString& aString)
-{
-  if (StringBeginsWith(aString, NS_LITERAL_STRING("devicestorage-"))) {
-    // The string representation of devicestorage file system is of the format:
-    // devicestorage-StorageType-StorageName
-
-    nsCharSeparatedTokenizer tokenizer(aString, char16_t('-'));
-    tokenizer.nextToken();
-
-    nsString storageType;
-    if (tokenizer.hasMoreTokens()) {
-      storageType = tokenizer.nextToken();
-    }
-
-    nsString storageName;
-    if (tokenizer.hasMoreTokens()) {
-      storageName = tokenizer.nextToken();
-    }
-
-    nsCOMPtr<DeviceStorageFileSystem> f =
-      new DeviceStorageFileSystem(storageType, storageName);
-    return f.forget();
-  }
-  return nullptr;
-}
-
-FileSystemBase::FileSystemBase()
-  : mIsTesting(false)
-{
-}
-
-FileSystemBase::~FileSystemBase()
-{
-}
-
-nsPIDOMWindow*
-FileSystemBase::GetWindow() const
-{
-  return nullptr;
-}
-
-bool
-FileSystemBase::IsSafeFile(nsIFile* aFile) const
-{
-  return true;
-}
-
-} // namespace dom
-} // namespace mozilla
deleted file mode 100644
--- a/dom/filesystem/FileSystemBase.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=2 et sw=2 tw=80: */
-/* 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/. */
-
-#ifndef mozilla_dom_FileSystemBase_h
-#define mozilla_dom_FileSystemBase_h
-
-#include "nsWeakReference.h"
-#include "nsAutoPtr.h"
-#include "nsString.h"
-
-class nsPIDOMWindow; // You need |#include "nsPIDOMWindow.h"| in CPP files.
-
-namespace mozilla {
-namespace dom {
-
-/*
- * To make FileSystemBase as a weak reference, so that before the child window
- * is closed and the FileSystemBase is destroyed, we don't need to notify the
- * FileSystemTaskBase instances, which hold the FileSystemBase reference, to
- * cancel and wait until the instances finish.
- */
-class FileSystemBase
-  : public nsSupportsWeakReference
-{
-  NS_DECL_THREADSAFE_ISUPPORTS
-public:
-
-  // Create file system object from its string representation.
-  static already_AddRefed<FileSystemBase>
-  FromString(const nsAString& aString);
-
-  FileSystemBase();
-
-  // Get the string representation of the file system.
-  const nsString&
-  ToString() const
-  {
-    return mString;
-  }
-
-  virtual nsPIDOMWindow*
-  GetWindow() const;
-
-  /*
-   * Create nsIFile object with the given real path (absolute DOM path).
-   */
-  virtual already_AddRefed<nsIFile>
-  GetLocalFile(const nsAString& aRealPath) const = 0;
-
-  /*
-   * Get the virtual name of the root directory. This name will be exposed to
-   * the content page.
-   */
-  virtual const nsAString&
-  GetRootName() const = 0;
-
-  virtual bool
-  IsSafeFile(nsIFile* aFile) const;
-
-  /*
-   * Get the permission name required to access this file system.
-   */
-  const nsCString&
-  GetPermission() const
-  {
-    return mPermission;
-  }
-
-  bool
-  IsTesting() const
-  {
-    return mIsTesting;
-  }
-protected:
-  virtual ~FileSystemBase();
-
-  // The string representation of the file system.
-  nsString mString;
-
-  // The permission name required to access the file system.
-  nsCString mPermission;
-
-  bool mIsTesting;
-};
-
-} // namespace dom
-} // namespace mozilla
-
-#endif // mozilla_dom_FileSystemBase_h
deleted file mode 100644
--- a/dom/filesystem/FileSystemPermissionRequest.cpp
+++ /dev/null
@@ -1,190 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:set ts=2 sw=2 sts=2 et cindent: */
-/* 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/. */
-#include "FileSystemPermissionRequest.h"
-
-#include "mozilla/dom/FileSystemBase.h"
-#include "mozilla/dom/FileSystemTaskBase.h"
-#include "mozilla/dom/FileSystemUtils.h"
-#include "mozilla/dom/TabChild.h"
-#include "nsIDocument.h"
-#include "nsPIDOMWindow.h"
-#include "nsString.h"
-
-namespace mozilla {
-namespace dom {
-
-NS_IMPL_ISUPPORTS2(FileSystemPermissionRequest, nsIRunnable, nsIContentPermissionRequest)
-
-// static
-void
-FileSystemPermissionRequest::RequestForTask(FileSystemTaskBase* aTask)
-{
-  MOZ_ASSERT(aTask, "aTask should not be null!");
-  MOZ_ASSERT(NS_IsMainThread());
-  nsRefPtr<FileSystemPermissionRequest> request =
-    new FileSystemPermissionRequest(aTask);
-  NS_DispatchToCurrentThread(request);
-}
-
-FileSystemPermissionRequest::FileSystemPermissionRequest(
-  FileSystemTaskBase* aTask)
-  : mTask(aTask)
-{
-  MOZ_ASSERT(mTask, "aTask should not be null!");
-  MOZ_ASSERT(NS_IsMainThread());
-
-  mTask->GetPermissionAccessType(mPermissionAccess);
-
-  nsRefPtr<FileSystemBase> filesystem = mTask->GetFileSystem();
-  if (!filesystem) {
-    return;
-  }
-
-  mPermissionType = filesystem->GetPermission();
-
-  mWindow = filesystem->GetWindow();
-  if (!mWindow) {
-    return;
-  }
-
-  nsCOMPtr<nsIDocument> doc = mWindow->GetDoc();
-  if (!doc) {
-    return;
-  }
-
-  mPrincipal = doc->NodePrincipal();
-}
-
-FileSystemPermissionRequest::~FileSystemPermissionRequest()
-{
-}
-
-bool
-FileSystemPermissionRequest::Recv__delete__(const bool& aAllow,
-               const InfallibleTArray<PermissionChoice>& aChoices)
-{
-  MOZ_ASSERT(aChoices.IsEmpty(),
-             "FileSystemPermissionRequest doesn't support permission choice");
-  if (aAllow) {
-    Allow(JS::UndefinedHandleValue);
-  } else {
-    Cancel();
-  }
-  return true;
-}
-
-void
-FileSystemPermissionRequest::IPDLRelease()
-{
-  Release();
-}
-
-NS_IMETHODIMP
-FileSystemPermissionRequest::GetTypes(nsIArray** aTypes)
-{
-  nsTArray<nsString> emptyOptions;
-  return CreatePermissionArray(mPermissionType,
-                               mPermissionAccess,
-                               emptyOptions,
-                               aTypes);
-}
-
-NS_IMETHODIMP
-FileSystemPermissionRequest::GetPrincipal(nsIPrincipal** aRequestingPrincipal)
-{
-  NS_IF_ADDREF(*aRequestingPrincipal = mPrincipal);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-FileSystemPermissionRequest::GetWindow(nsIDOMWindow** aRequestingWindow)
-{
-  NS_IF_ADDREF(*aRequestingWindow = mWindow);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-FileSystemPermissionRequest::GetElement(nsIDOMElement** aRequestingElement)
-{
-  *aRequestingElement = nullptr;
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-FileSystemPermissionRequest::Cancel()
-{
-  MOZ_ASSERT(NS_IsMainThread());
-  mTask->SetError(NS_ERROR_DOM_SECURITY_ERR);
-  mTask->Start();
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-FileSystemPermissionRequest::Allow(JS::HandleValue aChoices)
-{
-  MOZ_ASSERT(NS_IsMainThread());
-  MOZ_ASSERT(aChoices.isUndefined());
-  mTask->Start();
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-FileSystemPermissionRequest::Run()
-{
-  MOZ_ASSERT(NS_IsMainThread());
-
-  nsRefPtr<FileSystemBase> filesystem = mTask->GetFileSystem();
-  if (!filesystem) {
-    Cancel();
-    return NS_OK;
-  }
-
-  if (filesystem->IsTesting()) {
-    Allow(JS::UndefinedHandleValue);
-    return NS_OK;
-  }
-
-  if (FileSystemUtils::IsParentProcess()) {
-    nsCOMPtr<nsIContentPermissionPrompt> prompt
-      = do_CreateInstance(NS_CONTENT_PERMISSION_PROMPT_CONTRACTID);
-    if (!prompt || NS_FAILED(prompt->Prompt(this))) {
-      Cancel();
-    }
-    return NS_OK;
-  }
-
-  if (!mWindow) {
-    Cancel();
-    return NS_OK;
-  }
-
-  // because owner implements nsITabChild, we can assume that it is
-  // the one and only TabChild.
-  TabChild* child = TabChild::GetFrom(mWindow->GetDocShell());
-  if (!child) {
-    Cancel();
-    return NS_OK;
-  }
-
-  // Retain a reference so the object isn't deleted without IPDL's
-  // knowledge. Corresponding release occurs in
-  // DeallocPContentPermissionRequest.
-  AddRef();
-
-  nsTArray<PermissionRequest> permArray;
-  nsTArray<nsString> emptyOptions;
-  permArray.AppendElement(PermissionRequest(mPermissionType,
-                                            mPermissionAccess,
-                                            emptyOptions));
-  child->SendPContentPermissionRequestConstructor(
-    this, permArray, IPC::Principal(mPrincipal));
-
-  Sendprompt();
-  return NS_OK;
-}
-
-} /* namespace dom */
-} /* namespace mozilla */
deleted file mode 100644
--- a/dom/filesystem/FileSystemPermissionRequest.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
-/* vim: set ts=2 et sw=2 tw=80: */
-/* 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/. */
-
-#ifndef mozilla_dom_FileSystemPermissionRequest_h
-#define mozilla_dom_FileSystemPermissionRequest_h
-
-#include "PCOMContentPermissionRequestChild.h"
-#include "nsAutoPtr.h"
-#include "nsContentPermissionHelper.h"
-#include "nsIRunnable.h"
-
-class nsCString;
-class nsPIDOMWindow;
-
-namespace mozilla {
-namespace dom {
-
-class FileSystemTaskBase;
-
-class FileSystemPermissionRequest MOZ_FINAL
-  : public nsIContentPermissionRequest
-  , public nsIRunnable
-  , public PCOMContentPermissionRequestChild
-{
-public:
-  // Request permission for the given task.
-  static void
-  RequestForTask(FileSystemTaskBase* aTask);
-
-  // Overrides PCOMContentPermissionRequestChild
-
-  virtual void
-  IPDLRelease() MOZ_OVERRIDE;
-
-  bool
-  Recv__delete__(const bool& aAllow,
-    const InfallibleTArray<PermissionChoice>& aChoices) MOZ_OVERRIDE;
-
-  NS_DECL_THREADSAFE_ISUPPORTS
-  NS_DECL_NSICONTENTPERMISSIONREQUEST
-  NS_DECL_NSIRUNNABLE
-private:
-  FileSystemPermissionRequest(FileSystemTaskBase* aTask);
-
-  virtual
-  ~FileSystemPermissionRequest();
-
-  nsCString mPermissionType;
-  nsCString mPermissionAccess;
-  nsRefPtr<FileSystemTaskBase> mTask;
-  nsCOMPtr<nsPIDOMWindow> mWindow;
-  nsCOMPtr<nsIPrincipal> mPrincipal;
-};
-
-} // namespace dom
-} // namespace mozilla
-
-#endif // mozilla_dom_FileSystemPermissionRequest_h
deleted file mode 100644
--- a/dom/filesystem/FileSystemRequestParent.cpp
+++ /dev/null
@@ -1,79 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:set ts=2 sw=2 sts=2 et cindent: */
-/* 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/. */
-#include "mozilla/dom/FileSystemRequestParent.h"
-
-#include "CreateDirectoryTask.h"
-#include "GetFileOrDirectoryTask.h"
-
-#include "mozilla/AppProcessChecker.h"
-#include "mozilla/dom/FileSystemBase.h"
-
-namespace mozilla {
-namespace dom {
-
-FileSystemRequestParent::FileSystemRequestParent()
-{
-}
-
-FileSystemRequestParent::~FileSystemRequestParent()
-{
-}
-
-bool
-FileSystemRequestParent::Dispatch(ContentParent* aParent,
-                                  const FileSystemParams& aParams)
-{
-  MOZ_ASSERT(aParent, "aParent should not be null.");
-  nsRefPtr<FileSystemTaskBase> task;
-  switch (aParams.type()) {
-
-    case FileSystemParams::TFileSystemCreateDirectoryParams: {
-      const FileSystemCreateDirectoryParams& p = aParams;
-      mFileSystem = FileSystemBase::FromString(p.filesystem());
-      task = new CreateDirectoryTask(mFileSystem, p, this);
-      break;
-    }
-
-    case FileSystemParams::TFileSystemGetFileOrDirectoryParams: {
-      const FileSystemGetFileOrDirectoryParams& p = aParams;
-      mFileSystem = FileSystemBase::FromString(p.filesystem());
-      task  = new GetFileOrDirectoryTask(mFileSystem, p, this);
-      break;
-    }
-
-    default: {
-      NS_RUNTIMEABORT("not reached");
-      break;
-    }
-  }
-
-  if (NS_WARN_IF(!task || !mFileSystem)) {
-    // Should never reach here.
-    return false;
-  }
-
-  if (!mFileSystem->IsTesting()) {
-    // Check the content process permission.
-
-    nsCString access;
-    task->GetPermissionAccessType(access);
-
-    nsAutoCString permissionName;
-    permissionName = mFileSystem->GetPermission();
-    permissionName.AppendLiteral("-");
-    permissionName.Append(access);
-
-    if (!AssertAppProcessPermission(aParent, permissionName.get())) {
-      return false;
-    }
-  }
-
-  task->Start();
-  return true;
-}
-
-} // namespace dom
-} // namespace mozilla
deleted file mode 100644
--- a/dom/filesystem/FileSystemRequestParent.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:set ts=2 sw=2 sts=2 et cindent: */
-/* 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/. */
-
-#ifndef mozilla_dom_FileSystemRequestParent_h
-#define mozilla_dom_FileSystemRequestParent_h
-
-#include "mozilla/dom/PFileSystemRequestParent.h"
-#include "mozilla/dom/ContentChild.h"
-#include "mozilla/dom/ContentParent.h"
-
-namespace mozilla {
-namespace dom {
-
-class FileSystemBase;
-
-class FileSystemRequestParent
-  : public PFileSystemRequestParent
-{
-  NS_INLINE_DECL_THREADSAFE_REFCOUNTING(FileSystemRequestParent)
-public:
-  FileSystemRequestParent();
-
-  virtual
-  ~FileSystemRequestParent();
-
-  bool
-  IsRunning()
-  {
-    return state() == PFileSystemRequest::__Start;
-  }
-
-  bool
-  Dispatch(ContentParent* aParent, const FileSystemParams& aParams);
-private:
-  nsRefPtr<FileSystemBase> mFileSystem;
-};
-
-} // namespace dom
-} // namespace mozilla
-
-#endif // mozilla_dom_FileSystemRequestParent_h
deleted file mode 100644
--- a/dom/filesystem/FileSystemTaskBase.cpp
+++ /dev/null
@@ -1,207 +0,0 @@
-/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
-/* vim: set ts=2 et sw=2 tw=80: */
-/* 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/. */
-
-#include "mozilla/dom/FileSystemTaskBase.h"
-
-#include "nsNetUtil.h" // Stream transport service.
-#include "mozilla/dom/ContentChild.h"
-#include "mozilla/dom/FileSystemBase.h"
-#include "mozilla/dom/FileSystemRequestParent.h"
-#include "mozilla/dom/FileSystemUtils.h"
-#include "mozilla/dom/Promise.h"
-#include "mozilla/dom/PContent.h"
-#include "mozilla/unused.h"
-
-namespace mozilla {
-namespace dom {
-
-FileSystemTaskBase::FileSystemTaskBase(FileSystemBase* aFileSystem)
-  : mErrorValue(NS_OK)
-{
-  MOZ_ASSERT(NS_IsMainThread(), "Only call on main thread!");
-  MOZ_ASSERT(aFileSystem, "aFileSystem should not be null.");
-  mFileSystem = do_GetWeakReference(aFileSystem);
-}
-
-FileSystemTaskBase::FileSystemTaskBase(FileSystemBase* aFileSystem,
-                                       const FileSystemParams& aParam,
-                                       FileSystemRequestParent* aParent)
-  : mErrorValue(NS_OK)
-  , mRequestParent(aParent)
-{
-  MOZ_ASSERT(FileSystemUtils::IsParentProcess(),
-             "Only call from parent process!");
-  MOZ_ASSERT(NS_IsMainThread(), "Only call on main thread!");
-  MOZ_ASSERT(aFileSystem, "aFileSystem should not be null.");
-  mFileSystem = do_GetWeakReference(aFileSystem);
-}
-
-FileSystemTaskBase::~FileSystemTaskBase()
-{
-}
-
-already_AddRefed<FileSystemBase>
-FileSystemTaskBase::GetFileSystem()
-{
-  nsRefPtr<FileSystemBase> filesystem = do_QueryReferent(mFileSystem);
-  return filesystem.forget();
-}
-
-void
-FileSystemTaskBase::Start()
-{
-  MOZ_ASSERT(NS_IsMainThread(), "Only call on main thread!");
-
-  if (HasError()) {
-    HandlerCallback();
-    return;
-  }
-
-  if (FileSystemUtils::IsParentProcess()) {
-    // Run in parent process.
-    // Start worker thread.
-    nsCOMPtr<nsIEventTarget> target
-      = do_GetService(NS_STREAMTRANSPORTSERVICE_CONTRACTID);
-    NS_ASSERTION(target, "Must have stream transport service.");
-    target->Dispatch(this, NS_DISPATCH_NORMAL);
-    return;
-  }
-
-  // Run in child process.
-  nsRefPtr<FileSystemBase> filesystem = do_QueryReferent(mFileSystem);
-  if (!filesystem) {
-    return;
-  }
-
-  // Retain a reference so the task object isn't deleted without IPDL's
-  // knowledge. The reference will be released by
-  // mozilla::dom::ContentChild::DeallocPFileSystemRequestChild.
-  NS_ADDREF_THIS();
-  ContentChild::GetSingleton()->SendPFileSystemRequestConstructor(this,
-    GetRequestParams(filesystem->ToString()));
-}
-
-NS_IMETHODIMP
-FileSystemTaskBase::Run()
-{
-  if (!NS_IsMainThread()) {
-    // Run worker thread tasks
-    Work();
-    // Dispatch itself to main thread
-    NS_DispatchToMainThread(this);
-    return NS_OK;
-  }
-
-  // Run main thread tasks
-  HandleResult();
-  return NS_OK;
-}
-
-void
-FileSystemTaskBase::HandleResult()
-{
-  MOZ_ASSERT(FileSystemUtils::IsParentProcess(),
-             "Only call from parent process!");
-  MOZ_ASSERT(NS_IsMainThread(), "Only call on main thread!");
-  nsRefPtr<FileSystemBase> filesystem = do_QueryReferent(mFileSystem);
-  if (!filesystem) {
-    return;
-  }
-  if (mRequestParent && mRequestParent->IsRunning()) {
-    unused << mRequestParent->Send__delete__(mRequestParent,
-      GetRequestResult());
-  } else {
-    HandlerCallback();
-  }
-}
-
-FileSystemResponseValue
-FileSystemTaskBase::GetRequestResult() const
-{
-  MOZ_ASSERT(FileSystemUtils::IsParentProcess(),
-             "Only call from parent process!");
-  MOZ_ASSERT(NS_IsMainThread(), "Only call on main thread!");
-  if (HasError()) {
-    return FileSystemErrorResponse(mErrorValue);
-  } else {
-    return GetSuccessRequestResult();
-  }
-}
-
-void
-FileSystemTaskBase::SetRequestResult(const FileSystemResponseValue& aValue)
-{
-  MOZ_ASSERT(!FileSystemUtils::IsParentProcess(),
-             "Only call from child process!");
-  MOZ_ASSERT(NS_IsMainThread(), "Only call on main thread!");
-  if (aValue.type() == FileSystemResponseValue::TFileSystemErrorResponse) {
-    FileSystemErrorResponse r = aValue;
-    mErrorValue = r.error();
-  } else {
-    SetSuccessRequestResult(aValue);
-  }
-}
-
-bool
-FileSystemTaskBase::Recv__delete__(const FileSystemResponseValue& aValue)
-{
-  SetRequestResult(aValue);
-  HandlerCallback();
-  return true;
-}
-
-void
-FileSystemTaskBase::SetError(const nsresult& aErrorValue)
-{
-  uint16_t module = NS_ERROR_GET_MODULE(aErrorValue);
-  if (module == NS_ERROR_MODULE_DOM_FILESYSTEM ||
-      module == NS_ERROR_MODULE_DOM_FILE ||
-      module == NS_ERROR_MODULE_DOM) {
-    mErrorValue = aErrorValue;
-    return;
-  }
-
-  switch (aErrorValue) {
-    case NS_OK:
-      mErrorValue = NS_OK;
-      return;
-
-    case NS_ERROR_FILE_INVALID_PATH:
-    case NS_ERROR_FILE_UNRECOGNIZED_PATH:
-      mErrorValue = NS_ERROR_DOM_FILESYSTEM_INVALID_PATH_ERR;
-      return;
-
-    case NS_ERROR_FILE_DESTINATION_NOT_DIR:
-      mErrorValue = NS_ERROR_DOM_FILESYSTEM_INVALID_MODIFICATION_ERR;
-      return;
-
-    case NS_ERROR_FILE_ACCESS_DENIED:
-    case NS_ERROR_FILE_DIR_NOT_EMPTY:
-      mErrorValue = NS_ERROR_DOM_FILESYSTEM_NO_MODIFICATION_ALLOWED_ERR;
-      return;
-
-    case NS_ERROR_FILE_TARGET_DOES_NOT_EXIST:
-    case NS_ERROR_NOT_AVAILABLE:
-      mErrorValue = NS_ERROR_DOM_FILE_NOT_FOUND_ERR;
-      return;
-
-    case NS_ERROR_FILE_ALREADY_EXISTS:
-      mErrorValue = NS_ERROR_DOM_FILESYSTEM_PATH_EXISTS_ERR;
-      return;
-
-    case NS_ERROR_FILE_NOT_DIRECTORY:
-      mErrorValue = NS_ERROR_DOM_FILESYSTEM_TYPE_MISMATCH_ERR;
-      return;
-
-    case NS_ERROR_UNEXPECTED:
-    default:
-      mErrorValue = NS_ERROR_DOM_FILESYSTEM_UNKNOWN_ERR;
-      return;
-  }
-}
-
-} // namespace dom
-} // namespace mozilla
deleted file mode 100644
--- a/dom/filesystem/FileSystemTaskBase.h
+++ /dev/null
@@ -1,239 +0,0 @@
-/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
-/* vim: set ts=2 et sw=2 tw=80: */
-/* 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/. */
-
-#ifndef mozilla_dom_FileSystemTaskBase_h
-#define mozilla_dom_FileSystemTaskBase_h
-
-#include "mozilla/ErrorResult.h"
-#include "mozilla/dom/FileSystemRequestParent.h"
-#include "mozilla/dom/PFileSystemRequestChild.h"
-#include "nsWeakReference.h"
-
-namespace mozilla {
-namespace dom {
-
-class FileSystemBase;
-class FileSystemParams;
-class Promise;
-
-/*
- * The base class to implement a Task class.
- * The task is used to handle the OOP (out of process) operations.
- * The file system operations can only be performed in the parent process. When
- * performing such a parent-process-only operation, a task will delivered the
- * operation to the parent process if needed.
- *
- * The following diagram illustrates the how a API call from the content page
- * starts a task and gets call back results.
- *
- * The left block is the call sequence inside the child process, while the
- * right block is the call sequence inside the parent process.
- *
- * There are two types of API call. One is from the content page of the child
- * process and we mark the steps as (1) to (8). The other is from the content
- * page of the parent process and we mark the steps as (1') to (4').
- *
- *       Page                                             Page
- *        |                                                |
- *        | (1)                                            |  (1')
- *  ______|________________     |     _____________________|_____________
- * |      |                |    |    |                     |             |
- * |      |  Task in       |    |    |  Task in            |             |
- * |      |  Child Process |    |    |  Parent Process     |             |
- * |      V                |   IPC   |                     V             |
- * [new FileSystemTaskBase()]   |    |     [new FileSystemTaskBase()]    |
- * |         |             |    |    |                         |         |
- * |         | (2)         |         |                         | (2')    |
- * |         V             |   (3)   |                         |         |
- * |    [GetRequestParams]------------->[new FileSystemTaskBase(...)]    |
- * |                       |         |          |              |         |
- * |                       |    |    |          | (4)          |         |
- * |                       |    |    |          |              V         |
- * |                       |    |    |          -----------> [Work]      |
- * |                       |   IPC   |                         |         |
- * |                       |    |    |                     (5) | (3')    |
- * |                       |    |    |                         V         |
- * |                       |    |    |          --------[HandleResult]   |
- * |                       |    |    |          |              |         |
- * |                       |         |          | (6)          |         |
- * |                       |   (7)   |          V              |         |
- * |   [SetRequestResult]<-------------[GetRequestResult]      |         |
- * |       |               |         |                         | (4')    |
- * |       | (8)           |    |    |                         |         |
- * |       V               |    |    |                         V         |
- * |[HandlerCallback]      |   IPC   |               [HandlerCallback]   |
- * |_______|_______________|    |    |_________________________|_________|
- *         |                    |                              |
- *         V                                                   V
- *        Page                                                Page
- *
- * 1. From child process page
- * Child:
- *   (1) Call FileSystem API from content page with JS. Create a task and run.
- *   The base constructor [FileSystemTaskBase()] of the task should be called.
- *   (2) Forward the task to the parent process through the IPC and call
- *   [GetRequestParams] to prepare the parameters of the IPC.
- * Parent:
- *   (3) The parent process receives IPC and handle it in
- *   FileystemRequestParent.
- *   Get the IPC parameters and create a task to run the IPC task. The base
- *   constructor [FileSystemTaskBase(aParam, aParent)] of the task should be
- *   called to set the task as an IPC task.
- *   (4) The task operation will be performed in the member function of [Work].
- *   A worker thread will be created to run that function. If error occurs
- *   during the operation, call [SetError] to record the error and then abort.
- *   (5) After finishing the task operation, call [HandleResult] to send the
- *   result back to the child process though the IPC.
- *   (6) Call [GetRequestResult] request result to prepare the parameters of the
- *   IPC. Because the formats of the error result for different task are the
- *   same, FileSystemTaskBase can handle the error message without interfering.
- *   Each task only needs to implement its specific success result preparation
- *   function -[GetSuccessRequestResult].
- * Child:
- *   (7) The child process receives IPC and calls [SetRequestResult] to get the
- *   task result. Each task needs to implement its specific success result
- *   parsing function [SetSuccessRequestResult] to get the success result.
- *   (8) Call [HandlerCallback] to send the task result to the content page.
- * 2. From parent process page
- * We don't need to send the task parameters and result to other process. So
- * there are less steps, but their functions are the same. The correspondence
- * between the two types of steps is:
- *   (1') = (1),
- *   (2') = (4),
- *   (3') = (5),
- *   (4') = (8).
- */
-class FileSystemTaskBase
-  : public nsRunnable
-  , public PFileSystemRequestChild
-{
-public:
-  /*
-   * Start the task. If the task is running the child process, it will be
-   * forwarded to parent process by IPC, or else, creates a worker thread to
-   * do the task work.
-   */
-  void
-  Start();
-
-  /*
-   * The error codes are defined in xpcom/base/ErrorList.h and their
-   * corresponding error name and message are defined in dom/base/domerr.msg.
-   */
-  void
-  SetError(const nsresult& aErrorCode);
-
-  already_AddRefed<FileSystemBase>
-  GetFileSystem();
-
-  /*
-   * Get the type of permission access required to perform this task.
-   */
-  virtual void
-  GetPermissionAccessType(nsCString& aAccess) const = 0;
-
-  NS_DECL_NSIRUNNABLE
-protected:
-  /*
-   * To create a task to handle the page content request.
-   */
-  FileSystemTaskBase(FileSystemBase* aFileSystem);
-
-  /*
-   * To create a parent process task delivered from the child process through
-   * IPC.
-   */
-  FileSystemTaskBase(FileSystemBase* aFileSystem,
-                     const FileSystemParams& aParam,
-                     FileSystemRequestParent* aParent);
-
-  virtual
-  ~FileSystemTaskBase();
-
-  /*
-   * The function to perform task operation. It will be run on the worker
-   * thread of the parent process.
-   * Overrides this function to define the task operation for individual task.
-   */
-  virtual void
-  Work() = 0;
-
-  /*
-   * After the task is completed, this function will be called to pass the task
-   * result to the content page.
-   * Override this function to handle the call back to the content page.
-   */
-  virtual void
-  HandlerCallback() = 0;
-
-  /*
-   * Wrap the task parameter to FileSystemParams for sending it through IPC.
-   * It will be called when we need to forward a task from the child process to
-   * the prarent process.
-   * @param filesystem The string representation of the file system.
-   */
-  virtual FileSystemParams
-  GetRequestParams(const nsString& aFileSystem) const = 0;
-
-  /*
-   * Wrap the task success result to FileSystemResponseValue for sending it
-   * through IPC.
-   * It will be called when the task is completed successfully and we need to
-   * send the task success result back to the child process.
-   */
-  virtual FileSystemResponseValue
-  GetSuccessRequestResult() const = 0;
-
-  /*
-   * Unwrap the IPC message to get the task success result.
-   * It will be called when the task is completed successfully and an IPC
-   * message is received in the child process and we want to get the task
-   * success result.
-   */
-  virtual void
-  SetSuccessRequestResult(const FileSystemResponseValue& aValue) = 0;
-
-  bool
-  HasError() const { return mErrorValue != NS_OK; }
-
-  // Overrides PFileSystemRequestChild
-  virtual bool
-  Recv__delete__(const FileSystemResponseValue& value) MOZ_OVERRIDE;
-
-  nsresult mErrorValue;
-
-  nsWeakPtr mFileSystem;
-  nsRefPtr<FileSystemRequestParent> mRequestParent;
-private:
-  /*
-   * After finishing the task operation, handle the task result.
-   * If it is an IPC task, send back the IPC result. Or else, send the result
-   * to the content page.
-   */
-  void
-  HandleResult();
-
-  /*
-   * Wrap the task result to FileSystemResponseValue for sending it through IPC.
-   * It will be called when the task is completed and we need to
-   * send the task result back to the child process.
-   */
-  FileSystemResponseValue
-  GetRequestResult() const;
-
-  /*
-   * Unwrap the IPC message to get the task result.
-   * It will be called when the task is completed and an IPC message is received
-   * in the child process and we want to get the task result.
-   */
-  void
-  SetRequestResult(const FileSystemResponseValue& aValue);
-};
-
-} // namespace dom
-} // namespace mozilla
-
-#endif // mozilla_dom_FileSystemTaskBase_h
deleted file mode 100644
--- a/dom/filesystem/FileSystemUtils.cpp
+++ /dev/null
@@ -1,76 +0,0 @@
-/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
-/* vim: set ts=2 et sw=2 tw=80: */
-/* 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/. */
-
-#include "mozilla/dom/FileSystemUtils.h"
-
-#include "nsXULAppAPI.h"
-
-namespace mozilla {
-namespace dom {
-
-// static
-void
-FileSystemUtils::LocalPathToNormalizedPath(const nsAString& aLocal,
-                                           nsAString& aNorm)
-{
-  nsString result;
-  result = aLocal;
-#if defined(XP_WIN)
-  char16_t* cur = result.BeginWriting();
-  char16_t* end = result.EndWriting();
-  for (; cur < end; ++cur) {
-    if (char16_t('\\') == *cur)
-      *cur = char16_t('/');
-  }
-#endif
-  aNorm = result;
-}
-
-// static
-void
-FileSystemUtils::NormalizedPathToLocalPath(const nsAString& aNorm,
-                                           nsAString& aLocal)
-{
-  nsString result;
-  result = aNorm;
-#if defined(XP_WIN)
-  char16_t* cur = result.BeginWriting();
-  char16_t* end = result.EndWriting();
-  for (; cur < end; ++cur) {
-    if (char16_t('/') == *cur)
-      *cur = char16_t('\\');
-  }
-#endif
-  aLocal = result;
-}
-
-// static
-bool
-FileSystemUtils::IsDescendantPath(const nsAString& aPath,
-                                  const nsAString& aDescendantPath)
-{
-  // The descendant path should begin with its ancestor path.
-  nsAutoString prefix;
-  prefix = aPath + NS_LITERAL_STRING(FILESYSTEM_DOM_PATH_SEPARATOR);
-
-  // Check the sub-directory path to see if it has the parent path as prefix.
-  if (aDescendantPath.Length() < prefix.Length() ||
-      !StringBeginsWith(aDescendantPath, prefix)) {
-    return false;
-  }
-
-  return true;
-}
-
-// static
-bool
-FileSystemUtils::IsParentProcess()
-{
-  return XRE_GetProcessType() == GeckoProcessType_Default;
-}
-
-} // namespace dom
-} // namespace mozilla
deleted file mode 100644
--- a/dom/filesystem/FileSystemUtils.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
-/* vim: set ts=2 et sw=2 tw=80: */
-/* 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/. */
-
-#ifndef mozilla_dom_FileSystemUtils_h
-#define mozilla_dom_FileSystemUtils_h
-
-#include "nsStringGlue.h"
-
-namespace mozilla {
-namespace dom {
-
-#define FILESYSTEM_DOM_PATH_SEPARATOR "/"
-
-/*
- * This class is for error handling.
- * All methods in this class are static.
- */
-class FileSystemUtils
-{
-public:
-  /*
-   * Convert the path separator to "/".
-   */
-  static void
-  LocalPathToNormalizedPath(const nsAString& aLocal, nsAString& aNorm);
-
-  /*
-   * Convert the normalized path separator "/" to the system dependent path
-   * separator, which is "/" on Mac and Linux, and "\" on Windows.
-   */
-  static void
-  NormalizedPathToLocalPath(const nsAString& aNorm, nsAString& aLocal);
-
-  /*
-   * Return true if aDescendantPath is a descendant of aPath. Both aPath and
-   * aDescendantPath are absolute DOM path.
-   */
-  static bool
-  IsDescendantPath(const nsAString& aPath, const nsAString& aDescendantPath);
-
-  static bool
-  IsParentProcess();
-
-  static const char16_t kSeparatorChar = char16_t('/');
-};
-
-} // namespace dom
-} // namespace mozilla
-
-#endif // mozilla_dom_FileSystemUtils_h
deleted file mode 100644
--- a/dom/filesystem/GetFileOrDirectoryTask.cpp
+++ /dev/null
@@ -1,231 +0,0 @@
-/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
-/* vim: set ts=2 et sw=2 tw=80: */
-/* 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/. */
-
-#include "GetFileOrDirectoryTask.h"
-
-#include "js/Value.h"
-#include "mozilla/dom/Directory.h"
-#include "mozilla/dom/FileSystemBase.h"
-#include "mozilla/dom/FileSystemUtils.h"
-#include "mozilla/dom/Promise.h"
-#include "nsDOMFile.h"
-#include "nsIFile.h"
-#include "nsStringGlue.h"
-
-namespace mozilla {
-namespace dom {
-
-GetFileOrDirectoryTask::GetFileOrDirectoryTask(
-  FileSystemBase* aFileSystem,
-  const nsAString& aTargetPath,
-  bool aDirectoryOnly)
-  : FileSystemTaskBase(aFileSystem)
-  , mTargetRealPath(aTargetPath)
-  , mIsDirectory(aDirectoryOnly)
-{
-  MOZ_ASSERT(NS_IsMainThread(), "Only call on main thread!");
-  if (!aFileSystem) {
-    return;
-  }
-  nsCOMPtr<nsIGlobalObject> globalObject =
-    do_QueryInterface(aFileSystem->GetWindow());
-  if (!globalObject) {
-    return;
-  }
-  mPromise = new Promise(globalObject);
-}
-
-GetFileOrDirectoryTask::GetFileOrDirectoryTask(
-  FileSystemBase* aFileSystem,
-  const FileSystemGetFileOrDirectoryParams& aParam,
-  FileSystemRequestParent* aParent)
-  : FileSystemTaskBase(aFileSystem, aParam, aParent)
-  , mIsDirectory(false)
-{
-  MOZ_ASSERT(FileSystemUtils::IsParentProcess(),
-             "Only call from parent process!");
-  MOZ_ASSERT(NS_IsMainThread(), "Only call on main thread!");
-  mTargetRealPath = aParam.realPath();
-}
-
-GetFileOrDirectoryTask::~GetFileOrDirectoryTask()
-{
-  MOZ_ASSERT(!mPromise || NS_IsMainThread(),
-             "mPromise should be released on main thread!");
-}
-
-already_AddRefed<Promise>
-GetFileOrDirectoryTask::GetPromise()
-{
-  MOZ_ASSERT(NS_IsMainThread(), "Only call on main thread!");
-  return nsRefPtr<Promise>(mPromise).forget();
-}
-
-FileSystemParams
-GetFileOrDirectoryTask::GetRequestParams(const nsString& aFileSystem) const
-{
-  MOZ_ASSERT(NS_IsMainThread(), "Only call on main thread!");
-  return FileSystemGetFileOrDirectoryParams(aFileSystem, mTargetRealPath);
-}
-
-FileSystemResponseValue
-GetFileOrDirectoryTask::GetSuccessRequestResult() const
-{
-  MOZ_ASSERT(NS_IsMainThread(), "Only call on main thread!");
-  if (mIsDirectory) {
-    return FileSystemDirectoryResponse(mTargetRealPath);
-  }
-
-  ContentParent* cp = static_cast<ContentParent*>(mRequestParent->Manager());
-  BlobParent* actor = cp->GetOrCreateActorForBlob(mTargetFile);
-  if (!actor) {
-    return FileSystemErrorResponse(NS_ERROR_DOM_FILESYSTEM_UNKNOWN_ERR);
-  }
-  FileSystemFileResponse response;
-  response.blobParent() = actor;
-  return response;
-}
-
-void
-GetFileOrDirectoryTask::SetSuccessRequestResult(const FileSystemResponseValue& aValue)
-{
-  MOZ_ASSERT(NS_IsMainThread(), "Only call on main thread!");
-  switch (aValue.type()) {
-    case FileSystemResponseValue::TFileSystemFileResponse: {
-      FileSystemFileResponse r = aValue;
-      BlobChild* actor = static_cast<BlobChild*>(r.blobChild());
-      nsCOMPtr<nsIDOMBlob> blob = actor->GetBlob();
-      mTargetFile = do_QueryInterface(blob);
-      mIsDirectory = false;
-      break;
-    }
-    case FileSystemResponseValue::TFileSystemDirectoryResponse: {
-      FileSystemDirectoryResponse r = aValue;
-      mTargetRealPath = r.realPath();
-      mIsDirectory = true;
-      break;
-    }
-    default: {
-      NS_RUNTIMEABORT("not reached");
-      break;
-    }
-  }
-}
-
-void
-GetFileOrDirectoryTask::Work()
-{
-  MOZ_ASSERT(FileSystemUtils::IsParentProcess(),
-             "Only call from parent process!");
-  MOZ_ASSERT(!NS_IsMainThread(), "Only call on worker thread!");
-
-  nsRefPtr<FileSystemBase> filesystem = do_QueryReferent(mFileSystem);
-  if (!filesystem) {
-    return;
-  }
-
-  // Whether we want to get the root directory.
-  bool getRoot = mTargetRealPath.IsEmpty();
-
-  nsCOMPtr<nsIFile> file = filesystem->GetLocalFile(mTargetRealPath);
-  if (!file) {
-    SetError(NS_ERROR_DOM_FILESYSTEM_INVALID_PATH_ERR);
-    return;
-  }
-
-  bool ret;
-  nsresult rv = file->Exists(&ret);
-  if (NS_FAILED(rv)) {
-    SetError(rv);
-    return;
-  }
-
-  if (!ret) {
-    if (!getRoot) {
-      SetError(NS_ERROR_DOM_FILE_NOT_FOUND_ERR);
-      return;
-    }
-
-    // If the root directory doesn't exit, create it.
-    rv = file->Create(nsIFile::DIRECTORY_TYPE, 0777);
-    if (NS_FAILED(rv)) {
-      SetError(rv);
-      return;
-    }
-  }
-
-  // Get isDirectory.
-  rv = file->IsDirectory(&mIsDirectory);
-  if (NS_FAILED(rv)) {
-    SetError(rv);
-    return;
-  }
-
-  if (!mIsDirectory) {
-    // Check if the root is a directory.
-    if (getRoot) {
-      SetError(NS_ERROR_DOM_FILESYSTEM_TYPE_MISMATCH_ERR);
-      return;
-    }
-
-    // Get isFile
-    rv = file->IsFile(&ret);
-    if (NS_FAILED(rv)) {
-      SetError(rv);
-      return;
-    }
-    if (!ret) {
-      // Neither directory or file.
-      SetError(NS_ERROR_DOM_FILESYSTEM_TYPE_MISMATCH_ERR);
-      return;
-    }
-
-    if (!filesystem->IsSafeFile(file)) {
-      SetError(NS_ERROR_DOM_SECURITY_ERR);
-      return;
-    }
-
-    mTargetFile = new nsDOMFileFile(file);
-  }
-}
-
-void
-GetFileOrDirectoryTask::HandlerCallback()
-{
-  MOZ_ASSERT(NS_IsMainThread(), "Only call on main thread!");
-  nsRefPtr<FileSystemBase> filesystem = do_QueryReferent(mFileSystem);
-  if (!filesystem) {
-    mPromise = nullptr;
-    return;
-  }
-
-  if (HasError()) {
-    nsRefPtr<DOMError> domError = new DOMError(filesystem->GetWindow(),
-      mErrorValue);
-    mPromise->MaybeReject(domError);
-    mPromise = nullptr;
-    return;
-  }
-
-  if (mIsDirectory) {
-    nsRefPtr<Directory> dir = new Directory(filesystem, mTargetRealPath);
-    mPromise->MaybeResolve(dir);
-    mPromise = nullptr;
-    return;
-  }
-
-  mPromise->MaybeResolve(mTargetFile);
-  mPromise = nullptr;
-}
-
-void
-GetFileOrDirectoryTask::GetPermissionAccessType(nsCString& aAccess) const
-{
-  aAccess.AssignLiteral("read");
-}
-
-} // namespace dom
-} // namespace mozilla
deleted file mode 100644
--- a/dom/filesystem/GetFileOrDirectoryTask.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
-/* vim: set ts=2 et sw=2 tw=80: */
-/* 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/. */
-
-#ifndef mozilla_dom_GetFileOrDirectory_h
-#define mozilla_dom_GetFileOrDirectory_h
-
-#include "mozilla/dom/FileSystemTaskBase.h"
-#include "nsAutoPtr.h"
-
-class nsIDOMFile;
-class nsString;
-
-namespace mozilla {
-namespace dom {
-
-class FileSystemBase;
-class FileSystemFile;
-class FileSystemGetFileOrDirectoryParams;
-class Promise;
-
-class GetFileOrDirectoryTask MOZ_FINAL
-  : public FileSystemTaskBase
-{
-public:
-  // If aDirectoryOnly is set, we should ensure that the target is a directory.
-  GetFileOrDirectoryTask(FileSystemBase* aFileSystem,
-                         const nsAString& aTargetPath,
-                         bool aDirectoryOnly);
-  GetFileOrDirectoryTask(FileSystemBase* aFileSystem,
-                         const FileSystemGetFileOrDirectoryParams& aParam,
-                         FileSystemRequestParent* aParent);
-
-  virtual
-  ~GetFileOrDirectoryTask();
-
-  already_AddRefed<Promise>
-  GetPromise();
-
-  virtual void
-  GetPermissionAccessType(nsCString& aAccess) const MOZ_OVERRIDE;
-protected:
-  virtual FileSystemParams
-  GetRequestParams(const nsString& aFileSystem) const MOZ_OVERRIDE;
-
-  virtual FileSystemResponseValue
-  GetSuccessRequestResult() const MOZ_OVERRIDE;
-
-  virtual void
-  SetSuccessRequestResult(const FileSystemResponseValue& aValue) MOZ_OVERRIDE;
-
-  virtual void
-  Work() MOZ_OVERRIDE;
-
-  virtual void
-  HandlerCallback() MOZ_OVERRIDE;
-
-private:
-  nsRefPtr<Promise> mPromise;
-  nsString mTargetRealPath;
-  // Whether we get a directory.
-  bool mIsDirectory;
-  nsCOMPtr<nsIDOMFile> mTargetFile;
-};
-
-} // namespace dom
-} // namespace mozilla
-
-#endif // mozilla_dom_GetFileOrDirectory_h
deleted file mode 100644
--- a/dom/filesystem/PFileSystemRequest.ipdl
+++ /dev/null
@@ -1,44 +0,0 @@
-/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
-/* vim: set ts=2 et sw=2 tw=80: */
-/* 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/. */
-
-include protocol PBlob;
-include protocol PContent;
-
-namespace mozilla {
-namespace dom {
-
-struct FileSystemFileResponse
-{
-  PBlob blob;
-};
-
-struct FileSystemDirectoryResponse
-{
-  nsString realPath;
-};
-
-struct FileSystemErrorResponse
-{
-  nsresult error;
-};
-
-union FileSystemResponseValue
-{
-  FileSystemDirectoryResponse;
-  FileSystemFileResponse;
-  FileSystemErrorResponse;
-};
-
-sync protocol PFileSystemRequest
-{
-  manager PContent;
-
-child:
-  __delete__(FileSystemResponseValue response);
-};
-
-} // namespace dom
-} // namespace mozilla
deleted file mode 100644
--- a/dom/filesystem/moz.build
+++ /dev/null
@@ -1,39 +0,0 @@
-# -*- 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/.
-
-EXPORTS.mozilla.dom += [
-    'DeviceStorageFileSystem.h',
-    'Directory.h',
-    'FileSystemBase.h',
-    'FileSystemRequestParent.h',
-    'FileSystemTaskBase.h',
-    'FileSystemUtils.h',
-]
-
-SOURCES += [
-    'CreateDirectoryTask.cpp',
-    'DeviceStorageFileSystem.cpp',
-    'Directory.cpp',
-    'FileSystemBase.cpp',
-    'FileSystemPermissionRequest.cpp',
-    'FileSystemRequestParent.cpp',
-    'FileSystemTaskBase.cpp',
-    'FileSystemUtils.cpp',
-    'GetFileOrDirectoryTask.cpp',
-]
-
-FINAL_LIBRARY = 'gklayout'
-
-IPDL_SOURCES += [
-    'PFileSystemRequest.ipdl',
-]
-
-include('/ipc/chromium/chromium-config.mozbuild')
-
-LOCAL_INCLUDES += [
-    '/dom/base',
-]
-
--- a/dom/ipc/ContentChild.cpp
+++ b/dom/ipc/ContentChild.cpp
@@ -111,18 +111,16 @@
 #ifdef MOZ_NUWA_PROCESS
 #include <setjmp.h>
 #include "ipc/Nuwa.h"
 #endif
 
 #include "mozilla/dom/indexedDB/PIndexedDBChild.h"
 #include "mozilla/dom/mobilemessage/SmsChild.h"
 #include "mozilla/dom/devicestorage/DeviceStorageRequestChild.h"
-#include "mozilla/dom/PFileSystemRequestChild.h"
-#include "mozilla/dom/FileSystemTaskBase.h"
 #include "mozilla/dom/bluetooth/PBluetoothChild.h"
 #include "mozilla/dom/PFMRadioChild.h"
 #include "mozilla/ipc/InputStreamUtils.h"
 
 #ifdef MOZ_WEBSPEECH
 #include "mozilla/dom/PSpeechSynthesisChild.h"
 #endif
 
@@ -1041,34 +1039,16 @@ ContentChild::AllocPDeviceStorageRequest
 
 bool
 ContentChild::DeallocPDeviceStorageRequestChild(PDeviceStorageRequestChild* aDeviceStorage)
 {
     delete aDeviceStorage;
     return true;
 }
 
-PFileSystemRequestChild*
-ContentChild::AllocPFileSystemRequestChild(const FileSystemParams& aParams)
-{
-    NS_NOTREACHED("Should never get here!");
-    return nullptr;
-}
-
-bool
-ContentChild::DeallocPFileSystemRequestChild(PFileSystemRequestChild* aFileSystem)
-{
-    mozilla::dom::FileSystemTaskBase* child =
-      static_cast<mozilla::dom::FileSystemTaskBase*>(aFileSystem);
-    // The reference is increased in FileSystemTaskBase::Start of
-    // FileSystemTaskBase.cpp. We should decrease it after IPC.
-    NS_RELEASE(child);
-    return true;
-}
-
 PNeckoChild*
 ContentChild::AllocPNeckoChild()
 {
     return new NeckoChild();
 }
 
 bool
 ContentChild::DeallocPNeckoChild(PNeckoChild* necko)
--- a/dom/ipc/ContentChild.h
+++ b/dom/ipc/ContentChild.h
@@ -94,19 +94,16 @@ public:
 
     virtual PBrowserChild* AllocPBrowserChild(const IPCTabContext &aContext,
                                               const uint32_t &chromeFlags);
     virtual bool DeallocPBrowserChild(PBrowserChild*);
 
     virtual PDeviceStorageRequestChild* AllocPDeviceStorageRequestChild(const DeviceStorageParams&);
     virtual bool DeallocPDeviceStorageRequestChild(PDeviceStorageRequestChild*);
 
-    virtual PFileSystemRequestChild* AllocPFileSystemRequestChild(const FileSystemParams&);
-    virtual bool DeallocPFileSystemRequestChild(PFileSystemRequestChild*);
-
     virtual PBlobChild* AllocPBlobChild(const BlobConstructorParams& aParams);
     virtual bool DeallocPBlobChild(PBlobChild*);
 
     virtual PCrashReporterChild*
     AllocPCrashReporterChild(const mozilla::dom::NativeThreadId& id,
                              const uint32_t& processType) MOZ_OVERRIDE;
     virtual bool
     DeallocPCrashReporterChild(PCrashReporterChild*) MOZ_OVERRIDE;
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -33,17 +33,16 @@
 #include "mozilla/dom/power/PowerManagerService.h"
 #include "mozilla/dom/DOMStorageIPC.h"
 #include "mozilla/dom/bluetooth/PBluetoothParent.h"
 #include "mozilla/dom/PFMRadioParent.h"
 #include "mozilla/dom/devicestorage/DeviceStorageRequestParent.h"
 #include "mozilla/dom/GeolocationBinding.h"
 #include "mozilla/dom/telephony/TelephonyParent.h"
 #include "mozilla/dom/time/DateCacheCleaner.h"
-#include "mozilla/dom/FileSystemRequestParent.h"
 #include "SmsParent.h"
 #include "mozilla/hal_sandbox/PHalParent.h"
 #include "mozilla/ipc/BackgroundChild.h"
 #include "mozilla/ipc/BackgroundParent.h"
 #include "mozilla/ipc/TestShellParent.h"
 #include "mozilla/ipc/InputStreamUtils.h"
 #include "mozilla/layers/CompositorParent.h"
 #include "mozilla/layers/ImageBridgeParent.h"
@@ -2271,34 +2270,16 @@ ContentParent::AllocPDeviceStorageReques
 bool
 ContentParent::DeallocPDeviceStorageRequestParent(PDeviceStorageRequestParent* doomed)
 {
   DeviceStorageRequestParent *parent = static_cast<DeviceStorageRequestParent*>(doomed);
   NS_RELEASE(parent);
   return true;
 }
 
-PFileSystemRequestParent*
-ContentParent::AllocPFileSystemRequestParent(const FileSystemParams& aParams)
-{
-  nsRefPtr<FileSystemRequestParent> result = new FileSystemRequestParent();
-  if (!result->Dispatch(this, aParams)) {
-    return nullptr;
-  }
-  return result.forget().get();
-}
-
-bool
-ContentParent::DeallocPFileSystemRequestParent(PFileSystemRequestParent* doomed)
-{
-  FileSystemRequestParent* parent = static_cast<FileSystemRequestParent*>(doomed);
-  NS_RELEASE(parent);
-  return true;
-}
-
 PBlobParent*
 ContentParent::AllocPBlobParent(const BlobConstructorParams& aParams)
 {
   return BlobParent::Create(this, aParams);
 }
 
 bool
 ContentParent::DeallocPBlobParent(PBlobParent* aActor)
--- a/dom/ipc/ContentParent.h
+++ b/dom/ipc/ContentParent.h
@@ -341,22 +341,16 @@ private:
     virtual PBrowserParent* AllocPBrowserParent(const IPCTabContext& aContext,
                                                 const uint32_t& aChromeFlags) MOZ_OVERRIDE;
     virtual bool DeallocPBrowserParent(PBrowserParent* frame) MOZ_OVERRIDE;
 
     virtual PDeviceStorageRequestParent*
     AllocPDeviceStorageRequestParent(const DeviceStorageParams&) MOZ_OVERRIDE;
     virtual bool DeallocPDeviceStorageRequestParent(PDeviceStorageRequestParent*) MOZ_OVERRIDE;
 
-    virtual PFileSystemRequestParent*
-    AllocPFileSystemRequestParent(const FileSystemParams&) MOZ_OVERRIDE;
-
-    virtual bool
-    DeallocPFileSystemRequestParent(PFileSystemRequestParent*) MOZ_OVERRIDE;
-
     virtual PBlobParent* AllocPBlobParent(const BlobConstructorParams& aParams) MOZ_OVERRIDE;
     virtual bool DeallocPBlobParent(PBlobParent*) MOZ_OVERRIDE;
 
     virtual bool DeallocPCrashReporterParent(PCrashReporterParent* crashreporter) MOZ_OVERRIDE;
 
     virtual bool RecvGetRandomValues(const uint32_t& length,
                                      InfallibleTArray<uint8_t>* randomValues) MOZ_OVERRIDE;
 
--- a/dom/ipc/PContent.ipdl
+++ b/dom/ipc/PContent.ipdl
@@ -9,17 +9,16 @@ include protocol PBackground;
 include protocol PBlob;
 include protocol PBluetooth;
 include protocol PBrowser;
 include protocol PCompositor;
 include protocol PCrashReporter;
 include protocol PExternalHelperApp;
 include protocol PDeviceStorageRequest;
 include protocol PFMRadio;
-include protocol PFileSystemRequest;
 include protocol PHal;
 include protocol PImageBridge;
 include protocol PIndexedDB;
 include protocol PMemoryReportRequest;
 include protocol PNecko;
 include protocol PSms;
 include protocol PSpeechSynthesis;
 include protocol PStorage;
@@ -189,34 +188,16 @@ union FMRadioRequestParams
 {
   FMRadioRequestEnableParams;
   FMRadioRequestDisableParams;
   FMRadioRequestSetFrequencyParams;
   FMRadioRequestSeekParams;
   FMRadioRequestCancelSeekParams;
 };
 
-struct FileSystemCreateDirectoryParams
-{
-  nsString filesystem;
-  nsString realPath;
-};
-
-struct FileSystemGetFileOrDirectoryParams
-{
-  nsString filesystem;
-  nsString realPath;
-};
-
-union FileSystemParams
-{
-  FileSystemCreateDirectoryParams;
-  FileSystemGetFileOrDirectoryParams;
-};
-
 union PrefValue {
   nsCString;
   int32_t;
   bool;
 };
 
 union MaybePrefValue {
   PrefValue;
@@ -236,17 +217,16 @@ intr protocol PContent
     child opens PBackground;
 
     manages PAsmJSCacheEntry;
     manages PBlob;
     manages PBluetooth;
     manages PBrowser;
     manages PCrashReporter;
     manages PDeviceStorageRequest;
-    manages PFileSystemRequest;
     manages PExternalHelperApp;
     manages PFMRadio;
     manages PHal;
     manages PIndexedDB;
     manages PMemoryReportRequest;
     manages PNecko;
     manages PSms;
     manages PSpeechSynthesis;
@@ -386,18 +366,16 @@ parent:
      */
     sync GetProcessAttributes()
         returns (uint64_t id, bool isForApp, bool isForBrowser);
     sync GetXPCOMProcessAttributes()
         returns (bool isOffline);
 
     PDeviceStorageRequest(DeviceStorageParams params);
 
-    PFileSystemRequest(FileSystemParams params);
-
     sync PCrashReporter(NativeThreadId tid, uint32_t processType);
 
     sync GetRandomValues(uint32_t length)
         returns (uint8_t[] randomValues);
 
     PHal();
 
     PIndexedDB();
--- a/dom/ipc/moz.build
+++ b/dom/ipc/moz.build
@@ -93,17 +93,16 @@ LOCAL_INCLUDES += [
     '/content/base/src',
     '/content/media/webspeech/synth/ipc',
     '/docshell/base',
     '/dom/base',
     '/dom/bluetooth',
     '/dom/bluetooth/ipc',
     '/dom/devicestorage',
     '/dom/events',
-    '/dom/filesystem',
     '/dom/fmradio/ipc',
     '/dom/indexedDB',
     '/dom/indexedDB/ipc',
     '/dom/mobilemessage/src/ipc',
     '/extensions/cookie',
     '/hal/sandbox',
     '/js/ipc',
     '/layout/base',
--- a/dom/moz.build
+++ b/dom/moz.build
@@ -45,17 +45,16 @@ PARALLEL_DIRS += [
     'contacts',
     'phonenumberutils',
     'alarm',
     'datastore',
     'devicestorage',
     'encoding',
     'events',
     'file',
-    'filesystem',
     'fmradio',
     'asmjscache',
     'media',
     'messages',
     'power',
     'push',
     'quota',
     'settings',
--- a/dom/promise/Promise.h
+++ b/dom/promise/Promise.h
@@ -215,32 +215,16 @@ private:
     JSObject* abv = aArgument.Create(aCx, scope);
     if (!abv) {
       return false;
     }
     aValue.setObject(*abv);
     return true;
   }
 
-  // Accept objects that inherit from nsISupports but not nsWrapperCache (e.g.
-  // nsIDOMFile).
-  template <class T>
-  typename EnableIf<!IsBaseOf<nsWrapperCache, T>::value &&
-                    IsBaseOf<nsISupports, T>::value, bool>::Type
-  ArgumentToJSValue(T& aArgument,
-                    JSContext* aCx,
-                    JSObject* aScope,
-                    JS::MutableHandle<JS::Value> aValue)
-  {
-    JS::Rooted<JSObject*> scope(aCx, aScope);
-
-    nsresult rv = nsContentUtils::WrapNative(aCx, scope, &aArgument, aValue);
-    return NS_SUCCEEDED(rv);
-  }
-
   template <template <typename> class SmartPtr, typename T>
   bool
   ArgumentToJSValue(const SmartPtr<T>& aArgument,
                     JSContext* aCx,
                     JSObject* aScope,
                     JS::MutableHandle<JS::Value> aValue)
   {
     return ArgumentToJSValue(*aArgument.get(), aCx, aScope, aValue);
--- a/dom/webidl/DeviceStorage.webidl
+++ b/dom/webidl/DeviceStorage.webidl
@@ -50,12 +50,9 @@ interface DeviceStorage : EventTarget {
 
   // Note that the storageName is just a name (like sdcard), and doesn't
   // include any path information.
   readonly attribute DOMString storageName;
 
   // Determines if this storage area is the one which will be used by default
   // for storing new files.
   readonly attribute boolean default;
-
-  [NewObject]
-  Promise getRoot();
 };
deleted file mode 100644
--- a/dom/webidl/Directory.webidl
+++ /dev/null
@@ -1,49 +0,0 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* 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/.
- */
-
-interface File;
-
-/*
- * All functions on Directory that accept DOMString arguments for file or
- * directory names only allow relative path to current directory itself. The
- * path should be a descendent path like "path/to/file.txt" and not contain a
- * segment of ".." or ".". So the paths aren't allowd to walk up the directory
- * tree. For example, paths like "../foo", "..", "/foo/bar" or "foo/../bar" are
- * not allowed.
- */
-[NoInterfaceObject]
-interface Directory {
-  /*
-   * The leaf name of the directory.
-   */
-  readonly attribute DOMString name;
-
-  /*
-   * Creates a descendent directory. This method will create any intermediate
-   * directories specified by the path segments.
-   *
-   * @param path The relative path of the new directory to current directory.
-   * If path exists, createDirectory must fail.
-   * @return If succeeds, the promise is resolved with the new created
-   * Directory object. Otherwise, rejected with a DOM error.
-   */
-  [NewObject]
-  // Promise<Directory>
-  Promise createDirectory(DOMString path);
-
-  /*
-   * Gets a descendent file or directory with the given path.
-   *
-   * @param path The descendent entry's relative path to current directory.
-   * @return If the path exists and no error occurs, the promise is resolved
-   * with a File or Directory object, depending on the entry's type. Otherwise,
-   * rejected with a DOM error.
-   */
-  [NewObject]
-  // Promise<(File or Directory)>
-  Promise get(DOMString path);
-};
-
--- a/dom/webidl/moz.build
+++ b/dom/webidl/moz.build
@@ -68,17 +68,16 @@ WEBIDL_FILES = [
     'DataContainerEvent.webidl',
     'DataStore.webidl',
     'DataTransfer.webidl',
     'DedicatedWorkerGlobalScope.webidl',
     'DelayNode.webidl',
     'DesktopNotification.webidl',
     'DeviceMotionEvent.webidl',
     'DeviceStorage.webidl',
-    'Directory.webidl',
     'Document.webidl',
     'DocumentFragment.webidl',
     'DocumentType.webidl',
     'DOMCursor.webidl',
     'DOMError.webidl',
     'DOMException.webidl',
     'DOMImplementation.webidl',
     'DOMMMIError.webidl',
--- a/js/src/aclocal.m4
+++ b/js/src/aclocal.m4
@@ -7,17 +7,16 @@ builtin(include, ../../build/autoconf/ho
 builtin(include, ../../build/autoconf/acwinpaths.m4)dnl
 builtin(include, ../../build/autoconf/hooks.m4)dnl
 builtin(include, ../../build/autoconf/config.status.m4)dnl
 builtin(include, ../../build/autoconf/toolchain.m4)dnl
 builtin(include, ../../build/autoconf/ccache.m4)dnl
 builtin(include, ../../build/autoconf/wrapper.m4)dnl
 builtin(include, ../../build/autoconf/pkg.m4)dnl
 builtin(include, ../../build/autoconf/nspr.m4)dnl
-builtin(include, ../../build/autoconf/nspr-build.m4)dnl
 builtin(include, ../../build/autoconf/codeset.m4)dnl
 builtin(include, ../../build/autoconf/altoptions.m4)dnl
 builtin(include, ../../build/autoconf/mozprog.m4)dnl
 builtin(include, ../../build/autoconf/mozheader.m4)dnl
 builtin(include, ../../build/autoconf/mozcommonheader.m4)dnl
 builtin(include, ../../build/autoconf/lto.m4)dnl
 builtin(include, ../../build/autoconf/gcc-pr49911.m4)dnl
 builtin(include, ../../build/autoconf/gcc-pr39608.m4)dnl
--- a/js/src/configure.in
+++ b/js/src/configure.in
@@ -99,17 +99,17 @@ then
 	*     1. cd $_topsrcdir
 	*     2. gmake distclean
 	***
 	EOF
     exit 1
     break
   fi
 fi
-MOZ_BUILD_ROOT=`pwd -W 2>/dev/null || pwd`
+MOZ_BUILD_ROOT=`pwd`
 
 dnl Choose where to put the 'dist' directory.
 dnl ==============================================================
 
 MOZ_ARG_WITH_STRING(dist-dir,
 [  --with-dist-dir=DIR     Use DIR as 'dist' staging area.  DIR may be
                           relative to the top of SpiderMonkey build tree,
                           or absolute.],
@@ -158,17 +158,16 @@ else
 fi
 AC_SUBST(JS_SHARED_LIBRARY)
 
 if test "$JS_STANDALONE" = no; then
   autoconfmk=autoconf-js.mk
   JS_STANDALONE=
 else
   JS_STANDALONE=1
-  LIBXUL_DIST="$MOZ_BUILD_ROOT/dist"
   AC_DEFINE(JS_STANDALONE)
 fi
 AC_SUBST(JS_STANDALONE)
 BUILDING_JS=1
 AC_SUBST(autoconfmk)
 
 MOZ_ARG_WITH_STRING(gonk,
 [  --with-gonk=DIR
@@ -1707,16 +1706,22 @@ ia64*-hpux*)
     TARGET_NSPR_MDCPUCFG='\"md/_win95.cfg\"'
 
     dnl set NO_X11 defines here as the general check is skipped on win32
     no_x=yes
     AC_DEFINE(NO_X11)
 
     case "$host" in
     *-mingw*)
+        MOZ_BUILD_ROOT=`cd $MOZ_BUILD_ROOT && pwd -W`
+        ;;
+    esac
+
+    case "$host" in
+    *-mingw*)
         if test -z "$MOZ_TOOLS"; then
             AC_MSG_ERROR([MOZ_TOOLS is not set])
         fi
         MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
         if test "$?" != "0" -o -z "$MOZ_TOOLS_DIR"; then
             AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
         fi
         MOZ_TOOLS_BIN_DIR="$(cd "$MOZ_TOOLS_DIR/bin" && pwd)"
@@ -2813,26 +2818,111 @@ AC_SUBST(MOZ_DISABLE_UNIFIED_COMPILATION
 
 dnl ========================================================
 dnl =
 dnl = Check for external package dependencies
 dnl =
 dnl ========================================================
 MOZ_ARG_HEADER(External Packages)
 
+dnl ========================================================
+dnl = Find the right NSPR to use.
+dnl ========================================================
+MOZ_ARG_WITH_BOOL(system-nspr,
+[  --with-system-nspr      Use an NSPR that is already built and installed.
+                          Use the 'nspr-config' script in the current path,
+                          or look for the script in the directories given with
+                          --with-nspr-exec-prefix or --with-nspr-prefix.
+                          (Those flags are only checked if you specify
+                          --with-system-nspr.)],
+    _USE_SYSTEM_NSPR=1 )
+
+MOZ_ARG_WITH_STRING(nspr-cflags,
+[  --with-nspr-cflags=FLAGS
+                          Pass FLAGS to CC when building code that uses NSPR.
+                          Use this when there's no accurate nspr-config
+                          script available.  This is the case when building
+                          SpiderMonkey as part of the Mozilla tree: the
+                          top-level configure script computes NSPR flags
+                          that accomodate the quirks of that environment.],
+    NSPR_CFLAGS=$withval)
+MOZ_ARG_WITH_STRING(nspr-libs,
+[  --with-nspr-libs=LIBS   Pass LIBS to LD when linking code that uses NSPR.
+                          See --with-nspr-cflags for more details.],
+    NSPR_LIBS=$withval)
+AC_SUBST(NSPR_CFLAGS)
+AC_SUBST(NSPR_LIBS)
+
 JS_THREADSAFE=1
 MOZ_ARG_DISABLE_BOOL(threadsafe,
 [  --disable-threadsafe    Disable support for multiple threads.],
     JS_THREADSAFE= ,
     JS_THREADSAFE=1 )
 if test -n "$JS_THREADSAFE"; then
     AC_DEFINE(JS_THREADSAFE)
 fi
 
-MOZ_CONFIG_NSPR(js)
+if test "$_USE_SYSTEM_NSPR" || (test "$NSPR_CFLAGS" -o "$NSPR_LIBS"); then
+  _HAS_NSPR=1
+fi
+
+case "$target" in
+  *linux*|*darwin*|*dragonfly*|*freebsd*|*netbsd*|*openbsd*)
+    if test -z "$_HAS_NSPR" && test "$JS_THREADSAFE"; then
+      JS_POSIX_NSPR_DEFAULT=1
+    fi
+    ;;
+esac
+
+MOZ_ARG_ENABLE_BOOL(posix-nspr-emulation,
+[  --enable-posix-nspr-emulation
+                          Enable emulation of NSPR for POSIX systems],
+    JS_POSIX_NSPR=1,
+    JS_POSIX_NSPR=,
+    JS_POSIX_NSPR="$JS_POSIX_NSPR_DEFAULT" )
+if test -n "$JS_POSIX_NSPR"; then
+    AC_DEFINE(JS_POSIX_NSPR)
+fi
+
+AC_SUBST(JS_POSIX_NSPR)
+
+dnl Pass either --with-system-nspr or (--with-nspr-cflags and
+dnl --with-nspr-libs), but not both.
+if test "$_USE_SYSTEM_NSPR" && (test "$NSPR_CFLAGS" -o "$NSPR_LIBS"); then
+    AC_MSG_ERROR([--with-system-nspr and --with-nspr-libs/cflags are mutually exclusive.
+See 'configure --help'.])
+fi
+
+dnl Can't use --enable-posix-nspr-emulation if compiling with NSPR.
+if test "$_HAS_NSPR" && test "$JS_POSIX_NSPR"; then
+    AC_MSG_ERROR([--enable-posix-nspr-emulation is mututally exclusive with --with-system-nspr
+and --with-nspr-libs/cflags. See 'configure --help'.])
+fi
+
+if test -n "$_USE_SYSTEM_NSPR"; then
+    MOZ_NATIVE_NSPR=
+    AM_PATH_NSPR($NSPR_MINVER, [MOZ_NATIVE_NSPR=1], [AC_MSG_ERROR([your don't have NSPR installed or your version is too old])])
+fi
+
+NSPR_PKGCONF_CHECK="nspr"
+if test -n "$MOZ_NATIVE_NSPR"; then
+    # piggy back on $MOZ_NATIVE_NSPR to set a variable for the nspr check for js.pc
+    NSPR_PKGCONF_CHECK="nspr >= $NSPR_MINVER"
+
+    _SAVE_CFLAGS=$CFLAGS
+    CFLAGS="$CFLAGS $NSPR_CFLAGS"
+    AC_TRY_COMPILE([#include "prlog.h"],
+                [#ifndef PR_STATIC_ASSERT
+                 #error PR_STATIC_ASSERT not defined
+                 #endif],
+                [MOZ_NATIVE_NSPR=1],
+                AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT]))
+    CFLAGS=$_SAVE_CFLAGS
+fi
+AC_SUBST(NSPR_PKGCONF_CHECK)
 
 dnl ========================================================
 dnl system zlib Support
 dnl ========================================================
 dnl Standalone js defaults to system zlib
 ZLIB_DIR=yes
 
 MOZ_ZLIB_CHECK([1.2.3])
@@ -4031,19 +4121,16 @@ if test -n "$GNU_CC"; then
 JS_CONFIG_MOZ_JS_LIBS='-L${libdir} -l${JS_LIBRARY_NAME}'
 else
 JS_CONFIG_MOZ_JS_LIBS='${libdir}/${JS_LIBRARY_NAME}.lib'
 fi
 AC_SUBST(JS_LIBRARY_NAME)
 AC_SUBST(JS_CONFIG_MOZ_JS_LIBS)
 AC_SUBST(JS_CONFIG_LIBS)
 
-if test -n "$MOZ_BUILD_NSPR"; then
-    MOZ_SUBCONFIGURE_NSPR()
-fi
 MOZ_SUBCONFIGURE_FFI()
 
 dnl Spit out some output
 dnl ========================================================
 MOZ_CREATE_CONFIG_STATUS()
 
 if test "$JS_STANDALONE"; then
   MOZ_RUN_CONFIG_STATUS()
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/arrays/new-array-int-undefined-args.js
@@ -0,0 +1,2 @@
+for (var i = 0; i < 1e4; i++)
+  assertEq(new Array(0, undefined).length, 2, "bad, i: " + i);
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/arrays/new-array-undefined-undefined-more-args-1.js
@@ -0,0 +1,6 @@
+for (var i = 0; i < 1e4; i++)
+{
+  assertEq(typeof new Array(undefined, undefined, 1, 2, 3, 4).sort()[0],
+           "number",
+           "bad, i: " + i);
+}
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/arrays/new-array-undefined-undefined-more-args-2.js
@@ -0,0 +1,6 @@
+for (var i = 0; i < 1e4; i++)
+{
+  assertEq(new Array(undefined, undefined, 1, 2, 3, 4).length,
+           6,
+           "bad, i: " + i);
+}
--- a/js/src/vm/GlobalObject.h
+++ b/js/src/vm/GlobalObject.h
@@ -624,19 +624,17 @@ class GlobalObject : public JSObject
         // debuggers like Firebug (bug 934669).
         //return warnOnceAbout(cx, obj, WARNED_WATCH_DEPRECATED, JSMSG_OBJECT_WATCH_DEPRECATED);
         return true;
     }
 
     // Warn about use of the given __proto__ setter to attempt to mutate an
     // object's [[Prototype]], if no prior warning was given.
     static bool warnOnceAboutPrototypeMutation(JSContext *cx, HandleObject protoSetter) {
-        // Temporarily disabled until the second half of bug 948583 lands.
-        //return warnOnceAbout(cx, protoSetter, WARNED_PROTO_SETTING_SLOW, JSMSG_PROTO_SETTING_SLOW);
-        return true;
+        return warnOnceAbout(cx, protoSetter, WARNED_PROTO_SETTING_SLOW, JSMSG_PROTO_SETTING_SLOW);
     }
 
     static bool getOrCreateEval(JSContext *cx, Handle<GlobalObject*> global,
                                 MutableHandleObject eval);
 
     // Infallibly test whether the given value is the eval function for this global.
     bool valueIsEval(Value val);
 
--- a/layout/build/moz.build
+++ b/layout/build/moz.build
@@ -48,17 +48,16 @@ LOCAL_INCLUDES += [
     '/content/xul/document/src',
     '/content/xul/templates/src',
     '/docshell/base',
     '/dom/audiochannel',
     '/dom/base',
     '/dom/camera',
     '/dom/events',
     '/dom/file',
-    '/dom/filesystem',
     '/dom/media',
     '/dom/speakermanager',
     '/dom/src/geolocation',
     '/dom/src/json',
     '/dom/src/jsurl',
     '/dom/src/offline',
     '/dom/src/storage',
     '/dom/telephony',
--- a/layout/style/test/test_flexbox_flex_shorthand.html
+++ b/layout/style/test/test_flexbox_flex_shorthand.html
@@ -18,19 +18,27 @@ https://bugzilla.mozilla.org/show_bug.cg
 </div>
 <pre id="test">
 <script type="application/javascript;version=1.7">
 "use strict";
 
 /** Test for Bug 696253 **/
 /* (Testing the 'flex' CSS shorthand property) */
 
+// The CSS property name for the shorthand we're testing:
 const gFlexPropName = "flex";
+
+// Info from property_database.js on this property:
 const gFlexPropInfo = gCSSProperties[gFlexPropName];
 
+// The name of the property in the DOM (i.e. in elem.style):
+// (NOTE: In this case it's actually the same as the CSS property name --
+// "flex" -- but that's not guaranteed in general.)
+const gFlexDOMName = gFlexPropInfo.domProp;
+
 // Default values for shorthand subproperties, when they're not specified
 // explicitly in a testcase.  This lets the testcases be more concise.
 //
 // The values here are from the flexbox spec on the 'flex' shorthand:
 //   "When omitted, [flex-grow and flex-shrink] are set to '1'.
 //   "If omitted, the flex basis defaults to 0%"
 let gFlexShorthandDefaults = {
     "flex-grow":   "1",
@@ -236,17 +244,17 @@ let gFlexShorthandTestcases = [
 ];
 
 function runFlexShorthandTest(aFlexShorthandTestcase)
 {
   let content = document.getElementById("content");
 
   let elem = document.createElement("div");
 
-  elem.style[gFlexPropInfo.domProp] = aFlexShorthandTestcase[gFlexPropName];
+  elem.style[gFlexDOMName] = aFlexShorthandTestcase[gFlexPropName];
   content.appendChild(elem);
 
   gFlexPropInfo.subproperties.forEach(function(aSubPropName) {
     var expectedVal = aSubPropName in aFlexShorthandTestcase ?
      aFlexShorthandTestcase[aSubPropName] :
      gFlexShorthandDefaults[aSubPropName];
 
     // Compare computed value against expected computed value (from testcase)
--- a/moz.build
+++ b/moz.build
@@ -34,25 +34,26 @@ if not CONFIG['LIBXUL_SDK']:
         if not CONFIG['MOZ_NATIVE_ZLIB']:
             add_tier_dir('base', ['modules/zlib'])
 
         add_tier_dir('base', ['mozglue', 'memory/mozalloc'])
 
 if not CONFIG['JS_STANDALONE']:
     add_tier_dir('precompile', 'xpcom/xpidl')
 
-if CONFIG['COMPILE_ENVIRONMENT'] and not CONFIG['LIBXUL_SDK']:
-    if CONFIG['MOZ_BUILD_NSPR']:
-        add_tier_dir('nspr', 'config/nspr')
+    if CONFIG['COMPILE_ENVIRONMENT'] and not CONFIG['LIBXUL_SDK']:
+        if not CONFIG['MOZ_NATIVE_NSPR']:
+            add_tier_dir('nspr', 'config/nspr')
 
-    if not CONFIG['JS_STANDALONE']:
         add_tier_dir('external', 'config/external')
+
         if not CONFIG['MOZ_NATIVE_NSS']:
              add_tier_dir('nss', 'security/build')
 
+if CONFIG['COMPILE_ENVIRONMENT'] and not CONFIG['LIBXUL_SDK']:
     if CONFIG['BUILD_CTYPES'] and not CONFIG['MOZ_NATIVE_FFI']:
         add_tier_dir('js', ['js/src/ctypes/libffi'], static=True)
     add_tier_dir('js', ['intl/icu'], static=True)
     CONFIGURE_SUBST_FILES += ['intl/icu/Makefile']
     add_tier_dir('js', ['js/src'])
 
 if not CONFIG['JS_STANDALONE']:
     # Bring in the configuration for the configured application.
--- a/testing/marionette/client/marionette/marionette_test.py
+++ b/testing/marionette/client/marionette/marionette_test.py
@@ -284,17 +284,17 @@ permissions.forEach(function (perm) {
         if hasattr(self.marionette, 'session'):
             if self.marionette.session is not None:
                 try:
                     self.loglines.extend(self.marionette.get_logs())
                 except Exception, inst:
                     self.loglines = [['Error getting log: %s' % inst]]
                 try:
                     self.marionette.delete_session()
-                except (socket.error, MarionetteException):
+                except (socket.error, MarionetteException, IOError):
                     # Gecko has crashed?
                     self.marionette.session = None
                     try:
                         self.marionette.client.close()
                     except socket.error:
                         pass
         self.marionette = None
 
--- a/testing/mochitest/moz.build
+++ b/testing/mochitest/moz.build
@@ -1,15 +1,16 @@
 # -*- 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/.
 
 DIRS += [
+    'manifests',
     'tests',
     'ssltunnel',
 ]
 
 if CONFIG['MOZ_BUILD_APP'] == 'mobile/android':
     DIRS += ['roboextender']
 
 XPI_NAME = 'mochijar'
--- a/toolkit/components/osfile/modules/osfile_async_front.jsm
+++ b/toolkit/components/osfile/modules/osfile_async_front.jsm
@@ -195,23 +195,17 @@ let Scheduler = {
    *
    * @param {function} code A function returning a Promise.
    * This function will be executed once all the previously
    * pushed tasks have completed.
    * @return {Promise} A promise with the same behavior as
    * the promise returned by |code|.
    */
   push: function(code) {
-    let promise = this.queue.then(function() {
-      if (this.shutdown) {
-        LOG("OS.File is not available anymore. Request has been rejected.");
-        throw new Error("OS.File has been shut down.");
-      }
-      return code();
-    }.bind(this));
+    let promise = this.queue.then(code);
     // By definition, |this.queue| can never reject.
     this.queue = promise.then(null, () => undefined);
     // Fork |promise| to ensure that uncaught errors are reported
     return promise.then(null, null);
   },
 
   /**
    * Post a message to the worker thread.
@@ -409,23 +403,24 @@ const PREF_OSFILE_TEST_SHUTDOWN_OBSERVER
  * @return {promise} A promise satisfied once all pending messages
  * (including the shutdown warning message) have been answered.
  */
 function warnAboutUnclosedFiles(shutdown = true) {
   if (!Scheduler.launched || !worker) {
     // Don't launch the scheduler on our behalf. If no message has been
     // sent to the worker, we can't have any leaking file/directory
     // descriptor.
-    Scheduler.shutdown = Scheduler.shutdown || shutdown;
     return null;
   }
   let promise = Scheduler.post("Meta_getUnclosedResources");
 
   // Configure the worker to reject any further message.
-  Scheduler.shutdown = Scheduler.shutdown || shutdown;
+  if (shutdown) {
+    Scheduler.shutdown = true;
+  }
 
   return promise.then(function onSuccess(opened) {
     let msg = "";
     if (opened.openedFiles.length > 0) {
       msg += "The following files are still open:\n" +
         opened.openedFiles.join("\n");
     }
     if (msg) {
--- a/xpcom/base/ErrorList.h
+++ b/xpcom/base/ErrorList.h
@@ -821,28 +821,16 @@
   ERROR(NS_ERROR_SIGNED_JAR_ENTRY_MISSING,                FAILURE(4)),
   ERROR(NS_ERROR_SIGNED_JAR_WRONG_SIGNATURE,              FAILURE(5)),
   ERROR(NS_ERROR_SIGNED_JAR_ENTRY_TOO_LARGE,              FAILURE(6)),
   ERROR(NS_ERROR_SIGNED_JAR_ENTRY_INVALID,                FAILURE(7)),
   ERROR(NS_ERROR_SIGNED_JAR_MANIFEST_INVALID,             FAILURE(8)),
 #undef MODULE
 
   /* ======================================================================= */
-  /* 36: NS_ERROR_MODULE_DOM_FILESYSTEM */
-  /* ======================================================================= */
-#define MODULE NS_ERROR_MODULE_DOM_FILESYSTEM
-  ERROR(NS_ERROR_DOM_FILESYSTEM_INVALID_PATH_ERR,          FAILURE(1)),
-  ERROR(NS_ERROR_DOM_FILESYSTEM_INVALID_MODIFICATION_ERR,  FAILURE(2)),
-  ERROR(NS_ERROR_DOM_FILESYSTEM_NO_MODIFICATION_ALLOWED_ERR, FAILURE(3)),
-  ERROR(NS_ERROR_DOM_FILESYSTEM_PATH_EXISTS_ERR,           FAILURE(4)),
-  ERROR(NS_ERROR_DOM_FILESYSTEM_TYPE_MISMATCH_ERR,         FAILURE(5)),
-  ERROR(NS_ERROR_DOM_FILESYSTEM_UNKNOWN_ERR,               FAILURE(6)),
-#undef MODULE
-
-  /* ======================================================================= */
   /* 51: NS_ERROR_MODULE_GENERAL */
   /* ======================================================================= */
 #define MODULE NS_ERROR_MODULE_GENERAL
   /* Error code used internally by the incremental downloader to cancel the
    * network channel when the download is already complete. */
   ERROR(NS_ERROR_DOWNLOAD_COMPLETE,      FAILURE(1)),
   /* Error code used internally by the incremental downloader to cancel the
    * network channel when the response to a range request is 200 instead of
--- a/xpcom/base/nsError.h
+++ b/xpcom/base/nsError.h
@@ -64,17 +64,16 @@
 #define NS_ERROR_MODULE_IPC        28
 #define NS_ERROR_MODULE_SVG        29
 #define NS_ERROR_MODULE_STORAGE    30
 #define NS_ERROR_MODULE_SCHEMA     31
 #define NS_ERROR_MODULE_DOM_FILE   32
 #define NS_ERROR_MODULE_DOM_INDEXEDDB 33
 #define NS_ERROR_MODULE_DOM_FILEHANDLE 34
 #define NS_ERROR_MODULE_SIGNED_JAR 35
-#define NS_ERROR_MODULE_DOM_FILESYSTEM 36
 
 /* NS_ERROR_MODULE_GENERAL should be used by modules that do not
  * care if return code values overlap. Callers of methods that
  * return such codes should be aware that they are not
  * globally unique. Implementors should be careful about blindly
  * returning codes from other modules that might also use
  * the generic base.
  */
--- a/xpcom/base/nsMemoryReporterManager.cpp
+++ b/xpcom/base/nsMemoryReporterManager.cpp
@@ -1736,22 +1736,26 @@ nsMemoryReporterManager::SizeOfTab(nsIDO
   return NS_OK;
 }
 
 namespace mozilla {
 
 nsresult
 RegisterStrongMemoryReporter(nsIMemoryReporter* aReporter)
 {
+  // Hold a strong reference to the argument to make sure it gets released if
+  // we return early below.
+  nsCOMPtr<nsIMemoryReporter> reporter = aReporter;
+
   nsCOMPtr<nsIMemoryReporterManager> mgr =
     do_GetService("@mozilla.org/memory-reporter-manager;1");
   if (!mgr) {
     return NS_ERROR_FAILURE;
   }
-  return mgr->RegisterStrongReporter(aReporter);
+  return mgr->RegisterStrongReporter(reporter);
 }
 
 nsresult
 RegisterWeakMemoryReporter(nsIMemoryReporter* aReporter)
 {
   nsCOMPtr<nsIMemoryReporterManager> mgr =
     do_GetService("@mozilla.org/memory-reporter-manager;1");
   if (!mgr) {
--- a/xpcom/threads/SyncRunnable.h
+++ b/xpcom/threads/SyncRunnable.h
@@ -28,16 +28,17 @@ namespace mozilla {
  *
  */
 class SyncRunnable : public nsRunnable
 {
 public:
   SyncRunnable(nsIRunnable* r)
     : mRunnable(r)
     , mMonitor("SyncRunnable")
+    , mDone(false)
   { }
 
   void DispatchToThread(nsIEventTarget* thread,
                         bool forceDispatch = false)
   {
     nsresult rv;
     bool on;
 
@@ -45,39 +46,48 @@ public:
       rv = thread->IsOnCurrentThread(&on);
       MOZ_ASSERT(NS_SUCCEEDED(rv));
       if (NS_SUCCEEDED(rv) && on) {
         mRunnable->Run();
         return;
       }
     }
 
-    mozilla::MonitorAutoLock lock(mMonitor);
     rv = thread->Dispatch(this, NS_DISPATCH_NORMAL);
     if (NS_SUCCEEDED(rv)) {
-      lock.Wait();
+      mozilla::MonitorAutoLock lock(mMonitor);
+      while (!mDone) {
+        lock.Wait();
+      }
     }
   }
 
   static void DispatchToThread(nsIEventTarget* thread,
                                nsIRunnable* r,
                                bool forceDispatch = false)
   {
     nsRefPtr<SyncRunnable> s(new SyncRunnable(r));
     s->DispatchToThread(thread, forceDispatch);
   }
 
 protected:
   NS_IMETHODIMP Run()
   {
     mRunnable->Run();
-    mozilla::MonitorAutoLock(mMonitor).Notify();
+
+    mozilla::MonitorAutoLock lock(mMonitor);
+    MOZ_ASSERT(!mDone);
+
+    mDone = true;
+    mMonitor.Notify();
+
     return NS_OK;
   }
 
 private:
   nsCOMPtr<nsIRunnable> mRunnable;
   mozilla::Monitor mMonitor;
+  bool mDone;
 };
 
 } // namespace mozilla
 
 #endif // mozilla_SyncRunnable_h