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 802175 1bc2cc6b3a1a645377cbc6df6298ace664480a62
parent 802174 4fb5b52ddf3247f39494a09af4311ec324709190
push id111848
push userluca.greco@alcacoop.it
push dateThu, 31 May 2018 16:18:52 +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);
+});