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

Changed error type on qname, per spec #25223

Merged
merged 1 commit into from Feb 13, 2020
Merged

Conversation

@pshaughn
Copy link
Member

pshaughn commented Dec 10, 2019

As specified in https://dom.spec.whatwg.org/#validate invalid QNames when creating a namespaced document/element/attribute get an invalid character exception, not a namespace exception.


  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • These changes fix #25110
  • There are tests for these changes
@highfive
Copy link

highfive commented Dec 10, 2019

Heads up! This PR modifies the following files:

  • @asajeffrey: components/script/dom/bindings/xmlname.rs
  • @KiChjang: components/script/dom/bindings/xmlname.rs
@Manishearth
Copy link
Member

Manishearth commented Dec 10, 2019

@bors-servo
Copy link
Contributor

bors-servo commented Dec 10, 2019

📌 Commit a5b4d93 has been approved by Manishearth

Err(Error::Namespace)
},
XMLName::InvalidXMLName => Err(Error::InvalidCharacter),
XMLName::Name => Err(Error::InvalidCharacter),

This comment has been minimized.

Copy link
@jdm

jdm Dec 10, 2019

Member

My reading of https://dom.spec.whatwg.org/#validate says that XMLName shouldn't throw anything. How do the test results look if that's the case?

This comment has been minimized.

Copy link
@Manishearth

Manishearth Dec 10, 2019

Member

Oh, I misread this as being "does not match Name", but that's not the case

This comment has been minimized.

Copy link
@pshaughn

pshaughn Dec 10, 2019

Author Member

Good point, maybe there's more than just the exception-type to fix here. I'll find out.

This comment has been minimized.

Copy link
@pshaughn

pshaughn Dec 10, 2019

Author Member

When I change it to let Name in instead of throwing InvalidCharacter for it, then some tests go from correctly throwing InvalidCharacter to incorrectly not throwing, like Document.implementation.createDocumentType("prefix::local", "", "") is expected to throw Invalid Character. "prefix::local" appears to match the Name production. The test seems more consistent with just "if qualifiedName does not match the QName production."

This comment has been minimized.

Copy link
@pshaughn

pshaughn Dec 10, 2019

Author Member

However I should check the codepaths for those "" parts too, maybe those are what's supposed to cause the error this time.

This comment has been minimized.

Copy link
@pshaughn

pshaughn Dec 10, 2019

Author Member

https://dom.spec.whatwg.org/#interface-documenttype nope those are totally allowed to be empty strings, the error has to be for the prefix::local part

@Manishearth
Copy link
Member

Manishearth commented Dec 10, 2019

@bors-servo
Copy link
Contributor

bors-servo commented Jan 23, 2020

The latest upstream changes (presumably #25450) made this pull request unmergeable. Please resolve the merge conflicts.

@pshaughn
Copy link
Member Author

pshaughn commented Jan 27, 2020

Could I get someone's opinion on what the specs say to do vs. what the tests say to do vs. what the code does? I'm not sure which part's out of sync.

@Manishearth
Copy link
Member

Manishearth commented Feb 5, 2020

Sorry about the delay; been doing various travel things. I would file an issue on the spec and tag whoever has touched that area recently. Typically I've found that the tests for this kind of thing are more "correct" (in that they match what other browsers do). You should also check what other browsers do, and if it doesn't match the spec then get the spec changed.

@pshaughn
Copy link
Member Author

pshaughn commented Feb 5, 2020

It turns out there's already an issue: whatwg/dom#671

@pshaughn pshaughn force-pushed the pshaughn:xmlerrortype branch from a5b4d93 to 0959e05 Feb 5, 2020
@pshaughn
Copy link
Member Author

pshaughn commented Feb 5, 2020

(this push is just a rebase, not a functional update)

@pshaughn
Copy link
Member Author

pshaughn commented Feb 12, 2020

Based on that issue thread I think it's safe to assume the spec change reflects reality and will eventually land; I'm going to rebase again and add a comment about the issue.

@pshaughn pshaughn force-pushed the pshaughn:xmlerrortype branch from 0959e05 to 9cc3252 Feb 12, 2020
@pshaughn
Copy link
Member Author

pshaughn commented Feb 12, 2020

This is old enough some test might have slid out from under it...
@bors-servo try=wpt

@bors-servo
Copy link
Contributor

bors-servo commented Feb 12, 2020

Trying commit 9cc3252 with merge 8c92fd9...

bors-servo added a commit that referenced this pull request Feb 12, 2020
Changed error type on qname, per spec

<!-- Please describe your changes on the following line: -->
As specified in https://dom.spec.whatwg.org/#validate invalid QNames when creating a namespaced document/element/attribute get an invalid character exception, not a namespace exception.

---
<!-- 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 #25110

<!-- 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. -->
@bors-servo
Copy link
Contributor

bors-servo commented Feb 12, 2020

☀️ Test successful - status-taskcluster
State: approved= try=True

@Manishearth
Copy link
Member

Manishearth commented Feb 12, 2020

@bors-servo try- r+

@bors-servo
Copy link
Contributor

bors-servo commented Feb 12, 2020

📌 Commit 9cc3252 has been approved by Manishearth

@bors-servo
Copy link
Contributor

bors-servo commented Feb 12, 2020

Testing commit 9cc3252 with merge 69152c7...

bors-servo added a commit that referenced this pull request Feb 12, 2020
Changed error type on qname, per spec

<!-- Please describe your changes on the following line: -->
As specified in https://dom.spec.whatwg.org/#validate invalid QNames when creating a namespaced document/element/attribute get an invalid character exception, not a namespace exception.

---
<!-- 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 #25110

<!-- 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. -->
@bors-servo
Copy link
Contributor

bors-servo commented Feb 13, 2020

☀️ Test successful - status-taskcluster
Approved by: Manishearth
Pushing 69152c7 to master...

@bors-servo bors-servo merged commit 9cc3252 into servo:master Feb 13, 2020
2 checks passed
2 checks passed
Community-TC (pull_request) TaskGroup: success
Details
homu Test successful
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.