summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/HTML/WorkerLocation.h
blob: 384b74bfc7d500f3aea066938d1fcf5ac286821a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/*
 * Copyright (c) 2022, Andrew Kaster <akaster@serenityos.org>
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#pragma once

#include <AK/RefCounted.h>
#include <LibWeb/Bindings/Wrappable.h>
#include <LibWeb/Forward.h>

namespace Web::HTML {

// https://html.spec.whatwg.org/multipage/workers.html#worker-locations
class WorkerLocation
    : public RefCounted<WorkerLocation>
    , public Bindings::Wrappable {
public:
    using WrapperType = Bindings::WorkerLocationWrapper;

    static NonnullRefPtr<WorkerLocation> create(WorkerGlobalScope& global_scope)
    {
        return adopt_ref(*new WorkerLocation(global_scope));
    }

    String href() const;
    String origin() const;
    String protocol() const;
    String host() const;
    String hostname() const;
    String port() const;
    String pathname() const;
    String search() const;
    String hash() const;

private:
    WorkerLocation(WorkerGlobalScope&);

    WorkerGlobalScope& m_global_scope;
};

}