Bug 1572202 [wpt PR 18322] - [Native File System] Improve error reporting., a=testonly
authorMarijn Kruisselbrink <mek@chromium.org>
Mon, 26 Aug 2019 11:24:39 +0000
changeset 553922 cae32474972d63d84c4f8d87c1add976813273af
parent 553921 61e47a4752e1f5f2a1cb377735e3a0ab6a4a0a98
child 553923 742599978e68af9419289cb74d8b6bf81119d741
push id2165
push userffxbld-merge
push dateMon, 14 Oct 2019 16:30:58 +0000
treeherdermozilla-release@0eae18af659f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1572202, 18322, 971268, 991544, 1738654, 688278
milestone70.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1572202 [wpt PR 18322] - [Native File System] Improve error reporting., a=testonly Automatic update from web-platform-tests [Native File System] Improve error reporting. Don't try to force every error into a base::File::Error, instead have our own enum and a custom error message. This should make it easier for web developers to debug what is going on. Also switches some DOMException constructor usage to using V8ThrowDOMException which results in the exception messages actually being shown in dev-tools. Bug: 971268, 991544 Change-Id: Id5128363bf5410ed08c1f4e65ebbe4b4bee93d7a Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1738654 Commit-Queue: Marijn Kruisselbrink <mek@chromium.org> Reviewed-by: Daniel Cheng <dcheng@chromium.org> Reviewed-by: Victor Costan <pwnall@chromium.org> Cr-Commit-Position: refs/heads/master@{#688278} -- wpt-commits: 071a2e47b7f56ef3baf8a663bdcd30d3ace8706d wpt-pr: 18322
testing/web-platform/tests/native-file-system/FileSystemBaseHandle-remove.tentative.https.window.js
testing/web-platform/tests/native-file-system/FileSystemDirectoryHandle-getDirectory.tentative.https.window.js
testing/web-platform/tests/native-file-system/FileSystemDirectoryHandle-getFile.tentative.https.window.js
--- a/testing/web-platform/tests/native-file-system/FileSystemBaseHandle-remove.tentative.https.window.js
+++ b/testing/web-platform/tests/native-file-system/FileSystemBaseHandle-remove.tentative.https.window.js
@@ -39,38 +39,38 @@ promise_test(async t => {
     await promise_rejects(t, 'InvalidModificationError', root.removeEntry('dir-to-remove'));
     assert_array_equals(await getSortedDirectoryEntries(root), ['dir-to-remove/']);
     assert_array_equals(await getSortedDirectoryEntries(dir), ['file-in-dir']);
 }, 'removeEntry() on a non-empty directory should fail');
 
 promise_test(async t => {
     const root = await FileSystemDirectoryHandle.getSystemDirectory({ type: 'sandbox' });
     const dir = await createDirectory(t, 'dir', root);
-    await promise_rejects(t, 'NotFoundError', dir.removeEntry(""));
+    await promise_rejects(t, new TypeError(), dir.removeEntry(""));
 }, 'removeEntry() with empty name should fail');
 
 promise_test(async t => {
     const root = await FileSystemDirectoryHandle.getSystemDirectory({ type: 'sandbox' });
     const dir = await createDirectory(t, 'dir', root);
-    await promise_rejects(t, 'SecurityError', dir.removeEntry(kCurrentDirectory));
+    await promise_rejects(t, new TypeError(), dir.removeEntry(kCurrentDirectory));
 }, `removeEntry() with "${kCurrentDirectory}" name should fail`);
 
 promise_test(async t => {
     const root = await FileSystemDirectoryHandle.getSystemDirectory({ type: 'sandbox' });
     const dir = await createDirectory(t, 'dir', root);
-    await promise_rejects(t, 'SecurityError', dir.removeEntry(kParentDirectory));
+    await promise_rejects(t, new TypeError(), dir.removeEntry(kParentDirectory));
 }, `removeEntry() with "${kParentDirectory}" name should fail`);
 
 promise_test(async t => {
     const root = await FileSystemDirectoryHandle.getSystemDirectory({ type: 'sandbox' });
 
     const dir_name = 'dir-name';
     const dir = await createDirectory(t, dir_name, root);
 
     const file_name = 'file-name';
     await createEmptyFile(t, file_name, dir);
 
     for (let i = 0; i < kPathSeparators.length; ++i) {
         const path_with_separator = `${dir_name}${kPathSeparators[i]}${file_name}`;
-        await promise_rejects(t, 'SecurityError', root.removeEntry(path_with_separator),
+        await promise_rejects(t, new TypeError(), root.removeEntry(path_with_separator),
             `removeEntry() must reject names containing "${kPathSeparators[i]}"`);
     }
 }, 'removeEntry() with a path separator should fail.');
--- a/testing/web-platform/tests/native-file-system/FileSystemDirectoryHandle-getDirectory.tentative.https.window.js
+++ b/testing/web-platform/tests/native-file-system/FileSystemDirectoryHandle-getDirectory.tentative.https.window.js
@@ -53,54 +53,54 @@ promise_test(async t => {
 
     await promise_rejects(t, 'TypeMismatchError', root.getDirectory('file-name'));
     await promise_rejects(t, 'TypeMismatchError', root.getDirectory('file-name', { create: false }));
     await promise_rejects(t, 'TypeMismatchError', root.getDirectory('file-name', { create: true }));
 }, 'getDirectory() when a file already exists with the same name');
 
 promise_test(async t => {
     const dir = await FileSystemDirectoryHandle.getSystemDirectory({ type: 'sandbox' });
-    await promise_rejects(t, 'NotFoundError', dir.getDirectory("", { create: true }));
-    await promise_rejects(t, 'NotFoundError', dir.getDirectory("", { create: false }));
+    await promise_rejects(t, new TypeError(), dir.getDirectory("", { create: true }));
+    await promise_rejects(t, new TypeError(), dir.getDirectory("", { create: false }));
 }, 'getDirectory() with empty name');
 
 promise_test(async t => {
     const dir = await FileSystemDirectoryHandle.getSystemDirectory({ type: 'sandbox' });
-    await promise_rejects(t, 'SecurityError', dir.getDirectory(kCurrentDirectory));
-    await promise_rejects(t, 'SecurityError', dir.getDirectory(kCurrentDirectory, { create: true }));
+    await promise_rejects(t, new TypeError(), dir.getDirectory(kCurrentDirectory));
+    await promise_rejects(t, new TypeError(), dir.getDirectory(kCurrentDirectory, { create: true }));
 }, `getDirectory() with "${kCurrentDirectory}" name`);
 
 promise_test(async t => {
     const dir = await FileSystemDirectoryHandle.getSystemDirectory({ type: 'sandbox' });
     const subdir = await createDirectory(t, 'subdir-name', /*parent=*/dir);
 
-    await promise_rejects(t, 'SecurityError', subdir.getDirectory(kParentDirectory));
-    await promise_rejects(t, 'SecurityError', subdir.getDirectory(kParentDirectory, { create: true }));
+    await promise_rejects(t, new TypeError(), subdir.getDirectory(kParentDirectory));
+    await promise_rejects(t, new TypeError(), subdir.getDirectory(kParentDirectory, { create: true }));
 }, `getDirectory() with "${kParentDirectory}" name`);
 
 promise_test(async t => {
     const dir = await FileSystemDirectoryHandle.getSystemDirectory({ type: 'sandbox' });
 
     const first_subdir_name = 'first-subdir-name';
     const first_subdir = await createDirectory(t, first_subdir_name, /*parent=*/dir);
 
     const second_subdir_name = 'second-subdir-name';
     const second_subdir = await createDirectory(t, second_subdir_name, /*parent=*/first_subdir);
 
     for (let i = 0; i < kPathSeparators.length; ++i) {
         const path_with_separator = `${first_subdir_name}${kPathSeparators[i]}${second_subdir_name}`;
-        await promise_rejects(t, 'SecurityError', dir.getDirectory(path_with_separator),
+        await promise_rejects(t, new TypeError(), dir.getDirectory(path_with_separator),
             `getDirectory() must reject names containing "${kPathSeparators[i]}"`);
     }
 }, 'getDirectory(create=false) with a path separator when the directory exists');
 
 promise_test(async t => {
     const dir = await FileSystemDirectoryHandle.getSystemDirectory({ type: 'sandbox' });
 
     const subdir_name = 'subdir-name';
     const subdir = await createDirectory(t, subdir_name, /*parent=*/dir);
 
     for (let i = 0; i < kPathSeparators.length; ++i) {
         const path_with_separator = `${subdir_name}${kPathSeparators[i]}file_name`;
-        await promise_rejects(t, 'SecurityError', dir.getDirectory(path_with_separator, { create: true }),
+        await promise_rejects(t, new TypeError(), dir.getDirectory(path_with_separator, { create: true }),
             `getDirectory(true) must reject names containing "${kPathSeparators[i]}"`);
     }
 }, 'getDirectory(create=true) with a path separator');
--- a/testing/web-platform/tests/native-file-system/FileSystemDirectoryHandle-getFile.tentative.https.window.js
+++ b/testing/web-platform/tests/native-file-system/FileSystemDirectoryHandle-getFile.tentative.https.window.js
@@ -58,54 +58,54 @@ promise_test(async t => {
     const dir_handle = await dir.getDirectory('dir-name', { create: true });
     t.add_cleanup(() => dir.removeEntry('dir-name', { recursive: true }));
 
     await promise_rejects(t, 'TypeMismatchError', dir.getFile('dir-name', { create: true }));
 }, 'getFile(create=true) when a directory already exists with the same name');
 
 promise_test(async t => {
     const dir = await FileSystemDirectoryHandle.getSystemDirectory({ type: 'sandbox' });
-    await promise_rejects(t, 'NotFoundError', dir.getFile("", { create: true }));
-    await promise_rejects(t, 'NotFoundError', dir.getFile("", { create: false }));
+    await promise_rejects(t, new TypeError(), dir.getFile("", { create: true }));
+    await promise_rejects(t, new TypeError(), dir.getFile("", { create: false }));
 }, 'getFile() with empty name');
 
 promise_test(async t => {
     const dir = await FileSystemDirectoryHandle.getSystemDirectory({ type: 'sandbox' });
-    await promise_rejects(t, 'SecurityError', dir.getFile(kCurrentDirectory));
-    await promise_rejects(t, 'SecurityError', dir.getFile(kCurrentDirectory, { create: true }));
+    await promise_rejects(t, new TypeError(), dir.getFile(kCurrentDirectory));
+    await promise_rejects(t, new TypeError(), dir.getFile(kCurrentDirectory, { create: true }));
 }, `getFile() with "${kCurrentDirectory}" name`);
 
 promise_test(async t => {
     const dir = await FileSystemDirectoryHandle.getSystemDirectory({ type: 'sandbox' });
     const subdir = await createDirectory(t, 'subdir-name', /*parent=*/dir);
 
-    await promise_rejects(t, 'SecurityError', subdir.getFile(kParentDirectory));
-    await promise_rejects(t, 'SecurityError', subdir.getFile(kParentDirectory, { create: true }));
+    await promise_rejects(t, new TypeError(), subdir.getFile(kParentDirectory));
+    await promise_rejects(t, new TypeError(), subdir.getFile(kParentDirectory, { create: true }));
 }, `getFile() with "${kParentDirectory}" name`);
 
 promise_test(async t => {
     const dir = await FileSystemDirectoryHandle.getSystemDirectory({ type: 'sandbox' });
 
     const subdir_name = 'subdir-name';
     const subdir = await createDirectory(t, subdir_name, /*parent=*/dir);
 
     const file_name = 'file-name';
     await createEmptyFile(t, file_name, /*parent=*/subdir);
 
     for (let i = 0; i < kPathSeparators.length; ++i) {
         const path_with_separator = `${subdir_name}${kPathSeparators[i]}${file_name}`;
-        await promise_rejects(t, 'SecurityError', dir.getFile(path_with_separator),
+        await promise_rejects(t, new TypeError(), dir.getFile(path_with_separator),
             `getFile() must reject names containing "${kPathSeparators[i]}"`);
     }
 }, 'getFile(create=false) with a path separator when the file exists.');
 
 promise_test(async t => {
     const dir = await FileSystemDirectoryHandle.getSystemDirectory({ type: 'sandbox' });
 
     const subdir_name = 'subdir-name';
     const subdir = await createDirectory(t, subdir_name, /*parent=*/dir);
 
     for (let i = 0; i < kPathSeparators.length; ++i) {
         const path_with_separator = `${subdir_name}${kPathSeparators[i]}file_name`;
-        await promise_rejects(t, 'SecurityError', dir.getFile(path_with_separator, { create: true }),
+        await promise_rejects(t, new TypeError(), dir.getFile(path_with_separator, { create: true }),
             `getFile(true) must reject names containing "${kPathSeparators[i]}"`);
     }
 }, 'getFile(create=true) with a path separator');