Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upImplement checks on Location setters #23670
Conversation
highfive
commented
Jul 1, 2019
|
Thanks for the pull request, and welcome! The Servo team is excited to review your changes, and you should hear from @asajeffrey (or someone else) soon. |
highfive
commented
Jul 1, 2019
|
Heads up! This PR modifies the following files:
|
| @@ -204,7 +213,11 @@ impl LocationMethods for Location { | |||
| // https://html.spec.whatwg.org/multipage/#dom-location-port | |||
| fn SetPort(&self, value: USVString) -> ErrorResult { | |||
| self.check_same_origin_domain()?; | |||
| self.set_url_component(value, UrlHelper::SetPort); | |||
| let url = self.get_url(); | |||
| // If copyURL cannot have a username/password/port, then return. | |||
This comment has been minimized.
This comment has been minimized.
gterzian
Jul 1, 2019
Member
Here you could add a link to the spec: https://url.spec.whatwg.org/#cannot-have-a-username-password-port
This comment has been minimized.
This comment has been minimized.
| self.set_url_component(value, UrlHelper::SetProtocol); | ||
| // If copyURL's scheme is not an HTTP(S) scheme, then terminate these steps. | ||
| let scheme = value.split(':').next().unwrap(); | ||
| if scheme.eq_ignore_ascii_case("http") || scheme.eq_ignore_ascii_case("https") { |
This comment has been minimized.
This comment has been minimized.
gterzian
Jul 1, 2019
Member
The spec contains this note:
Because the URL parser ignores multiple consecutive colons, providing a value of "https:" (or even "https::::") is the same as providing a value of "https".
Does this allow for multiple consecutive colons?
If this is currently not tested in the existing tests, you could also consider adding such a testcase.
This comment has been minimized.
This comment has been minimized.
@bors-servo try=wpt (let's see if we find any other updates)
If you find a relevant test to write, you can do it here and it will be upstreamed automatically. |
Implement checks on Location setters So, this is my first pull to servo. I've tried to follow all the directions, but I may have missed or forgotten some of them. If so, please let me know - I'll be happy to fix things up! As described in #23522, this implements various checks on the Location setters. In particular, for the following components. * protocol * host * hostname * port * pathname I'd also like to add code for throwing a `SyntaxError` when appropriate, but I may do that separately. I've removed the expectations for the protocol setter tests, but I haven't yet found any failing tests for the other components. Should I write tests for those? If so, should I add them here or is there an upstream that I should contribute to? Let me know what you think! --- - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #23522 - [ ] There are tests for these changes <!-- 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/23670) <!-- Reviewable:end -->
|
|
|
Ok so since the tests were successful(no unexpected PASS), it means you got all the metadata update covered... |
|
Re those tests for the protocol setter, I think they are covered by the url test suite, so on second-thoughts I don't think it's necessary to add those. Sorry if you have already started working on it... I'd say if you squash your commits into one, it's ready to go. @jdm @asajeffrey r? |
|
@asajeffrey Are you available to review this? |
| @@ -140,7 +140,10 @@ impl LocationMethods for Location { | |||
| // https://html.spec.whatwg.org/multipage/#dom-location-host | |||
| fn SetHost(&self, value: USVString) -> ErrorResult { | |||
| self.check_same_origin_domain()?; | |||
| self.set_url_component(value, UrlHelper::SetHost); | |||
| // If copyURL's cannot-be-a-base-URL flag is set, terminate these steps. | |||
This comment has been minimized.
This comment has been minimized.
asajeffrey
Jul 17, 2019
Member
Can you add a comment "Step 4" to this, to make it easy to follow the code wrt the spec? (This applies to the other setters too.) Apart from that, looks great!
|
This looks great, just needs some comments linking to steps of the spec. Might be a good idea to squash all the commits into one? |
|
@braddunbar Are you still working on this? |
|
@braddunbar Ping? |
|
|
|
Closing as dormant. Feel free to reopen it! |
Implement various checks on the Location setters Since there are no existing open PRs for the issue, I am raising one based on the work done by @UxioAndrade and @braddunbar in previous two PRs for the issue (#25714 and #23670) respectively. - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #23522 - [x] There are tests for these changes
Implement various checks on the Location setters Since there are no existing open PRs for the issue, I am raising one based on the work done by @UxioAndrade and @braddunbar in previous two PRs for the issue (#25714 and #23670) respectively. - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #23522 - [x] There are tests for these changes
Implement various checks on the Location setters Since there are no existing open PRs for the issue, I am raising one based on the work done by @UxioAndrade and @braddunbar in previous two PRs for the issue (#25714 and #23670) respectively. - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #23522 - [x] There are tests for these changes
Implement various checks on the Location setters Since there are no existing open PRs for the issue, I am raising one based on the work done by @UxioAndrade and @braddunbar in previous two PRs for the issue (#25714 and #23670) respectively. - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #23522 - [x] There are tests for these changes
braddunbar commentedJul 1, 2019
•
edited by SimonSapin
So, this is my first pull to servo. I've tried to follow all the directions, but I may have missed or forgotten some of them. If so, please let me know - I'll be happy to fix things up!
As described in #23522, this implements various checks on the Location setters. In particular, for the following components.
I'd also like to add code for throwing a
SyntaxErrorwhen appropriate, but I may do that separately.I've removed the expectations for the protocol setter tests, but I haven't yet found any failing tests for the other components. Should I write tests for those? If so, should I add them here or is there an upstream that I should contribute to?
Let me know what you think!
./mach build -ddoes not report any errors./mach test-tidydoes not report any errorsThis change is