1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 12:38:12 +00:00

LibWeb: Rename Origin::is_same() to Origin::is_same_origin()

The HTML Origin spec has two similar but slightly different concepts of
origin equality: "same origin" and "same origin-domain". Let's be
explicit with the naming here :^)
Also add spec comments.
This commit is contained in:
Linus Groh 2022-02-14 21:54:20 +00:00 committed by Andreas Kling
parent f2ee62e268
commit 6d0e6e3811
3 changed files with 12 additions and 5 deletions

View file

@ -394,7 +394,7 @@ DOM::ExceptionOr<void> XMLHttpRequest::send(String body)
if (auto* page = m_window->page())
should_enforce_same_origin_policy = page->is_same_origin_policy_enabled();
if (should_enforce_same_origin_policy && !m_window->associated_document().origin().is_same(request_url_origin)) {
if (should_enforce_same_origin_policy && !m_window->associated_document().origin().is_same_origin(request_url_origin)) {
dbgln("XHR failed to load: Same-Origin Policy violation: {} may not load {}", m_window->associated_document().url(), request_url);
set_ready_state(ReadyState::Done);
dispatch_event(DOM::Event::create(HTML::EventNames::error));