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 802154 c18edc9f9c407fb219633fac49a7be1e8c771206
parent 802153 545d8d48c4b148c9e5554e92f1fb2ddf78890b24
push id111840
push userluca.greco@alcacoop.it
push dateThu, 31 May 2018 15:14:50 +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);
+});