1
0
Fork 0
firefox/testing/web-platform/tests/FileAPI/reading-data-section/filereader_readAsArrayBuffer.any.js
Daniel Baumann 5e9a113729
Adding upstream version 140.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
2025-06-25 09:37:52 +02:00

24 lines
853 B
JavaScript

// META: title=FileAPI Test: filereader_readAsArrayBuffer
async_test(function() {
var blob = new Blob(["TEST"]);
var reader = new FileReader();
reader.onload = this.step_func(function(evt) {
assert_equals(reader.result.byteLength, 4, "The byteLength is 4");
assert_true(reader.result instanceof ArrayBuffer, "The result is instanceof ArrayBuffer");
assert_array_equals(new Uint8Array(reader.result), [84, 69, 83, 84]);
assert_equals(reader.readyState, reader.DONE);
this.done();
});
reader.onloadstart = this.step_func(function(evt) {
assert_equals(reader.readyState, reader.LOADING);
});
reader.onprogress = this.step_func(function(evt) {
assert_equals(reader.readyState, reader.LOADING);
});
reader.readAsArrayBuffer(blob);
});