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 checks on Location setters #23670

Closed
wants to merge 6 commits into from
Closed

Conversation

@braddunbar
Copy link

braddunbar commented Jul 1, 2019

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!


  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • These changes fix #23522
  • There are tests for these changes

This change is Reviewable

braddunbar added 5 commits Jun 29, 2019
@highfive
Copy link

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
Copy link

highfive commented Jul 1, 2019

Heads up! This PR modifies the following files:

Copy link
Member

gterzian left a comment

Looks great, just a few questions...

I'll remove my commit from #23368, since this is better :)

@@ -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.

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.

@gterzian

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.

@braddunbar

braddunbar Jul 1, 2019

Author

Ok, I'll write some tests!

@gterzian
Copy link
Member

gterzian commented Jul 1, 2019

Should I write tests for those?

@bors-servo try=wpt (let's see if we find any other updates)

If so, should I add them here or is there an upstream that I should contribute to?

If you find a relevant test to write, you can do it here and it will be upstreamed automatically.

bors-servo added a commit that referenced this pull request Jul 1, 2019
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 -->
@bors-servo
Copy link
Contributor

bors-servo commented Jul 1, 2019

Trying commit 6c31813 with merge 7be2770...

@bors-servo
Copy link
Contributor

bors-servo commented Jul 1, 2019

☀️ Test successful - linux-rel-css, linux-rel-wpt, status-taskcluster
State: approved= try=True

@gterzian
Copy link
Member

gterzian commented Jul 2, 2019

Ok so since the tests were successful(no unexpected PASS), it means you got all the metadata update covered...

@gterzian gterzian mentioned this pull request Jul 2, 2019
0 of 5 tasks complete
@gterzian
Copy link
Member

gterzian commented Jul 9, 2019

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?

@jdm
Copy link
Member

jdm commented Jul 12, 2019

@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.

@asajeffrey

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!

@asajeffrey
Copy link
Member

asajeffrey commented Jul 17, 2019

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?

@asajeffrey
Copy link
Member

asajeffrey commented Aug 19, 2019

@braddunbar Are you still working on this?

@asajeffrey
Copy link
Member

asajeffrey commented Sep 27, 2019

@braddunbar Ping?

@bors-servo
Copy link
Contributor

bors-servo commented Oct 22, 2019

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

@asajeffrey
Copy link
Member

asajeffrey commented Jan 6, 2020

Closing as dormant. Feel free to reopen it!

@asajeffrey asajeffrey closed this Jan 6, 2020
@utsavoza utsavoza mentioned this pull request Apr 20, 2020
4 of 4 tasks complete
bors-servo added a commit that referenced this pull request Apr 22, 2020
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
bors-servo added a commit that referenced this pull request Apr 24, 2020
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
bors-servo added a commit that referenced this pull request Apr 24, 2020
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
bors-servo added a commit that referenced this pull request Apr 24, 2020
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

6 participants
You can’t perform that action at this time.