Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TextDecoder: streaming decode, ignoreBOM #20431

Merged
merged 2 commits into from Mar 26, 2018

Conversation

talklittle
Copy link
Contributor

@talklittle talklittle commented Mar 26, 2018

Implement streaming decode and ignoreBOM flag for TextDecoder.

https://encoding.spec.whatwg.org/#dom-textdecoder-decode

https://encoding.spec.whatwg.org/#dom-textdecoder-ignorebom


  • There are tests for these changes OR
  • These changes do not require tests because the wpt tests are used for testing:
  • /encoding/textdecoder-fatal-streaming.html
  • /encoding/textdecoder-streaming.html
  • /encoding/textdecoder-ignorebom.html

This change is Reviewable

@highfive
Copy link

Heads up! This PR modifies the following files:

  • @asajeffrey: components/script/dom/textdecoder.rs, components/script/dom/webidls/TextDecoder.webidl, components/script/dom/bindings/trace.rs
  • @fitzgen: components/script/dom/textdecoder.rs, components/script/dom/webidls/TextDecoder.webidl, components/script/dom/bindings/trace.rs
  • @KiChjang: components/script/dom/textdecoder.rs, components/script/dom/webidls/TextDecoder.webidl, components/script/dom/bindings/trace.rs

@highfive
Copy link

warning Warning warning

  • These commits modify script code, but no tests are modified. Please consider adding a test!

@highfive highfive added the S-awaiting-review There is new code that needs to be reviewed. label Mar 26, 2018
@talklittle
Copy link
Contributor Author

This PR also fixes the tests /encoding/textdecoder-byte-order-marks.html. Unsure if that means issue #13233 is considered fixed as well?

Copy link
Member

@jdm jdm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks really great! Thanks for working on this!

#[ignore_malloc_size_of = "defined in encoding_rs"]
decoder_: RefCell<Decoder>,
in_stream_: RefCell<Vec<u8>>,
do_not_flush_: Cell<bool>,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: no need for the trailing _s

s
};
Ok(USVString(s.into_owned()))
if !self.do_not_flush_.get() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add a // Step 1 comment here (and similar for the rest of this method).

@jdm jdm assigned jdm and unassigned pcwalton Mar 26, 2018
@jdm jdm added S-needs-code-changes Changes have not yet been made that were requested by a reviewer. and removed S-awaiting-review There is new code that needs to be reviewed. labels Mar 26, 2018
@highfive highfive added S-awaiting-review There is new code that needs to be reviewed. and removed S-needs-code-changes Changes have not yet been made that were requested by a reviewer. labels Mar 26, 2018
@jdm
Copy link
Member

jdm commented Mar 26, 2018

@bors-servo r+

@bors-servo
Copy link
Contributor

📌 Commit 3990946 has been approved by jdm

@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-awaiting-review There is new code that needs to be reviewed. labels Mar 26, 2018
@bors-servo
Copy link
Contributor

⌛ Testing commit 3990946 with merge fd19a43...

bors-servo pushed a commit that referenced this pull request Mar 26, 2018
TextDecoder: streaming decode, ignoreBOM

<!-- Please describe your changes on the following line: -->
Implement streaming decode and ignoreBOM flag for TextDecoder.

https://encoding.spec.whatwg.org/#dom-textdecoder-decode

https://encoding.spec.whatwg.org/#dom-textdecoder-ignorebom

---
<!-- 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 #13234 (github issue number if applicable).
- [x] These changes fix #5600 (github issue number if applicable).

<!-- Either: -->
- [ ] There are tests for these changes OR
- [x] These changes do not require tests because the wpt tests are used for testing:

* /encoding/textdecoder-fatal-streaming.html
* /encoding/textdecoder-streaming.html
* /encoding/textdecoder-ignorebom.html

<!-- 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/20431)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

💔 Test failed - linux-rel-css

@highfive highfive added S-tests-failed The changes caused existing tests to fail. and removed S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. labels Mar 26, 2018
@jdm
Copy link
Member

jdm commented Mar 26, 2018

Hooray, lots of other passing tests!

@jdm
Copy link
Member

jdm commented Mar 26, 2018

To be clear - you will need to follow these steps and include the changes in this commit.

@highfive highfive added S-awaiting-review There is new code that needs to be reviewed. and removed S-tests-failed The changes caused existing tests to fail. labels Mar 26, 2018
@jdm
Copy link
Member

jdm commented Mar 26, 2018

@bors-servo r+

@bors-servo
Copy link
Contributor

📌 Commit 36838d2 has been approved by jdm

@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-awaiting-review There is new code that needs to be reviewed. labels Mar 26, 2018
@bors-servo
Copy link
Contributor

⌛ Testing commit 36838d2 with merge 1981efc...

bors-servo pushed a commit that referenced this pull request Mar 26, 2018
TextDecoder: streaming decode, ignoreBOM

<!-- Please describe your changes on the following line: -->
Implement streaming decode and ignoreBOM flag for TextDecoder.

https://encoding.spec.whatwg.org/#dom-textdecoder-decode

https://encoding.spec.whatwg.org/#dom-textdecoder-ignorebom

---
<!-- 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 #13234 (github issue number if applicable).
- [x] These changes fix #5600 (github issue number if applicable).

<!-- Either: -->
- [ ] There are tests for these changes OR
- [x] These changes do not require tests because the wpt tests are used for testing:

* /encoding/textdecoder-fatal-streaming.html
* /encoding/textdecoder-streaming.html
* /encoding/textdecoder-ignorebom.html

<!-- 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/20431)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

☀️ 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
Approved by: jdm
Pushing 1981efc to master...

@bors-servo bors-servo merged commit 36838d2 into servo:master Mar 26, 2018
@highfive highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Mar 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement streaming support for TextDecoder Implement TextDecoder#ignoreBOM.
5 participants