Coverage Report

Created: 2026-02-16 07:47

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/serenity/Userland/Libraries/LibWeb/HTML/WindowProxy.h
Line
Count
Source
1
/*
2
 * Copyright (c) 2022, Linus Groh <linusg@serenityos.org>
3
 *
4
 * SPDX-License-Identifier: BSD-2-Clause
5
 */
6
7
#pragma once
8
9
#include <AK/Forward.h>
10
#include <LibJS/Forward.h>
11
#include <LibJS/Heap/GCPtr.h>
12
#include <LibJS/Runtime/Object.h>
13
#include <LibWeb/Forward.h>
14
15
namespace Web::HTML {
16
17
class WindowProxy final : public JS::Object {
18
    JS_OBJECT(WindowProxy, JS::Object);
19
    JS_DECLARE_ALLOCATOR(WindowProxy);
20
21
public:
22
    virtual ~WindowProxy() override = default;
23
24
    virtual JS::ThrowCompletionOr<JS::Object*> internal_get_prototype_of() const override;
25
    virtual JS::ThrowCompletionOr<bool> internal_set_prototype_of(Object* prototype) override;
26
    virtual JS::ThrowCompletionOr<bool> internal_is_extensible() const override;
27
    virtual JS::ThrowCompletionOr<bool> internal_prevent_extensions() override;
28
    virtual JS::ThrowCompletionOr<Optional<JS::PropertyDescriptor>> internal_get_own_property(JS::PropertyKey const&) const override;
29
    virtual JS::ThrowCompletionOr<bool> internal_define_own_property(JS::PropertyKey const&, JS::PropertyDescriptor const&, Optional<JS::PropertyDescriptor>* precomputed_get_own_property = nullptr) override;
30
    virtual JS::ThrowCompletionOr<JS::Value> internal_get(JS::PropertyKey const&, JS::Value receiver, JS::CacheablePropertyMetadata*, PropertyLookupPhase) const override;
31
    virtual JS::ThrowCompletionOr<bool> internal_set(JS::PropertyKey const&, JS::Value value, JS::Value receiver, JS::CacheablePropertyMetadata*) override;
32
    virtual JS::ThrowCompletionOr<bool> internal_delete(JS::PropertyKey const&) override;
33
    virtual JS::ThrowCompletionOr<JS::MarkedVector<JS::Value>> internal_own_property_keys() const override;
34
35
0
    JS::GCPtr<Window> window() const { return m_window; }
36
    void set_window(JS::NonnullGCPtr<Window>);
37
38
    JS::NonnullGCPtr<BrowsingContext> associated_browsing_context() const;
39
40
private:
41
    explicit WindowProxy(JS::Realm&);
42
43
    virtual void visit_edges(JS::Cell::Visitor&) override;
44
45
    // [[Window]], https://html.spec.whatwg.org/multipage/window-object.html#concept-windowproxy-window
46
    JS::GCPtr<Window> m_window;
47
};
48
49
}