Skip to content

Comments

Add comments linking to the steps of the specs in the checks on Location setters#25714

Closed
uxioandrade wants to merge 9 commits intoservo:masterfrom
uxioandrade:https-scheme
Closed

Add comments linking to the steps of the specs in the checks on Location setters#25714
uxioandrade wants to merge 9 commits intoservo:masterfrom
uxioandrade:https-scheme

Conversation

@uxioandrade
Copy link

@uxioandrade uxioandrade commented Feb 9, 2020

As stated in #23670 (comment), I added some comments to the checks on Location setters, so that it is easier to follow the steps in specs.


  • These changes do not require tests because I just added some comments

@highfive
Copy link

highfive commented Feb 9, 2020

Thanks for the pull request, and welcome! The Servo team is excited to review your changes, and you should hear from @paulrouget (or someone else) soon.

@highfive
Copy link

highfive commented Feb 9, 2020

Heads up! This PR modifies the following files:

@highfive highfive added the S-awaiting-review There is new code that needs to be reviewed. label Feb 9, 2020
@gterzian
Copy link
Member

Thanks! Could you please also squash into one commit?

self.check_same_origin_domain()?;
self.set_url_component(value, UrlHelper::SetProtocol);
// Step 6: If copyURL's scheme is not an HTTP(S) scheme, then terminate these steps.
let scheme = value.split(':').next().unwrap();
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn’t it dangerous to have unwrap() here?

Copy link
Member

@gterzian gterzian Feb 10, 2020

Choose a reason for hiding this comment

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

Yes you're right, actually per Step 5 of the protocol setter spec, I think we should return a Error::Syntax here instead of unwrap, see https://html.spec.whatwg.org/multipage/history.html#dom-location-protocol

This would be using use crate::dom::bindings::error::Error;

Copy link
Author

Choose a reason for hiding this comment

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

Would my latest commit fix that?

Copy link
Member

Choose a reason for hiding this comment

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

@uxioandrade
Copy link
Author

Hi @gterzian should I squash all the commits or just the ones before I merged the master branch?

@gterzian
Copy link
Member

I would say just one(and I think it will still automatically list @braddunbar as co-author, which would be a good thing).

fn SetPathname(&self, value: USVString) -> ErrorResult {
self.check_same_origin_domain()?;
self.set_url_component(value, UrlHelper::SetPathname);
// Step 3: If copyURL's cannot-be-a-base-URL flag is set, terminate these steps.
Copy link
Member

Choose a reason for hiding this comment

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

Actually, can we put this comment, and all others, above the Ok(()) branch, because the comments all refer to the steps take when the condition is not met.

}
Ok(())
} else {
Err(Error::Syntax)
Copy link
Member

Choose a reason for hiding this comment

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

Here we can put a comment for Step 5, throw a "SyntaxError" DOMException.

@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 Feb 10, 2020
@bors-servo
Copy link
Contributor

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

@highfive highfive added the S-needs-rebase There are merge conflict errors. label Mar 9, 2020
@bors-servo
Copy link
Contributor

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

@bors-servo
Copy link
Contributor

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

@bors-servo
Copy link
Contributor

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

@dralley
Copy link
Contributor

dralley commented Apr 12, 2020

@uxioandrade Are you planning on finishing up the PR?

@bors-servo
Copy link
Contributor

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

@jdm jdm closed this Apr 20, 2020
@jdm
Copy link
Member

jdm commented Apr 20, 2020

Closing due to inactivity.

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

Labels

S-needs-code-changes Changes have not yet been made that were requested by a reviewer. S-needs-rebase There are merge conflict errors.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement various checks on the Location setters

8 participants