From fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 03:14:29 +0200 Subject: Merging upstream version 125.0.1. Signed-off-by: Daniel Baumann --- dom/system/tests/ioutils/file_ioutils_worker.js | 2 +- .../tests/ioutils/test_ioutils_copy_move.html | 18 ++++++------ .../tests/ioutils/test_ioutils_dir_iteration.html | 4 +-- .../tests/ioutils/test_ioutils_mac_xattr.html | 6 ++-- dom/system/tests/ioutils/test_ioutils_mkdir.html | 8 ++--- .../tests/ioutils/test_ioutils_read_write.html | 34 ++++++++-------------- .../ioutils/test_ioutils_read_write_json.html | 4 +-- .../ioutils/test_ioutils_read_write_utf8.html | 18 ++++++------ dom/system/tests/ioutils/test_ioutils_remove.html | 4 +-- .../test_ioutils_stat_set_modification_time.html | 6 ++-- .../test_ioutils_windows_file_attributes.html | 2 +- 11 files changed, 48 insertions(+), 58 deletions(-) (limited to 'dom/system/tests') diff --git a/dom/system/tests/ioutils/file_ioutils_worker.js b/dom/system/tests/ioutils/file_ioutils_worker.js index e367eb4d99..f8cf286f8e 100644 --- a/dom/system/tests/ioutils/file_ioutils_worker.js +++ b/dom/system/tests/ioutils/file_ioutils_worker.js @@ -14,7 +14,7 @@ importScripts("chrome://mochikit/content/tests/SimpleTest/WorkerSimpleTest.js"); importScripts("file_ioutils_test_fixtures.js"); -self.onmessage = async function (msg) { +self.onmessage = async function () { const tmpDir = await PathUtils.getTempDir(); // IOUtils functionality is the same when called from the main thread, or a diff --git a/dom/system/tests/ioutils/test_ioutils_copy_move.html b/dom/system/tests/ioutils/test_ioutils_copy_move.html index 408bb82f39..0761447bc6 100644 --- a/dom/system/tests/ioutils/test_ioutils_copy_move.html +++ b/dom/system/tests/ioutils/test_ioutils_copy_move.html @@ -24,7 +24,7 @@ info("Test moving a file to a relative destination"); await Assert.rejects( IOUtils.move(tmpFileName, dest), - /Could not parse path/, + /OperationError: Could not move `.*' to `.*': could not parse path \(NS_ERROR_FILE_UNRECOGNIZED_PATH\)/, "IOUtils::move only works with absolute paths" ); ok( @@ -56,7 +56,7 @@ // Test. await Assert.rejects( IOUtils.move(tmpFileName, destFileName, { noOverwrite: true }), - /Could not move source file\(.*\) to destination\(.*\) because the destination already exists and overwrites are not allowed/, + /Could not move `.*' to `.*': destination file exists and `noOverwrite' is true/, "IOUtils::move will refuse to move a file if overwrites are disabled" ); ok( @@ -161,7 +161,7 @@ // Test. await Assert.rejects( IOUtils.move(notExistsSrc, notExistsDest), - /Could not move source file\(.*\) because it does not exist/, + /NotFoundError: Could not move `.*' to `.*': source file does not exist/, "IOUtils::move throws if source file does not exist" ); ok( @@ -178,7 +178,7 @@ // Test. await Assert.rejects( IOUtils.move(srcDir, destFile), - /Could not move the source directory\(.*\) to the destination\(.*\) because the destination is not a directory/, + /InvalidAccessError: Could not move directory `.*' to `.*': destination is not a directory/, "IOUtils::move throws if try to move dir into an existing file" ); @@ -206,7 +206,7 @@ // Test. await Assert.rejects( IOUtils.copy(tmpFileName, destFileName, { noOverwrite: true }), - /Could not copy source file\(.*\) to destination\(.*\) because the destination already exists and overwrites are not allowed/, + /NoModificationAllowedError: Could not copy `.*' to `.*': destination file exists and `noOverwrite' is true/, "IOUtils::copy will refuse to copy to existing destination if overwrites are disabled" ); ok( @@ -311,7 +311,7 @@ // Test. await Assert.rejects( IOUtils.copy(notExistsSrc, notExistsDest), - /Could not copy source file\(.*\) because it does not exist/, + /NotFoundError: Could not copy `.*' to `.*': source file does not exist/, "IOUtils::copy throws if source file does not exist" ); ok( @@ -328,8 +328,8 @@ // Test. await Assert.rejects( IOUtils.copy(srcDir, destFile, { recursive: true }), - /Could not copy the source directory\(.*\) to the destination\(.*\) because the destination is not a directory/, - "IOUtils::copy throws if try to move dir into an existing file" + /InvalidAccessError: Could not copy directory `.*' to `.*': destination is not a directory/, + "IOUtils::copy throws when trying to move a directory into an existing file" ); ok(await fileHasTextContents(destFile, ""), "IOUtils::copy failure does not affect destination"); @@ -339,7 +339,7 @@ // Test. await Assert.rejects( IOUtils.copy(srcDir, notExistsDest, { recursive: false }), - /Refused to copy source directory\(.*\) to the destination\(.*\)/, + /OperationError: Refused to copy directory `.*' to `.*': `recursive' is false/, "IOUtils::copy throws if try to copy a directory with { recursive: false }" ); console.log(`${notExistsDest} exists?`, await IOUtils.exists(notExistsDest)) diff --git a/dom/system/tests/ioutils/test_ioutils_dir_iteration.html b/dom/system/tests/ioutils/test_ioutils_dir_iteration.html index 54168235b0..1e3653d876 100644 --- a/dom/system/tests/ioutils/test_ioutils_dir_iteration.html +++ b/dom/system/tests/ioutils/test_ioutils_dir_iteration.html @@ -21,7 +21,7 @@ await Assert.rejects( IOUtils.getChildren(notExists), - /Could not get children of file\(.*\) because it does not exist/, + /NotFoundError: Could not get children of `.*': directory does not exist/, "IOUtils::getChildren rejects if the file does not exist" ); ok(!await fileExists(notExists), `Expected ${notExists} not to exist`); @@ -31,7 +31,7 @@ let tmpFileName = PathUtils.join(PathUtils.tempDir, 'iterator_file.tmp'); await createFile(tmpFileName) await Assert.rejects(IOUtils.getChildren(tmpFileName), - /Could not get children of file\(.*\) because it is not a directory/, + /InvalidAccessError: Could not get children of `.*': file is not a directory/, "IOUtils::getChildren rejects if the file is not a dir" ); diff --git a/dom/system/tests/ioutils/test_ioutils_mac_xattr.html b/dom/system/tests/ioutils/test_ioutils_mac_xattr.html index 6af9b2e6f8..775490976e 100644 --- a/dom/system/tests/ioutils/test_ioutils_mac_xattr.html +++ b/dom/system/tests/ioutils/test_ioutils_mac_xattr.html @@ -36,7 +36,7 @@ info("Testing getting an attribute that does not exist"); await Assert.rejects( IOUtils.getMacXAttr(path, ATTR), - /NotFoundError: The file `.+' does not have an extended attribute/, + /NotFoundError: Could not get extended attribute `bogus.attr' from `.*': the file does not have the attribute/, "IOUtils::getMacXAttr rejects when the attribute does not exist" ); @@ -61,7 +61,7 @@ await IOUtils.delMacXAttr(path, ATTR); await Assert.rejects( IOUtils.getMacXAttr(path, ATTR), - /NotFoundError: The file `.+' does not have an extended attribute/, + /NotFoundError: Could not get extended attribute `bogus.attr' from `.*': the file does not have the attribute/, "IOUtils::delMacXAttr removes the attribute" ); @@ -73,7 +73,7 @@ info("Testing removing an attribute that does not exist"); await Assert.rejects( IOUtils.delMacXAttr(path, ATTR), - /NotFoundError: The file `.+' does not have an extended attribute/, + /NotFoundError: Could not delete extended attribute `bogus.attr' from `.*': the file does not have the attribute/, "IOUtils::delMacXAttr rejects when the attribute does not exist" ); diff --git a/dom/system/tests/ioutils/test_ioutils_mkdir.html b/dom/system/tests/ioutils/test_ioutils_mkdir.html index 6827b24cc6..e95873fd17 100644 --- a/dom/system/tests/ioutils/test_ioutils_mkdir.html +++ b/dom/system/tests/ioutils/test_ioutils_mkdir.html @@ -33,7 +33,7 @@ ); await Assert.rejects( IOUtils.makeDirectory(newDirectoryName, { ignoreExisting: false }), - /Could not create directory because it already exists at .*/, + /NoModificationAllowedError: Could not create directory `.*': directory already exists/, "IOUtils::makeDirectory can throw if the target dir exists" ) @@ -45,7 +45,7 @@ ); await Assert.rejects( IOUtils.makeDirectory(nestedDirName, { createAncestors: false }), - /Could not create directory at .*/, + /NotFoundError: Could not create directory `.*'/, "IOUtils::makeDirectory can fail if the target is missing parents" ); ok(!await IOUtils.exists(nestedDirName), `Expected ${nestedDirName} not to exist`); @@ -65,14 +65,14 @@ await Assert.rejects( IOUtils.makeDirectory(notADirFileName, { ignoreExisting: false }), - /Could not create directory because the target file\(.*\) exists and is not a directory/, + /InvalidAccessError: Could not create directory `.*': file exists and is not a directory/, "IOUtils::makeDirectory [ignoreExisting: false] throws when the target is an existing file" ); ok(await fileExists(notADirFileName), `Expected ${notADirFileName} to exist`); await Assert.rejects( IOUtils.makeDirectory(notADirFileName, { ignoreExisting: true }), - /Could not create directory because the target file\(.*\) exists and is not a directory/, + /InvalidAccessError: Could not create directory `.*': file exists and is not a directory/, "IOUtils::makeDirectory [ignoreExisting: true] throws when the target is an existing file" ); ok(await fileExists(notADirFileName), `Expected ${notADirFileName} to exist`); diff --git a/dom/system/tests/ioutils/test_ioutils_read_write.html b/dom/system/tests/ioutils/test_ioutils_read_write.html index 2243eb1eda..49232d464a 100644 --- a/dom/system/tests/ioutils/test_ioutils_read_write.html +++ b/dom/system/tests/ioutils/test_ioutils_read_write.html @@ -23,7 +23,7 @@ const doesNotExist = PathUtils.join(PathUtils.tempDir, "does_not_exist.tmp"); await Assert.rejects( IOUtils.read(doesNotExist), - /Could not open the file at .*/, + /NotFoundError: Could not open `.*': file does not exist/, "IOUtils::read rejects when file does not exist" ); }); @@ -46,7 +46,7 @@ IOUtils.write(tmpFileName, newContents, { mode: "create", }), - /Refusing to overwrite the file at */, + /NoModificationAllowedError: Could not write to `.*': refusing to overwrite file, `mode' is not "overwrite"/, "IOUtils::write rejects writing to existing file if overwrites are disabled" ); ok( @@ -285,7 +285,7 @@ info("Test writing a file at a relative destination"); await Assert.rejects( IOUtils.write(tmpFileName, bytes), - /Could not parse path/, + /OperationError: Could not write to `.*': could not parse path \(NS_ERROR_FILE_UNRECOGNIZED_PATH\)/, "IOUtils::write only works with absolute paths" ); }); @@ -296,8 +296,8 @@ info("Test reading a file at a relative destination"); await Assert.rejects( IOUtils.read(tmpFileName), - /Could not parse path/, - "IOUtils::write only works with absolute paths" + /OperationError: Could not read `.*': could not parse path \(NS_ERROR_FILE_UNRECOGNIZED_PATH\)/, + "IOUtils::read only works with absolute paths" ); }); @@ -348,7 +348,7 @@ is(bytesWritten, 64, "Expected to write 64 bytes"); await Assert.rejects( IOUtils.read(tmpFileName, { maxBytes: 4, decompress: true }), - /The `maxBytes` and `decompress` options are not compatible/, + /DataError: Could not read `.*': the `maxBytes' and `decompress' options are mutually exclusive/, "IOUtils::read rejects when maxBytes and decompress options are both used" ); @@ -364,17 +364,7 @@ await Assert.rejects( IOUtils.read(tmpFileName, { decompress: true }), - (actual) => { - is(actual.constructor, DOMException, - "rejection reason constructor for decompress with bad header"); - is(actual.name, "NotReadableError", - "rejection error name for decompress with bad header"); - ok(/Could not decompress file because it has an invalid LZ4 header \(wrong magic number: .*\)/ - .test(actual.message), - "rejection error message for decompress with bad header. Got " - + actual.message); - return true; - }, + /NotReadableError: Could not read `.*': could not decompress file: invalid LZ4 header: wrong magic number: `01 01 01 01 01 01 01 01 01 01 01 01' \(NS_ERROR_FILE_CORRUPTED\)/, "IOUtils::read fails to decompress LZ4 data with a bad header" ); @@ -384,7 +374,7 @@ await Assert.rejects( IOUtils.read(tmpFileName, { decompress: true }), - /Could not decompress file because the buffer is too short/, + /NotReadableError: Could not read `.*': could not decompress file: buffer is too small \(NS_ERROR_FILE_CORRUPTED\)/, "IOUtils::read fails to decompress LZ4 data with missing header" ); @@ -396,7 +386,7 @@ await Assert.rejects( IOUtils.read(tmpFileName, { decompress: true }), - /Could not decompress file contents, the file may be corrupt/, + /NotReadableError: Could not read `.*': could not decompress file: the file may be corrupt \(NS_ERROR_FILE_CORRUPTED\)/, "IOUtils::read fails to read corrupt LZ4 contents with a correct header" ); @@ -411,11 +401,11 @@ await IOUtils.makeDirectory(fileName); await Assert.rejects( IOUtils.write(fileName, bytes), - /NotAllowedError: Could not open the file at .+ for writing/); + /NotAllowedError: Could not write to `.*': failed to open file for writing/); await Assert.rejects( IOUtils.write(fileName, bytes, { tmpPath }), - /NotAllowedError: Could not open the file at .+ for writing/); + /NotAllowedError: Could not write to `.*': file is a directory/); ok(!await IOUtils.exists(PathUtils.join(fileName, PathUtils.filename(tmpPath)))); }); @@ -509,7 +499,7 @@ await Assert.rejects( IOUtils.write(fileName, Uint8Array.of(5, 6, 7, 8, 9), { mode: "append" }), - /NotFoundError: Could not open the file at .*/ + /NotFoundError: Could not write to `.*': failed to open file for writing/ ); }); diff --git a/dom/system/tests/ioutils/test_ioutils_read_write_json.html b/dom/system/tests/ioutils/test_ioutils_read_write_json.html index 0acb191e1b..a85a0c19a1 100644 --- a/dom/system/tests/ioutils/test_ioutils_read_write_json.html +++ b/dom/system/tests/ioutils/test_ioutils_read_write_json.html @@ -77,7 +77,7 @@ ok(!await IOUtils.exists(notExistsFilename), `${notExistsFilename} should not exist`); await Assert.rejects( IOUtils.readJSON(notExistsFilename), - /NotFoundError: Could not open the file at/, + /NotFoundError: Could not open `.*'/, "IOUtils::readJSON rejects when file does not exist" ); @@ -149,7 +149,7 @@ await Assert.rejects( IOUtils.writeJSON(filename, OBJECT, {mode: "append"}), - /NotSupportedError: IOUtils.writeJSON does not support appending to files/, + /NotSupportedError: Could not write to `.*': IOUtils.writeJSON does not support appending to files/, "IOUtils.writeJSON() cannot append" ); diff --git a/dom/system/tests/ioutils/test_ioutils_read_write_utf8.html b/dom/system/tests/ioutils/test_ioutils_read_write_utf8.html index cdea016732..e1a1864656 100644 --- a/dom/system/tests/ioutils/test_ioutils_read_write_utf8.html +++ b/dom/system/tests/ioutils/test_ioutils_read_write_utf8.html @@ -26,7 +26,7 @@ const doesNotExist = PathUtils.join(PathUtils.tempDir, "does_not_exist.tmp"); await Assert.rejects( IOUtils.readUTF8(doesNotExist), - /Could not open the file at .*/, + /NotFoundError: Could not open `.*'/, "IOUtils::readUTF8 rejects when file does not exist" ); @@ -38,7 +38,7 @@ await Assert.rejects( IOUtils.readUTF8(invalidUTF8File), - /Could not read file\(.*\) because it is not UTF-8 encoded/, + /NotReadableError: Could not read `.*': file is not UTF-8 encoded/, "IOUtils::readUTF8 will reject when reading a file that is not valid UTF-8" ); @@ -56,7 +56,7 @@ IOUtils.writeUTF8(tmpFileName, newContents, { mode: "create", }), - /Refusing to overwrite the file at */, + /NoModificationAllowedError: Could not write to `.*': refusing to overwrite file, `mode' is not "overwrite"/, "IOUtils::writeUTF8 rejects writing to existing file if overwrites are disabled" ); ok( @@ -233,7 +233,7 @@ info("Test writing a file at a relative destination"); await Assert.rejects( IOUtils.writeUTF8(tmpFileName, "foo"), - /Could not parse path/, + /OperationError: Could not write to `.*': could not parse path \(NS_ERROR_FILE_UNRECOGNIZED_PATH\)/, "IOUtils::writeUTF8 only works with absolute paths" ); }); @@ -244,7 +244,7 @@ info("Test reading a file at a relative destination"); await Assert.rejects( IOUtils.readUTF8(tmpFileName), - /Could not parse path/, + /OperationError: Could not read `.*': could not parse path \(NS_ERROR_FILE_UNRECOGNIZED_PATH\)/, "IOUtils::readUTF8 only works with absolute paths" ); }); @@ -309,7 +309,7 @@ await Assert.rejects( IOUtils.readUTF8(tmpFileName, { decompress: true }), - /Could not decompress file because it has an invalid LZ4 header \(wrong magic number: .*\)/, + /NotReadableError: Could not read `.*': could not decompress file: invalid LZ4 header: wrong magic number: `01 01 01 01 01 01 01 01 01 01 01 01' \(NS_ERROR_FILE_CORRUPTED\)/, "IOUtils::readUTF8 fails to decompress LZ4 data with a bad header" ); @@ -319,7 +319,7 @@ await Assert.rejects( IOUtils.readUTF8(tmpFileName, { decompress: true }), - /Could not decompress file because the buffer is too short/, + /NotReadableError: Could not read `.*': could not decompress file: buffer is too small \(NS_ERROR_FILE_CORRUPTED\)/, "IOUtils::readUTF8 fails to decompress LZ4 data with missing header" ); @@ -331,7 +331,7 @@ await Assert.rejects( IOUtils.readUTF8(tmpFileName, { decompress: true }), - /Could not decompress file contents, the file may be corrupt/, + /NotReadableError: Could not read `.*': could not decompress file: the file may be corrupt \(NS_ERROR_FILE_CORRUPTED\)/, "IOUtils::readUTF8 fails to read corrupt LZ4 contents with a correct header" ); @@ -342,7 +342,7 @@ } await Assert.rejects( IOUtils.readUTF8(tmpFileName, { decompress: true }), - /Could not decompress file because the buffer is too short/, + /NotReadableError: Could not read `.*': could not decompress file: buffer is too small \(NS_ERROR_FILE_CORRUPTED\)/, "IOUtils::readUTF8 fails to decompress empty files" ); diff --git a/dom/system/tests/ioutils/test_ioutils_remove.html b/dom/system/tests/ioutils/test_ioutils_remove.html index f368fc09d3..1d860a7871 100644 --- a/dom/system/tests/ioutils/test_ioutils_remove.html +++ b/dom/system/tests/ioutils/test_ioutils_remove.html @@ -43,7 +43,7 @@ await Assert.rejects( IOUtils.remove(tmpFileName, { ignoreAbsent: false }), - /Could not remove the file at .* because it does not exist/, + /NotFoundError: Could not remove `.*': file does not exist/, "IOUtils::remove can throw an error when target file is missing" ); ok(!await fileExists(tmpFileName), `Expected file ${tmpFileName} not to exist`); @@ -69,7 +69,7 @@ await Assert.rejects( IOUtils.remove(tmpParentDir, { recursive: false }), - /Could not remove the non-empty directory at .*/, + /OperationError: Could not remove `.*': the directory is not empty/, "IOUtils::remove fails if non-recursively removing directory with contents" ); diff --git a/dom/system/tests/ioutils/test_ioutils_stat_set_modification_time.html b/dom/system/tests/ioutils/test_ioutils_stat_set_modification_time.html index e508817a41..8a5b521742 100644 --- a/dom/system/tests/ioutils/test_ioutils_stat_set_modification_time.html +++ b/dom/system/tests/ioutils/test_ioutils_stat_set_modification_time.html @@ -76,7 +76,7 @@ await Assert.rejects( IOUtils.stat(notExistsFile), - /Could not stat file\(.*\) because it does not exist/, + /NotFoundError: Could not stat `.*': file does not exist/, "IOUtils::stat throws if the target file does not exist" ); }); @@ -214,7 +214,7 @@ await Assert.rejects( IOUtils.setModificationTime(notExistsFile), - /Could not set modification time of file\(.*\) because it does not exist/, + /Could not set modification time of `.*': file does not exist/, "IOUtils::setModificationTime throws if the target file does not exist" ); @@ -224,7 +224,7 @@ await Assert.rejects( IOUtils.setModificationTime(tempFileName, 0), - /Refusing to set the modification time of file\(.*\) to 0/, + /DataError: Refusing to set modification time of `.*' to 0: to use the current system time, call `setModificationTime' with no arguments/, "IOUtils::setModificationTime cannot set the file modification time to Epoch" ); diff --git a/dom/system/tests/ioutils/test_ioutils_windows_file_attributes.html b/dom/system/tests/ioutils/test_ioutils_windows_file_attributes.html index a5b72bd078..00219fd6fb 100644 --- a/dom/system/tests/ioutils/test_ioutils_windows_file_attributes.html +++ b/dom/system/tests/ioutils/test_ioutils_windows_file_attributes.html @@ -48,7 +48,7 @@ await Assert.rejects( IOUtils.writeUTF8(filePath, "hello, world"), - /NotAllowedError: Could not open the file at .+ for writing/, + /NotAllowedError: Could not write to `.*': failed to open file for writing/, "IOUtils::writeUTF8 on a read-only file fails." ); -- cgit v1.2.3