summaryrefslogtreecommitdiffstats
path: root/dom/system/tests/pathutils_worker.js
blob: 9e4742b764efae9da5899e6deb3294f55d82ec9c (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
35
36
37
/* Any copyright is dedicated to the Public Domain.
 * http://creativecommons.org/publicdomain/zero/1.0/ */

/* eslint-env worker */

"use strict";

/* import-globals-from /testing/mochitest/tests/SimpleTest/WorkerSimpleTest.js */
importScripts("chrome://mochikit/content/tests/SimpleTest/WorkerSimpleTest.js");

self.onmessage = async function (message) {
  let expected = message.data;
  info("ON message");
  info(JSON.stringify(expected));
  const profileDir = await PathUtils.getProfileDir();
  is(
    profileDir,
    expected.profileDir,
    "PathUtils.profileDir() in a worker should match PathUtils.profileDir on main thread"
  );

  const localProfileDir = await PathUtils.getLocalProfileDir();
  is(
    localProfileDir,
    expected.localProfileDir,
    "PathUtils.getLocalProfileDir() in a worker should match PathUtils.localProfileDir on main thread"
  );

  const tempDir = await PathUtils.getTempDir();
  is(
    tempDir,
    expected.tempDir,
    "PathUtils.getTempDir() in a worker should match PathUtils.tempDir on main thread"
  );

  finish();
};