mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 01:20:25 +00:00
LibWeb: Add Origin::is_same(const Origin&)
Getting ready for some extremely basic same-origin policy stuff, this initial implementation simply checks that two origins have identical protocol, host and port.
This commit is contained in:
parent
b4a3537716
commit
4c1f317572
Notes:
sideshowbarker
2024-07-19 02:16:22 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/4c1f3175720
1 changed files with 8 additions and 1 deletions
|
@ -32,7 +32,7 @@ namespace Web {
|
|||
|
||||
class Origin {
|
||||
public:
|
||||
Origin() {}
|
||||
Origin() { }
|
||||
Origin(const String& protocol, const String& host, u16 port)
|
||||
: m_protocol(protocol)
|
||||
, m_host(host)
|
||||
|
@ -46,6 +46,13 @@ public:
|
|||
const String& host() const { return m_host; }
|
||||
u16 port() const { return m_port; }
|
||||
|
||||
bool is_same(const Origin& other) const
|
||||
{
|
||||
return protocol() == other.protocol()
|
||||
&& host() == other.host()
|
||||
&& port() == other.port();
|
||||
}
|
||||
|
||||
private:
|
||||
String m_protocol;
|
||||
String m_host;
|
||||
|
|
Loading…
Reference in a new issue