Bug 1596542 - Skip test_browserData_should_not_remove_extension_data if LSNG is disabled. r=mixedpuppy
authorLuca Greco <lgreco@mozilla.com>
Mon, 18 Nov 2019 16:14:20 +0000
changeset 502439 d79432359063ff9e76eb2beb606d77713444cf88
parent 502438 09bdf1773bfd1b61d928938fe43b00834f8c3e85
child 502440 67de1c204ffb433aa8d8cc1c2799d17b10548b36
push id100837
push userluca.greco@alcacoop.it
push dateMon, 18 Nov 2019 16:15:19 +0000
treeherderautoland@d79432359063 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmixedpuppy
bugs1596542
milestone72.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
Bug 1596542 - Skip test_browserData_should_not_remove_extension_data if LSNG is disabled. r=mixedpuppy When LSNG is disabled, the browsingData API does clear the localStorage data by notify a "extension:purge-localStorage" message over the observer service, when the browserData API call doesn't specify a list of specific origins to clear, the code that handles "extension:purge-localStorage" will clear all the localStorage data, including the one stored by extensions: - https://searchfox.org/mozilla-central/rev/e7c61f4a68b974d5fecd216dc7407b631a24eb8f/browser/components/extensions/parent/ext-browsingData.js#172 - https://searchfox.org/mozilla-central/rev/e7c61f4a68b974d5fecd216dc7407b631a24eb8f/dom/storage/StorageObserver.cpp#292-295,323,326 Differential Revision: https://phabricator.services.mozilla.com/D53071
browser/components/extensions/test/browser/browser_ext_browsingData_localStorage.js
--- a/browser/components/extensions/test/browser/browser_ext_browsingData_localStorage.js
+++ b/browser/components/extensions/test/browser/browser_ext_browsingData_localStorage.js
@@ -129,16 +129,24 @@ add_task(async function test_browserData
   await SiteDataTestUtils.addToIndexedDB("file:///fake/file", "foo", "bar", {});
 
   await extension.startup();
   await extension.awaitMessage("done");
   await extension.unload();
 });
 
 add_task(async function test_browserData_should_not_remove_extension_data() {
+  if (!Services.prefs.getBoolPref("dom.storage.next_gen")) {
+    // When LSNG isn't enabled, the browsingData API does still clear
+    // all the extensions localStorage if called without a list of specific
+    // origins to clear.
+    info("Test skipped because LSNG is currently disabled");
+    return;
+  }
+
   let extension = ExtensionTestUtils.loadExtension({
     async background() {
       window.localStorage.setItem("key", "value");
       await browser.browsingData.removeLocalStorage({}).catch(err => {
         browser.test.fail(`${err} :: ${err.stack}`);
       });
       browser.test.sendMessage("done", window.localStorage.getItem("key"));
     },