summaryrefslogtreecommitdiffstats
path: root/dom/quota/test/modules/content/worker/UtilsChild.mjs
blob: db5757bff0946e9c802acabae83cbc0033d8ab53 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/**
 * Any copyright is dedicated to the Public Domain.
 * http://creativecommons.org/publicdomain/zero/1.0/
 */

export const UtilsChild = {
  async getCachedOriginUsage() {
    postMessage({
      moduleName: "UtilsParent",
      objectName: "UtilsParent",
      op: "getCachedOriginUsage",
    });

    return new Promise(function (resolve) {
      addEventListener("message", async function onMessage(event) {
        removeEventListener("message", onMessage);
        const data = event.data;
        resolve(data);
      });
    });
  },
};