summaryrefslogtreecommitdiffstats
path: root/dom/quota/test/common/browser.js
blob: b9903184dfb7829bf8a968b578a18892d9702730 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/**
 * Any copyright is dedicated to the Public Domain.
 * http://creativecommons.org/publicdomain/zero/1.0/
 */

loadScript("dom/quota/test/common/system.js");

function addTest(testFunction) {
  const taskFunction = async function () {
    await enableStorageTesting();

    await testFunction();
  };

  Object.defineProperty(taskFunction, "name", {
    value: testFunction.name,
    writable: false,
  });

  add_task(taskFunction);
}

async function enableStorageTesting() {
  const prefsToSet = [
    ["dom.quotaManager.testing", true],
    ["dom.storageManager.enabled", true],
    ["dom.simpleDB.enabled", true],
  ];
  if (Services.appinfo.OS === "WINNT") {
    prefsToSet.push(["dom.quotaManager.useDOSDevicePathSyntax", true]);
  }

  await SpecialPowers.pushPrefEnv({ set: prefsToSet });
}