Backed out changeset 6b2cd302a91f (bug 1753375) for causing mochitest failures on test_ioutils_mkdir.html CLOSED TREE

This commit is contained in:
Cristian Tuns 2022-03-21 16:32:40 -04:00
parent d6bda1cd01
commit 4228d282a7
3 changed files with 12 additions and 18 deletions

View File

@ -103,26 +103,17 @@ namespace PathUtils {
[Exposed=Window]
partial namespace PathUtils {
/**
* The profile directory.
*/
[Throws, BinaryName="ProfileDirSync"]
readonly attribute DOMString profileDir;
/**
* The local-specific profile directory.
*/
[Throws, BinaryName="LocalProfileDirSync"]
readonly attribute DOMString localProfileDir;
/**
* The temporary directory for the process.
*/
[Throws, BinaryName="TempDirSync"]
readonly attribute DOMString tempDir;
};
[Exposed=Worker]
[Exposed=(Window, Worker)]
partial namespace PathUtils {
/**
* The profile directory.

View File

@ -376,7 +376,7 @@ void PathUtils::GetTempDirSync(const GlobalObject&, nsString& aResult,
already_AddRefed<Promise> PathUtils::GetProfileDirAsync(
const GlobalObject& aGlobal, ErrorResult& aErr) {
MOZ_ASSERT(!NS_IsMainThread());
// NB: This will eventually be off-main-thread only.
auto guard = sDirCache.Lock();
return DirectoryCache::Ensure(guard.ref())
@ -385,7 +385,7 @@ already_AddRefed<Promise> PathUtils::GetProfileDirAsync(
already_AddRefed<Promise> PathUtils::GetLocalProfileDirAsync(
const GlobalObject& aGlobal, ErrorResult& aErr) {
MOZ_ASSERT(!NS_IsMainThread());
// NB: This will eventually be off-main-thread only.
auto guard = sDirCache.Lock();
return DirectoryCache::Ensure(guard.ref())
@ -395,7 +395,7 @@ already_AddRefed<Promise> PathUtils::GetLocalProfileDirAsync(
already_AddRefed<Promise> PathUtils::GetTempDirAsync(
const GlobalObject& aGlobal, ErrorResult& aErr) {
MOZ_ASSERT(!NS_IsMainThread());
// NB: This will eventually be off-main-thread only.
auto guard = sDirCache.Lock();
return DirectoryCache::Ensure(guard.ref())

View File

@ -318,7 +318,7 @@
// symlink to `/var`, so we need to pre-normalize our temporary directory
// or expected paths won't match.
const tmpDir = PathUtils.join(
PathUtils.normalize(PathUtils.tempDir),
PathUtils.normalize(await PathUtils.getTempDir()),
"pathutils_test"
);
@ -475,16 +475,19 @@
add_task(async function test_getDirectories() {
// See: nsAppDirectoryServiceDefs.h
const tests = [
["profileDir", "ProfD"],
["localProfileDir", "ProfLD"],
["tempDir", AppConstants.MOZ_SANDBOX ? "ContentTmpD" : "TmpD"],
["profileDir", "getProfileDir", "ProfD"],
["localProfileDir", "getLocalProfileDir", "ProfLD"],
["tempDir", "getTempDir", AppConstants.MOZ_SANDBOX ? "ContentTmpD" : "TmpD"],
];
for (const [attrName, dirConstant] of tests) {
for (const [attrName, methName, dirConstant] of tests) {
const expected = Services.dirsvc.get(dirConstant, Ci.nsIFile).path;
const attrValue = PathUtils[attrName];
is(attrValue, expected, `PathUtils.${attrName} == Services.dirsvc.get("${dirConstant}", Ci.nsIFile).path`);
const methValue = await PathUtils[methName]();
is(methValue, expected, `PathUtils.${methName}() == Services.dirsvc.get("${dirConstant}", Ci.nsIFile).path`);
}
});
</script>