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

Implement TextEncoder. #4768

Closed
Ms2ger opened this issue Jan 29, 2015 · 10 comments
Closed

Implement TextEncoder. #4768

Ms2ger opened this issue Jan 29, 2015 · 10 comments

Comments

@Ms2ger
Copy link
Contributor

@Ms2ger Ms2ger commented Jan 29, 2015

Spec: https://encoding.spec.whatwg.org/#interface-textencoder.

This includes enabling the relevant tests by adding

[encoding]
  skip: false

to tests/wpt/include.ini.

This may also include updating the mozjs and rust-mozjs dependencies to ensure we can work with typed arrays.

@yodalee
Copy link
Contributor

@yodalee yodalee commented Feb 4, 2015

Allow me try this if you permit. I'm afraid that I may take long time to complete.

@SimonSapin
Copy link
Member

@SimonSapin SimonSapin commented Feb 4, 2015

Go ahead!

This is mostly about plugging things together between JavaScript and Rust. The rust-encoding library, which we already use in Servo, implements the encodings themselves as well as the label lookup.

http://doc.servo.org/encoding/index.html

@jdm jdm added the C-assigned label Feb 4, 2015
@yodalee
Copy link
Contributor

@yodalee yodalee commented Feb 5, 2015

There is a problem: the codegen python cannot recognize USVString in webidls, or should I leave the encode method comment out now?

@jdm
Copy link
Member

@jdm jdm commented Feb 5, 2015

Just use DOMString instead and leave a FIXME comment.

@yodalee
Copy link
Contributor

@yodalee yodalee commented Feb 8, 2015

I'm stuck at Encoding method, which should find encoding name by utfLabel. I'm not sure how to implement these function.
Using a large match seems not a good idea. Using an Hashmap as a member of TextEncoder will require runtime initialization. I found there is a compile time Rust static map, but not sure I can use it.
https://github.com/sfackler/rust-phf
Any suggestion about this?

@Ms2ger
Copy link
Contributor Author

@Ms2ger Ms2ger commented Feb 8, 2015

@yodalee
Copy link
Contributor

@yodalee yodalee commented Feb 8, 2015

OH! my fault (: P)

@yodalee
Copy link
Contributor

@yodalee yodalee commented Feb 10, 2015

The spec said the TextEncoder should throw a RangeError if input label is not a UTF type. However, the RangeError is not defined in domexception. Should I add an new exception or is there alternative exception? The description message of EncodingError seems quite suitable for this.


Since I saw the link in DOMException.webidl
https://dom.spec.whatwg.org/#domexception
There it says

RangeException has been removed.

Or maybe it talking about two different thing?

@Ms2ger
Copy link
Contributor Author

@Ms2ger Ms2ger commented Feb 11, 2015

Using RangeError won't work right now; throw something sensible and file a followup for now.

mbrubeck added a commit to mbrubeck/servo that referenced this issue Mar 31, 2015
@mbrubeck mbrubeck closed this in 9cd976a Apr 1, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.