summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/Bindings/PlatformObject.cpp
blob: 9b00217cc76c268d8c3b5c4ae3e7bd7a9e6fef28 (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
/*
 * Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#include <AK/TypeCasts.h>
#include <LibJS/Runtime/Realm.h>
#include <LibWeb/Bindings/PlatformObject.h>
#include <LibWeb/HTML/Window.h>

namespace Web::Bindings {

PlatformObject::PlatformObject(JS::Realm& realm)
    : JS::Object(realm, nullptr)
{
}

PlatformObject::PlatformObject(JS::Object& prototype)
    : JS::Object(ConstructWithPrototypeTag::Tag, prototype)
{
}

PlatformObject::~PlatformObject() = default;

JS::Realm& PlatformObject::realm() const
{
    return shape().realm();
}

HTML::Window& PlatformObject::global_object() const
{
    return verify_cast<HTML::Window>(realm().global_object());
}

}