@@ -97,27 +97,23 @@ static void copyToUWS(WebCore::FetchHeaders* headers, UWSResponse* res)
9797 auto & internalHeaders = headers->internalHeaders ();
9898
9999 for (auto & value : internalHeaders.getSetCookieHeaders ()) {
100- res->writeHeader (std::string_view (" set-cookie" , 10 ), std::string_view (
101- value.is8Bit () ? reinterpret_cast <const char *>(value.characters8 ()) : value.utf8 ().data (), value.length ()
102- ));
100+ res->writeHeader (std::string_view (" set-cookie" , 10 ), std::string_view (value.is8Bit () ? reinterpret_cast <const char *>(value.characters8 ()) : value.utf8 ().data (), value.length ()));
103101 }
104102
105103 for (auto & header : internalHeaders.commonHeaders ()) {
106104 const auto & name = WebCore::httpHeaderNameString (header.key );
107105 auto & value = header.value ;
108106 res->writeHeader (
109107 std::string_view (name.is8Bit () ? reinterpret_cast <const char *>(name.characters8 ()) : name.utf8 ().data (), name.length ()),
110- std::string_view (value.is8Bit () ? reinterpret_cast <const char *>(value.characters8 ()) : value.utf8 ().data (), value.length ())
111- );
108+ std::string_view (value.is8Bit () ? reinterpret_cast <const char *>(value.characters8 ()) : value.utf8 ().data (), value.length ()));
112109 }
113110
114111 for (auto & header : internalHeaders.uncommonHeaders ()) {
115112 auto & name = header.key ;
116113 auto & value = header.value ;
117114 res->writeHeader (
118115 std::string_view (name.is8Bit () ? reinterpret_cast <const char *>(name.characters8 ()) : name.utf8 ().data (), name.length ()),
119- std::string_view (value.is8Bit () ? reinterpret_cast <const char *>(value.characters8 ()) : value.utf8 ().data (), value.length ())
120- );
116+ std::string_view (value.is8Bit () ? reinterpret_cast <const char *>(value.characters8 ()) : value.utf8 ().data (), value.length ()));
121117 }
122118}
123119
@@ -718,12 +714,11 @@ WebCore__FetchHeaders* WebCore__FetchHeaders__createEmpty()
718714 return new WebCore::FetchHeaders ({ WebCore::FetchHeaders::Guard::None, {} });
719715}
720716void WebCore__FetchHeaders__append (WebCore__FetchHeaders* headers, const ZigString* arg1, const ZigString* arg2,
721- JSC__JSGlobalObject* lexicalGlobalObject)
717+ JSC__JSGlobalObject* lexicalGlobalObject)
722718{
723719 auto throwScope = DECLARE_THROW_SCOPE (lexicalGlobalObject->vm ());
724720 WebCore::propagateException (*lexicalGlobalObject, throwScope,
725- headers->append (Zig::toString (*arg1), Zig::toString (*arg2))
726- );
721+ headers->append (Zig::toString (*arg1), Zig::toString (*arg2)));
727722}
728723WebCore__FetchHeaders* WebCore__FetchHeaders__cast_ (JSC__JSValue JSValue0, JSC__VM* vm)
729724{
@@ -752,8 +747,7 @@ WebCore__FetchHeaders* WebCore__FetchHeaders__createFromJS(JSC__JSGlobalObject*
752747 // ExceptionOr<void>. So we need to check for the exception and, if set,
753748 // translate it to JSValue and throw it.
754749 WebCore::propagateException (*lexicalGlobalObject, throwScope,
755- headers->fill (WTFMove (init.value ()))
756- );
750+ headers->fill (WTFMove (init.value ())));
757751 }
758752 return headers;
759753}
@@ -770,8 +764,7 @@ JSC__JSValue WebCore__FetchHeaders__clone(WebCore__FetchHeaders* headers, JSC__J
770764 Zig::GlobalObject* globalObject = reinterpret_cast <Zig::GlobalObject*>(arg1);
771765 auto * clone = new WebCore::FetchHeaders ({ WebCore::FetchHeaders::Guard::None, {} });
772766 WebCore::propagateException (*arg1, throwScope,
773- clone->fill (*headers)
774- );
767+ clone->fill (*headers));
775768 return JSC::JSValue::encode (WebCore::toJSNewlyCreated (arg1, globalObject, WTFMove (clone)));
776769}
777770
@@ -780,8 +773,7 @@ WebCore__FetchHeaders* WebCore__FetchHeaders__cloneThis(WebCore__FetchHeaders* h
780773 auto throwScope = DECLARE_THROW_SCOPE (lexicalGlobalObject->vm ());
781774 auto * clone = new WebCore::FetchHeaders ({ WebCore::FetchHeaders::Guard::None, {} });
782775 WebCore::propagateException (*lexicalGlobalObject, throwScope,
783- clone->fill (*headers)
784- );
776+ clone->fill (*headers));
785777 return clone;
786778}
787779
@@ -936,9 +928,8 @@ JSC__JSValue WebCore__FetchHeaders__createValue(JSC__JSGlobalObject* arg0, Strin
936928 }
937929
938930 Ref<WebCore::FetchHeaders> headers = WebCore::FetchHeaders::create ();
939- WebCore::propagateException (*arg0, throwScope,
940- headers->fill (WebCore::FetchHeaders::Init (WTFMove (pairs)))
941- );
931+ WebCore::propagateException (*arg0, throwScope,
932+ headers->fill (WebCore::FetchHeaders::Init (WTFMove (pairs))));
942933 pairs.releaseBuffer ();
943934 return JSC::JSValue::encode (WebCore::toJSNewlyCreated (arg0, reinterpret_cast <Zig::GlobalObject*>(arg0), WTFMove (headers)));
944935}
@@ -965,15 +956,13 @@ void WebCore__FetchHeaders__put_(WebCore__FetchHeaders* headers, const ZigString
965956{
966957 auto throwScope = DECLARE_THROW_SCOPE (global->vm ());
967958 WebCore::propagateException (*global, throwScope,
968- headers->set (Zig::toString (*arg1), Zig::toString (*arg2))
969- );
959+ headers->set (Zig::toString (*arg1), Zig::toString (*arg2)));
970960}
971961void WebCore__FetchHeaders__remove (WebCore__FetchHeaders* headers, const ZigString* arg1, JSC__JSGlobalObject* global)
972962{
973963 auto throwScope = DECLARE_THROW_SCOPE (global->vm ());
974964 WebCore::propagateException (*global, throwScope,
975- headers->remove (Zig::toString (*arg1))
976- );
965+ headers->remove (Zig::toString (*arg1)));
977966}
978967
979968void WebCore__FetchHeaders__fastRemove_ (WebCore__FetchHeaders* headers, unsigned char headerName)
@@ -3762,6 +3751,40 @@ void JSC__JSValue__forEachProperty(JSC__JSValue JSValue0, JSC__JSGlobalObject* g
37623751 }
37633752}
37643753
3754+ inline bool propertyCompare (const std::pair<String, JSValue>& a, const std::pair<String, JSValue>& b)
3755+ {
3756+ return codePointCompare (a.first .impl (), b.first .impl ()) < 0 ;
3757+ }
3758+
3759+ void JSC__JSValue__forEachPropertyOrdered (JSC__JSValue JSValue0, JSC__JSGlobalObject* globalObject, void * arg2, void (*iter)(JSC__JSGlobalObject* arg0, void * ctx, ZigString* arg2, JSC__JSValue JSValue3, bool isSymbol))
3760+ {
3761+ JSC::JSValue value = JSC::JSValue::decode (JSValue0);
3762+ JSC::JSObject* object = value.getObject ();
3763+ if (!object)
3764+ return ;
3765+
3766+ JSC::VM& vm = globalObject->vm ();
3767+ auto scope = DECLARE_CATCH_SCOPE (vm);
3768+
3769+ JSC::PropertyNameArray properties (vm, PropertyNameMode::StringsAndSymbols, PrivateSymbolMode::Exclude);
3770+ JSC::JSObject::getOwnPropertyNames (object, globalObject, properties, DontEnumPropertiesMode::Include);
3771+
3772+ Vector<std::pair<String, JSValue>> ordered_properties;
3773+ for (auto property : properties) {
3774+ JSValue propertyValue = object->getDirect (vm, property);
3775+ ordered_properties.append (std::pair<String, JSValue>(property.isSymbol () && !property.isPrivateName () ? property.impl () : property.string (), propertyValue));
3776+ }
3777+
3778+ std::sort (ordered_properties.begin (), ordered_properties.end (), propertyCompare);
3779+
3780+ for (auto item : ordered_properties) {
3781+ ZigString key = toZigString (item.first );
3782+ JSValue propertyValue = item.second ;
3783+ JSC::EnsureStillAliveScope ensureStillAliveScope (propertyValue);
3784+ iter (globalObject, arg2, &key, JSC::JSValue::encode (propertyValue), propertyValue.isSymbol ());
3785+ }
3786+ }
3787+
37653788extern " C" JSC__JSValue JSC__JSValue__createRopeString (JSC__JSValue JSValue0, JSC__JSValue JSValue1, JSC__JSGlobalObject* globalObject)
37663789{
37673790 return JSValue::encode (JSC::jsString (globalObject, JSC::JSValue::decode (JSValue0).toString (globalObject), JSC::JSValue::decode (JSValue1).toString (globalObject)));
@@ -3796,39 +3819,44 @@ extern "C" void JSC__JSGlobalObject__queueMicrotaskJob(JSC__JSGlobalObject* arg0
37963819 JSC::JSValue::decode (JSValue4));
37973820}
37983821
3799- extern " C" JSC__AbortSignal* JSC__AbortSignal__signal (JSC__AbortSignal* arg0, JSC__JSValue JSValue1) {
3822+ extern " C" JSC__AbortSignal* JSC__AbortSignal__signal (JSC__AbortSignal* arg0, JSC__JSValue JSValue1)
3823+ {
38003824 WebCore::AbortSignal* abortSignal = reinterpret_cast <WebCore::AbortSignal*>(arg0);
38013825 abortSignal->signalAbort (JSC::JSValue::decode (JSValue1));
38023826 return arg0;
38033827}
38043828
3805- extern " C" bool JSC__AbortSignal__aborted (JSC__AbortSignal* arg0) {
3829+ extern " C" bool JSC__AbortSignal__aborted (JSC__AbortSignal* arg0)
3830+ {
38063831 WebCore::AbortSignal* abortSignal = reinterpret_cast <WebCore::AbortSignal*>(arg0);
38073832 return abortSignal->aborted ();
38083833}
38093834
3810- extern " C" JSC__JSValue JSC__AbortSignal__abortReason (JSC__AbortSignal* arg0) {
3835+ extern " C" JSC__JSValue JSC__AbortSignal__abortReason (JSC__AbortSignal* arg0)
3836+ {
38113837 WebCore::AbortSignal* abortSignal = reinterpret_cast <WebCore::AbortSignal*>(arg0);
38123838 return JSC::JSValue::encode (abortSignal->reason ().getValue ());
38133839}
38143840
3815-
3816- extern " C " JSC__AbortSignal* JSC__AbortSignal__ref (JSC__AbortSignal* arg0) {
3841+ extern " C " JSC__AbortSignal* JSC__AbortSignal__ref (JSC__AbortSignal* arg0)
3842+ {
38173843 WebCore::AbortSignal* abortSignal = reinterpret_cast <WebCore::AbortSignal*>(arg0);
38183844 abortSignal->ref ();
38193845 return arg0;
38203846}
38213847
3822- extern " C" JSC__AbortSignal* JSC__AbortSignal__unref (JSC__AbortSignal* arg0) {
3848+ extern " C" JSC__AbortSignal* JSC__AbortSignal__unref (JSC__AbortSignal* arg0)
3849+ {
38233850 WebCore::AbortSignal* abortSignal = reinterpret_cast <WebCore::AbortSignal*>(arg0);
38243851 abortSignal->deref ();
38253852 return arg0;
38263853}
38273854
3828- extern " C" JSC__AbortSignal* JSC__AbortSignal__addListener (JSC__AbortSignal* arg0, void * ctx, void (*callback)(void * ctx, JSC__JSValue reason)) {
3855+ extern " C" JSC__AbortSignal* JSC__AbortSignal__addListener (JSC__AbortSignal* arg0, void * ctx, void (*callback)(void * ctx, JSC__JSValue reason))
3856+ {
38293857 WebCore::AbortSignal* abortSignal = reinterpret_cast <WebCore::AbortSignal*>(arg0);
3830-
3831- if (abortSignal->aborted ()){
3858+
3859+ if (abortSignal->aborted ()) {
38323860 callback (ctx, JSC::JSValue::encode (abortSignal->reason ().getValue ()));
38333861 return arg0;
38343862 }
@@ -3859,7 +3887,7 @@ extern "C" JSC__JSValue JSC__AbortSignal__createAbortError(const ZigString* mess
38593887 error->putDirect (
38603888 vm, vm.propertyNames ->name ,
38613889 JSC::JSValue (JSC::jsOwnedString (vm, ABORT_ERROR_NAME)),
3862- 0 );
3890+ 0 );
38633891
38643892 if (code.len > 0 ) {
38653893 auto clientData = WebCore::clientData (vm);
@@ -3881,7 +3909,7 @@ extern "C" JSC__JSValue JSC__AbortSignal__createTimeoutError(const ZigString* me
38813909 error->putDirect (
38823910 vm, vm.propertyNames ->name ,
38833911 JSC::JSValue (JSC::jsOwnedString (vm, TIMEOUT_ERROR_NAME)),
3884- 0 );
3912+ 0 );
38853913
38863914 if (code.len > 0 ) {
38873915 auto clientData = WebCore::clientData (vm);
0 commit comments