[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor-browser/tor-browser-52.6.0esr-8.0-2] Revert "Bug 18619: If indexedDB disabled, use in-memory db for asyncStorage.js"



commit 8ee6fdadea2a79524f1b9b9427d4daf0362a074f
Author: Georg Koppen <gk@xxxxxxxxxxxxxx>
Date:   Tue Feb 20 10:15:47 2018 +0000

    Revert "Bug 18619: If indexedDB disabled, use in-memory db for asyncStorage.js"
    
    This reverts commit dcd2db035018a6e5466dcd27eb630dfd08995c71.
    
    We don't need this patch anymore as we are relying on IndexedDB being
    disabled in Private Browsing Mode (PBM) and properly isolated in non-PBM.
---
 devtools/shared/async-storage.js | 38 ++++++--------------------------------
 1 file changed, 6 insertions(+), 32 deletions(-)

diff --git a/devtools/shared/async-storage.js b/devtools/shared/async-storage.js
index 31ad22a8f666..0d260fc5ad5a 100644
--- a/devtools/shared/async-storage.js
+++ b/devtools/shared/async-storage.js
@@ -43,32 +43,6 @@
 "use strict";
 
 const Promise = require("promise");
-const prefs = require("sdk/preferences/service");
-
-// Substitute memory-only "database" when "dom.indexedDB.enabled" is false.
-// Match the API and behavior of the indexedDB-based version.
-const memoryDB = function () {
-  let dbMap = new Map();
-  if (prefs.get('dom.indexedDB.enabled', true)) {
-    return {}; // We won't use a memory db.
-  }
-  return {
-    getItem : k => {
-      let value = dbMap.get(k);
-      // Match the behavior of indexedDB-based implementation
-      // when an item is not present.
-      if (value === undefined) {
-        value = null;
-      }
-      return Promise.resolve(value);
-    },
-    setItem : (k, v) => Promise.resolve(dbMap.set(k, v)),
-    removeItem : k => Promise.resolve(dbMap.delete(k)),
-    clear : () => Promise.resolve(dbMap.clear()),
-    length : () => Promise.resolve(dbMap.size),
-    key : n => Promise.resolve(Array.from(dbMap.keys())[n])
-  };
-}();
 
 const DBNAME = "devtools-async-storage";
 const DBVERSION = 1;
@@ -206,9 +180,9 @@ function key(n) {
   });
 }
 
-exports.getItem = memoryDB.getItem || getItem;
-exports.setItem = memoryDB.setItem || setItem;
-exports.removeItem = memoryDB.removeItem || removeItem;
-exports.clear = memoryDB.clear || clear;
-exports.length = memoryDB.length || length;
-exports.key = memoryDB.key || key;
+exports.getItem = getItem;
+exports.setItem = setItem;
+exports.removeItem = removeItem;
+exports.clear = clear;
+exports.length = length;
+exports.key = key;

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits