summaryrefslogtreecommitdiffstats
path: root/dom/system/tests/pathutils_worker.js
blob: 606769d8e160c0ce934b515f50ebb1b737bb9718 (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 mozilla/chrome-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();
};