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 various checks on the Location setters #23522
Comments
|
As a bonus you can also return a security error when the spec says to, see for how that is done: servo/components/script/dom/location.rs Line 61 in d180f76 |
|
I'll work on this! |
|
Thanks, let us know how it goes! @braddunbar |
|
@braddunbar How is this going? let us know if you have any questions, you can also just open the PR with a work in progress and ask questions from there... |
|
Good! I’ll send a pull this weekend. |
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 -->
|
There was a PR that was just missing some specification link comments in #23670, then the author stopped responding. |
|
@jdm Hi, I would like to work on this. Do you think this would be a nice issue for a first contribution? |
|
@UxioAndrade Absolutely! (Sorry for answering in lieu of @jdm) If you look at #23670, you can see that most of the work has already been done by @braddunbar, and there are just a few last comments that need to be addressed. If it's not clear what those last comments are, let us know. |
|
@gterzian Great, thank you! |
|
Hey @gterzian @UxioAndrade, is it ok for me to take up this issue if we are not making progress on it currently? |
|
Yes it would be great to finally close this one, there is not much work left I think(see the open PR). Perhaps give @UxioAndrade a couple of days to respond? In any case, there is always more work to do on this project! |
|
Sure. |
|
For posterity, I think the |
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
Spec: https://html.spec.whatwg.org/multipage/history.html#location
See all attributes that say "Can be set, to navigate to the given URL.".
Code: See all the
Set_methods atservo/components/script/dom/location.rs
Line 78 in 7a5ce04
As well as
set_url_componentwhich is used by those methods:servo/components/script/dom/location.rs
Line 45 in 7a5ce04
Currently failing tests(and maybe others):
And the actual tests are found in https://github.com/servo/servo/tree/master/tests/wpt/web-platform-tests/html/browsers/history/the-location-interface
A start was made at https://github.com/servo/servo/pull/23368/files#diff-45df5e6ab4c1d79fae956506be147b62R244
and https://github.com/servo/servo/pull/23368/files#diff-c1196726ff21e3563c663b049214dafeL21
Note the only gotcha is that the
ServoUrlcontains anArc, so you can't manipulate it directly when you do the initial parse to then perform the check, as that will actually change the url of the window. So instead you'll need to get a copy, as is for example done at https://github.com/servo/servo/pull/23368/files#diff-45df5e6ab4c1d79fae956506be147b62R244 (or you need to perform the checks without manipulating the current url)