aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js/bindings/DOMWrapperWorld-class.h
blob: d2d4fb00c10a3c2abe1f524314e2cf6ba7cd72c5 (plain) (blame)
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#pragma once

#include "root.h"

#include "wtf/Forward.h"

namespace WebCore {

class WindowProxy;

typedef HashMap<void*, JSC::Weak<JSC::JSObject>> DOMObjectWrapperMap;

class DOMWrapperWorld : public RefCounted<DOMWrapperWorld> {
public:
    enum class Type {
        Normal, // Main (e.g. Page)
        User, // User Scripts (e.g. Extensions)
        Internal, // WebKit Internal (e.g. Media Controls)
    };

    static Ref<DOMWrapperWorld> create(JSC::VM& vm, Type type = Type::Internal, const String& name = {})
    {
        return adoptRef(*new DOMWrapperWorld(vm, type, name));
    }
    WEBCORE_EXPORT ~DOMWrapperWorld();

    // Free as much memory held onto by this world as possible.
    WEBCORE_EXPORT void clearWrappers();

    void didCreateWindowProxy(WindowProxy* controller) { m_jsWindowProxies.add(controller); }
    void didDestroyWindowProxy(WindowProxy* controller) { m_jsWindowProxies.remove(controller); }

    void setShadowRootIsAlwaysOpen() { m_shadowRootIsAlwaysOpen = true; }
    bool shadowRootIsAlwaysOpen() const { return m_shadowRootIsAlwaysOpen; }

    void disableLegacyOverrideBuiltInsBehavior() { m_shouldDisableLegacyOverrideBuiltInsBehavior = true; }
    bool shouldDisableLegacyOverrideBuiltInsBehavior() const { return m_shouldDisableLegacyOverrideBuiltInsBehavior; }

    DOMObjectWrapperMap& wrappers() { return m_wrappers; }

    Type type() const { return m_type; }
    bool isNormal() const { return m_type == Type::Normal; }

    const String& name() const { return m_name; }

    JSC::VM& vm() const { return m_vm; }

protected:
    DOMWrapperWorld(JSC::VM&, Type, const String& name);

private:
    JSC::VM& m_vm;
    HashSet<WindowProxy*> m_jsWindowProxies;
    DOMObjectWrapperMap m_wrappers;

    String m_name;
    Type m_type { Type::Internal };

    bool m_shadowRootIsAlwaysOpen { false };
    bool m_shouldDisableLegacyOverrideBuiltInsBehavior { false };
};

} // namespace WebCore
r> 2022-04-06Fix Netlify adapter and dynamic routes (#3011)Gravatar Matthew Phillips 10-18/+82 * Fix Netlify adapter and dynamic routes * Changeset 2022-04-06fix(integrations): `astro:build:done` dir now matches SSR client output (#3008)Gravatar Juan Martín Seery 5-7/+20 * `dir` now matches client output * Updated integrations * Changeset 2022-04-06fix: Nested hydration with Solid (#3003)Gravatar Ryan Carniato 3-16/+44 * fix: solid nested hydration * Create ten-rice-unite.md Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com> 2022-04-06[ci] formatGravatar natemoo-re 2-6/+15 2022-04-06Astro add docs (#2958)Gravatar Peter Singh 3-3/+49 * So This works 😎 * need to add to the cli next * Renamed Files and Export Applied creditation to where I found the 'inspiration' for this application. * applied `astro docs` to cli * Trying to add to CLI, Not working 🤷‍♂️ * Converted into async method, * 🎆🎆 It works!!! 🥳🎉🥳 Embarrasing as it is I totally missed the part where logic was to be in. * Moved `docs` cmd to `supportedCommands` * refactor: cleanup docs command * chore: add changeset * chore: rename browser to open Co-authored-by: Nate Moore <nate@skypack.dev> 2022-04-06fix: @astrojs/vercel bug fixes (#3000)Gravatar Juan Martín Seery 2-6/+29 * Fixed outDir * Updated server out * changeset * Renamed out to tmp 2022-04-06[ci] formatGravatar matthewp 1-32/+32 2022-04-06[ci] release (beta) (#3005)astro@1.0.0-beta.3Gravatar github-actions[bot] 31-88/+98 Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> 2022-04-06Fixes dynamic API routes in SSR (#3006)Gravatar Matthew Phillips 4-1/+26 * Fixes dynamic API routes in SSR * Adds a changeset 2022-04-06[ci] formatGravatar tony-sull 1-1/+1 2022-04-06fix(#2981): keeps `astro preview` server alive (#3004)Gravatar Tony Sullivan 3-1/+17 * fix(#2981): keeps server alive * chore: adding changeset * keep alive until the 'close' or 'error' event fires 2022-04-06Update readme.mdGravatar Nate Moore 1-2/+3 2022-04-06[ci] collect statsGravatar FredKSchott 1-0/+1 2022-04-05[ci] formatGravatar matthewp 1-1/+1 2022-04-05[ci] release (beta) (#2997)@astrojs/netlify@0.1.1-beta.0Gravatar github-actions[bot] 3-2/+9 Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> 2022-04-05Docs: netlify adapter site requirement (#2996)Gravatar Ben Holmes 3-4/+23 * feat: human-readable error on bad site or base * fix: human-readable error should have 1 config option * docs: update README * chore: changeset * docs: mention localhost for testing via netlify CLI 2022-04-05[ci] collect statsGravatar FredKSchott 1-0/+1 2022-04-05[ci] formatGravatar FredKSchott 1-32/+32 2022-04-04[ci] release (beta) (#2992)astro@1.0.0-beta.2Gravatar github-actions[bot] 31-87/+94 Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>