summaryrefslogtreecommitdiffstats
path: root/dom/base/test/browser_data_documents_aboutmemory.js
blob: 5c534a83b603368e92f07f7dee5573f7c23dc694 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
add_task(async function () {
  const doc = new DOMParser().parseFromString("<p>dadada</p>", "text/html");

  let mgr = Cc["@mozilla.org/memory-reporter-manager;1"].getService(
    Ci.nsIMemoryReporterManager
  );

  let amount = 0;
  const handleReport = (aProcess, aPath, aKind, aUnits, aAmount) => {
    const regex = new RegExp(".*/window-objects/.*/data-documents/.*");
    if (regex.test(aPath)) {
      amount += aAmount;
    }
  };

  await new Promise(r =>
    mgr.getReports(handleReport, null, r, null, /* anonymized = */ false)
  );
  ok(amount > 0, "Got data documents amount");
});