зеркало из https://github.com/mozilla/gecko-dev.git
Bug 793435 - Handle INVALID_HANDLE in CloseHandle and FindClose correctly. r=yoric
This commit is contained in:
Родитель
d76a805b87
Коммит
e83732b663
|
@ -188,7 +188,11 @@
|
|||
/*handle*/ ctypes.voidptr_t);
|
||||
|
||||
WinFile.CloseHandle = function(fd) {
|
||||
return fd.dispose(); // Returns the value of |CloseHandle|.
|
||||
if (fd == INVALID_HANDLE) {
|
||||
return true;
|
||||
} else {
|
||||
return fd.dispose(); // Returns the value of |CloseHandle|.
|
||||
}
|
||||
};
|
||||
|
||||
let _FindClose =
|
||||
|
@ -197,7 +201,11 @@
|
|||
/*handle*/ ctypes.voidptr_t);
|
||||
|
||||
WinFile.FindClose = function(handle) {
|
||||
return handle.dispose(); // Returns the value of |FindClose|.
|
||||
if (handle == INVALID_HANDLE) {
|
||||
return true;
|
||||
} else {
|
||||
return handle.dispose(); // Returns the value of |FindClose|.
|
||||
}
|
||||
};
|
||||
|
||||
// Declare libc functions as functions of |OS.Win.File|
|
||||
|
|
|
@ -47,6 +47,8 @@ function test_init() {
|
|||
function test_OpenClose() {
|
||||
ok(true, "Starting test_OpenClose");
|
||||
is(typeof OS.Win.File.CreateFile, "function", "OS.Win.File.CreateFile is a function");
|
||||
is(OS.Win.File.CloseHandle(OS.Constants.Win.INVALID_HANDLE_VALUE), true, "CloseHandle returns true given the invalid handle");
|
||||
is(OS.Win.File.FindClose(OS.Constants.Win.INVALID_HANDLE_VALUE), true, "FindClose returns true given the invalid handle");
|
||||
isnot(OS.Constants.Win.GENERIC_READ, undefined, "GENERIC_READ exists");
|
||||
isnot(OS.Constants.Win.FILE_SHARE_READ, undefined, "FILE_SHARE_READ exists");
|
||||
isnot(OS.Constants.Win.FILE_ATTRIBUTE_NORMAL, undefined, "FILE_ATTRIBUTE_NORMAL exists");
|
||||
|
|
Загрузка…
Ссылка в новой задаче