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

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

Closed
wants to merge 9 commits into from

host or hostname: abort if url cannot be a base

  • Loading branch information
braddunbar committed Jun 30, 2019
commit 3c8df69834b20b48239f830e56910d446ee1e4e5
@@ -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.
if !self.get_url().cannot_be_a_base() {
self.set_url_component(value, UrlHelper::SetHost);
}
Ok(())
}

@@ -159,7 +162,10 @@ impl LocationMethods for Location {
// https://html.spec.whatwg.org/multipage/#dom-location-hostname
fn SetHostname(&self, value: USVString) -> ErrorResult {
self.check_same_origin_domain()?;
self.set_url_component(value, UrlHelper::SetHostname);
// If copyURL's cannot-be-a-base-URL flag is set, terminate these steps.
if !self.get_url().cannot_be_a_base() {
self.set_url_component(value, UrlHelper::SetHostname);
}
Ok(())
}

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.