mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-06 16:19:23 +00:00
LibURL: Implement Site concept
This commit is contained in:
parent
2e64e0b836
commit
b83f015c70
Notes:
github-actions[bot]
2024-11-30 11:23:42 +00:00
Author: https://github.com/AtkinsSJ
Commit: b83f015c70
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2610
Reviewed-by: https://github.com/shannonbooth ✅
6 changed files with 146 additions and 1 deletions
|
@ -6,9 +6,27 @@
|
|||
|
||||
#include <LibURL/Origin.h>
|
||||
#include <LibURL/Parser.h>
|
||||
#include <LibURL/Site.h>
|
||||
|
||||
namespace URL {
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/browsers.html#same-site
|
||||
bool Origin::is_same_site(Origin const& other) const
|
||||
{
|
||||
// 1. Let siteA be the result of obtaining a site given A.
|
||||
auto site_a = Site::obtain(*this);
|
||||
|
||||
// 2. Let siteB be the result of obtaining a site given B.
|
||||
auto site_b = Site::obtain(other);
|
||||
|
||||
// 3. If siteA is same site with siteB, then return true.
|
||||
if (site_a.is_same_site(site_b))
|
||||
return true;
|
||||
|
||||
// 4. Return false.
|
||||
return false;
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/origin.html#ascii-serialisation-of-an-origin
|
||||
String Origin::serialize() const
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue