diff options
author | Luke Wilde <lukew@serenityos.org> | 2022-06-19 16:02:48 +0100 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-06-19 16:35:43 +0100 |
commit | 1f820f8840ebf83ada1ea552f3686dce23a66346 (patch) | |
tree | d5cc1467d3251dd01aae69c689df12d56d31372c /Userland/Libraries/LibWeb/HTML/Scripting/WindowEnvironmentSettingsObject.cpp | |
parent | b3d87f8e3747aa40d2f72c5d91a25d38e505501b (diff) | |
download | serenity-1f820f8840ebf83ada1ea552f3686dce23a66346.zip |
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`
Diffstat (limited to 'Userland/Libraries/LibWeb/HTML/Scripting/WindowEnvironmentSettingsObject.cpp')
-rw-r--r-- | Userland/Libraries/LibWeb/HTML/Scripting/WindowEnvironmentSettingsObject.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/Userland/Libraries/LibWeb/HTML/Scripting/WindowEnvironmentSettingsObject.cpp b/Userland/Libraries/LibWeb/HTML/Scripting/WindowEnvironmentSettingsObject.cpp index 14a541e6bb..bc5183fce2 100644 --- a/Userland/Libraries/LibWeb/HTML/Scripting/WindowEnvironmentSettingsObject.cpp +++ b/Userland/Libraries/LibWeb/HTML/Scripting/WindowEnvironmentSettingsObject.cpp @@ -62,9 +62,8 @@ String WindowEnvironmentSettingsObject::api_url_character_encoding() // https://html.spec.whatwg.org/multipage/window-object.html#script-settings-for-window-objects:api-base-url AK::URL WindowEnvironmentSettingsObject::api_base_url() { - // FIXME: Return the current base URL of window's associated Document. - // (This currently just returns the current document URL, not accounting for <base> elements and such) - return m_window->associated_document().url(); + // Return the current base URL of window's associated Document. + return m_window->associated_document().base_url(); } // https://html.spec.whatwg.org/multipage/window-object.html#script-settings-for-window-objects:concept-settings-object-origin |