From 879cb231630c6cedf6466be0e57baea5fe4fe77b Mon Sep 17 00:00:00 2001 From: Meghan Denny Date: Fri, 26 Jul 2024 03:47:41 -0700 Subject: [PATCH] cpp: missing uses of propertyNames (#12835) --- src/bun.js/bindings/BunObject.cpp | 2 +- src/bun.js/bindings/BunProcess.cpp | 4 ++-- src/bun.js/bindings/CommonJSModuleRecord.cpp | 2 +- src/bun.js/bindings/webcore/EventEmitter.cpp | 2 +- src/bun.js/bindings/webcore/JSErrorEvent.cpp | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/bun.js/bindings/BunObject.cpp b/src/bun.js/bindings/BunObject.cpp index f29203a995..8f7b40708e 100644 --- a/src/bun.js/bindings/BunObject.cpp +++ b/src/bun.js/bindings/BunObject.cpp @@ -311,7 +311,7 @@ static JSValue constructDNSObject(VM& vm, JSObject* bunObject) JSC::JSObject* dnsObject = JSC::constructEmptyObject(globalObject); dnsObject->putDirectNativeFunction(vm, globalObject, JSC::Identifier::fromString(vm, "lookup"_s), 2, Bun__DNSResolver__lookup, ImplementationVisibility::Public, NoIntrinsic, JSC::PropertyAttribute::DontDelete | 0); - dnsObject->putDirectNativeFunction(vm, globalObject, builtinNames(vm).resolvePublicName(), 2, Bun__DNSResolver__resolve, ImplementationVisibility::Public, NoIntrinsic, + dnsObject->putDirectNativeFunction(vm, globalObject, vm.propertyNames->resolve, 2, Bun__DNSResolver__resolve, ImplementationVisibility::Public, NoIntrinsic, JSC::PropertyAttribute::DontDelete | 0); dnsObject->putDirectNativeFunction(vm, globalObject, JSC::Identifier::fromString(vm, "resolveSrv"_s), 2, Bun__DNSResolver__resolveSrv, ImplementationVisibility::Public, NoIntrinsic, JSC::PropertyAttribute::DontDelete | 0); diff --git a/src/bun.js/bindings/BunProcess.cpp b/src/bun.js/bindings/BunProcess.cpp index c0f52800ed..e03743ba17 100644 --- a/src/bun.js/bindings/BunProcess.cpp +++ b/src/bun.js/bindings/BunProcess.cpp @@ -1616,7 +1616,7 @@ static JSValue constructReportObjectComplete(VM& vm, Zig::GlobalObject* globalOb auto constructJavaScriptStack = [&]() -> JSC::JSValue { JSC::JSObject* javascriptStack = JSC::constructEmptyObject(globalObject, globalObject->objectPrototype(), 3); - javascriptStack->putDirect(vm, JSC::Identifier::fromString(vm, "message"_s), JSC::jsString(vm, String("Error [ERR_SYNTHETIC]: JavaScript Callstack"_s)), 0); + javascriptStack->putDirect(vm, vm.propertyNames->message, JSC::jsString(vm, String("Error [ERR_SYNTHETIC]: JavaScript Callstack"_s)), 0); // TODO: allow errors as an argument { @@ -2817,7 +2817,7 @@ extern "C" void Process__emitMessageEvent(Zig::GlobalObject* global, EncodedJSVa auto* process = static_cast(global->processObject()); auto& vm = global->vm(); - auto ident = Identifier::fromString(vm, "message"_s); + auto ident = vm.propertyNames->message; if (process->wrapped().hasEventListeners(ident)) { JSC::MarkedArgumentBuffer args; args.append(JSValue::decode(value)); diff --git a/src/bun.js/bindings/CommonJSModuleRecord.cpp b/src/bun.js/bindings/CommonJSModuleRecord.cpp index 3ed8339213..eb7bcb75eb 100644 --- a/src/bun.js/bindings/CommonJSModuleRecord.cpp +++ b/src/bun.js/bindings/CommonJSModuleRecord.cpp @@ -290,7 +290,7 @@ RequireFunctionPrototype* RequireFunctionPrototype::create( RequireFunctionPrototype* prototype = new (NotNull, JSC::allocateCell(vm)) RequireFunctionPrototype(vm, structure); prototype->finishCreation(vm); - prototype->putDirect(vm, builtinNames(vm).resolvePublicName(), jsCast(globalObject)->requireResolveFunctionUnbound(), 0); + prototype->putDirect(vm, vm.propertyNames->resolve, jsCast(globalObject)->requireResolveFunctionUnbound(), 0); return prototype; } diff --git a/src/bun.js/bindings/webcore/EventEmitter.cpp b/src/bun.js/bindings/webcore/EventEmitter.cpp index f582289559..021edf1fca 100644 --- a/src/bun.js/bindings/webcore/EventEmitter.cpp +++ b/src/bun.js/bindings/webcore/EventEmitter.cpp @@ -249,7 +249,7 @@ void EventEmitter::innerInvokeEventListeners(const Identifier& eventType, Simple auto* exception = exceptionPtr.get(); if (UNLIKELY(exception)) { - auto errorIdentifier = JSC::Identifier::fromString(vm, eventNames().errorEvent); + auto errorIdentifier = vm.propertyNames->error; auto hasErrorListener = this->hasActiveEventListeners(errorIdentifier); if (!hasErrorListener || eventType == errorIdentifier) { // If the event type is error, report the exception to the console. diff --git a/src/bun.js/bindings/webcore/JSErrorEvent.cpp b/src/bun.js/bindings/webcore/JSErrorEvent.cpp index 6e80cddc1c..60515f2074 100644 --- a/src/bun.js/bindings/webcore/JSErrorEvent.cpp +++ b/src/bun.js/bindings/webcore/JSErrorEvent.cpp @@ -114,7 +114,7 @@ template<> ErrorEvent::Init convertDictionary(JSGlobalObject& if (isNullOrUndefined) errorValue = jsUndefined(); else { - errorValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "error"_s)); + errorValue = object->get(&lexicalGlobalObject, vm.propertyNames->error); RETURN_IF_EXCEPTION(throwScope, {}); } if (!errorValue.isUndefined()) { @@ -150,7 +150,7 @@ template<> ErrorEvent::Init convertDictionary(JSGlobalObject& if (isNullOrUndefined) messageValue = jsUndefined(); else { - messageValue = object->get(&lexicalGlobalObject, Identifier::fromString(vm, "message"_s)); + messageValue = object->get(&lexicalGlobalObject, vm.propertyNames->message); RETURN_IF_EXCEPTION(throwScope, {}); } if (!messageValue.isUndefined()) {