Repository navigation
Implement setter for document.domain - #15536
Conversation
|
Heads up! This PR modifies the following files:
|
e33dace to
e2d4a51
Compare
|
Updated the wpt manifest. |
|
☔ The latest upstream changes (presumably #15588) made this pull request unmergeable. Please resolve the merge conflicts. |
e2d4a51 to
d68a989
Compare
|
☔ The latest upstream changes (presumably #14962) made this pull request unmergeable. Please resolve the merge conflicts. |
d68a989 to
34f1164
Compare
|
IRC conversation with @jdm: http://logs.glob.uno/?c=mozilla%23servo&s=24+Feb+2017&e=24+Feb+2017#c619500 TL;DR: closed #15478 in favour of merging with this PR, so we can include wpt tests. |
|
The spec for document.domain changed: whatwg/html@03bbc6e I added some more wpt tests. @emilio, @Ms2ger and @jdm: This is ready for review, since #15478 was closed in favour of this PR. |
94ae9b2 to
7ce7340
Compare
|
The spec for IRC chat with @Ms2ger: http://logs.glob.uno/?c=mozilla%23servo&s=27+Feb+2017&e=27+Feb+2017#c620440 - now that there's a wpt test for |
| [/*PutForwards=href, */Unforgeable] | ||
| readonly attribute Location? location; | ||
| readonly attribute DOMString domain; | ||
| [Throws] attribute DOMString domain; |
There was a problem hiding this comment.
Can this use [SetterThrows]?
There was a problem hiding this comment.
Oh, I didn't know there was such a thing! Yes, it should.
|
Fixes #15233. |
971794d to
4d82e40
Compare
|
Squashed down into two commits. The first used to be #15478, the second is the implementation of the setter for document.domain. |
|
Pushed again to get appveyor to rebuild. |
| Some(Host::Domain(String::from(reg_suffix(&*domain)))) | ||
| } else { | ||
| Some(host) | ||
| }, |
There was a problem hiding this comment.
This is worse than before or what I suggested and the formatting is wrong. Don't nest an if let expression inside a match arm without enclosing it in braces.
| fn is_a_registrable_domain_suffix_of_or_is_equal_to(host_suffix_string: &str, original_host: Host) -> bool { | ||
| // The spec says to return a bool, we actually return an Option<Host> containing | ||
| // the parsed host in the successful case, to avoid having to re-parse the host. | ||
| fn is_a_registrable_domain_suffix_of_or_is_equal_to(host_suffix_string: &str, original_host: Host) -> Option<Host> { |
There was a problem hiding this comment.
Rename the method to something that doesn't sound like a boolean.
| let host = match is_a_registrable_domain_suffix_of_or_is_equal_to(&*value, effective_domain) { | ||
| None => return Err(Error::Security), | ||
| Some(host) => host, | ||
| }; |
There was a problem hiding this comment.
let host = is_a_registrable_domain_suffix_of_or_is_equal_to(&*value, effective_domain).ok_or(Error::Security)?;|
@bors-servo try |
Implement setter for document.domain <!-- Please describe your changes on the following line: --> This PR implements the setter for `document.domain`. It builds on #15438 and #15478, only the last commit is part of this PR. It includes tests for similar-origin security checks. --- <!-- 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 #934. - [X] There are tests for these changes. <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- 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/15536) <!-- Reviewable:end -->
|
💔 Test failed - linux-rel-wpt |
| _ => Some(host), | ||
| }, | ||
| ImmutableOrigin::Opaque(_) => None, | ||
| } |
There was a problem hiding this comment.
Still the same issue?
Either just copy/paste my original comment, or wrap the nested match in braces.
match url.origin() {
ImmutableOrigin::Tuple(_, Host::Domain(domain), _) => Some(Host::Domain(String::from(reg_suffix(&*domain)))),
ImmutableOrigin::Tuple(_, ip, _) => Some(ip),
ImmutableOrigin::Opaque(_) => None,
}There was a problem hiding this comment.
Or a mix of the two.
match url.origin() {
ImmutableOrigin::Tuple(_, Host::Domain(domain), _) => {
Some(Host::Domain(String::from(reg_suffix(&*domain))))
},
ImmutableOrigin::Tuple(_, ip, _) => Some(ip),
ImmutableOrigin::Opaque(_) => None,
}|
r=me when the tests pass. |
|
The intermittent crash seems to be a race condition when writing the |
|
Added #15962. |
0ae1849 to
5348b63
Compare
|
Squashed down to two commits. @bors-servo: r=nox |
|
📌 Commit 5348b63 has been approved by |
Implement setter for document.domain <!-- Please describe your changes on the following line: --> This PR implements the setter for `document.domain`. It builds on #15438 and #15478, only the last commit is part of this PR. It includes tests for similar-origin security checks. --- <!-- 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 #934. - [X] There are tests for these changes. <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- 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/15536) <!-- Reviewable:end -->
|
☀️ Test successful - android, arm32, arm64, linux-dev, linux-rel-css, linux-rel-wpt, mac-dev-unit, mac-rel-css, mac-rel-wpt1, mac-rel-wpt2, windows-gnu-dev, windows-msvc-dev |
Implement dissimilar-origin window.parent and window.top <!-- Please describe your changes on the following line: --> This PR implements `window.parent` and `window.top` for dissimilar-origin windows. This PR builds on #15536, only the last commit is part of this PR. --- <!-- 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 #14996 and fix #11660. - [X] These changes do not require tests because there's already a parentage test in `mozilla/cross-origin-objects/cross-origin-objects.html`. <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- 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/15799) <!-- Reviewable:end -->
Upstreamed from servo/servo#15536 [ci skip]
This PR implements the setter for
document.domain.It builds on #15438 and #15478, only the last commit is part of this PR.
It includes tests for similar-origin security checks.
./mach build -ddoes not report any errors./mach test-tidydoes not report any errorsThis change is