Bug 1406181 - Test storage.local from extension tab pages on file and indexedDB backends. draft
authorLuca Greco <lgreco@mozilla.com>
Thu, 19 Oct 2017 16:27:02 +0200
changeset 802310 7585dd2bd6e794d4192a4e3ee34dbdf9c1ce4eda
parent 802309 bcddd1e7b74b087b6f617960b984d56a0f993c11
push id111857
push userluca.greco@alcacoop.it
push dateThu, 31 May 2018 17:21:49 +0000
bugs1406181
milestone62.0a1
Bug 1406181 - Test storage.local from extension tab pages on file and indexedDB backends. MozReview-Commit-ID: BYhlnLiitgh
toolkit/components/extensions/test/xpcshell/test_ext_storage_tab.js
--- a/toolkit/components/extensions/test/xpcshell/test_ext_storage_tab.js
+++ b/toolkit/components/extensions/test/xpcshell/test_ext_storage_tab.js
@@ -1,11 +1,13 @@
 "use strict";
 
-add_task(async function test_multiple_pages() {
+ChromeUtils.import("resource://gre/modules/ExtensionStorageIDB.jsm");
+
+async function test_multiple_pages() {
   let extension = ExtensionTestUtils.loadExtension({
     async background() {
       function awaitMessage(expectedMsg, api = "test") {
         return new Promise(resolve => {
           browser[api].onMessage.addListener(function listener(msg) {
             if (msg === expectedMsg) {
               browser[api].onMessage.removeListener(listener);
               resolve();
@@ -82,9 +84,19 @@ add_task(async function test_multiple_pa
   extension.onMessage("remove-page", async url => {
     await contentPage.close();
     extension.sendMessage("page-removed");
   });
 
   await extension.startup();
   await extension.awaitFinish("storage-multiple");
   await extension.unload();
+}
+
+add_task(async function test_storage_local_file_backend_from_tab() {
+  return runWithPrefs([[ExtensionStorageIDB.BACKEND_ENABLED_PREF, false]],
+                      test_multiple_pages);
 });
+
+add_task(async function test_storage_local_idb_backend_from_tab() {
+  return runWithPrefs([[ExtensionStorageIDB.BACKEND_ENABLED_PREF, true]],
+                      test_multiple_pages);
+});