mirror of
https://github.com/HeyPuter/firefox.git
synced 2026-11-13 20:14:57 -10:00
Automatic update from web-platform-tests Fixes crbug.com/1439823 by allowing empty strings to be processed in ToDataURL in file_reader_data.cc. Bug: 1439823 Change-Id: Ic2ec3fe20cd30c9d72e4e2dee9665f4a75d26c42 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4522437 Reviewed-by: Ayu Ishii <[email protected]> Commit-Queue: Ayu Ishii <[email protected]> Auto-Submit: Dean Leitersdorf <[email protected]> Cr-Commit-Position: refs/heads/main@{#1146061} -- wpt-commits: e36dbb6f00fb59f9fc792f509194432e9e6d0b6d wpt-pr: 39968
54 lines
1.6 KiB
JavaScript
54 lines
1.6 KiB
JavaScript
// META: title=FileAPI Test: FileReader.readAsDataURL
|
|
|
|
async_test(function(testCase) {
|
|
var blob = new Blob(["TEST"]);
|
|
var reader = new FileReader();
|
|
|
|
reader.onload = this.step_func(function(evt) {
|
|
assert_equals(reader.readyState, reader.DONE);
|
|
testCase.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.readAsDataURL(blob);
|
|
}, 'FileReader readyState during readAsDataURL');
|
|
|
|
async_test(function(testCase) {
|
|
var blob = new Blob(["TEST"], { type: 'text/plain' });
|
|
var reader = new FileReader();
|
|
|
|
reader.onload = this.step_func(function() {
|
|
assert_equals(reader.result, "data:text/plain;base64,VEVTVA==");
|
|
testCase.done();
|
|
});
|
|
reader.readAsDataURL(blob);
|
|
}, 'readAsDataURL result for Blob with specified MIME type');
|
|
|
|
async_test(function(testCase) {
|
|
var blob = new Blob(["TEST"]);
|
|
var reader = new FileReader();
|
|
|
|
reader.onload = this.step_func(function() {
|
|
assert_equals(reader.result,
|
|
"data:application/octet-stream;base64,VEVTVA==");
|
|
testCase.done();
|
|
});
|
|
reader.readAsDataURL(blob);
|
|
}, 'readAsDataURL result for Blob with unspecified MIME type');
|
|
|
|
async_test(function(testCase) {
|
|
var blob = new Blob([]);
|
|
var reader = new FileReader();
|
|
|
|
reader.onload = this.step_func(function() {
|
|
assert_equals(reader.result,
|
|
"data:application/octet-stream;base64,");
|
|
testCase.done();
|
|
});
|
|
reader.readAsDataURL(blob);
|
|
}, 'readAsDataURL result for empty Blob'); |