Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test gets skipped with pattern: os != 'mac' && os != 'linux'
- Manifest: toolkit/components/extensions/test/mochitest/chrome.toml
<!DOCTYPE HTML>
<html>
<head>
<title>WebExtension test</title>
<script type="text/javascript" src="head.js"></script>
</head>
<body>
<script type="text/javascript">
"use strict";
// Test that the default paths searched for native host manifests
// are the ones we expect.
add_task(async function test_default_paths() {
let expectUser, expectGlobal;
switch (AppConstants.platform) {
case "macosx": {
expectUser = PathUtils.joinRelative(
Services.dirsvc.get("Home", Ci.nsIFile).path,
"Library/Application Support/Mozilla"
);
expectGlobal = "/Library/Application Support/Mozilla";
break;
}
case "linux": {
expectUser = PathUtils.join(
Services.dirsvc.get("Home", Ci.nsIFile).path,
".mozilla"
);
const libdir = AppConstants.HAVE_USR_LIB64_DIR ? "lib64" : "lib";
expectGlobal = PathUtils.join("/usr", libdir, "mozilla");
break;
}
default:
// Fixed filesystem paths are only defined for MacOS and Linux,
// there's nothing to test on other platforms.
ok(false, `This test does not apply on ${AppConstants.platform}`);
break;
}
let userDir = Services.dirsvc.get("XREUserNativeManifests", Ci.nsIFile).path;
is(userDir, expectUser, "user-specific native messaging directory is correct");
let globalDir = Services.dirsvc.get("XRESysNativeManifests", Ci.nsIFile).path;
is(globalDir, expectGlobal, "system-wide native messaing directory is correct");
});
</script>
</body>
</html>