1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 13:37:44 +00:00

LibWeb: Add support for the <base> element changing the base URL

Used by Google seemingly almost all around account sign in and
management. The modern sign in page has this near the beginning:
```html
<base href="https://accounts.google.com">
```
All of the XHRs performed by sign in are relative URLs to this
base URL. Previously we ignored this and did it relative to the
current URL, causing the XHRs to 404 and sign in to fall apart.

I presume they do this because you can access the sign in page
from multiple endpoints, such as `/ServiceLogin` and
`/o/oauth2/auth/identifier`
This commit is contained in:
Luke Wilde 2022-06-19 16:02:48 +01:00 committed by Linus Groh
parent b3d87f8e37
commit 1f820f8840
7 changed files with 111 additions and 8 deletions

View file

@ -66,6 +66,10 @@ public:
void set_url(const AK::URL& url) { m_url = url; }
AK::URL url() const { return m_url; }
AK::URL fallback_base_url() const;
AK::URL base_url() const;
RefPtr<HTML::HTMLBaseElement> first_base_element_with_href_in_tree_order() const;
String url_string() const { return m_url.to_string(); }
String document_uri() const { return m_url.to_string(); }