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
Prev

change scheme unwrap into syntax error

  • Loading branch information
UxioAndrade committed Feb 10, 2020
commit ec7723142efc30b083a7c4e44f2fe2448041cc45
@@ -257,12 +257,15 @@ impl LocationMethods for Location {
fn SetProtocol(&self, value: USVString) -> ErrorResult {
self.check_same_origin_domain()?;
// Step 6: If copyURL's scheme is not an HTTP(S) scheme, then terminate these steps.
let scheme = value.split(':').next().unwrap();
if scheme.eq_ignore_ascii_case("http") || scheme.eq_ignore_ascii_case("https") {
self.set_url_component(value, UrlHelper::SetProtocol);
if let Ok(scheme) = value.split(':').next() {
if scheme.eq_ignore_ascii_case("http") || scheme.eq_ignore_ascii_case("https") {
self.set_url_component(value, UrlHelper::SetProtocol);
}
Ok(())
} else {
Err(Error::Syntax)

This comment has been minimized.

Copy link
@gterzian

gterzian Feb 10, 2020

Member

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

}
Ok(())
}
}

// https://html.spec.whatwg.org/multipage/#dom-location-search
fn GetSearch(&self) -> Fallible<USVString> {
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.