Upgrade webkit (#9885)

* span

* remove JSStringIsEqualToString

* bump webkit tag

* span literal

* undo

* fix windows build

* Update JSStringDecoder.cpp

* Update JSStringDecoder.cpp

* Update JSStringDecoder.cpp

---------

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
This commit is contained in:
Dylan Conway
2024-04-03 17:10:39 -07:00
committed by GitHub
parent 390441327f
commit c831dd8db8
40 changed files with 449 additions and 458 deletions

View File

@@ -9,6 +9,8 @@
#include "JSDOMConvertEnumeration.h"
#include <JavaScriptCore/JSArrayBufferView.h>
#include "BunClientData.h"
#include "wtf/text/StringImpl.h"
#include "wtf/unicode/CharacterNames.h"
namespace WebCore {
@@ -22,6 +24,12 @@ static JSC_DECLARE_CUSTOM_GETTER(jsStringDecoder_lastChar);
static JSC_DECLARE_CUSTOM_GETTER(jsStringDecoder_lastNeed);
static JSC_DECLARE_CUSTOM_GETTER(jsStringDecoder_lastTotal);
static WTF::String replacementString()
{
return WTF::String(std::span<const UChar> { u"\uFFFD", 1 });
}
static inline JSC::EncodedJSValue jsStringDecoderCast(JSGlobalObject* globalObject, JSValue stringDecoderValue)
{
if (LIKELY(jsDynamicCast<JSStringDecoder*>(stringDecoderValue)))
@@ -75,17 +83,17 @@ JSC::JSValue JSStringDecoder::fillLast(JSC::VM& vm, JSC::JSGlobalObject* globalO
// utf8CheckExtraBytes
if ((bufPtr[0] & 0xC0) != 0x80) {
m_lastNeed = 0;
RELEASE_AND_RETURN(throwScope, JSC::jsString(vm, WTF::String(u"\uFFFD", 1)));
RELEASE_AND_RETURN(throwScope, JSC::jsString(vm, replacementString()));
}
if (m_lastNeed > 1 && length > 1) {
if ((bufPtr[1] & 0xC0) != 0x80) {
m_lastNeed = 1;
RELEASE_AND_RETURN(throwScope, JSC::jsString(vm, WTF::String(u"\uFFFD", 1)));
RELEASE_AND_RETURN(throwScope, JSC::jsString(vm, replacementString()));
}
if (m_lastNeed > 2 && length > 2) {
if ((bufPtr[2] & 0xC0) != 0x80) {
m_lastNeed = 2;
RELEASE_AND_RETURN(throwScope, JSC::jsString(vm, WTF::String(u"\uFFFD", 1)));
RELEASE_AND_RETURN(throwScope, JSC::jsString(vm, replacementString()));
}
}
}
@@ -297,11 +305,11 @@ JSStringDecoder::end(JSC::VM& vm, JSC::JSGlobalObject* globalObject, uint8_t* bu
}
case BufferEncodingType::utf8: {
if (length == 0) {
RELEASE_AND_RETURN(throwScope, m_lastNeed ? JSC::jsString(vm, WTF::String(u"\uFFFD", 1)) : JSC::jsEmptyString(vm));
RELEASE_AND_RETURN(throwScope, m_lastNeed ? JSC::jsString(vm, replacementString()) : JSC::jsEmptyString(vm));
}
JSString* firstHalf = write(vm, globalObject, bufPtr, length).toString(globalObject);
RETURN_IF_EXCEPTION(throwScope, JSC::jsUndefined());
RELEASE_AND_RETURN(throwScope, m_lastNeed ? JSC::jsString(globalObject, firstHalf, WTF::String(u"\uFFFD", 1)) : firstHalf);
RELEASE_AND_RETURN(throwScope, m_lastNeed ? JSC::jsString(globalObject, firstHalf, replacementString()) : firstHalf);
}
case BufferEncodingType::base64:
case BufferEncodingType::base64url: {