Merge mozilla-central to autoland. a=merge CLOSED TREE
authorOana Pop Rus <opoprus@mozilla.com>
Thu, 09 May 2019 06:42:25 +0300
changeset 531982 9d0b46d9bb9ac851d04c0cce35e00d247ec77a6b
parent 531981 c2250a23fd66e3c812cb023c2d12f6f5e8d5a2f2 (current diff)
parent 531979 34a824c75b7b5618a06ba8987c418d6363da5038 (diff)
child 531983 3390fa47ebcd66eadead3c8bfe75d61f52c6812a
push id11265
push userffxbld-merge
push dateMon, 13 May 2019 10:53:39 +0000
treeherdermozilla-beta@77e0fe8dbdd3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmerge
milestone68.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 mozilla-central to autoland. a=merge CLOSED TREE
dom/quota/test/unit/localStorageArchive2upgrade_profile.zip
dom/quota/test/unit/localStorageArchive3upgrade_profile.zip
dom/quota/test/unit/test_localStorageArchive2upgrade.js
dom/quota/test/unit/test_localStorageArchive3upgrade.js
--- a/dom/localstorage/ActorsParent.cpp
+++ b/dom/localstorage/ActorsParent.cpp
@@ -33,16 +33,17 @@
 #include "mozilla/dom/quota/QuotaObject.h"
 #include "mozilla/dom/quota/UsageInfo.h"
 #include "mozilla/ipc/BackgroundChild.h"
 #include "mozilla/ipc/BackgroundParent.h"
 #include "mozilla/ipc/PBackgroundChild.h"
 #include "mozilla/ipc/PBackgroundParent.h"
 #include "mozilla/ipc/PBackgroundSharedTypes.h"
 #include "mozilla/Logging.h"
+#include "mozilla/storage/Variant.h"
 #include "nsClassHashtable.h"
 #include "nsDataHashtable.h"
 #include "nsExceptionHandler.h"
 #include "nsInterfaceHashtable.h"
 #include "nsIObjectInputStream.h"
 #include "nsIObjectOutputStream.h"
 #include "nsISimpleEnumerator.h"
 #include "nsNetUtil.h"
@@ -2339,16 +2340,19 @@ class LSRequestBase : public DatastoreOp
 };
 
 class PrepareDatastoreOp
     : public LSRequestBase,
       public OpenDirectoryListener,
       public SupportsCheckedUnsafePtr<CheckIf<DiagnosticAssertEnabled>> {
   class LoadDataOp;
 
+  class CompressFunction;
+  class CompressibleFunction;
+
   enum class NestedState {
     // The nesting has not yet taken place. Next step is
     // CheckExistingOperations.
     BeforeNesting,
 
     // Checking if a prepare datastore operation is already running for given
     // origin on the PBackground thread. Next step is CheckClosingDatastore.
     CheckExistingOperations,
@@ -2532,16 +2536,33 @@ class PrepareDatastoreOp::LoadDataOp fin
 
   void OnSuccess() override;
 
   void OnFailure(nsresult aResultCode) override;
 
   void Cleanup() override;
 };
 
+class PrepareDatastoreOp::CompressFunction final : public mozIStorageFunction {
+ private:
+  ~CompressFunction() = default;
+
+  NS_DECL_ISUPPORTS
+  NS_DECL_MOZISTORAGEFUNCTION
+};
+
+class PrepareDatastoreOp::CompressibleFunction final
+    : public mozIStorageFunction {
+ private:
+  ~CompressibleFunction() = default;
+
+  NS_DECL_ISUPPORTS
+  NS_DECL_MOZISTORAGEFUNCTION
+};
+
 class PrepareObserverOp : public LSRequestBase {
   const LSRequestPrepareObserverParams mParams;
   nsCString mOrigin;
 
  public:
   PrepareObserverOp(nsIEventTarget* aMainEventTarget,
                     const LSRequestParams& aParams);
 
@@ -7029,40 +7050,68 @@ nsresult PrepareDatastoreOp::DatabaseWor
 
     if (!quotaObject->MaybeUpdateSize(newUsage, /* aTruncate */ true)) {
       return NS_ERROR_FILE_NO_DEVICE_SPACE;
     }
 
     mozStorageTransaction transaction(
         connection, false, mozIStorageConnection::TRANSACTION_IMMEDIATE);
 
+    nsCOMPtr<mozIStorageFunction> function = new CompressFunction();
+
+    rv =
+        connection->CreateFunction(NS_LITERAL_CSTRING("compress"), 1, function);
+    if (NS_WARN_IF(NS_FAILED(rv))) {
+      return rv;
+    }
+
+    function = new CompressibleFunction();
+
+    rv = connection->CreateFunction(NS_LITERAL_CSTRING("compressible"), 1,
+                                    function);
+    if (NS_WARN_IF(NS_FAILED(rv))) {
+      return rv;
+    }
+
     nsCOMPtr<mozIStorageStatement> stmt;
     rv = connection->CreateStatement(
-        NS_LITERAL_CSTRING("INSERT INTO data (key, value, utf16Length) "
-                           "SELECT key, value, utf16Length(value) "
-                           "FROM webappsstore2 "
-                           "WHERE originKey = :originKey "
-                           "AND originAttributes = :originAttributes;"
-
-                           ),
+        NS_LITERAL_CSTRING(
+            "INSERT INTO data (key, value, utf16Length, compressed) "
+            "SELECT key, compress(value), utf16Length(value), "
+            "compressible(value) "
+            "FROM webappsstore2 "
+            "WHERE originKey = :originKey "
+            "AND originAttributes = :originAttributes;"
+
+            ),
         getter_AddRefs(stmt));
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
     }
 
     rv = mArchivedOriginScope->BindToStatement(stmt);
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
     }
 
     rv = stmt->Execute();
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
     }
 
+    rv = connection->RemoveFunction(NS_LITERAL_CSTRING("compress"));
+    if (NS_WARN_IF(NS_FAILED(rv))) {
+      return rv;
+    }
+
+    rv = connection->RemoveFunction(NS_LITERAL_CSTRING("compressible"));
+    if (NS_WARN_IF(NS_FAILED(rv))) {
+      return rv;
+    }
+
     rv = connection->CreateStatement(
         NS_LITERAL_CSTRING("UPDATE database SET usage = :usage;"),
         getter_AddRefs(stmt));
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
     }
 
     rv = stmt->BindInt64ByName(NS_LITERAL_CSTRING("usage"), newUsage);
@@ -7761,16 +7810,90 @@ void PrepareDatastoreOp::LoadDataOp::Cle
   MOZ_ASSERT(mPrepareDatastoreOp->mLoadDataOp == this);
 
   mPrepareDatastoreOp->mLoadDataOp = nullptr;
   mPrepareDatastoreOp = nullptr;
 
   ConnectionDatastoreOperationBase::Cleanup();
 }
 
+NS_IMPL_ISUPPORTS(PrepareDatastoreOp::CompressFunction, mozIStorageFunction)
+
+NS_IMETHODIMP
+PrepareDatastoreOp::CompressFunction::OnFunctionCall(
+    mozIStorageValueArray* aFunctionArguments, nsIVariant** aResult) {
+  AssertIsOnIOThread();
+  MOZ_ASSERT(aFunctionArguments);
+  MOZ_ASSERT(aResult);
+
+#ifdef DEBUG
+  {
+    uint32_t argCount;
+    MOZ_ALWAYS_SUCCEEDS(aFunctionArguments->GetNumEntries(&argCount));
+    MOZ_ASSERT(argCount == 1);
+
+    int32_t type;
+    MOZ_ALWAYS_SUCCEEDS(aFunctionArguments->GetTypeOfIndex(0, &type));
+    MOZ_ASSERT(type == mozIStorageValueArray::VALUE_TYPE_TEXT);
+  }
+#endif
+
+  nsCString value;
+  nsresult rv = aFunctionArguments->GetUTF8String(0, value);
+  if (NS_WARN_IF(NS_FAILED(rv))) {
+    return rv;
+  }
+
+  nsCString compressed;
+  if (!SnappyCompress(value, compressed)) {
+    compressed = value;
+  }
+
+  nsCOMPtr<nsIVariant> result = new storage::UTF8TextVariant(compressed);
+
+  result.forget(aResult);
+  return NS_OK;
+}
+
+NS_IMPL_ISUPPORTS(PrepareDatastoreOp::CompressibleFunction, mozIStorageFunction)
+
+NS_IMETHODIMP
+PrepareDatastoreOp::CompressibleFunction::OnFunctionCall(
+    mozIStorageValueArray* aFunctionArguments, nsIVariant** aResult) {
+  AssertIsOnIOThread();
+  MOZ_ASSERT(aFunctionArguments);
+  MOZ_ASSERT(aResult);
+
+#ifdef DEBUG
+  {
+    uint32_t argCount;
+    MOZ_ALWAYS_SUCCEEDS(aFunctionArguments->GetNumEntries(&argCount));
+    MOZ_ASSERT(argCount == 1);
+
+    int32_t type;
+    MOZ_ALWAYS_SUCCEEDS(aFunctionArguments->GetTypeOfIndex(0, &type));
+    MOZ_ASSERT(type == mozIStorageValueArray::VALUE_TYPE_TEXT);
+  }
+#endif
+
+  nsCString value;
+  nsresult rv = aFunctionArguments->GetUTF8String(0, value);
+  if (NS_WARN_IF(NS_FAILED(rv))) {
+    return rv;
+  }
+
+  nsCString compressed;
+  bool compressible = SnappyCompress(value, compressed);
+
+  nsCOMPtr<nsIVariant> result = new storage::IntegerVariant(compressible);
+
+  result.forget(aResult);
+  return NS_OK;
+}
+
 /*******************************************************************************
  * PrepareObserverOp
  ******************************************************************************/
 
 PrepareObserverOp::PrepareObserverOp(nsIEventTarget* aMainEventTarget,
                                      const LSRequestParams& aParams)
     : LSRequestBase(aMainEventTarget),
       mParams(aParams.get_LSRequestPrepareObserverParams()) {
index 6ee654e4223e64a0443995bed683e4f044e83efc..2f60db2a456b9b918418888847d82c95dbaf2064
GIT binary patch
literal 4096
zc$}412T)U46#XDXL24*c#R3Q-MWv`TS&E{9BuYmiA)!ex0c2^4I?7VR8Wkym3rG=Z
z(gKJmEwG`8NE0OVkVS-`6mb*WS%aX7Z{|<_n|V3smh;~|Ca1TsumjX(m4P+_Xx27B
z4Dj*w@P;`e6;02x0b9f#h}fK?JbnS&0VWnQ69BOAQ_h)C5ct>5%k9fFcDK>0?qQ<-
zpBWIQL2&hvhk4sOIirvYK3=ZQzQ{F5-uX70@wv9|AxZ5zXFKhLfFYD<tkdm)zMCVJ
zwP0m~n2YzJoL<6Al@X#n5AU(|-_A?5d9xt5f>~u!Kq<Au;8@bo+(X;JYLDfG<?4mc
zIz<@AcLclna`cVycI8`y3FI~if1W@(_%pN`)9_M8KeSX(Gtl=!lA3LBq;z`Dj6U%5
zH8fa)BbKzb2E_YUIQAH3ZcCcIkc-tiBjOD1sLyc#hnSTr7PgnEP28w5yN5O6(!He3
znTIM8MxoWBP=`6s5{t@;AwgIH{KfgDeLdZ^Ssx#DYiqSC#CUvAv@AU=7TvIDm!K)9
z=-^zsz}0Iw`+8tRrhjJJa^90yCBe&jd+{f#{s~Nu@)y*cDa0k2%y&6*6QX*}3a&4-
zj@_=n#CLS4V%)E3XRtYYC#<S=?~w=<;wXAap1eR#^Ff7J=b4Y&22~8#aMDRrZow|(
z-s1pXI>(;CyWlU-#H=Iqs#a696VvP^`*>wdE1Rp0hej(1qyx;))t9d7Hb>gK36hhq
zucw@x95Mj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yckPxz3-w;Fp6QW
z|6CY-!j0C8R^iJG6RtC2tY3{7ojli%d)ho#LBNLL&sgo&k8)Z})K*~g!A>7|<DB>k
iyv7smP3hJ8slobnYHUDc1p#Yq<p44$b=BKW-Tey}WkFZ~
--- a/dom/quota/ActorsParent.cpp
+++ b/dom/quota/ActorsParent.cpp
@@ -213,17 +213,17 @@ const char kResourceOriginPrefix[] = "re
 #define METADATA_TMP_FILE_NAME ".metadata-tmp"
 #define METADATA_V2_FILE_NAME ".metadata-v2"
 #define METADATA_V2_TMP_FILE_NAME ".metadata-v2-tmp"
 
 #define WEB_APPS_STORE_FILE_NAME "webappsstore.sqlite"
 #define LS_ARCHIVE_FILE_NAME "ls-archive.sqlite"
 #define LS_ARCHIVE_TMP_FILE_NAME "ls-archive-tmp.sqlite"
 
-const uint32_t kLocalStorageArchiveVersion = 3;
+const uint32_t kLocalStorageArchiveVersion = 4;
 
 const char kProfileDoChangeTopic[] = "profile-do-change";
 
 /******************************************************************************
  * SQLite functions
  ******************************************************************************/
 
 int32_t MakeStorageVersion(uint32_t aMajorStorageVersion,
@@ -441,16 +441,17 @@ nsresult LoadLocalStorageArchiveVersion(
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   aVersion = version;
   return NS_OK;
 }
 
+/*
 nsresult SaveLocalStorageArchiveVersion(mozIStorageConnection* aConnection,
                                         uint32_t aVersion) {
   AssertIsOnIOThread();
   MOZ_ASSERT(aConnection);
 
   nsCOMPtr<mozIStorageStatement> stmt;
   nsresult rv = aConnection->CreateStatement(
       NS_LITERAL_CSTRING("UPDATE database SET version = :version;"),
@@ -466,16 +467,17 @@ nsresult SaveLocalStorageArchiveVersion(
 
   rv = stmt->Execute();
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   return NS_OK;
 }
+*/
 
 /******************************************************************************
  * Quota manager class declarations
  ******************************************************************************/
 
 }  // namespace
 
 class DirectoryLockImpl final : public DirectoryLock {
@@ -5326,53 +5328,48 @@ nsresult QuotaManager::DowngradeLocalSto
   rv = InitializeLocalStorageArchive(aConnection, kLocalStorageArchiveVersion);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
   return NS_OK;
 }
 
-nsresult QuotaManager::UpgradeLocalStorageArchiveFrom0To1(
+nsresult QuotaManager::UpgradeLocalStorageArchiveFromLessThan4To4(
     nsCOMPtr<mozIStorageConnection>& aConnection) {
   AssertIsOnIOThread();
   MOZ_ASSERT(CachedNextGenLocalStorageEnabled());
 
   nsresult rv = RecreateLocalStorageArchive(aConnection);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
-  rv = InitializeLocalStorageArchive(aConnection, 1);
-  if (NS_WARN_IF(NS_FAILED(rv))) {
-    return rv;
-  }
-
-  return NS_OK;
-}
-
-nsresult QuotaManager::UpgradeLocalStorageArchiveFrom1To2(
+  rv = InitializeLocalStorageArchive(aConnection, 4);
+  if (NS_WARN_IF(NS_FAILED(rv))) {
+    return rv;
+  }
+
+  return NS_OK;
+}
+
+/*
+nsresult QuotaManager::UpgradeLocalStorageArchiveFrom4To5(
     nsCOMPtr<mozIStorageConnection>& aConnection) {
-  nsresult rv = SaveLocalStorageArchiveVersion(aConnection, 2);
-  if (NS_WARN_IF(NS_FAILED(rv))) {
-    return rv;
-  }
-
-  return NS_OK;
-}
-
-nsresult QuotaManager::UpgradeLocalStorageArchiveFrom2To3(
-    nsCOMPtr<mozIStorageConnection>& aConnection) {
-  nsresult rv = SaveLocalStorageArchiveVersion(aConnection, 3);
-  if (NS_WARN_IF(NS_FAILED(rv))) {
-    return rv;
-  }
-
-  return NS_OK;
-}
+  AssertIsOnIOThread();
+  MOZ_ASSERT(CachedNextGenLocalStorageEnabled());
+
+  nsresult rv = SaveLocalStorageArchiveVersion(aConnection, 5);
+  if (NS_WARN_IF(NS_FAILED(rv))) {
+    return rv;
+  }
+
+  return NS_OK;
+}
+*/
 
 #ifdef DEBUG
 
 void QuotaManager::AssertStorageIsInitialized() const {
   AssertIsOnIOThread();
   MOZ_ASSERT(mStorageInitialized);
 }
 
@@ -5586,28 +5583,27 @@ nsresult QuotaManager::EnsureStorageIsIn
         MOZ_ASSERT(version == 0);
 
         rv = InitializeLocalStorageArchive(connection,
                                            kLocalStorageArchiveVersion);
         if (NS_WARN_IF(NS_FAILED(rv))) {
           return rv;
         }
       } else {
-        static_assert(kLocalStorageArchiveVersion == 3,
+        static_assert(kLocalStorageArchiveVersion == 4,
                       "Upgrade function needed due to LocalStorage archive "
                       "version increase.");
 
         while (version != kLocalStorageArchiveVersion) {
-          if (version == 0) {
-            rv = UpgradeLocalStorageArchiveFrom0To1(connection);
-          } else if (version == 1) {
-            rv = UpgradeLocalStorageArchiveFrom1To2(connection);
-          } else if (version == 2) {
-            rv = UpgradeLocalStorageArchiveFrom2To3(connection);
-          } else {
+          if (version < 4) {
+            rv = UpgradeLocalStorageArchiveFromLessThan4To4(connection);
+          } /* else if (version == 4) {
+            rv = UpgradeLocalStorageArchiveFrom4To5(connection);
+          } */
+          else {
             QM_WARNING(
                 "Unable to initialize LocalStorage archive, no upgrade path is "
                 "available!");
             return NS_ERROR_FAILURE;
           }
 
           if (NS_WARN_IF(NS_FAILED(rv))) {
             return rv;
--- a/dom/quota/QuotaManager.h
+++ b/dom/quota/QuotaManager.h
@@ -478,24 +478,22 @@ class QuotaManager final : public Backgr
       mozIStorageConnection** aConnection, bool& aNewlyCreated);
 
   nsresult RecreateLocalStorageArchive(
       nsCOMPtr<mozIStorageConnection>& aConnection);
 
   nsresult DowngradeLocalStorageArchive(
       nsCOMPtr<mozIStorageConnection>& aConnection);
 
-  nsresult UpgradeLocalStorageArchiveFrom0To1(
+  nsresult UpgradeLocalStorageArchiveFromLessThan4To4(
       nsCOMPtr<mozIStorageConnection>& aConnection);
 
-  nsresult UpgradeLocalStorageArchiveFrom1To2(
-      nsCOMPtr<mozIStorageConnection>& aConnection);
-
-  nsresult UpgradeLocalStorageArchiveFrom2To3(
-      nsCOMPtr<mozIStorageConnection>& aConnection);
+  /*
+  nsresult UpgradeLocalStorageArchiveFrom4To5();
+  */
 
   nsresult InitializeRepository(PersistenceType aPersistenceType);
 
   nsresult InitializeOrigin(PersistenceType aPersistenceType,
                             const nsACString& aGroup, const nsACString& aOrigin,
                             int64_t aAccessTime, bool aPersisted,
                             nsIFile* aDirectory);
 
deleted file mode 100644
index 8883ea4630468f1c63076254109d53429752b8ca..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index e475d3d17540b10922e395f28afeb97a56e07bff..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
new file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..cf5b29adae091387926af9a1c9c8b54cf10cc606
GIT binary patch
literal 7853
zc$}S>2{@E%6vxNDZ#P>+VKNwulw_-<g(ia%k!|cU(^$sXw<KA!r4-4|RhMK*wnUah
zLTT(-izHhzS?&z?USn-s&+~eo&oj>N%=`Y||98&Ogi=tl0{{S8z`MH{Flk{1TTycS
zqYoKi7hn&-*}@cVXXogMMmbnWI@%*_&=wc9=>Qb5j4cL)<>bNuAfuci0|1tTjJ<2P
zvP+8{(5q%DAy(mkU6OKlr?qlGntu4%iVVG*=Q9g>VQKd5)S&M0khJGgLrfmjJykT{
zB@BwuW34yZafR9y<9@M4!=3I&0u)%<zBvVpchmbB=~w9{$!g{EblvP13Ho#JLU0*2
z_!eIfxTSMkJ9*%WLC@uqMfOmdK?cCKKR(_sQqIT67kea17j=970Cq6>eZ$OR`_r-Y
zHOBo~1+hPVRl?b*v8H1m{4lnqe5gm=dL7m^&N`^Vy{~$7t7dikg)VZ<YUBl(Hg$Oz
znO8zv?iFL}q4s*R$K)=?#usZg=4hqdcg3XOR5jz7bGo0qW_#vA=T+{zlrC5=XlC0e
ze!cE>*zlNAZJFxS@GtC~n=3fKEg^X#V4`D^V*BJ@cw0#8-hT{{kP+rBZBolE>47>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Nh1cvS2Lnk^61BRq`z4l*6UnSqoo><x
zuLrJefQf<qBm>uLv}<P?6<D*UOH5m0i90RQ^s=_kBG!vOGYOa->vL^KMa=8n5$}Jh
z6S!t4ZCFS^lBms%eH5`&YDgrlDsz*LiWs-Cl_JI+WF-x^UYDCRRm9MZ75fU5Y#FNj
s2Vh<OPPJ0M|3(sP3q)c`0NDW>%Ehftf{Gfjyc6629R3L634a9q4d?_ax&QzG
deleted file mode 100644
--- a/dom/quota/test/unit/test_localStorageArchive2upgrade.js
+++ /dev/null
@@ -1,65 +0,0 @@
-/**
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-/**
- * This test is mainly to verify that local storage directories are not removed
- * during local storage archive upgrade from version 1 to version 2.
- * See bug 1546310.
- */
-
-async function testSteps() {
-  const lsDirs = [
-    "storage/default/http+++example.com/ls",
-    "storage/default/http+++localhost/ls",
-    "storage/default/http+++www.mozilla.org/ls",
-  ];
-
-  info("Clearing");
-
-  let request = clear();
-  await requestFinished(request);
-
-  info("Installing package");
-
-  // The profile contains three initialized origin directories with local
-  // storage data, local storage archive, a script for origin initialization,
-  // the storage database and the web apps store database:
-  // - storage/default/https+++example.com
-  // - storage/default/https+++localhost
-  // - storage/default/https+++www.mozilla.org
-  // - storage/ls-archive.sqlite
-  // - create_db.js
-  // - storage.sqlite
-  // - webappsstore.sqlite
-  // The file create_db.js in the package was run locally (with a build with
-  // local storage archive version 1), specifically it was temporarily added to
-  // xpcshell.ini and then executed:
-  //   mach xpcshell-test --interactive dom/localstorage/test/unit/create_db.js
-  // Note: to make it become the profile in the test, additional manual steps
-  // are needed.
-  // 1. Remove the folder "storage/temporary".
-  installPackage("localStorageArchive2upgrade_profile");
-
-  info("Checking ls dirs");
-
-  for (let lsDir of lsDirs) {
-    let dir = getRelativeFile(lsDir);
-
-    exists = dir.exists();
-    ok(exists, "ls directory does exist");
-  }
-
-  request = init();
-  request = await requestFinished(request);
-
-  info("Checking ls dirs");
-
-  for (let lsDir of lsDirs) {
-    let dir = getRelativeFile(lsDir);
-
-    exists = dir.exists();
-    ok(exists, "ls directory does exist");
-  }
-}
deleted file mode 100644
--- a/dom/quota/test/unit/test_localStorageArchive3upgrade.js
+++ /dev/null
@@ -1,65 +0,0 @@
-/**
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-/**
- * This test is mainly to verify that local storage directories are not removed
- * during local storage archive upgrade from version 2 to version 3.
- * See bug 1513937.
- */
-
-async function testSteps() {
-  const lsDirs = [
-    "storage/default/http+++example.com/ls",
-    "storage/default/http+++localhost/ls",
-    "storage/default/http+++www.mozilla.org/ls",
-  ];
-
-  info("Clearing");
-
-  let request = clear();
-  await requestFinished(request);
-
-  info("Installing package");
-
-  // The profile contains three initialized origin directories with local
-  // storage data, local storage archive, a script for origin initialization,
-  // the storage database and the web apps store database:
-  // - storage/default/https+++example.com
-  // - storage/default/https+++localhost
-  // - storage/default/https+++www.mozilla.org
-  // - storage/ls-archive.sqlite
-  // - create_db.js
-  // - storage.sqlite
-  // - webappsstore.sqlite
-  // The file create_db.js in the package was run locally (with a build with
-  // local storage archive version 2), specifically it was temporarily added to
-  // xpcshell.ini and then executed:
-  //   mach xpcshell-test --interactive dom/localstorage/test/unit/create_db.js
-  // Note: to make it become the profile in the test, additional manual steps
-  // are needed.
-  // 1. Remove the folder "storage/temporary".
-  installPackage("localStorageArchive3upgrade_profile");
-
-  info("Checking ls dirs");
-
-  for (let lsDir of lsDirs) {
-    let dir = getRelativeFile(lsDir);
-
-    exists = dir.exists();
-    ok(exists, "ls directory does exist");
-  }
-
-  request = init();
-  request = await requestFinished(request);
-
-  info("Checking ls dirs");
-
-  for (let lsDir of lsDirs) {
-    let dir = getRelativeFile(lsDir);
-
-    exists = dir.exists();
-    ok(exists, "ls directory does exist");
-  }
-}
new file mode 100644
--- /dev/null
+++ b/dom/quota/test/unit/test_localStorageArchive4upgrade.js
@@ -0,0 +1,95 @@
+/**
+ * Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/
+ */
+
+/**
+ * This test is mainly to verify that local storage directories are removed
+ * during local storage archive upgrade from version 3 to version 4.
+ * See bug 1549654.
+ */
+
+async function testSteps() {
+  const lsDirs = [
+    "storage/default/http+++localhost/ls",
+    "storage/default/http+++www.mozilla.org/ls",
+    "storage/default/http+++example.com/ls",
+  ];
+
+  const principalInfos = [
+    "http://localhost",
+    "http://www.mozilla.org",
+    "http://example.com",
+  ];
+
+  const data = [
+    { key: "foo0", value: "bar" },
+    { key: "foo1", value: "A" },
+    { key: "foo2", value: "A".repeat(100) },
+  ];
+
+  function getLocalStorage(principal) {
+    return Services.domStorageManager.createStorage(null, principal, "");
+  }
+
+  info("Clearing");
+
+  let request = clear();
+  await requestFinished(request);
+
+  info("Installing package");
+
+  // The profile contains three initialized origin directories with local
+  // storage data, local storage archive, a script for origin initialization,
+  // the storage database and the web apps store database:
+  // - storage/default/https+++example.com
+  // - storage/default/https+++localhost
+  // - storage/default/https+++www.mozilla.org
+  // - storage/ls-archive.sqlite
+  // - create_db.js
+  // - storage.sqlite
+  // - webappsstore.sqlite
+  // The file create_db.js in the package was run locally (with a build with
+  // local storage archive version 3), specifically it was temporarily added to
+  // xpcshell.ini and then executed:
+  //   mach xpcshell-test --interactive dom/localstorage/test/unit/create_db.js
+  // Note: to make it become the profile in the test, additional manual steps
+  // are needed.
+  // 1. Remove the folder "storage/temporary".
+  installPackage("localStorageArchive4upgrade_profile");
+
+  info("Checking ls dirs");
+
+  for (let lsDir of lsDirs) {
+    let dir = getRelativeFile(lsDir);
+
+    exists = dir.exists();
+    ok(exists, "ls directory does exist");
+  }
+
+  request = init();
+  request = await requestFinished(request);
+
+  info("Checking ls dirs");
+
+  for (let lsDir of lsDirs) {
+    let dir = getRelativeFile(lsDir);
+
+    exists = dir.exists();
+    ok(!exists, "ls directory doesn't exist");
+  }
+
+  info("Getting storages");
+
+  let storages = [];
+  for (let i = 0; i < principalInfos.length; i++) {
+    let storage = getLocalStorage(getPrincipal(principalInfos[i]));
+    storages.push(storage);
+  }
+
+  info("Verifying data");
+
+  for (let i = 0; i < storages.length; i++) {
+    is(storages[i].getItem(data[i].key), data[i].value, "Correct value");
+  }
+}
--- a/dom/quota/test/unit/xpcshell.ini
+++ b/dom/quota/test/unit/xpcshell.ini
@@ -9,18 +9,17 @@ support-files =
   clearStorageForPrincipal_profile.zip
   createLocalStorage_profile.zip
   defaultStorageUpgrade_profile.zip
   getUsage_profile.zip
   groupMismatch_profile.zip
   idbSubdirUpgrade1_profile.zip
   idbSubdirUpgrade2_profile.zip
   localStorageArchive1upgrade_profile.zip
-  localStorageArchive2upgrade_profile.zip
-  localStorageArchive3upgrade_profile.zip
+  localStorageArchive4upgrade_profile.zip
   localStorageArchiveDowngrade_profile.zip
   morgueCleanup_profile.zip
   obsoleteOriginAttributes_profile.zip
   originAttributesUpgrade_profile.zip
   removeLocalStorage1_profile.zip
   removeLocalStorage2_profile.zip
   storagePersistentUpgrade_profile.zip
   tempMetadataCleanup_profile.zip
@@ -33,18 +32,17 @@ support-files =
 [test_clearStorageForPrincipal.js]
 [test_defaultStorageUpgrade.js]
 [test_getUsage.js]
 [test_groupMismatch.js]
 [test_idbSubdirUpgrade.js]
 [test_initTemporaryStorage.js]
 [test_listInitializedOrigins.js]
 [test_localStorageArchive1upgrade.js]
-[test_localStorageArchive2upgrade.js]
-[test_localStorageArchive3upgrade.js]
+[test_localStorageArchive4upgrade.js]
 [test_localStorageArchiveDowngrade.js]
 [test_morgueCleanup.js]
 [test_obsoleteOriginAttributesUpgrade.js]
 [test_obsoleteOrigins.js]
 [test_originAttributesUpgrade.js]
 [test_persist.js]
 [test_persist_eviction.js]
 [test_persist_globalLimit.js]
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -1619,16 +1619,17 @@ pref("network.protocol-handler.external-
 pref("network.protocol-handler.warn-external-default", true); // warn before load
 
 // Prevent using external protocol handlers for these schemes
 pref("network.protocol-handler.external.hcp", false);
 pref("network.protocol-handler.external.vbscript", false);
 pref("network.protocol-handler.external.javascript", false);
 pref("network.protocol-handler.external.data", false);
 pref("network.protocol-handler.external.ms-help", false);
+pref("network.protocol-handler.external.res", false);
 pref("network.protocol-handler.external.shell", false);
 pref("network.protocol-handler.external.vnd.ms.radio", false);
 #ifdef XP_MACOSX
 pref("network.protocol-handler.external.help", false);
 #endif
 pref("network.protocol-handler.external.disk", false);
 pref("network.protocol-handler.external.disks", false);
 pref("network.protocol-handler.external.afp", false);