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 setter for document.domain #15536
Conversation
highfive
commented
Feb 13, 2017
|
Heads up! This PR modifies the following files:
|
highfive
commented
Feb 13, 2017
e33dace
to
e2d4a51
|
Updated the wpt manifest. |
|
|
e2d4a51
to
d68a989
|
|
d68a989
to
34f1164
|
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
|
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 |
| @@ -81,7 +81,7 @@ partial /*sealed*/ interface Document { | |||
| // resource metadata management | |||
| [/*PutForwards=href, */Unforgeable] | |||
| readonly attribute Location? location; | |||
| readonly attribute DOMString domain; | |||
| [Throws] attribute DOMString domain; | |||
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Fixes #15233. |
971794d
to
4d82e40
|
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) | ||
| }, |
This comment has been minimized.
This comment has been minimized.
nox
Mar 15, 2017
Member
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> { |
This comment has been minimized.
This comment has been minimized.
| let host = match is_a_registrable_domain_suffix_of_or_is_equal_to(&*value, effective_domain) { | ||
| None => return Err(Error::Security), | ||
| Some(host) => host, | ||
| }; |
This comment has been minimized.
This comment has been minimized.
nox
Mar 15, 2017
Member
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 -->
|
|
| _ => Some(host), | ||
| }, | ||
| ImmutableOrigin::Opaque(_) => None, | ||
| } |
This comment has been minimized.
This comment has been minimized.
nox
Mar 15, 2017
Member
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,
}
This comment has been minimized.
This comment has been minimized.
nox
Mar 15, 2017
•
Member
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
|
Squashed down to two commits. @bors-servo: r=nox |
|
|
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 -->
|
|
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]
asajeffrey commentedFeb 13, 2017
•
edited by larsbergstrom
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