Bug 1001948 - Attempt to remove files more than once in the Windows cleanup functions in toolkit/webapps/ tests. r=myk,Yoric,tabraldes

This commit is contained in:
Marco Castelluccio 2014-05-08 20:06:26 +02:00
parent 4e8cc02c21
commit 33831340af
7 changed files with 92 additions and 18 deletions

View File

@ -737,6 +737,7 @@ static const dom::ConstantSpec gWinProperties[] =
INT_CONSTANT(DACL_SECURITY_INFORMATION),
// Errors
INT_CONSTANT(ERROR_SUCCESS),
INT_CONSTANT(ERROR_INVALID_HANDLE),
INT_CONSTANT(ERROR_ACCESS_DENIED),
INT_CONSTANT(ERROR_DIR_NOT_EMPTY),
@ -746,6 +747,7 @@ static const dom::ConstantSpec gWinProperties[] =
INT_CONSTANT(ERROR_NO_MORE_FILES),
INT_CONSTANT(ERROR_PATH_NOT_FOUND),
INT_CONSTANT(ERROR_BAD_ARGUMENTS),
INT_CONSTANT(ERROR_SHARING_VIOLATION),
INT_CONSTANT(ERROR_NOT_SUPPORTED),
PROP_END

View File

@ -117,10 +117,22 @@ if (LINUX) {
yield OS.File.removeDir(profileDir.parent.parent.path, { ignoreAbsent: true });
}
yield OS.File.removeDir(installPath, { ignoreAbsent: true });
let removed = false;
do {
try {
yield OS.File.removeDir(installPath, { ignoreAbsent: true });
yield OS.File.remove(desktopShortcut, { ignoreAbsent: true });
yield OS.File.remove(startMenuShortcut, { ignoreAbsent: true });
yield OS.File.remove(desktopShortcut, { ignoreAbsent: true });
yield OS.File.remove(startMenuShortcut, { ignoreAbsent: true });
removed = true;
} catch (ex if ex instanceof OS.File.Error &&
(ex.winLastError == OS.Constants.Win.ERROR_SUCCESS ||
ex.winLastError == OS.Constants.Win.ERROR_SHARING_VIOLATION)) {
// Wait 100 ms before attempting to remove again.
yield wait(100);
}
} while (!removed);
});
};
} else if (MAC) {

View File

@ -117,10 +117,22 @@ if (LINUX) {
yield OS.File.removeDir(profileDir.parent.parent.path, { ignoreAbsent: true });
}
yield OS.File.removeDir(installPath, { ignoreAbsent: true });
let removed = false;
do {
try {
yield OS.File.removeDir(installPath, { ignoreAbsent: true });
yield OS.File.remove(desktopShortcut, { ignoreAbsent: true });
yield OS.File.remove(startMenuShortcut, { ignoreAbsent: true });
yield OS.File.remove(desktopShortcut, { ignoreAbsent: true });
yield OS.File.remove(startMenuShortcut, { ignoreAbsent: true });
removed = true;
} catch (ex if ex instanceof OS.File.Error &&
(ex.winLastError == OS.Constants.Win.ERROR_SUCCESS ||
ex.winLastError == OS.Constants.Win.ERROR_SHARING_VIOLATION)) {
// Wait 100 ms before attempting to remove again.
yield wait(100);
}
} while (!removed);
});
};
} else if (MAC) {

View File

@ -122,10 +122,22 @@ if (LINUX) {
yield OS.File.removeDir(profileDir.parent.parent.path, { ignoreAbsent: true });
}
yield OS.File.removeDir(installPath, { ignoreAbsent: true });
let removed = false;
do {
try {
yield OS.File.removeDir(installPath, { ignoreAbsent: true });
yield OS.File.remove(desktopShortcut, { ignoreAbsent: true });
yield OS.File.remove(startMenuShortcut, { ignoreAbsent: true });
yield OS.File.remove(desktopShortcut, { ignoreAbsent: true });
yield OS.File.remove(startMenuShortcut, { ignoreAbsent: true });
removed = true;
} catch (ex if ex instanceof OS.File.Error &&
(ex.winLastError == OS.Constants.Win.ERROR_SUCCESS ||
ex.winLastError == OS.Constants.Win.ERROR_SHARING_VIOLATION)) {
// Wait 100 ms before attempting to remove again.
yield wait(100);
}
} while (!removed);
});
};
} else if (MAC) {

View File

@ -127,10 +127,22 @@ if (LINUX) {
yield OS.File.removeDir(profileDir.parent.parent.path, { ignoreAbsent: true });
}
yield OS.File.removeDir(installPath, { ignoreAbsent: true });
let removed = false;
do {
try {
yield OS.File.removeDir(installPath, { ignoreAbsent: true });
yield OS.File.remove(desktopShortcut, { ignoreAbsent: true });
yield OS.File.remove(startMenuShortcut, { ignoreAbsent: true });
yield OS.File.remove(desktopShortcut, { ignoreAbsent: true });
yield OS.File.remove(startMenuShortcut, { ignoreAbsent: true });
removed = true;
} catch (ex if ex instanceof OS.File.Error &&
(ex.winLastError == OS.Constants.Win.ERROR_SUCCESS ||
ex.winLastError == OS.Constants.Win.ERROR_SHARING_VIOLATION)) {
// Wait 100 ms before attempting to remove again.
yield wait(100);
}
} while (!removed);
});
};
} else if (MAC) {

View File

@ -127,10 +127,22 @@ if (LINUX) {
yield OS.File.removeDir(profileDir.parent.parent.path, { ignoreAbsent: true });
}
yield OS.File.removeDir(installPath, { ignoreAbsent: true });
let removed = false;
do {
try {
yield OS.File.removeDir(installPath, { ignoreAbsent: true });
yield OS.File.remove(desktopShortcut, { ignoreAbsent: true });
yield OS.File.remove(startMenuShortcut, { ignoreAbsent: true });
yield OS.File.remove(desktopShortcut, { ignoreAbsent: true });
yield OS.File.remove(startMenuShortcut, { ignoreAbsent: true });
removed = true;
} catch (ex if ex instanceof OS.File.Error &&
(ex.winLastError == OS.Constants.Win.ERROR_SUCCESS ||
ex.winLastError == OS.Constants.Win.ERROR_SHARING_VIOLATION)) {
// Wait 100 ms before attempting to remove again.
yield wait(100);
}
} while (!removed);
});
};
} else if (MAC) {

View File

@ -135,10 +135,22 @@ if (LINUX) {
yield OS.File.removeDir(profileDir.parent.parent.path, { ignoreAbsent: true });
}
yield OS.File.removeDir(installPath, { ignoreAbsent: true });
let removed = false;
do {
try {
yield OS.File.removeDir(installPath, { ignoreAbsent: true });
yield OS.File.remove(desktopShortcut, { ignoreAbsent: true });
yield OS.File.remove(startMenuShortcut, { ignoreAbsent: true });
yield OS.File.remove(desktopShortcut, { ignoreAbsent: true });
yield OS.File.remove(startMenuShortcut, { ignoreAbsent: true });
removed = true;
} catch (ex if ex instanceof OS.File.Error &&
(ex.winLastError == OS.Constants.Win.ERROR_SUCCESS ||
ex.winLastError == OS.Constants.Win.ERROR_SHARING_VIOLATION)) {
// Wait 100 ms before attempting to remove again.
yield wait(100);
}
} while (!removed);
});
};
} else if (MAC) {