aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Liz <accs@liz3.net> 2023-10-18 19:04:45 +0200
committerGravatar GitHub <noreply@github.com> 2023-10-18 10:04:45 -0700
commit9c0cd5c0309c73d226462a2ea0deb1293323e13f (patch)
tree2c05fd5ed270b98f59554d313164bf4562bccae6
parent2f10398c74b771bce738d636429135a679f52bdb (diff)
downloadbun-9c0cd5c0309c73d226462a2ea0deb1293323e13f.tar.gz
bun-9c0cd5c0309c73d226462a2ea0deb1293323e13f.tar.zst
bun-9c0cd5c0309c73d226462a2ea0deb1293323e13f.zip
fix(web): stub `performance.getEntriesByName` (#6542)
Diffstat (limited to '')
-rw-r--r--src/bun.js/bindings/ZigGlobalObject.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/bun.js/bindings/ZigGlobalObject.cpp b/src/bun.js/bindings/ZigGlobalObject.cpp
index 93f9a0fa2..15647cd24 100644
--- a/src/bun.js/bindings/ZigGlobalObject.cpp
+++ b/src/bun.js/bindings/ZigGlobalObject.cpp
@@ -2206,9 +2206,17 @@ static inline EncodedJSValue functionPerformanceNowBody(JSGlobalObject* globalOb
return JSValue::encode(jsDoubleNumber(result));
}
+static inline EncodedJSValue functionPerformanceGetEntriesByNameBody(JSGlobalObject* globalObject) {
+ auto& vm = globalObject->vm();
+ auto* global = reinterpret_cast<GlobalObject*>(globalObject);
+ auto* array = JSC::constructEmptyArray(globalObject, nullptr);
+ return JSValue::encode(array);
+}
+
extern "C" {
class JSPerformanceObject;
static JSC_DECLARE_HOST_FUNCTION(functionPerformanceNow);
+static JSC_DECLARE_HOST_FUNCTION(functionPerformanceGetEntriesByName);
static JSC_DECLARE_JIT_OPERATION_WITHOUT_WTF_INTERNAL(functionPerformanceNowWithoutTypeCheck, JSC::EncodedJSValue, (JSC::JSGlobalObject*, JSPerformanceObject*));
}
@@ -2270,6 +2278,10 @@ private:
this->putDirect(vm, JSC::Identifier::fromString(vm, "markResourceTiming"_s), noopNotImplemented, 0);
this->putDirect(vm, JSC::Identifier::fromString(vm, "measure"_s), noopNotImplemented, 0);
+ // this is a stub impl for getEntriesByName(https://github.com/oven-sh/bun/issues/6537)
+ JSFunction* getEntriesByName = JSFunction::create(
+ vm, globalObject(), 0, String("getEntriesByName"_s), functionPerformanceGetEntriesByName, ImplementationVisibility::Public, NoIntrinsic, functionPerformanceGetEntriesByName, nullptr);
+ this->putDirect(vm, JSC::Identifier::fromString(vm, "getEntriesByName"_s), getEntriesByName, 0);
this->putDirect(
vm,
JSC::Identifier::fromString(vm, "timeOrigin"_s),
@@ -2284,6 +2296,12 @@ JSC_DEFINE_HOST_FUNCTION(functionPerformanceNow, (JSGlobalObject * globalObject,
return functionPerformanceNowBody(globalObject);
}
+
+JSC_DEFINE_HOST_FUNCTION(functionPerformanceGetEntriesByName, (JSGlobalObject * globalObject, JSC::CallFrame* callFrame))
+{
+ return functionPerformanceGetEntriesByNameBody(globalObject);
+}
+
JSC_DEFINE_JIT_OPERATION(functionPerformanceNowWithoutTypeCheck, JSC::EncodedJSValue, (JSC::JSGlobalObject * lexicalGlobalObject, JSPerformanceObject* castedThis))
{
VM& vm = JSC::getVM(lexicalGlobalObject);