aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bun.js/bindings/Process.h23
-rw-r--r--src/bun.js/bindings/ZigGlobalObject.cpp3
2 files changed, 12 insertions, 14 deletions
diff --git a/src/bun.js/bindings/Process.h b/src/bun.js/bindings/Process.h
index a710edbad..2952cfb7d 100644
--- a/src/bun.js/bindings/Process.h
+++ b/src/bun.js/bindings/Process.h
@@ -4,29 +4,25 @@
#include "BunBuiltinNames.h"
#include "BunClientData.h"
+#include "JSEventEmitter.h"
namespace Zig {
using namespace JSC;
-class Process : public JSC::JSNonFinalObject {
- using Base = JSC::JSNonFinalObject;
+class Process : public WebCore::JSEventEmitter {
+ using Base = WebCore::JSEventEmitter;
public:
- Process(JSC::VM& vm, JSC::Structure* structure)
- : Base(vm, structure)
+ Process(JSC::Structure* structure, WebCore::JSDOMGlobalObject& globalObject, Ref<WebCore::EventEmitter>&& impl)
+ : Base(structure, globalObject, WTFMove(impl))
{
}
- DECLARE_INFO;
+ DECLARE_EXPORT_INFO;
static constexpr unsigned StructureFlags = Base::StructureFlags;
- template<typename CellType, SubspaceAccess> static GCClient::IsoSubspace* subspaceFor(VM& vm)
- {
- return &vm.plainObjectSpace();
- }
-
static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject,
JSC::JSValue prototype)
{
@@ -34,10 +30,11 @@ public:
JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
}
- static Process* create(JSC::VM& vm, JSC::Structure* structure)
+ static Process* create(WebCore::JSDOMGlobalObject& globalObject, JSC::Structure* structure)
{
- Process* accessor = new (NotNull, JSC::allocateCell<Process>(vm)) Process(vm, structure);
- accessor->finishCreation(vm);
+ auto emitter = WebCore::EventEmitter::create(*globalObject.scriptExecutionContext());
+ Process* accessor = new (NotNull, JSC::allocateCell<Process>(globalObject.vm())) Process(structure, globalObject, WTFMove(emitter));
+ accessor->finishCreation(globalObject.vm());
return accessor;
}
diff --git a/src/bun.js/bindings/ZigGlobalObject.cpp b/src/bun.js/bindings/ZigGlobalObject.cpp
index 0d0ec1128..85b3c27ee 100644
--- a/src/bun.js/bindings/ZigGlobalObject.cpp
+++ b/src/bun.js/bindings/ZigGlobalObject.cpp
@@ -1993,8 +1993,9 @@ void GlobalObject::finishCreation(VM& vm)
m_processObject.initLater(
[](const JSC::LazyProperty<JSC::JSGlobalObject, JSC::JSObject>::Initializer& init) {
+ Zig::GlobalObject* globalObject = reinterpret_cast<Zig::GlobalObject*>(init.owner);
auto* process = Zig::Process::create(
- init.vm, Zig::Process::createStructure(init.vm, init.owner, init.owner->objectPrototype()));
+ *globalObject, Zig::Process::createStructure(init.vm, init.owner, WebCore::JSEventEmitter::prototype(init.vm, *globalObject)));
process->putDirectCustomAccessor(init.vm, JSC::Identifier::fromString(init.vm, "env"_s),
JSC::CustomGetterSetter::create(init.vm, lazyProcessEnvGetter, lazyProcessEnvSetter),
JSC::PropertyAttribute::DontDelete