1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-28 13:55:06 +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

@ -16,6 +16,18 @@ public:
HTMLBaseElement(DOM::Document&, DOM::QualifiedName);
virtual ~HTMLBaseElement() override;
AK::URL const& frozen_base_url() const { return m_frozen_base_url; }
virtual void inserted() override;
virtual void parse_attribute(FlyString const& name, String const& value) override;
private:
// https://html.spec.whatwg.org/multipage/semantics.html#frozen-base-url
// A base element that is the first base element with an href content attribute in a document tree has a frozen base URL.
AK::URL m_frozen_base_url;
void set_the_frozen_base_url();
};
}