diff options
Diffstat (limited to 'src/bun.js/bindings/ZigGlobalObject.cpp')
-rw-r--r-- | src/bun.js/bindings/ZigGlobalObject.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/bun.js/bindings/ZigGlobalObject.cpp b/src/bun.js/bindings/ZigGlobalObject.cpp index 84cef9452..433130d8d 100644 --- a/src/bun.js/bindings/ZigGlobalObject.cpp +++ b/src/bun.js/bindings/ZigGlobalObject.cpp @@ -1306,6 +1306,13 @@ JSC: obj->putDirect( vm, JSC::PropertyName(JSC::Identifier::fromString(vm, "isContext"_s)), JSC::JSFunction::create(vm, globalObject, 0, "isContext"_s, vmModule_isContext, ImplementationVisibility::Public), 0); + obj->putDirect( + vm, JSC::PropertyName(JSC::Identifier::fromString(vm, "runInNewContext"_s)), + JSC::JSFunction::create(vm, globalObject, 0, "runInNewContext"_s, vmModuleRunInNewContext, ImplementationVisibility::Public), 0); + + obj->putDirect( + vm, JSC::PropertyName(JSC::Identifier::fromString(vm, "runInThisContext"_s)), + JSC::JSFunction::create(vm, globalObject, 0, "runInThisContext"_s, vmModuleRunInThisContext, ImplementationVisibility::Public), 0); return JSValue::encode(obj); } @@ -2661,6 +2668,20 @@ void GlobalObject::finishCreation(VM& vm) this->initGeneratedLazyClasses(); + m_cachedGlobalObjectStructure.initLater( + [](const JSC::LazyProperty<JSC::JSGlobalObject, Structure>::Initializer& init) { + auto& global = *reinterpret_cast<Zig::GlobalObject*>(init.owner); + + init.set( + JSC::JSGlobalObject::createStructure(init.vm, JSC::jsNull())); + }); + + m_cachedGlobalProxyStructure.initLater( + [](const JSC::LazyProperty<JSC::JSGlobalObject, Structure>::Initializer& init) { + init.set( + JSC::JSGlobalProxy::createStructure(init.vm, init.owner, JSC::jsNull())); + }); + m_subtleCryptoObject.initLater( [](const JSC::LazyProperty<JSC::JSGlobalObject, JSC::JSObject>::Initializer& init) { auto& global = *reinterpret_cast<Zig::GlobalObject*>(init.owner); @@ -3735,6 +3756,9 @@ void GlobalObject::visitChildrenImpl(JSCell* cell, Visitor& visitor) thisObject->m_vmModuleContextMap.visit(visitor); thisObject->m_bunSleepThenCallback.visit(visitor); + thisObject->m_cachedGlobalObjectStructure.visit(visitor); + thisObject->m_cachedGlobalProxyStructure.visit(visitor); + for (auto& barrier : thisObject->m_thenables) { visitor.append(barrier); } |