diff --git a/test/common/wpt.js b/test/common/wpt.js
index 8a4482de7142af..ad31ecbd68c62b 100644
--- a/test/common/wpt.js
+++ b/test/common/wpt.js
@@ -251,6 +251,9 @@ class StatusRuleSet {
// A specification of WPT test
class WPTTestSpec {
+
+ #content;
+
/**
* @param {string} mod name of the WPT module, e.g.
* 'html/webappapis/microtask-queuing'
@@ -298,7 +301,8 @@ class WPTTestSpec {
}
getContent() {
- return fs.readFileSync(this.getAbsolutePath(), 'utf8');
+ this.#content ??= fs.readFileSync(this.getAbsolutePath(), 'utf8');
+ return this.#content;
}
}
@@ -355,7 +359,7 @@ class StatusLoader {
}
/**
- * Grep for all .*.js file recursively in a directory.
+ * Grep for all .*.js file recursively in a directory, omitting helpers.
* @param {string} dir
*/
grep(dir) {
@@ -374,6 +378,7 @@ class StatusLoader {
result.push(filepath);
}
}
+ result = result.filter((filepath) => !filepath.endsWith('.helper.js'));
return result;
}
@@ -484,9 +489,7 @@ class WPTRunner {
pretendGlobalThisAs(name) {
switch (name) {
case 'Window': {
- this.globalThisInitScripts.push(
- `global.Window = Object.getPrototypeOf(globalThis).constructor;
- self.GLOBAL.isWorker = () => false;`);
+ this.globalThisInitScripts.push('globalThis.Window = Object.getPrototypeOf(globalThis).constructor;');
this.loadLazyGlobals();
break;
}
@@ -526,39 +529,10 @@ class WPTRunner {
this.globalThisInitScripts.push(script);
}
- brandCheckGlobalScopeAttribute(name) {
- // TODO(legendecas): idlharness GlobalScope attribute receiver validation.
- const script = `
- const desc = Object.getOwnPropertyDescriptor(globalThis, '${name}');
- function getter() {
- // Mimic GlobalScope instance brand check.
- if (this !== globalThis) {
- throw new TypeError('Illegal invocation');
- }
- return desc.get();
- }
- Object.defineProperty(getter, 'name', { value: 'get ${name}' });
-
- function setter(value) {
- // Mimic GlobalScope instance brand check.
- if (this !== globalThis) {
- throw new TypeError('Illegal invocation');
- }
- desc.set(value);
- }
- Object.defineProperty(setter, 'name', { value: 'set ${name}' });
-
- Object.defineProperty(globalThis, '${name}', {
- get: getter,
- set: setter,
- });
- `;
- this.globalThisInitScripts.push(script);
- }
-
// TODO(joyeecheung): work with the upstream to port more tests in .html
// to .js.
async runJsTests() {
+ this.pretendGlobalThisAs('Window');
let queue = [];
// If the tests are run as `node test/wpt/test-something.js subset.any.js`,
@@ -914,6 +888,17 @@ class WPTRunner {
continue;
}
+ if (filename.includes('tentative')) {
+ this.skip(filename, [ 'test makes assertions not yet required by any specification' ]);
+ continue;
+ }
+
+ const isServiceWorker = spec.getContent().includes('importScripts(');
+ if (isServiceWorker) {
+ this.skip(filename, [ 'importScripts is not defined' ]);
+ continue;
+ }
+
queue.push(spec);
}
return queue;
diff --git a/test/fixtures/wpt/FileAPI/BlobURL/test2-manual.html b/test/fixtures/wpt/FileAPI/BlobURL/test2-manual.html
deleted file mode 100644
index 07fb27ef8af10b..00000000000000
--- a/test/fixtures/wpt/FileAPI/BlobURL/test2-manual.html
+++ /dev/null
@@ -1,62 +0,0 @@
-
-
-
-
- Blob and File reference URL Test(2)
-
-
-
-
-
-
-
-
-
-
Test steps:
-
- - Download the file.
- - Select the file in the file inputbox.
- - Delete the file.
- - Click the 'start' button.
-
-
-
-
-
-
-
-
diff --git a/test/fixtures/wpt/FileAPI/FileReader/progress_event_bubbles_cancelable.html b/test/fixtures/wpt/FileAPI/FileReader/progress_event_bubbles_cancelable.html
deleted file mode 100644
index 6a03243f934081..00000000000000
--- a/test/fixtures/wpt/FileAPI/FileReader/progress_event_bubbles_cancelable.html
+++ /dev/null
@@ -1,33 +0,0 @@
-
-
-File API Test: Progress Event - bubbles, cancelable
-
-
-
-
-
-
-
diff --git a/test/fixtures/wpt/FileAPI/FileReader/support/file_test1.txt b/test/fixtures/wpt/FileAPI/FileReader/support/file_test1.txt
deleted file mode 100644
index e69de29bb2d1d6..00000000000000
diff --git a/test/fixtures/wpt/FileAPI/FileReader/test_errors-manual.html b/test/fixtures/wpt/FileAPI/FileReader/test_errors-manual.html
deleted file mode 100644
index b8c3f84d2bf23a..00000000000000
--- a/test/fixtures/wpt/FileAPI/FileReader/test_errors-manual.html
+++ /dev/null
@@ -1,72 +0,0 @@
-
-
-
-
- FileReader Errors Test
-
-
-
-
-
-
-
-
-
-
Test steps:
-
- - Download the file.
- - Select the file in the file inputbox.
- - Delete the file.
- - Click the 'start' button.
-
-
-
-
-
-
-
-
diff --git a/test/fixtures/wpt/FileAPI/FileReader/test_notreadableerrors-manual.html b/test/fixtures/wpt/FileAPI/FileReader/test_notreadableerrors-manual.html
deleted file mode 100644
index 46d73598a0f91a..00000000000000
--- a/test/fixtures/wpt/FileAPI/FileReader/test_notreadableerrors-manual.html
+++ /dev/null
@@ -1,42 +0,0 @@
-
-
-FileReader NotReadableError Test
-
-
-
-
-
-
-
-
Test steps:
-
- - Download the file.
- - Select the file in the file inputbox.
- - Delete the file's readable permission.
- - Click the 'start' button.
-
-
-
-
-
diff --git a/test/fixtures/wpt/FileAPI/FileReader/test_securityerrors-manual.html b/test/fixtures/wpt/FileAPI/FileReader/test_securityerrors-manual.html
deleted file mode 100644
index add93ed69d139a..00000000000000
--- a/test/fixtures/wpt/FileAPI/FileReader/test_securityerrors-manual.html
+++ /dev/null
@@ -1,40 +0,0 @@
-
-
-FileReader SecurityError Test
-
-
-
-
-
-
-
-
Test steps:
-
- - Select a system sensitive file (e.g. files in /usr/bin, password files,
- and other native operating system executables) in the file inputbox.
- - Click the 'start' button.
-
-
-
-
diff --git a/test/fixtures/wpt/FileAPI/FileReader/workers.html b/test/fixtures/wpt/FileAPI/FileReader/workers.html
deleted file mode 100644
index 8e114eeaf86ff5..00000000000000
--- a/test/fixtures/wpt/FileAPI/FileReader/workers.html
+++ /dev/null
@@ -1,27 +0,0 @@
-
-
-
-
-
diff --git a/test/fixtures/wpt/FileAPI/FileReaderSync.worker.js b/test/fixtures/wpt/FileAPI/FileReaderSync.worker.js
deleted file mode 100644
index 3d7a0222f31266..00000000000000
--- a/test/fixtures/wpt/FileAPI/FileReaderSync.worker.js
+++ /dev/null
@@ -1,56 +0,0 @@
-importScripts("/resources/testharness.js");
-
-var blob, empty_blob, readerSync;
-setup(() => {
- readerSync = new FileReaderSync();
- blob = new Blob(["test"]);
- empty_blob = new Blob();
-});
-
-test(() => {
- assert_true(readerSync instanceof FileReaderSync);
-}, "Interface");
-
-test(() => {
- var text = readerSync.readAsText(blob);
- assert_equals(text, "test");
-}, "readAsText");
-
-test(() => {
- var text = readerSync.readAsText(empty_blob);
- assert_equals(text, "");
-}, "readAsText with empty blob");
-
-test(() => {
- var data = readerSync.readAsDataURL(blob);
- assert_equals(data.indexOf("data:"), 0);
-}, "readAsDataURL");
-
-test(() => {
- var data = readerSync.readAsDataURL(empty_blob);
- assert_equals(data.indexOf("data:"), 0);
-}, "readAsDataURL with empty blob");
-
-test(() => {
- var data = readerSync.readAsBinaryString(blob);
- assert_equals(data, "test");
-}, "readAsBinaryString");
-
-test(() => {
- var data = readerSync.readAsBinaryString(empty_blob);
- assert_equals(data, "");
-}, "readAsBinaryString with empty blob");
-
-test(() => {
- var data = readerSync.readAsArrayBuffer(blob);
- assert_true(data instanceof ArrayBuffer);
- assert_equals(data.byteLength, "test".length);
-}, "readAsArrayBuffer");
-
-test(() => {
- var data = readerSync.readAsArrayBuffer(empty_blob);
- assert_true(data instanceof ArrayBuffer);
- assert_equals(data.byteLength, 0);
-}, "readAsArrayBuffer with empty blob");
-
-done();
diff --git a/test/fixtures/wpt/FileAPI/META.yml b/test/fixtures/wpt/FileAPI/META.yml
deleted file mode 100644
index 506a59fec1eb33..00000000000000
--- a/test/fixtures/wpt/FileAPI/META.yml
+++ /dev/null
@@ -1,6 +0,0 @@
-spec: https://w3c.github.io/FileAPI/
-suggested_reviewers:
- - inexorabletash
- - zqzhang
- - jdm
- - mkruisselbrink
diff --git a/test/fixtures/wpt/FileAPI/blob/Blob-constructor.any.js b/test/fixtures/wpt/FileAPI/blob/Blob-constructor.any.js
index 6c34d7e34b93f9..d16f760caeeb2d 100644
--- a/test/fixtures/wpt/FileAPI/blob/Blob-constructor.any.js
+++ b/test/fixtures/wpt/FileAPI/blob/Blob-constructor.any.js
@@ -311,7 +311,16 @@ test_blob(function() {
desc: "Passing a Float64Array as element of the blobParts array should work."
});
-
+test_blob(function() {
+ return new Blob([
+ new BigInt64Array([BigInt("0x5353415053534150")]),
+ new BigUint64Array([BigInt("0x5353415053534150")])
+ ]);
+}, {
+ expected: "PASSPASSPASSPASS",
+ type: "",
+ desc: "Passing BigInt typed arrays as elements of the blobParts array should work."
+});
var t_ports = async_test("Passing a FrozenArray as the blobParts array should work (FrozenArray).");
t_ports.step(function() {
diff --git a/test/fixtures/wpt/FileAPI/blob/Blob-constructor.html b/test/fixtures/wpt/FileAPI/blob/Blob-constructor.html
deleted file mode 100644
index 62a649aed66418..00000000000000
--- a/test/fixtures/wpt/FileAPI/blob/Blob-constructor.html
+++ /dev/null
@@ -1,501 +0,0 @@
-
-
-Blob constructor
-
-
-
-
-
-
-
-
-
diff --git a/test/fixtures/wpt/FileAPI/blob/Blob-in-worker.worker.js b/test/fixtures/wpt/FileAPI/blob/Blob-in-worker.worker.js
index a67060e7b85eff..a0ca84551dd7cc 100644
--- a/test/fixtures/wpt/FileAPI/blob/Blob-in-worker.worker.js
+++ b/test/fixtures/wpt/FileAPI/blob/Blob-in-worker.worker.js
@@ -1,14 +1,9 @@
importScripts("/resources/testharness.js");
-async_test(function() {
- var data = "TEST";
- var blob = new Blob([data], {type: "text/plain"});
- var reader = new FileReader();
- reader.onload = this.step_func_done(function() {
- assert_equals(reader.result, data);
- });
- reader.onerror = this.unreached_func("Unexpected error event");
- reader.readAsText(blob);
-}, "Create Blob in Worker");
+promise_test(async () => {
+ const data = "TEST";
+ const blob = new Blob([data], {type: "text/plain"});
+ assert_equals(await blob.text(), data);
+}, 'Create Blob in Worker');
done();
diff --git a/test/fixtures/wpt/FileAPI/blob/Blob-slice-overflow.html b/test/fixtures/wpt/FileAPI/blob/Blob-slice-overflow.html
deleted file mode 100644
index 74cd83a34f7116..00000000000000
--- a/test/fixtures/wpt/FileAPI/blob/Blob-slice-overflow.html
+++ /dev/null
@@ -1,42 +0,0 @@
-
-
-Blob slice overflow
-
-
-
-
-
-
-
diff --git a/test/fixtures/wpt/FileAPI/blob/Blob-slice.html b/test/fixtures/wpt/FileAPI/blob/Blob-slice.html
deleted file mode 100644
index 03fe6ca5343bd1..00000000000000
--- a/test/fixtures/wpt/FileAPI/blob/Blob-slice.html
+++ /dev/null
@@ -1,238 +0,0 @@
-
-
-Blob slice
-
-
-
-
-
-
-
diff --git a/test/fixtures/wpt/FileAPI/blob/Blob-stream-byob-crash.html b/test/fixtures/wpt/FileAPI/blob/Blob-stream-byob-crash.html
new file mode 100644
index 00000000000000..5992ed1396ca90
--- /dev/null
+++ b/test/fixtures/wpt/FileAPI/blob/Blob-stream-byob-crash.html
@@ -0,0 +1,11 @@
+
+
diff --git a/test/fixtures/wpt/FileAPI/blob/Blob-stream.any.js b/test/fixtures/wpt/FileAPI/blob/Blob-stream.any.js
index 792b6639c35a26..87710a171a9752 100644
--- a/test/fixtures/wpt/FileAPI/blob/Blob-stream.any.js
+++ b/test/fixtures/wpt/FileAPI/blob/Blob-stream.any.js
@@ -1,24 +1,26 @@
// META: title=Blob Stream
// META: script=../support/Blob.js
-// META: script=../../streams/resources/test-utils.js
+// META: script=/common/gc.js
'use strict';
// Helper function that triggers garbage collection while reading a chunk
// if perform_gc is true.
async function read_and_gc(reader, perform_gc) {
- const read_promise = reader.read();
- if (perform_gc)
- garbageCollect();
+ // Passing Uint8Array for byte streams; non-byte streams will simply ignore it
+ const read_promise = reader.read(new Uint8Array(64));
+ if (perform_gc) {
+ await garbageCollect();
+ }
return read_promise;
}
// Takes in a ReadableStream and reads from it until it is done, returning
// an array that contains the results of each read operation. If perform_gc
// is true, garbage collection is triggered while reading every chunk.
-async function read_all_chunks(stream, perform_gc = false) {
+async function read_all_chunks(stream, { perform_gc = false, mode } = {}) {
assert_true(stream instanceof ReadableStream);
assert_true('getReader' in stream);
- const reader = stream.getReader();
+ const reader = stream.getReader({ mode });
assert_true('read' in reader);
let read_value = await read_and_gc(reader, perform_gc);
@@ -65,8 +67,17 @@ promise_test(async() => {
let blob = new Blob([typed_arr]);
const stream = blob.stream();
blob = null;
- garbageCollect();
- const chunks = await read_all_chunks(stream, /*perform_gc=*/true);
+ await garbageCollect();
+ const chunks = await read_all_chunks(stream, { perform_gc: true });
assert_array_equals(chunks, input_arr);
}, "Blob.stream() garbage collection of blob shouldn't break stream" +
"consumption")
+
+promise_test(async () => {
+ const input_arr = [8, 241, 48, 123, 151];
+ const typed_arr = new Uint8Array(input_arr);
+ let blob = new Blob([typed_arr]);
+ const stream = blob.stream();
+ const chunks = await read_all_chunks(stream, { mode: "byob" });
+ assert_array_equals(chunks, input_arr);
+}, "Reading Blob.stream() with BYOB reader")
diff --git a/test/fixtures/wpt/FileAPI/file/File-constructor.html b/test/fixtures/wpt/FileAPI/file/File-constructor.html
deleted file mode 100644
index 3477e4ada16e92..00000000000000
--- a/test/fixtures/wpt/FileAPI/file/File-constructor.html
+++ /dev/null
@@ -1,159 +0,0 @@
-
-
-File constructor
-
-
-
-
-
diff --git a/test/fixtures/wpt/FileAPI/file/send-file-form-controls.tentative.html b/test/fixtures/wpt/FileAPI/file/send-file-form-controls.tentative.html
deleted file mode 100644
index d11f4a860931b4..00000000000000
--- a/test/fixtures/wpt/FileAPI/file/send-file-form-controls.tentative.html
+++ /dev/null
@@ -1,117 +0,0 @@
-
-
-Upload files named using controls (tentative)
-
-
-
-
-
-
-
-
-
diff --git a/test/fixtures/wpt/FileAPI/file/send-file-form-iso-2022-jp.tentative.html b/test/fixtures/wpt/FileAPI/file/send-file-form-iso-2022-jp.tentative.html
deleted file mode 100644
index 659af3bde85852..00000000000000
--- a/test/fixtures/wpt/FileAPI/file/send-file-form-iso-2022-jp.tentative.html
+++ /dev/null
@@ -1,72 +0,0 @@
-
-
-
-Upload files in ISO-2022-JP form (tentative)
-
-
-
-
-
-
-
-
-
-
diff --git a/test/fixtures/wpt/FileAPI/file/send-file-form-punctuation.tentative.html b/test/fixtures/wpt/FileAPI/file/send-file-form-punctuation.tentative.html
deleted file mode 100644
index 5c2d6d0bf1fe01..00000000000000
--- a/test/fixtures/wpt/FileAPI/file/send-file-form-punctuation.tentative.html
+++ /dev/null
@@ -1,230 +0,0 @@
-
-
-Upload files named using punctuation (tentative)
-
-
-
-
-
-
-
-
-
diff --git a/test/fixtures/wpt/FileAPI/file/send-file-form-windows-1252.tentative.html b/test/fixtures/wpt/FileAPI/file/send-file-form-windows-1252.tentative.html
deleted file mode 100644
index a2c37186b3e023..00000000000000
--- a/test/fixtures/wpt/FileAPI/file/send-file-form-windows-1252.tentative.html
+++ /dev/null
@@ -1,69 +0,0 @@
-
-
-Upload files in Windows-1252 form (tentative)
-
-
-
-
-
-
-
-
-
-
diff --git a/test/fixtures/wpt/FileAPI/file/send-file-form-x-user-defined.tentative.html b/test/fixtures/wpt/FileAPI/file/send-file-form-x-user-defined.tentative.html
deleted file mode 100644
index 503b08a51706f7..00000000000000
--- a/test/fixtures/wpt/FileAPI/file/send-file-form-x-user-defined.tentative.html
+++ /dev/null
@@ -1,70 +0,0 @@
-
-
-Upload files in x-user-defined form (tentative)
-
-
-
-
-
-
-
-
-
-
diff --git a/test/fixtures/wpt/FileAPI/file/send-file-formdata-controls.tentative.html b/test/fixtures/wpt/FileAPI/file/send-file-formdata-controls.tentative.html
deleted file mode 100644
index 4259741b63ef31..00000000000000
--- a/test/fixtures/wpt/FileAPI/file/send-file-formdata-controls.tentative.html
+++ /dev/null
@@ -1,93 +0,0 @@
-
-
-FormData: Upload files named using controls (tentative)
-
-
-
-
-
-
-
-
-
diff --git a/test/fixtures/wpt/FileAPI/file/send-file-formdata-punctuation.tentative.html b/test/fixtures/wpt/FileAPI/file/send-file-formdata-punctuation.tentative.html
deleted file mode 100644
index d8e84e9d978094..00000000000000
--- a/test/fixtures/wpt/FileAPI/file/send-file-formdata-punctuation.tentative.html
+++ /dev/null
@@ -1,168 +0,0 @@
-
-
-FormData: Upload files named using punctuation (tentative)
-
-
-
-
-
-
-
-
-
diff --git a/test/fixtures/wpt/FileAPI/file/send-file-formdata-utf-8.html b/test/fixtures/wpt/FileAPI/file/send-file-formdata-utf-8.html
deleted file mode 100644
index 7a7f6cefe776b9..00000000000000
--- a/test/fixtures/wpt/FileAPI/file/send-file-formdata-utf-8.html
+++ /dev/null
@@ -1,53 +0,0 @@
-
-
-FormData: Upload files in UTF-8 fetch()
-
-
-
-
-
-
-
-
diff --git a/test/fixtures/wpt/FileAPI/file/send-file-formdata.html b/test/fixtures/wpt/FileAPI/file/send-file-formdata.html
deleted file mode 100644
index 77e048e54741c0..00000000000000
--- a/test/fixtures/wpt/FileAPI/file/send-file-formdata.html
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
-FormData: Upload ASCII-named file in UTF-8 form
-
-
-
-
-
-
-
-
diff --git a/test/fixtures/wpt/FileAPI/fileReader.html b/test/fixtures/wpt/FileAPI/fileReader.html
deleted file mode 100644
index b767e22d4a66eb..00000000000000
--- a/test/fixtures/wpt/FileAPI/fileReader.html
+++ /dev/null
@@ -1,67 +0,0 @@
-
-
-
- FileReader States
-
-
-
-
-
-
-
-
-
-
diff --git a/test/fixtures/wpt/FileAPI/filelist-section/filelist.html b/test/fixtures/wpt/FileAPI/filelist-section/filelist.html
deleted file mode 100644
index b97dcde19f647c..00000000000000
--- a/test/fixtures/wpt/FileAPI/filelist-section/filelist.html
+++ /dev/null
@@ -1,57 +0,0 @@
-
-
-
-
- FileAPI Test: filelist
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/test/fixtures/wpt/FileAPI/filelist-section/filelist_multiple_selected_files-manual.html b/test/fixtures/wpt/FileAPI/filelist-section/filelist_multiple_selected_files-manual.html
deleted file mode 100644
index 2efaa059fa4897..00000000000000
--- a/test/fixtures/wpt/FileAPI/filelist-section/filelist_multiple_selected_files-manual.html
+++ /dev/null
@@ -1,64 +0,0 @@
-
-
-
-
- FileAPI Test: filelist_multiple_selected_files
-
-
-
-
-
-
-
-
-
-
-
-
Test steps:
-
- - Download upload.txt, upload.zip to local.
- - Select the local two files (upload.txt, upload.zip) to run the test.
-
-
-
-
-
-
-
-
diff --git a/test/fixtures/wpt/FileAPI/filelist-section/filelist_selected_file-manual.html b/test/fixtures/wpt/FileAPI/filelist-section/filelist_selected_file-manual.html
deleted file mode 100644
index 966aadda615589..00000000000000
--- a/test/fixtures/wpt/FileAPI/filelist-section/filelist_selected_file-manual.html
+++ /dev/null
@@ -1,64 +0,0 @@
-
-
-
-
- FileAPI Test: filelist_selected_file
-
-
-
-
-
-
-
-
-
-
-
-
Test steps:
-
- - Download upload.txt to local.
- - Select the local upload.txt file to run the test.
-
-
-
-
-
-
-
-
diff --git a/test/fixtures/wpt/FileAPI/filelist-section/support/upload.txt b/test/fixtures/wpt/FileAPI/filelist-section/support/upload.txt
deleted file mode 100644
index f45965b711f127..00000000000000
--- a/test/fixtures/wpt/FileAPI/filelist-section/support/upload.txt
+++ /dev/null
@@ -1 +0,0 @@
-Hello, this is test file for file upload.
diff --git a/test/fixtures/wpt/FileAPI/filelist-section/support/upload.zip b/test/fixtures/wpt/FileAPI/filelist-section/support/upload.zip
deleted file mode 100644
index a933d6a949428c..00000000000000
Binary files a/test/fixtures/wpt/FileAPI/filelist-section/support/upload.zip and /dev/null differ
diff --git a/test/fixtures/wpt/FileAPI/historical.https.html b/test/fixtures/wpt/FileAPI/historical.https.html
deleted file mode 100644
index 4f841f17639459..00000000000000
--- a/test/fixtures/wpt/FileAPI/historical.https.html
+++ /dev/null
@@ -1,65 +0,0 @@
-
-
-
-
- Historical features
-
-
-
-
-
-
-
-
-
diff --git a/test/fixtures/wpt/FileAPI/idlharness-manual.html b/test/fixtures/wpt/FileAPI/idlharness-manual.html
deleted file mode 100644
index c1d8b0c7149d75..00000000000000
--- a/test/fixtures/wpt/FileAPI/idlharness-manual.html
+++ /dev/null
@@ -1,45 +0,0 @@
-
-
-
-
- File API manual IDL tests
-
-
-
-
-
-
-
-
- File API manual IDL tests
-
- Either download upload.txt and select it below or select an
- arbitrary local file.
-
-
-
-
-
-
-
-
diff --git a/test/fixtures/wpt/FileAPI/idlharness.html b/test/fixtures/wpt/FileAPI/idlharness.html
deleted file mode 100644
index 5e0a43f80df3f8..00000000000000
--- a/test/fixtures/wpt/FileAPI/idlharness.html
+++ /dev/null
@@ -1,40 +0,0 @@
-
-
-
-
- File API automated IDL tests
-
-
-
-
-
-
-
-
- File API automated IDL tests
-
-
-
-
-
-
-
-
-
diff --git a/test/fixtures/wpt/FileAPI/idlharness.worker.js b/test/fixtures/wpt/FileAPI/idlharness.worker.js
deleted file mode 100644
index 786b7e4199fb45..00000000000000
--- a/test/fixtures/wpt/FileAPI/idlharness.worker.js
+++ /dev/null
@@ -1,20 +0,0 @@
-importScripts("/resources/testharness.js");
-importScripts("/resources/WebIDLParser.js", "/resources/idlharness.js");
-
-'use strict';
-
-// https://w3c.github.io/FileAPI/
-
-idl_test(
- ['FileAPI'],
- ['dom', 'html', 'url'],
- idl_array => {
- idl_array.add_objects({
- Blob: ['new Blob(["TEST"])'],
- File: ['new File(["myFileBits"], "myFileName")'],
- FileReader: ['new FileReader()'],
- FileReaderSync: ['new FileReaderSync()']
- });
- }
-);
-done();
diff --git a/test/fixtures/wpt/FileAPI/progress-manual.html b/test/fixtures/wpt/FileAPI/progress-manual.html
deleted file mode 100644
index b2e03b3eb27387..00000000000000
--- a/test/fixtures/wpt/FileAPI/progress-manual.html
+++ /dev/null
@@ -1,49 +0,0 @@
-
-
-Process Events for FileReader
-
-
-
-
-Please choose one file through this input below.
-
-
-
diff --git a/test/fixtures/wpt/FileAPI/reading-data-section/Determining-Encoding.html b/test/fixtures/wpt/FileAPI/reading-data-section/Determining-Encoding.html
deleted file mode 100644
index d65ae9db18a1ff..00000000000000
--- a/test/fixtures/wpt/FileAPI/reading-data-section/Determining-Encoding.html
+++ /dev/null
@@ -1,91 +0,0 @@
-
-
-FileAPI Test: Blob Determining Encoding
-
-
-
-
-
-
-
diff --git a/test/fixtures/wpt/FileAPI/reading-data-section/FileReader-event-handler-attributes.html b/test/fixtures/wpt/FileAPI/reading-data-section/FileReader-event-handler-attributes.html
deleted file mode 100644
index 86657b5711aff1..00000000000000
--- a/test/fixtures/wpt/FileAPI/reading-data-section/FileReader-event-handler-attributes.html
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
-FileReader event handler attributes
-
-
-
-
diff --git a/test/fixtures/wpt/FileAPI/reading-data-section/FileReader-multiple-reads.html b/test/fixtures/wpt/FileAPI/reading-data-section/FileReader-multiple-reads.html
deleted file mode 100644
index e7279fe4bd445e..00000000000000
--- a/test/fixtures/wpt/FileAPI/reading-data-section/FileReader-multiple-reads.html
+++ /dev/null
@@ -1,89 +0,0 @@
-๏ปฟ
-FileReader: starting new reads while one is in progress
-
-
-
-
-
-
diff --git a/test/fixtures/wpt/FileAPI/reading-data-section/filereader_abort.html b/test/fixtures/wpt/FileAPI/reading-data-section/filereader_abort.html
deleted file mode 100644
index 940a775d35bf42..00000000000000
--- a/test/fixtures/wpt/FileAPI/reading-data-section/filereader_abort.html
+++ /dev/null
@@ -1,53 +0,0 @@
-
-
-
-
- FileAPI Test: filereader_abort
-
-
-
-
-
-
-
-
-
-
-
diff --git a/test/fixtures/wpt/FileAPI/reading-data-section/filereader_error.html b/test/fixtures/wpt/FileAPI/reading-data-section/filereader_error.html
deleted file mode 100644
index cf4524825b80ca..00000000000000
--- a/test/fixtures/wpt/FileAPI/reading-data-section/filereader_error.html
+++ /dev/null
@@ -1,35 +0,0 @@
-
-
-
-
- FileAPI Test: filereader_error
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/test/fixtures/wpt/FileAPI/reading-data-section/filereader_events.any.js b/test/fixtures/wpt/FileAPI/reading-data-section/filereader_events.any.js
deleted file mode 100644
index ac692907d119f7..00000000000000
--- a/test/fixtures/wpt/FileAPI/reading-data-section/filereader_events.any.js
+++ /dev/null
@@ -1,19 +0,0 @@
-promise_test(async t => {
- var reader = new FileReader();
- var eventWatcher = new EventWatcher(t, reader, ['loadstart', 'progress', 'abort', 'error', 'load', 'loadend']);
- reader.readAsText(new Blob([]));
- await eventWatcher.wait_for('loadstart');
- // No progress event for an empty blob, as no data is loaded.
- await eventWatcher.wait_for('load');
- await eventWatcher.wait_for('loadend');
-}, 'events are dispatched in the correct order for an empty blob');
-
-promise_test(async t => {
- var reader = new FileReader();
- var eventWatcher = new EventWatcher(t, reader, ['loadstart', 'progress', 'abort', 'error', 'load', 'loadend']);
- reader.readAsText(new Blob(['a']));
- await eventWatcher.wait_for('loadstart');
- await eventWatcher.wait_for('progress');
- await eventWatcher.wait_for('load');
- await eventWatcher.wait_for('loadend');
-}, 'events are dispatched in the correct order for a non-empty blob');
diff --git a/test/fixtures/wpt/FileAPI/reading-data-section/filereader_file-manual.html b/test/fixtures/wpt/FileAPI/reading-data-section/filereader_file-manual.html
deleted file mode 100644
index 702ca9afd7b067..00000000000000
--- a/test/fixtures/wpt/FileAPI/reading-data-section/filereader_file-manual.html
+++ /dev/null
@@ -1,69 +0,0 @@
-
-
-
-
- FileAPI Test: filereader_file
-
-
-
-
-
-
-
-
-
Test step:
-
- - Download blue-100x100.png to local.
- - Select the local file (blue-100x100.png) to run the test.
-
-
-
-
-
-
-
-
-
diff --git a/test/fixtures/wpt/FileAPI/reading-data-section/filereader_file_img-manual.html b/test/fixtures/wpt/FileAPI/reading-data-section/filereader_file_img-manual.html
deleted file mode 100644
index fca42c7fceba48..00000000000000
--- a/test/fixtures/wpt/FileAPI/reading-data-section/filereader_file_img-manual.html
+++ /dev/null
@@ -1,47 +0,0 @@
-
-
-
-
- FileAPI Test: filereader_file_img
-
-
-
-
-
-
-
-
-
Test step:
-
- - Download blue-100x100.png to local.
- - Select the local file (blue-100x100.png) to run the test.
-
-
-
-
-
-
-
-
-
diff --git a/test/fixtures/wpt/FileAPI/reading-data-section/filereader_readAsArrayBuffer.html b/test/fixtures/wpt/FileAPI/reading-data-section/filereader_readAsArrayBuffer.html
deleted file mode 100644
index 31001a51a0727f..00000000000000
--- a/test/fixtures/wpt/FileAPI/reading-data-section/filereader_readAsArrayBuffer.html
+++ /dev/null
@@ -1,38 +0,0 @@
-
-
-
-
- FileAPI Test: filereader_readAsArrayBuffer
-
-
-
-
-
-
-
-
-
-
-
diff --git a/test/fixtures/wpt/FileAPI/reading-data-section/filereader_readAsBinaryString.html b/test/fixtures/wpt/FileAPI/reading-data-section/filereader_readAsBinaryString.html
deleted file mode 100644
index b550e4d0a96dc7..00000000000000
--- a/test/fixtures/wpt/FileAPI/reading-data-section/filereader_readAsBinaryString.html
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
-FileAPI Test: filereader_readAsBinaryString
-
-
-
-
-
diff --git a/test/fixtures/wpt/FileAPI/reading-data-section/filereader_readAsDataURL.html b/test/fixtures/wpt/FileAPI/reading-data-section/filereader_readAsDataURL.html
deleted file mode 100644
index 5bc39499a229d1..00000000000000
--- a/test/fixtures/wpt/FileAPI/reading-data-section/filereader_readAsDataURL.html
+++ /dev/null
@@ -1,51 +0,0 @@
-
-
-FileAPI Test: FileReader.readAsDataURL
-
-
-
-
-
-
\ No newline at end of file
diff --git a/test/fixtures/wpt/FileAPI/reading-data-section/filereader_readAsText.html b/test/fixtures/wpt/FileAPI/reading-data-section/filereader_readAsText.html
deleted file mode 100644
index 7d639d0111473b..00000000000000
--- a/test/fixtures/wpt/FileAPI/reading-data-section/filereader_readAsText.html
+++ /dev/null
@@ -1,51 +0,0 @@
-
-
-
-
- FileAPI Test: filereader_readAsText
-
-
-
-
-
-
-
-
-
-
-
diff --git a/test/fixtures/wpt/FileAPI/reading-data-section/filereader_readystate.html b/test/fixtures/wpt/FileAPI/reading-data-section/filereader_readystate.html
deleted file mode 100644
index 1586b8995059f7..00000000000000
--- a/test/fixtures/wpt/FileAPI/reading-data-section/filereader_readystate.html
+++ /dev/null
@@ -1,34 +0,0 @@
-
-
-
-
- FileAPI Test: filereader_readystate
-
-
-
-
-
-
-
-
-
-
-
diff --git a/test/fixtures/wpt/FileAPI/reading-data-section/filereader_result.html b/test/fixtures/wpt/FileAPI/reading-data-section/filereader_result.html
deleted file mode 100644
index b80322ed424f83..00000000000000
--- a/test/fixtures/wpt/FileAPI/reading-data-section/filereader_result.html
+++ /dev/null
@@ -1,97 +0,0 @@
-
-
-
-
- FileAPI Test: filereader_result
-
-
-
-
-
-
-
-
-
-
-
diff --git a/test/fixtures/wpt/FileAPI/reading-data-section/support/blue-100x100.png b/test/fixtures/wpt/FileAPI/reading-data-section/support/blue-100x100.png
deleted file mode 100644
index 5748719ff22a34..00000000000000
Binary files a/test/fixtures/wpt/FileAPI/reading-data-section/support/blue-100x100.png and /dev/null differ
diff --git a/test/fixtures/wpt/FileAPI/support/Blob.js b/test/fixtures/wpt/FileAPI/support/Blob.js
index 04069acd3ccbe7..2c249746858918 100644
--- a/test/fixtures/wpt/FileAPI/support/Blob.js
+++ b/test/fixtures/wpt/FileAPI/support/Blob.js
@@ -1,6 +1,6 @@
'use strict'
-function test_blob(fn, expectations) {
+self.test_blob = (fn, expectations) => {
var expected = expectations.expected,
type = expectations.type,
desc = expectations.desc;
@@ -24,7 +24,7 @@ function test_blob(fn, expectations) {
});
}
-function test_blob_binary(fn, expectations) {
+self.test_blob_binary = (fn, expectations) => {
var expected = expectations.expected,
type = expectations.type,
desc = expectations.desc;
diff --git a/test/fixtures/wpt/FileAPI/support/empty-document.html b/test/fixtures/wpt/FileAPI/support/empty-document.html
new file mode 100644
index 00000000000000..b9cd130a07f77e
--- /dev/null
+++ b/test/fixtures/wpt/FileAPI/support/empty-document.html
@@ -0,0 +1,3 @@
+
+
+
diff --git a/test/fixtures/wpt/FileAPI/support/send-file-formdata-helper.js b/test/fixtures/wpt/FileAPI/support/send-file-formdata-helper.js
index 53572ef36c8d1b..53c8cca7e09b8e 100644
--- a/test/fixtures/wpt/FileAPI/support/send-file-formdata-helper.js
+++ b/test/fixtures/wpt/FileAPI/support/send-file-formdata-helper.js
@@ -70,19 +70,21 @@ const formDataPostFileUploadTest = ({
}`,
);
- const asName = fileBaseName.replace(/[\r\n"]/g, encodeURIComponent);
+ const asValue = fileBaseName.replace(/\r\n?|\n/g, "\r\n");
+ const asName = asValue.replace(/[\r\n"]/g, encodeURIComponent);
+ const asFilename = fileBaseName.replace(/[\r\n"]/g, encodeURIComponent);
const expectedText = [
boundary,
'Content-Disposition: form-data; name="filename"',
"",
- fileBaseName,
+ asValue,
boundary,
`Content-Disposition: form-data; name="${asName}"`,
"",
"filename",
boundary,
`Content-Disposition: form-data; name="file"; ` +
- `filename="${asName}"`,
+ `filename="${asFilename}"`,
"Content-Type: text/plain",
"",
kTestChars,
diff --git a/test/fixtures/wpt/FileAPI/unicode.html b/test/fixtures/wpt/FileAPI/unicode.html
deleted file mode 100644
index ce3e3579d7c2c7..00000000000000
--- a/test/fixtures/wpt/FileAPI/unicode.html
+++ /dev/null
@@ -1,46 +0,0 @@
-
-
-Blob/Unicode interaction: normalization and encoding
-
-
-
diff --git a/test/fixtures/wpt/FileAPI/url/cross-global-revoke.sub.html b/test/fixtures/wpt/FileAPI/url/cross-global-revoke.sub.html
deleted file mode 100644
index 21b8c5bb1986d5..00000000000000
--- a/test/fixtures/wpt/FileAPI/url/cross-global-revoke.sub.html
+++ /dev/null
@@ -1,61 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/test/fixtures/wpt/FileAPI/url/multi-global-origin-serialization.sub.html b/test/fixtures/wpt/FileAPI/url/multi-global-origin-serialization.sub.html
deleted file mode 100644
index 0052b26fa62130..00000000000000
--- a/test/fixtures/wpt/FileAPI/url/multi-global-origin-serialization.sub.html
+++ /dev/null
@@ -1,26 +0,0 @@
-
-
-Blob URL serialization (specifically the origin) in multi-global situations
-
-
-
-
-
-
-
-
-
-
-
diff --git a/test/fixtures/wpt/FileAPI/url/resources/create-helper.html b/test/fixtures/wpt/FileAPI/url/resources/create-helper.html
deleted file mode 100644
index fa6cf4e671e835..00000000000000
--- a/test/fixtures/wpt/FileAPI/url/resources/create-helper.html
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
\ No newline at end of file
diff --git a/test/fixtures/wpt/FileAPI/url/resources/create-helper.js b/test/fixtures/wpt/FileAPI/url/resources/create-helper.js
deleted file mode 100644
index e6344f700ced60..00000000000000
--- a/test/fixtures/wpt/FileAPI/url/resources/create-helper.js
+++ /dev/null
@@ -1,4 +0,0 @@
-self.addEventListener('message', e => {
- let url = URL.createObjectURL(e.data.blob);
- self.postMessage({url: url});
-});
diff --git a/test/fixtures/wpt/FileAPI/url/resources/fetch-tests.js b/test/fixtures/wpt/FileAPI/url/resources/fetch-tests.js
deleted file mode 100644
index a81ea1e7b1de35..00000000000000
--- a/test/fixtures/wpt/FileAPI/url/resources/fetch-tests.js
+++ /dev/null
@@ -1,71 +0,0 @@
-// This method generates a number of tests verifying fetching of blob URLs,
-// allowing the same tests to be used both with fetch() and XMLHttpRequest.
-//
-// |fetch_method| is only used in test names, and should describe the
-// (javascript) method being used by the other two arguments (i.e. 'fetch' or 'XHR').
-//
-// |fetch_should_succeed| is a callback that is called with the Test and a URL.
-// Fetching the URL is expected to succeed. The callback should return a promise
-// resolved with whatever contents were fetched.
-//
-// |fetch_should_fail| similarly is a callback that is called with the Test, a URL
-// to fetch, and optionally a method to use to do the fetch. If no method is
-// specified the callback should use the 'GET' method. Fetching of these URLs is
-// expected to fail, and the callback should return a promise that resolves iff
-// fetching did indeed fail.
-function fetch_tests(fetch_method, fetch_should_succeed, fetch_should_fail) {
- const blob_contents = 'test blob contents';
- const blob = new Blob([blob_contents]);
-
- promise_test(t => {
- const url = URL.createObjectURL(blob);
-
- return fetch_should_succeed(t, url).then(text => {
- assert_equals(text, blob_contents);
- });
- }, 'Blob URLs can be used in ' + fetch_method);
-
- promise_test(t => {
- const url = URL.createObjectURL(blob);
-
- return fetch_should_succeed(t, url + '#fragment').then(text => {
- assert_equals(text, blob_contents);
- });
- }, fetch_method + ' with a fragment should succeed');
-
- promise_test(t => {
- const url = URL.createObjectURL(blob);
- URL.revokeObjectURL(url);
-
- return fetch_should_fail(t, url);
- }, fetch_method + ' of a revoked URL should fail');
-
- promise_test(t => {
- const url = URL.createObjectURL(blob);
- URL.revokeObjectURL(url + '#fragment');
-
- return fetch_should_succeed(t, url).then(text => {
- assert_equals(text, blob_contents);
- });
- }, 'Only exact matches should revoke URLs, using ' + fetch_method);
-
- promise_test(t => {
- const url = URL.createObjectURL(blob);
-
- return fetch_should_fail(t, url + '?querystring');
- }, 'Appending a query string should cause ' + fetch_method + ' to fail');
-
- promise_test(t => {
- const url = URL.createObjectURL(blob);
-
- return fetch_should_fail(t, url + '/path');
- }, 'Appending a path should cause ' + fetch_method + ' to fail');
-
- for (const method of ['HEAD', 'POST', 'DELETE', 'OPTIONS', 'PUT', 'CUSTOM']) {
- const url = URL.createObjectURL(blob);
-
- promise_test(t => {
- return fetch_should_fail(t, url, method);
- }, fetch_method + ' with method "' + method + '" should fail');
- }
-}
\ No newline at end of file
diff --git a/test/fixtures/wpt/FileAPI/url/resources/revoke-helper.html b/test/fixtures/wpt/FileAPI/url/resources/revoke-helper.html
deleted file mode 100644
index adf5a014a668d6..00000000000000
--- a/test/fixtures/wpt/FileAPI/url/resources/revoke-helper.html
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
\ No newline at end of file
diff --git a/test/fixtures/wpt/FileAPI/url/resources/revoke-helper.js b/test/fixtures/wpt/FileAPI/url/resources/revoke-helper.js
deleted file mode 100644
index c3e05b64b1a6c8..00000000000000
--- a/test/fixtures/wpt/FileAPI/url/resources/revoke-helper.js
+++ /dev/null
@@ -1,9 +0,0 @@
-self.addEventListener('message', e => {
- URL.revokeObjectURL(e.data.url);
- // Registering a new object URL will make absolutely sure that the revocation
- // has propagated. Without this at least in chrome it is possible for the
- // below postMessage to arrive at its destination before the revocation has
- // been fully processed.
- URL.createObjectURL(new Blob([]));
- self.postMessage('revoked');
-});
diff --git a/test/fixtures/wpt/FileAPI/url/sandboxed-iframe.html b/test/fixtures/wpt/FileAPI/url/sandboxed-iframe.html
deleted file mode 100644
index a52939a3eb297c..00000000000000
--- a/test/fixtures/wpt/FileAPI/url/sandboxed-iframe.html
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
-FileAPI Test: Verify behavior of Blob URL in unique origins
-
-
-
-
-
-
-
diff --git a/test/fixtures/wpt/FileAPI/url/unicode-origin.sub.html b/test/fixtures/wpt/FileAPI/url/unicode-origin.sub.html
deleted file mode 100644
index 2c4921c0344998..00000000000000
--- a/test/fixtures/wpt/FileAPI/url/unicode-origin.sub.html
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
-FileAPI Test: Verify origin of Blob URL
-
-
-
-
diff --git a/test/fixtures/wpt/FileAPI/url/url-charset.window.js b/test/fixtures/wpt/FileAPI/url/url-charset.window.js
deleted file mode 100644
index 777709b64a50e5..00000000000000
--- a/test/fixtures/wpt/FileAPI/url/url-charset.window.js
+++ /dev/null
@@ -1,34 +0,0 @@
-async_test(t => {
- // This could be detected as ISO-2022-JP, in which case there would be no
- //