mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 02:47:35 +00:00
AK+Everywhere: Replace "protocol" with "scheme" url helpers
URL had properly named replacements for protocol(), set_protocol() and create_with_file_protocol() already. This patch removes these function and updates all call sites to use the functions named according to the specification. See https://url.spec.whatwg.org/#concept-url-scheme
This commit is contained in:
parent
454bf1fde0
commit
4230dbbb21
61 changed files with 113 additions and 116 deletions
|
@ -56,7 +56,7 @@ static HTML::Origin url_origin(AK::URL const& url)
|
|||
if (url.scheme() == "file"sv) {
|
||||
// Unfortunate as it is, this is left as an exercise to the reader. When in doubt, return a new opaque origin.
|
||||
// Note: We must return an origin with the `file://' protocol for `file://' iframes to work from `file://' pages.
|
||||
return HTML::Origin(url.protocol(), String(), 0);
|
||||
return HTML::Origin(url.scheme(), String(), 0);
|
||||
}
|
||||
|
||||
return HTML::Origin {};
|
||||
|
|
|
@ -168,7 +168,7 @@ void BrowsingContextContainer::shared_attribute_processing_steps_for_iframe_and_
|
|||
// FIXME: Set the referrer policy.
|
||||
|
||||
// AD-HOC:
|
||||
if (url.protocol() == "file" && document().origin().protocol() != "file") {
|
||||
if (url.scheme() == "file" && document().origin().protocol() != "file") {
|
||||
dbgln("iframe failed to load URL: Security violation: {} may not load {}", document().url(), url);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -96,8 +96,8 @@ void HTMLFormElement::submit_form(JS::GCPtr<HTMLElement> submitter, bool from_su
|
|||
return;
|
||||
}
|
||||
|
||||
if (url.protocol() == "file") {
|
||||
if (document().url().protocol() != "file") {
|
||||
if (url.scheme() == "file") {
|
||||
if (document().url().scheme() != "file") {
|
||||
dbgln("Failed to submit form: Security violation: {} may not submit to {}", document().url(), url);
|
||||
return;
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ void HTMLFormElement::submit_form(JS::GCPtr<HTMLElement> submitter, bool from_su
|
|||
dbgln("Failed to submit form: Unsupported form method '{}' for URL: {}", method(), url);
|
||||
return;
|
||||
}
|
||||
} else if (url.protocol() != "http" && url.protocol() != "https") {
|
||||
} else if (url.scheme() != "http" && url.scheme() != "https") {
|
||||
dbgln("Failed to submit form: Unsupported protocol for URL: {}", url);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -117,7 +117,7 @@ void HTMLIFrameElement::load_src(String const& value)
|
|||
dbgln("iframe failed to load URL: Invalid URL: {}", value);
|
||||
return;
|
||||
}
|
||||
if (url.protocol() == "file" && document().origin().protocol() != "file") {
|
||||
if (url.scheme() == "file" && document().origin().protocol() != "file") {
|
||||
dbgln("iframe failed to load URL: Security violation: {} may not load {}", document().url(), url);
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue