Skip to content

Commit 58728cd

Browse files
committed
review
1 parent ce3b6c8 commit 58728cd

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/bun.js/bindings/webcore/JSEventTarget.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -226,18 +226,18 @@ static inline JSC::EncodedJSValue jsEventTargetPrototypeFunction_addEventListene
226226
RETURN_IF_EXCEPTION(throwScope, {});
227227
// Emit a warning if listener is null, as it has no effect
228228
if (!listener) {
229-
auto& vm = JSC::getVM(lexicalGlobalObject);
230229
String warningMessage;
231230
if (argument1.value().isNull()) {
232-
warningMessage = makeString("addEventListener called with null listener, which has no effect."_s);
231+
warningMessage = "addEventListener called with null listener, which has no effect."_s;
233232
} else {
234-
warningMessage = makeString("addEventListener called with undefined listener, which has no effect."_s);
233+
warningMessage = "addEventListener called with undefined listener, which has no effect."_s;
235234
}
236235
auto errorInstance = JSC::ErrorInstance::create(vm, lexicalGlobalObject->errorStructure(JSC::ErrorType::Error), warningMessage, JSValue(), nullptr, RuntimeType::TypeNothing, JSC::ErrorType::Error);
237-
errorInstance->putDirect(vm, vm.propertyNames->name, jsString(vm, makeString("AddEventListenerArgumentTypeWarning"_s)));
238-
errorInstance->putDirect(vm, vm.propertyNames->target, &static_cast<JSObject&>(*castedThis));
236+
errorInstance->putDirect(vm, vm.propertyNames->name, jsString(vm, String("AddEventListenerArgumentTypeWarning"_s)));
237+
JSObject& target = *castedThis;
238+
errorInstance->putDirect(vm, vm.propertyNames->target, &target);
239239
RETURN_IF_EXCEPTION(throwScope, {});
240-
errorInstance->putDirect(vm, vm.propertyNames->type, jsString(vm, type));
240+
errorInstance->putDirect(vm, vm.propertyNames->type, jsString(vm, WTFMove(type)));
241241
Bun::Process::emitWarningErrorInstance(lexicalGlobalObject, errorInstance);
242242
RETURN_IF_EXCEPTION(throwScope, {});
243243
}

0 commit comments

Comments
 (0)