Repository navigation
Implement read methods on FileReaderSync - #19511
Conversation
|
Thanks for the pull request, and welcome! The Servo team is excited to review your changes, and you should hear from @wafflespeanut (or someone else) soon. |
|
Heads up! This PR modifies the following files:
|
|
I tried to update the manifest with ./mach update-manifest but this changed almost every entry in the files. What is the correct way to only change the entry for the changed test (/tests/wpt/web-platform-tests/FileAPI/FileReaderSync.worker.js) ? |
|
That's the correct way to update it; what were the changes it tried to make? |
|
manifests.zip |
jdm
left a comment
There was a problem hiding this comment.
This is great! I think it should be possible to avoid duplicating some of the less straightforward parts of the implementation, though.
|
|
||
| // step 2 | ||
| let blob_contents = blob.get_bytes().unwrap_or(vec![]); | ||
| if blob_contents.is_empty() { |
There was a problem hiding this comment.
What happens if we run a test like readerSync.readAsBinaryString(new Blob([""]));? Won't this incorrectly throw an exception?
|
|
||
| // step 2 | ||
| let blob_contents = blob.get_bytes().unwrap_or(vec![]); | ||
| if blob_contents.is_empty() { |
There was a problem hiding this comment.
Same question as readAsBinaryString.
| let blob_type = String::from(blob.Type()); | ||
|
|
||
| //https://w3c.github.io/FileAPI/#encoding-determination | ||
| let mut encoding = blob_label.as_ref() |
There was a problem hiding this comment.
Could we share this code with filereader.rs instead of duplicating it?
|
|
||
| // step 2 | ||
| let blob_contents = blob.get_bytes().unwrap_or(vec![]); | ||
| if blob_contents.is_empty() { |
| } | ||
|
|
||
| // step 3 | ||
| let base64 = base64::encode(&blob_contents); |
There was a problem hiding this comment.
Let's share this code with filereader.rs.
|
|
||
| // step 2 | ||
| let blob_contents = blob.get_bytes().unwrap_or(vec![]); | ||
| if blob_contents.is_empty() { |
| var data = readerSync.readAsBinaryString(blob); | ||
| assert_equals(data, "test"); | ||
| }, "readAsBinaryString"); | ||
|
|
There was a problem hiding this comment.
Let's add tests with empty blobs in this file as well.
| pub fn new_inherited() -> FileReaderSync { | ||
| FileReaderSync { | ||
| eventtarget: EventTarget::new_inherited(), | ||
| ready_state: Cell::new(FileReaderReadyState::Empty), |
There was a problem hiding this comment.
Since the spec doesn't actually tell us to modify the readyState for synchronous file readers, nor does it describe a way where the LOADING check could actually succeed, let's remove it from our implementation.
|
Sorry about the unnecessary delay before this code was reviewed. I promise shorter review cycles if you want to keep working on this! |
|
@jdm No worries about the delay, I'm rather short on time myself right now, so I probably wouldn't have been able to work on this any sooner anyway. That said, I do want to keep working on it! :) |
|
Now I'm the one having to apologize for taking SO long to update this... I am also still unable to properly update the manifest files for the updated tests (same issues as described in an earlier comment) |
|
Error syncing changes upstream. Logs saved in error-snapshot-1527098417542. |
|
Error syncing changes upstream. Logs saved in error-snapshot-1527103060139. |
jdm
left a comment
There was a problem hiding this comment.
Great work! For sharing code, it's a toss-up as to whether it's worth creating static methods on a type like this PR does, or using free functions. I'm not bothered either way. Please squash all the commits together, too!
| let blob_label = &data.label; | ||
| let blob_type = &data.blobtype; | ||
|
|
||
| //https://w3c.github.io/FileAPI/#encoding-determination |
There was a problem hiding this comment.
This comment should be moved into the text_decode function.
There was a problem hiding this comment.
Its in text_decode (link to line) as well, do you want me to remove it here anyway?
There was a problem hiding this comment.
Ah, my mistake. You can just remove it from this location, in that case.
|
This is the first time I'm attempting to squash commits together, so I just wanted to be sure if I'm doing it correctly. I searched the Thanks for your patience and help :) |
|
@DonatJR What happens if you do |
|
@KiChjang And it changes nothing about the number of commits when squashing. |
|
@DonatJR Oh sorry, I meant |
|
With But again, no changes to before when squashing. |
|
It's probably easiest to make a new branch based off of master and cherry-pick all of the non-merge commits like: Then you can do |
371c770 to
21bf9c3
Compare
…nc, r=jdm Implement read methods on FileReaderSync <!-- Please describe your changes on the following line: --> Implemented the read methods on the FileReaderSync struct according to https://w3c.github.io/FileAPI/#dfn-FileReaderSync --- <!-- 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 #15114 <!-- Either: --> - [x] There are tests for these changes <!-- 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/19511) <!-- Reviewable:end -->
|
💔 Test failed - android |
|
|
Oh, right. Yeah, that's super weird, and I don't have any good suggestions. I'll make the change locally and update the PR. |
21bf9c3 to
0fdafb0
Compare
|
@bors-servo r+ |
|
📌 Commit 0fdafb0 has been approved by |
|
Transplanted upstreamable changes to existing PR. Completed upstream sync of web-platform-test changes at jdm/web-platform-tests#65. |
…nc, r=jdm Implement read methods on FileReaderSync <!-- Please describe your changes on the following line: --> Implemented the read methods on the FileReaderSync struct according to https://w3c.github.io/FileAPI/#dfn-FileReaderSync --- <!-- 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 #15114 <!-- Either: --> - [x] There are tests for these changes <!-- 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/19511) <!-- Reviewable:end -->
|
💔 Test failed - mac-rel-css2 |
|
@bors-servo retry |
|
⚡ Previous build results for android, arm32, arm64, linux-dev, linux-rel-css, linux-rel-wpt, mac-dev-unit, mac-rel-css1, mac-rel-wpt1, mac-rel-wpt2, mac-rel-wpt3, mac-rel-wpt4, windows-msvc-dev are reusable. Rebuilding only mac-rel-css2... |
|
☀️ Test successful - android, arm32, arm64, linux-dev, linux-rel-css, linux-rel-wpt, mac-dev-unit, mac-rel-css1, mac-rel-css2, mac-rel-wpt1, mac-rel-wpt2, mac-rel-wpt3, mac-rel-wpt4, windows-msvc-dev |
Upstreamed from servo/servo#19511 [ci skip]
Implemented the read methods on the FileReaderSync struct according to https://w3c.github.io/FileAPI/#dfn-FileReaderSync
./mach build -ddoes not report any errors./mach test-tidydoes not report any errorsThis change is