mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Auto merge of #24329 - tigleym:filereader_result, r=jdm
FileReader.read sets `result` to null before performing read operation <!-- Please describe your changes on the following line: --> As described in the spec, FileReader.read now sets its `result` to null after the FileReader's ready state is changed to "loading". --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #24288 (GitHub issue number if applicable) <!-- Either: --> - [X] There are tests for these changes OR - [ ] These changes do not require tests because ___ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/24329) <!-- Reviewable:end -->
This commit is contained in:
commit
607efbe380
2 changed files with 5 additions and 21 deletions
|
@ -279,8 +279,6 @@ impl FileReader {
|
|||
fr.dispatch_progress_event(atom!("loadend"), 0, None);
|
||||
}
|
||||
return_on_abort!();
|
||||
// Step 9
|
||||
fr.terminate_ongoing_reading();
|
||||
}
|
||||
|
||||
// https://w3c.github.io/FileAPI/#dfn-readAsText
|
||||
|
@ -443,6 +441,8 @@ impl FileReader {
|
|||
self.change_ready_state(FileReaderReadyState::Loading);
|
||||
|
||||
// Step 3
|
||||
*self.result.borrow_mut() = None;
|
||||
|
||||
let blob_contents = Arc::new(blob.get_bytes().unwrap_or(vec![]));
|
||||
|
||||
let type_ = blob.Type();
|
||||
|
@ -450,6 +450,9 @@ impl FileReader {
|
|||
let load_data = ReadMetaData::new(String::from(type_), label.map(String::from), function);
|
||||
|
||||
let fr = Trusted::new(self);
|
||||
|
||||
let GenerationId(prev_id) = self.generation_id.get();
|
||||
self.generation_id.set(GenerationId(prev_id + 1));
|
||||
let gen_id = self.generation_id.get();
|
||||
|
||||
let global = self.global();
|
||||
|
|
|
@ -2,27 +2,8 @@
|
|||
[result is null during "loadstart" event for readAsBinaryString]
|
||||
expected: FAIL
|
||||
|
||||
[result is null during "loadstart" event for readAsDataURL]
|
||||
expected: FAIL
|
||||
|
||||
[result is null during "progress" event for readAsArrayBuffer]
|
||||
expected: FAIL
|
||||
|
||||
[result is null during "progress" event for readAsBinaryString]
|
||||
expected: FAIL
|
||||
|
||||
[result is null during "loadstart" event for readAsArrayBuffer]
|
||||
expected: FAIL
|
||||
|
||||
[readAsBinaryString]
|
||||
expected: FAIL
|
||||
|
||||
[result is null during "progress" event for readAsDataURL]
|
||||
expected: FAIL
|
||||
|
||||
[result is null during "loadstart" event for readAsText]
|
||||
expected: FAIL
|
||||
|
||||
[result is null during "progress" event for readAsText]
|
||||
expected: FAIL
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue