diff options
author | 2022-04-01 01:17:36 -0700 | |
---|---|---|
committer | 2022-04-01 01:17:36 -0700 | |
commit | e0011fd6baf2fe2b12d1b2a909981da1a183cdad (patch) | |
tree | e59f664577a99789c933ca2fe60841b10c675893 /src/javascript/jsc/bindings/ZigGlobalObject.cpp | |
parent | 8e0ee052eb900465f6bffb9d4c226d3ca762780a (diff) | |
download | bun-e0011fd6baf2fe2b12d1b2a909981da1a183cdad.tar.gz bun-e0011fd6baf2fe2b12d1b2a909981da1a183cdad.tar.zst bun-e0011fd6baf2fe2b12d1b2a909981da1a183cdad.zip |
[bun.js] Use `Headers` from WebKit instead of custom
Diffstat (limited to 'src/javascript/jsc/bindings/ZigGlobalObject.cpp')
-rw-r--r-- | src/javascript/jsc/bindings/ZigGlobalObject.cpp | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/javascript/jsc/bindings/ZigGlobalObject.cpp b/src/javascript/jsc/bindings/ZigGlobalObject.cpp index a99087abf..178fe3d1d 100644 --- a/src/javascript/jsc/bindings/ZigGlobalObject.cpp +++ b/src/javascript/jsc/bindings/ZigGlobalObject.cpp @@ -86,10 +86,11 @@ #include "JSCustomEvent.h" #include "JSAbortController.h" #include "JSEvent.h" +#include "JSFetchHeaders.h" #include "Process.h" -#include "JavaScriptCore/RemoteInspectorServer.h" +#include <JavaScriptCore/RemoteInspectorServer.h> using JSGlobalObject = JSC::JSGlobalObject; using Exception = JSC::Exception; @@ -372,6 +373,17 @@ JSC_DEFINE_CUSTOM_GETTER(JSCustomEvent_getter, WebCore::JSCustomEvent::getConstructor(JSC::getVM(lexicalGlobalObject), thisObject)); } +JSC_DECLARE_CUSTOM_GETTER(JSFetchHeaders_getter); + +JSC_DEFINE_CUSTOM_GETTER(JSFetchHeaders_getter, + (JSC::JSGlobalObject * lexicalGlobalObject, JSC::EncodedJSValue thisValue, + JSC::PropertyName)) +{ + Zig::GlobalObject* thisObject = JSC::jsCast<Zig::GlobalObject*>(lexicalGlobalObject); + return JSC::JSValue::encode( + WebCore::JSFetchHeaders::getConstructor(JSC::getVM(lexicalGlobalObject), thisObject)); +} + JSC_DECLARE_CUSTOM_GETTER(JSEventTarget_getter); JSC_DEFINE_CUSTOM_GETTER(JSEventTarget_getter, @@ -849,11 +861,14 @@ void GlobalObject::installAPIGlobals(JSClassRef* globals, int count, JSC::VM& vm putDirectCustomAccessor(vm, JSC::Identifier::fromString(vm, "CustomEvent"), JSC::CustomGetterSetter::create(vm, JSCustomEvent_getter, nullptr), JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly); + putDirectCustomAccessor(vm, JSC::Identifier::fromString(vm, "Headers"), JSC::CustomGetterSetter::create(vm, JSFetchHeaders_getter, nullptr), + JSC::PropertyAttribute::DontDelete | JSC::PropertyAttribute::ReadOnly); + extraStaticGlobals.releaseBuffer(); - // this->setRemoteDebuggingEnabled(true); + this->setRemoteDebuggingEnabled(true); // auto& server = Inspector::RemoteInspectorServer::singleton(); - // if (server.start("127.0.0.1", 9222)) { + // if (server.start("localhost", 9222)) { // } } |