1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 19:08:10 +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:
networkException 2022-09-29 01:30:58 +02:00 committed by Linus Groh
parent 454bf1fde0
commit 4230dbbb21
61 changed files with 113 additions and 116 deletions

View file

@ -92,7 +92,7 @@ MainWidget::MainWidget()
m_web_view = find_descendant_of_type_named<WebView::OutOfProcessWebView>("web_view");
m_web_view->on_link_click = [this](auto& url, auto&, unsigned) {
if (url.protocol() == "file") {
if (url.scheme() == "file") {
auto path = url.path();
if (!path.starts_with("/usr/share/man/"sv)) {
open_external(url);
@ -106,7 +106,7 @@ MainWidget::MainWidget()
}
m_history.push(path);
open_page(path);
} else if (url.protocol() == "help") {
} else if (url.scheme() == "help") {
if (url.host() == "man") {
if (url.paths().size() != 2) {
dbgln("Bad help page URL '{}'", url);
@ -272,7 +272,7 @@ void MainWidget::open_url(URL const& url)
m_go_back_action->set_enabled(m_history.can_go_back());
m_go_forward_action->set_enabled(m_history.can_go_forward());
if (url.protocol() == "file") {
if (url.scheme() == "file") {
m_web_view->load(url);
m_web_view->scroll_to_top();