Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop String constructors taking in a raw pointer and a length #26611

Merged
merged 1 commit into from
Mar 30, 2024

Conversation

cdumez
Copy link
Contributor

@cdumez cdumez commented Mar 29, 2024

c04fd9f

Drop String constructors taking in a raw pointer and a length
https://bugs.webkit.org/show_bug.cgi?id=271888

Reviewed by Darin Adler.

Drop String constructors taking in a raw pointer and a length, in favor of the
ones taking in a std::span.

* Source/JavaScriptCore/API/OpaqueJSString.h:
(OpaqueJSString::OpaqueJSString):
* Source/JavaScriptCore/API/tests/JSONParseTest.cpp:
(testJSONParse):
* Source/JavaScriptCore/dfg/DFGLazyJSValue.cpp:
(JSC::DFG::LazyJSValue::tryGetString const):
* Source/JavaScriptCore/parser/Lexer.cpp:
(JSC::Lexer<CharacterType>::parseCommentDirectiveValue):
* Source/JavaScriptCore/runtime/FuzzerPredictions.cpp:
(JSC::readFileIntoString):
* Source/JavaScriptCore/runtime/IntlCollator.cpp:
(JSC::IntlCollator::sortLocaleData):
(JSC::IntlCollator::checkICULocaleInvariants):
* Source/JavaScriptCore/runtime/IntlDateTimeFormat.cpp:
(JSC::IntlDateTimeFormat::localeData):
* Source/JavaScriptCore/runtime/IntlDisplayNames.cpp:
(JSC::IntlDisplayNames::of const):
* Source/JavaScriptCore/runtime/IntlDurationFormat.cpp:
(JSC::retrieveSeparator):
* Source/JavaScriptCore/runtime/IntlLocale.cpp:
(JSC::IntlLocale::language):
(JSC::IntlLocale::script):
(JSC::IntlLocale::region):
(JSC::IntlLocale::calendars):
(JSC::IntlLocale::collations):
(JSC::IntlLocale::timeZones):
* Source/JavaScriptCore/runtime/IntlNumberFormat.cpp:
(JSC::IntlNumberFormat::formatRange const):
* Source/JavaScriptCore/runtime/IntlObject.cpp:
(JSC::languageTagForLocaleID):
(JSC::intlAvailableCalendars):
(JSC::availableCollations):
(JSC::availableCurrencies):
(JSC::availableNumberingSystems):
(JSC::intlAvailableTimeZones):
* Source/JavaScriptCore/runtime/IntlPluralRules.cpp:
(JSC::IntlPluralRules::resolvedOptions const):
* Source/JavaScriptCore/runtime/JSImmutableButterfly.cpp:
(JSC::JSImmutableButterfly::createFromString):
* Source/JavaScriptCore/runtime/JSONObject.cpp:
(JSC::gap):
(JSC::FastStringifier<CharType>::result const):
* Source/JavaScriptCore/runtime/LiteralParser.cpp:
(JSC::LiteralParser<CharType>::makeJSString):
* Source/JavaScriptCore/runtime/NumberPrototype.cpp:
(JSC::toStringWithRadixInternal):
* Source/JavaScriptCore/tools/FunctionAllowlist.cpp:
(JSC::FunctionAllowlist::FunctionAllowlist):
* Source/JavaScriptCore/tools/FunctionOverrides.cpp:
(JSC::parseClause):
* Source/JavaScriptCore/wasm/WasmIndexOrName.cpp:
(JSC::Wasm::makeString):
* Source/WTF/wtf/URLHelpers.cpp:
(WTF::URLHelpers::mapHostName):
* Source/WTF/wtf/UUID.cpp:
(WTF::bootSessionUUIDString):
* Source/WTF/wtf/text/StringView.h:
(WTF::StringView::toString const):
* Source/WTF/wtf/text/WTFString.cpp:
(WTF::String::String):
(WTF::String::fromCodePoint):
* Source/WTF/wtf/text/WTFString.h:
(WTF::IntegerToStringConversionTrait<String>::flush):
(WTF::StringLiterals::operator _str):
* Source/WebCore/Modules/encryptedmedia/InitDataRegistry.cpp:
(WebCore::extractKeyIDsKeyids):
* Source/WebCore/Modules/websockets/WebSocketExtensionParser.cpp:
(WebCore::WebSocketExtensionParser::consumeToken):
* Source/WebCore/PAL/pal/text/TextCodecReplacement.cpp:
(PAL::TextCodecReplacement::decode):
* Source/WebCore/accessibility/AccessibilityMathMLElement.cpp:
(WebCore::AccessibilityMathMLElement::textUnderElement const):
* Source/WebCore/bindings/js/SerializedScriptValue.cpp:
(WebCore::CloneDeserializer::readString):
* Source/WebCore/crypto/SubtleCrypto.cpp:
(WebCore::SubtleCrypto::unwrapKey):
* Source/WebCore/css/CSSCounterStyle.cpp:
(WebCore::counterForSystemCJK):
(WebCore::CSSCounterStyle::counterForSystemEthiopicNumeric):
* Source/WebCore/css/process-css-properties.py:
(GenerateCSSPropertyNames):
* Source/WebCore/editing/Editing.cpp:
(WebCore::nonBreakingSpaceString):
* Source/WebCore/fileapi/FileReaderLoader.cpp:
(WebCore::FileReaderLoader::stringResult):
* Source/WebCore/html/FTPDirectoryDocument.cpp:
(WebCore::FTPDirectoryDocumentParser::appendEntry):
(WebCore::FTPDirectoryDocumentParser::loadDocumentTemplate):
* Source/WebCore/html/TypeAhead.cpp:
(WebCore::TypeAhead::handleEvent):
* Source/WebCore/html/parser/AtomHTMLToken.h:
(WebCore::AtomHTMLToken::AtomHTMLToken):
* Source/WebCore/html/parser/CSSPreloadScanner.cpp:
(WebCore::parseCSSStringOrURL):
* Source/WebCore/html/parser/HTMLDocumentParserFastPath.cpp:
(WebCore::HTMLFastPathParser::scanText):
* Source/WebCore/html/parser/HTMLEntityParser.cpp:
(WebCore::SegmentedStringSource::pushBackButKeep):
* Source/WebCore/html/parser/HTMLInputStream.h:
(WebCore::HTMLInputStream::markEndOfFile):
* Source/WebCore/html/shadow/DateTimeNumericFieldElement.cpp:
(WebCore::DateTimeNumericFieldElement::handleKeyboardEvent):
* Source/WebCore/html/track/VTTScanner.cpp:
(WebCore::VTTScanner::extractString):
* Source/WebCore/html/track/VTTScanner.h:
* Source/WebCore/html/track/WebVTTTokenizer.cpp:
(WebCore::WebVTTTokenizer::WebVTTTokenizer):
* Source/WebCore/inspector/InspectorStyleSheet.cpp:
(WebCore::fixUnparsedProperties):
* Source/WebCore/layout/formattingContexts/inline/display/InlineDisplayContentBuilder.cpp:
(WebCore::Layout::InlineDisplayContentBuilder::appendTextDisplayBox):
* Source/WebCore/loader/FTPDirectoryParser.cpp:
(WebCore::parseOneFTPLine):
* Source/WebCore/loader/FormSubmission.cpp:
(WebCore::appendMailtoPostFormDataToURL):
* Source/WebCore/loader/LinkHeader.cpp:
(WebCore::findURLBoundaries):
(WebCore::parseParameterValue):
* Source/WebCore/loader/ResourceCryptographicDigest.cpp:
(WebCore::parseCryptographicDigestImpl):
(WebCore::parseEncodedCryptographicDigestImpl):
* Source/WebCore/loader/appcache/ApplicationCacheManifestParser.cpp:
(WebCore::makeManifestURL):
* Source/WebCore/loader/appcache/ApplicationCacheStorage.cpp:
(WebCore::parseHeader):
* Source/WebCore/page/EventSource.cpp:
(WebCore::EventSource::dispatchMessageEvent):
* Source/WebCore/page/csp/ContentSecurityPolicy.cpp:
(WebCore::ContentSecurityPolicy::didReceiveHeader):
* Source/WebCore/page/csp/ContentSecurityPolicyDirectiveList.cpp:
(WebCore::ContentSecurityPolicyDirectiveList::parseDirective):
(WebCore::ContentSecurityPolicyDirectiveList::parseRequireTrustedTypesFor):
* Source/WebCore/page/csp/ContentSecurityPolicyMediaListDirective.cpp:
(WebCore::ContentSecurityPolicyMediaListDirective::parse):
* Source/WebCore/page/csp/ContentSecurityPolicySourceList.cpp:
(WebCore::ContentSecurityPolicySourceList::parse):
(WebCore::ContentSecurityPolicySourceList::parsePath):
(WebCore::ContentSecurityPolicySourceList::parseNonceSource):
* Source/WebCore/page/csp/ContentSecurityPolicyTrustedTypesDirective.cpp:
(WebCore::ContentSecurityPolicyTrustedTypesDirective::parse):
* Source/WebCore/platform/cocoa/KeyEventCocoa.mm:
(WebCore::keyForCharCode):
* Source/WebCore/platform/encryptedmedia/CDMUtilities.cpp:
(WebCore::CDMUtilities::parseJSONObject):
* Source/WebCore/platform/graphics/FontCascade.h:
(WebCore::FontCascade::widthOfSpaceString const):
* Source/WebCore/platform/graphics/StringTruncator.cpp:
(WebCore::truncateString):
* Source/WebCore/platform/graphics/TextRun.h:
(WebCore::TextRun::isolatedCopy const):
* Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp:
(WebCore::GraphicsContextGLANGLE::getActiveAttribImpl):
(WebCore::GraphicsContextGLANGLE::getActiveUniformImpl):
(WebCore::GraphicsContextGLANGLE::getProgramInfoLog):
(WebCore::GraphicsContextGLANGLE::getShaderInfoLog):
(WebCore::GraphicsContextGLANGLE::getActiveUniformBlockName):
(WebCore::GraphicsContextGLANGLE::getTransformFeedbackVarying):
(WebCore::GraphicsContextGLANGLE::getTranslatedShaderSourceANGLE):
* Source/WebCore/platform/graphics/avfoundation/CDMFairPlayStreaming.cpp:
(WebCore::extractSinfData):
(WebCore::CDMPrivateFairPlayStreaming::extractKeyIDsMpts):
* Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
(WebCore::MediaPlayerPrivateAVFoundation::extractKeyURIKeyIDAndCertificateFromInitData):
* Source/WebCore/platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
(WebCore::parseJSONValue):
* Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm:
(WebCore::FontPlatformData::variationAxes const):
* Source/WebCore/platform/graphics/cocoa/SourceBufferParserWebM.cpp:
(WebCore::WebMParser::OnTrackEntry):
* Source/WebCore/platform/network/HTTPHeaderMap.cpp:
(WebCore::HTTPHeaderMap::set):
* Source/WebCore/platform/network/HTTPParsers.cpp:
(WebCore::trimInputSample):
(WebCore::parseHTTPHeader):
* Source/WebCore/platform/network/RFC8941.cpp:
(RFC8941::parseToken):
* Source/WebCore/platform/text/SegmentedString.cpp:
(WebCore::SegmentedString::advancePastSlowCase):
* Source/WebCore/rendering/RenderCombineText.cpp:
(WebCore::RenderCombineText::combineTextIfNeeded):
* Source/WebCore/rendering/RenderFileUploadControl.cpp:
(WebCore::RenderFileUploadControl::computeIntrinsicLogicalWidths const):
* Source/WebCore/rendering/RenderListMarker.cpp:
(WebCore::RenderListMarker::textRun const):
* Source/WebCore/rendering/RenderTextControl.cpp:
(WebCore::RenderTextControl::getAverageCharWidth):
* Source/WebCore/rendering/svg/SVGTextMetrics.cpp:
(WebCore::SVGTextMetrics::SVGTextMetrics):
* Source/WebCore/svg/SVGParserUtilities.cpp:
(WebCore::parseGlyphName):
(WebCore::parseKerningUnicodeString):
* Source/WebCore/svg/SVGStringList.cpp:
(WebCore::SVGStringList::parse):
* Source/WebCore/svg/SVGToOTFFontConversion.cpp:
(WebCore::codepointToString):
* Source/WebCore/svg/SVGViewSpec.cpp:
(WebCore::SVGViewSpec::parseViewSpec):
* Source/WebCore/testing/MockCDMFactory.cpp:
(WebCore::MockCDMInstanceSession::updateLicense):
* Source/WebKit/UIProcess/API/APIContentRuleListStore.cpp:
(API::getContentRuleListSourceFromMappedFile):
* Source/WebKit/UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
(WebKit::WebPasteboardProxy::testIPCSharedMemory):
* Source/WebKit/UIProcess/mac/WebViewImpl.mm:
(WebKit::commandNameForSelector):
* Source/WebKit/WebProcess/Network/webrtc/LibWebRTCResolver.cpp:
(WebKit::LibWebRTCResolver::start):
* Source/WebKitLegacy/mac/WebView/WebHTMLView.mm:
(commandNameForSelector):
* Tools/DumpRenderTree/TestRunner.cpp:
(TestRunner::runUIScript):
* Tools/TestRunnerShared/UIScriptContext/UIScriptContext.cpp:
(UIScriptContext::tryToCompleteUIScriptForCurrentParentCallback):
* Tools/TestWebKitAPI/Tests/WTF/HexNumber.cpp:
* Tools/TestWebKitAPI/Tests/WTF/NativePromise.cpp:
(TestWebKitAPI::PhotoProducer::takePhotoImpl const):
* Tools/TestWebKitAPI/Tests/WTF/StringBuilder.cpp:
(TestWebKitAPI::expectBuilderContent):
(TestWebKitAPI::TEST(StringBuilderTest, Append)):
(TestWebKitAPI::TEST(StringBuilderTest, VariadicAppend)):
* Tools/TestWebKitAPI/Tests/WTF/StringOperators.cpp:
(TestWebKitAPI::TEST(WTF, ConcatenateCharacterArrayAndEmptyString)):
* Tools/TestWebKitAPI/Tests/WTF/StringView.cpp:
(TestWebKitAPI::TEST(WTF, StringViewContainsOnlyASCII)):
* Tools/TestWebKitAPI/Tests/WTF/TextBreakIterator.cpp:
(TestWebKitAPI::makeUTF16):
* Tools/TestWebKitAPI/Tests/WTF/WTFString.cpp:
(TestWebKitAPI::TEST(WTF, StringUnicodeEqualUCharArray)):
* Tools/TestWebKitAPI/Tests/WTF/cocoa/URLExtras.mm:
(TestWebKitAPI::TEST(WTF_URLExtras, URLExtras_ParsingError)):
* Tools/TestWebKitAPI/Tests/WebCore/CBORReaderTest.cpp:
(TestWebKitAPI::TEST(CBORReaderTest, TestReadStringWithNUL)):
* Tools/TestWebKitAPI/Tests/WebCore/FileMonitor.cpp:
(TestWebKitAPI::readContentsOfFile):
* Tools/TestWebKitAPI/Tests/WebCore/SharedBuffer.cpp:
(TestWebKitAPI::TEST_F):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/Download.mm:
(longString):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/EventAttribution.mm:
(TestWebKitAPI::signUnlinkableTokenAndSendSecretToken):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/ServiceWorkerBasic.mm:
((ServiceWorker, ExtensionServiceWorkerDisableCORS)):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionAPIWebNavigation.mm:
(TestWebKitAPI::longString):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/WebPushDaemon.mm:
* Tools/TestWebKitAPI/cocoa/HTTPServer.mm:
(TestWebKitAPI::HTTPServer::parsePath):
(TestWebKitAPI::HTTPServer::parseBody):
* Tools/WebKitTestRunner/TestController.cpp:
(WTR::TestController::createTestURL):

Canonical link: https://commits.webkit.org/276859@main

e949a4f

Misc iOS, tvOS & watchOS macOS Linux Windows
βœ… πŸ§ͺ style βœ… πŸ›  ios βœ… πŸ›  mac βœ… πŸ›  wpe βœ… πŸ›  wincairo
βœ… πŸ§ͺ bindings βœ… πŸ›  ios-sim βœ… πŸ›  mac-AS-debug βœ… πŸ§ͺ wpe-wk2
βœ… πŸ§ͺ webkitperl βœ… πŸ§ͺ ios-wk2   πŸ§ͺ api-mac βœ… πŸ§ͺ api-wpe
βœ… πŸ§ͺ ios-wk2-wpt   πŸ§ͺ mac-wk1 βœ… πŸ›  wpe-skia
  πŸ›  πŸ§ͺ jsc βœ… πŸ§ͺ api-ios   πŸ§ͺ mac-wk2   πŸ›  gtk
βœ… πŸ›  πŸ§ͺ jsc-arm64 βœ… πŸ›  tv βœ… πŸ§ͺ mac-AS-debug-wk2 ❌ πŸ§ͺ gtk-wk2
βœ… πŸ›  tv-sim βœ… πŸ§ͺ api-gtk
βœ… πŸ›  watch βœ… πŸ›  jsc-armv7
βœ… πŸ›  πŸ§ͺ unsafe-merge βœ… πŸ›  watch-sim βœ… πŸ§ͺ jsc-armv7-tests

@cdumez cdumez self-assigned this Mar 29, 2024
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Mar 29, 2024
@cdumez cdumez removed the merging-blocked Applied to prevent a change from being merged label Mar 29, 2024
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Mar 29, 2024
@cdumez cdumez removed the merging-blocked Applied to prevent a change from being merged label Mar 29, 2024
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Mar 29, 2024
@cdumez cdumez removed the merging-blocked Applied to prevent a change from being merged label Mar 29, 2024
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Mar 29, 2024
@cdumez cdumez removed the merging-blocked Applied to prevent a change from being merged label Mar 29, 2024
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Mar 29, 2024
@cdumez cdumez removed the merging-blocked Applied to prevent a change from being merged label Mar 29, 2024
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Mar 29, 2024
@cdumez cdumez removed the merging-blocked Applied to prevent a change from being merged label Mar 29, 2024
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Mar 29, 2024
@cdumez cdumez removed the merging-blocked Applied to prevent a change from being merged label Mar 29, 2024
@@ -131,7 +131,7 @@ String LazyJSValue::tryGetString(Graph& graph) const
return u.stringImpl;

case SingleCharacterString:
return String(&u.character, 1);
return String(span(u.character));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need String() here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do not.

@@ -43,7 +43,7 @@ static String readFileIntoString(const char* fileName)
size_t readSize = fread(buffer.data(), 1, buffer.size(), file);
fclose(file);
RELEASE_ASSERT(readSize == buffer.size());
return String(buffer.data(), buffer.size());
return String(buffer.span());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need String() here?

β€˜I also think String::createUninitialized would allow us to do this without two copies. And there should be a helper function version of this, not written out here.

@@ -340,7 +340,7 @@ JSValue IntlDisplayNames::of(JSGlobalObject* globalObject, JSValue codeValue) co
// uldn_localeDisplayName, uldn_regionDisplayName, and uldn_scriptDisplayName return U_ILLEGAL_ARGUMENT_ERROR if the display-name is not found.
// We should return undefined if fallback is "none". Otherwise, we should return input value.
if (status == U_ILLEGAL_ARGUMENT_ERROR)
return (m_fallback == Fallback::None) ? jsUndefined() : jsString(vm, String(canonicalCode.data(), canonicalCode.length()));
return (m_fallback == Fallback::None) ? jsUndefined() : jsString(vm, String(canonicalCode.span()));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can omit String() here?

@@ -457,7 +457,7 @@ const String& IntlLocale::language()
Vector<char, 8> buffer;
auto status = callBufferProducingFunction(uloc_getLanguage, m_localeID.data(), buffer);
ASSERT_UNUSED(status, U_SUCCESS(status));
m_language = String(buffer.data(), buffer.size());
m_language = String(buffer.span());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we omit String() here?

@@ -469,7 +469,7 @@ const String& IntlLocale::script()
Vector<char, 4> buffer;
auto status = callBufferProducingFunction(uloc_getScript, m_localeID.data(), buffer);
ASSERT_UNUSED(status, U_SUCCESS(status));
m_script = String(buffer.data(), buffer.size());
m_script = String(buffer.span());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we omit String() here?

@@ -224,7 +224,7 @@ static String unmodifiedTextFromEvent(WPARAM wparam, WebEventType type)
return String();

UChar c = static_cast<UChar>(wparam);
return String(&c, 1);
return String(span(c));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can omit String() here.

@@ -1172,7 +1172,7 @@ HTTPServer server([receivedFirstConnection = false] (Connection connection) muta
String longString(LChar c)
{
Vector<LChar> vector(length, c);
return String(vector.data(), length);
return String(vector.span());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can omit String() here.

@@ -268,7 +268,7 @@
String longString(LChar c)
{
Vector<LChar> vector(length, c);
return String(vector.data(), length);
return String(vector.span());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can omit String() here.

@@ -375,15 +375,15 @@ static void appendUTF8ToVector(Vector<uint8_t>& vector, const String& string)
pathPrefixLength = strlen(postPathPrefix);
ASSERT_WITH_MESSAGE(pathPrefixLength, "HTTPServer assumes request is GET or POST");
size_t pathLength = pathEnd - request.data() - pathPrefixLength;
return String(request.data() + pathPrefixLength, pathLength);
return String(request.subspan(pathPrefixLength, pathLength));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can omit String() here.

}

String HTTPServer::parseBody(const Vector<char>& request)
{
const char* headerEndBytes = "\r\n\r\n";
const char* headerEnd = strnstr(request.data(), headerEndBytes, request.size()) + strlen(headerEndBytes);
size_t headerLength = headerEnd - request.data();
return String(headerEnd, request.size() - headerLength);
return String(request.subspan(headerLength));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can omit String() here.

@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Mar 30, 2024
@cdumez cdumez removed the merging-blocked Applied to prevent a change from being merged label Mar 30, 2024
@cdumez cdumez added the unsafe-merge-queue Applied to send a pull request to merge-queue, but skip building and testing label Mar 30, 2024
https://bugs.webkit.org/show_bug.cgi?id=271888

Reviewed by Darin Adler.

Drop String constructors taking in a raw pointer and a length, in favor of the
ones taking in a std::span.

* Source/JavaScriptCore/API/OpaqueJSString.h:
(OpaqueJSString::OpaqueJSString):
* Source/JavaScriptCore/API/tests/JSONParseTest.cpp:
(testJSONParse):
* Source/JavaScriptCore/dfg/DFGLazyJSValue.cpp:
(JSC::DFG::LazyJSValue::tryGetString const):
* Source/JavaScriptCore/parser/Lexer.cpp:
(JSC::Lexer<CharacterType>::parseCommentDirectiveValue):
* Source/JavaScriptCore/runtime/FuzzerPredictions.cpp:
(JSC::readFileIntoString):
* Source/JavaScriptCore/runtime/IntlCollator.cpp:
(JSC::IntlCollator::sortLocaleData):
(JSC::IntlCollator::checkICULocaleInvariants):
* Source/JavaScriptCore/runtime/IntlDateTimeFormat.cpp:
(JSC::IntlDateTimeFormat::localeData):
* Source/JavaScriptCore/runtime/IntlDisplayNames.cpp:
(JSC::IntlDisplayNames::of const):
* Source/JavaScriptCore/runtime/IntlDurationFormat.cpp:
(JSC::retrieveSeparator):
* Source/JavaScriptCore/runtime/IntlLocale.cpp:
(JSC::IntlLocale::language):
(JSC::IntlLocale::script):
(JSC::IntlLocale::region):
(JSC::IntlLocale::calendars):
(JSC::IntlLocale::collations):
(JSC::IntlLocale::timeZones):
* Source/JavaScriptCore/runtime/IntlNumberFormat.cpp:
(JSC::IntlNumberFormat::formatRange const):
* Source/JavaScriptCore/runtime/IntlObject.cpp:
(JSC::languageTagForLocaleID):
(JSC::intlAvailableCalendars):
(JSC::availableCollations):
(JSC::availableCurrencies):
(JSC::availableNumberingSystems):
(JSC::intlAvailableTimeZones):
* Source/JavaScriptCore/runtime/IntlPluralRules.cpp:
(JSC::IntlPluralRules::resolvedOptions const):
* Source/JavaScriptCore/runtime/JSImmutableButterfly.cpp:
(JSC::JSImmutableButterfly::createFromString):
* Source/JavaScriptCore/runtime/JSONObject.cpp:
(JSC::gap):
(JSC::FastStringifier<CharType>::result const):
* Source/JavaScriptCore/runtime/LiteralParser.cpp:
(JSC::LiteralParser<CharType>::makeJSString):
* Source/JavaScriptCore/runtime/NumberPrototype.cpp:
(JSC::toStringWithRadixInternal):
* Source/JavaScriptCore/tools/FunctionAllowlist.cpp:
(JSC::FunctionAllowlist::FunctionAllowlist):
* Source/JavaScriptCore/tools/FunctionOverrides.cpp:
(JSC::parseClause):
* Source/JavaScriptCore/wasm/WasmIndexOrName.cpp:
(JSC::Wasm::makeString):
* Source/WTF/wtf/URLHelpers.cpp:
(WTF::URLHelpers::mapHostName):
* Source/WTF/wtf/UUID.cpp:
(WTF::bootSessionUUIDString):
* Source/WTF/wtf/text/StringView.h:
(WTF::StringView::toString const):
* Source/WTF/wtf/text/WTFString.cpp:
(WTF::String::String):
(WTF::String::fromCodePoint):
* Source/WTF/wtf/text/WTFString.h:
(WTF::IntegerToStringConversionTrait<String>::flush):
(WTF::StringLiterals::operator _str):
* Source/WebCore/Modules/encryptedmedia/InitDataRegistry.cpp:
(WebCore::extractKeyIDsKeyids):
* Source/WebCore/Modules/websockets/WebSocketExtensionParser.cpp:
(WebCore::WebSocketExtensionParser::consumeToken):
* Source/WebCore/PAL/pal/text/TextCodecReplacement.cpp:
(PAL::TextCodecReplacement::decode):
* Source/WebCore/accessibility/AccessibilityMathMLElement.cpp:
(WebCore::AccessibilityMathMLElement::textUnderElement const):
* Source/WebCore/bindings/js/SerializedScriptValue.cpp:
(WebCore::CloneDeserializer::readString):
* Source/WebCore/crypto/SubtleCrypto.cpp:
(WebCore::SubtleCrypto::unwrapKey):
* Source/WebCore/css/CSSCounterStyle.cpp:
(WebCore::counterForSystemCJK):
(WebCore::CSSCounterStyle::counterForSystemEthiopicNumeric):
* Source/WebCore/css/process-css-properties.py:
(GenerateCSSPropertyNames):
* Source/WebCore/editing/Editing.cpp:
(WebCore::nonBreakingSpaceString):
* Source/WebCore/fileapi/FileReaderLoader.cpp:
(WebCore::FileReaderLoader::stringResult):
* Source/WebCore/html/FTPDirectoryDocument.cpp:
(WebCore::FTPDirectoryDocumentParser::appendEntry):
(WebCore::FTPDirectoryDocumentParser::loadDocumentTemplate):
* Source/WebCore/html/TypeAhead.cpp:
(WebCore::TypeAhead::handleEvent):
* Source/WebCore/html/parser/AtomHTMLToken.h:
(WebCore::AtomHTMLToken::AtomHTMLToken):
* Source/WebCore/html/parser/CSSPreloadScanner.cpp:
(WebCore::parseCSSStringOrURL):
* Source/WebCore/html/parser/HTMLDocumentParserFastPath.cpp:
(WebCore::HTMLFastPathParser::scanText):
* Source/WebCore/html/parser/HTMLEntityParser.cpp:
(WebCore::SegmentedStringSource::pushBackButKeep):
* Source/WebCore/html/parser/HTMLInputStream.h:
(WebCore::HTMLInputStream::markEndOfFile):
* Source/WebCore/html/shadow/DateTimeNumericFieldElement.cpp:
(WebCore::DateTimeNumericFieldElement::handleKeyboardEvent):
* Source/WebCore/html/track/VTTScanner.cpp:
(WebCore::VTTScanner::extractString):
* Source/WebCore/html/track/VTTScanner.h:
* Source/WebCore/html/track/WebVTTTokenizer.cpp:
(WebCore::WebVTTTokenizer::WebVTTTokenizer):
* Source/WebCore/inspector/InspectorStyleSheet.cpp:
(WebCore::fixUnparsedProperties):
* Source/WebCore/layout/formattingContexts/inline/display/InlineDisplayContentBuilder.cpp:
(WebCore::Layout::InlineDisplayContentBuilder::appendTextDisplayBox):
* Source/WebCore/loader/FTPDirectoryParser.cpp:
(WebCore::parseOneFTPLine):
* Source/WebCore/loader/FormSubmission.cpp:
(WebCore::appendMailtoPostFormDataToURL):
* Source/WebCore/loader/LinkHeader.cpp:
(WebCore::findURLBoundaries):
(WebCore::parseParameterValue):
* Source/WebCore/loader/ResourceCryptographicDigest.cpp:
(WebCore::parseCryptographicDigestImpl):
(WebCore::parseEncodedCryptographicDigestImpl):
* Source/WebCore/loader/appcache/ApplicationCacheManifestParser.cpp:
(WebCore::makeManifestURL):
* Source/WebCore/loader/appcache/ApplicationCacheStorage.cpp:
(WebCore::parseHeader):
* Source/WebCore/page/EventSource.cpp:
(WebCore::EventSource::dispatchMessageEvent):
* Source/WebCore/page/csp/ContentSecurityPolicy.cpp:
(WebCore::ContentSecurityPolicy::didReceiveHeader):
* Source/WebCore/page/csp/ContentSecurityPolicyDirectiveList.cpp:
(WebCore::ContentSecurityPolicyDirectiveList::parseDirective):
(WebCore::ContentSecurityPolicyDirectiveList::parseRequireTrustedTypesFor):
* Source/WebCore/page/csp/ContentSecurityPolicyMediaListDirective.cpp:
(WebCore::ContentSecurityPolicyMediaListDirective::parse):
* Source/WebCore/page/csp/ContentSecurityPolicySourceList.cpp:
(WebCore::ContentSecurityPolicySourceList::parse):
(WebCore::ContentSecurityPolicySourceList::parsePath):
(WebCore::ContentSecurityPolicySourceList::parseNonceSource):
* Source/WebCore/page/csp/ContentSecurityPolicyTrustedTypesDirective.cpp:
(WebCore::ContentSecurityPolicyTrustedTypesDirective::parse):
* Source/WebCore/platform/cocoa/KeyEventCocoa.mm:
(WebCore::keyForCharCode):
* Source/WebCore/platform/encryptedmedia/CDMUtilities.cpp:
(WebCore::CDMUtilities::parseJSONObject):
* Source/WebCore/platform/graphics/FontCascade.h:
(WebCore::FontCascade::widthOfSpaceString const):
* Source/WebCore/platform/graphics/StringTruncator.cpp:
(WebCore::truncateString):
* Source/WebCore/platform/graphics/TextRun.h:
(WebCore::TextRun::isolatedCopy const):
* Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp:
(WebCore::GraphicsContextGLANGLE::getActiveAttribImpl):
(WebCore::GraphicsContextGLANGLE::getActiveUniformImpl):
(WebCore::GraphicsContextGLANGLE::getProgramInfoLog):
(WebCore::GraphicsContextGLANGLE::getShaderInfoLog):
(WebCore::GraphicsContextGLANGLE::getActiveUniformBlockName):
(WebCore::GraphicsContextGLANGLE::getTransformFeedbackVarying):
(WebCore::GraphicsContextGLANGLE::getTranslatedShaderSourceANGLE):
* Source/WebCore/platform/graphics/avfoundation/CDMFairPlayStreaming.cpp:
(WebCore::extractSinfData):
(WebCore::CDMPrivateFairPlayStreaming::extractKeyIDsMpts):
* Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
(WebCore::MediaPlayerPrivateAVFoundation::extractKeyURIKeyIDAndCertificateFromInitData):
* Source/WebCore/platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm:
(WebCore::parseJSONValue):
* Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm:
(WebCore::FontPlatformData::variationAxes const):
* Source/WebCore/platform/graphics/cocoa/SourceBufferParserWebM.cpp:
(WebCore::WebMParser::OnTrackEntry):
* Source/WebCore/platform/network/HTTPHeaderMap.cpp:
(WebCore::HTTPHeaderMap::set):
* Source/WebCore/platform/network/HTTPParsers.cpp:
(WebCore::trimInputSample):
(WebCore::parseHTTPHeader):
* Source/WebCore/platform/network/RFC8941.cpp:
(RFC8941::parseToken):
* Source/WebCore/platform/text/SegmentedString.cpp:
(WebCore::SegmentedString::advancePastSlowCase):
* Source/WebCore/rendering/RenderCombineText.cpp:
(WebCore::RenderCombineText::combineTextIfNeeded):
* Source/WebCore/rendering/RenderFileUploadControl.cpp:
(WebCore::RenderFileUploadControl::computeIntrinsicLogicalWidths const):
* Source/WebCore/rendering/RenderListMarker.cpp:
(WebCore::RenderListMarker::textRun const):
* Source/WebCore/rendering/RenderTextControl.cpp:
(WebCore::RenderTextControl::getAverageCharWidth):
* Source/WebCore/rendering/svg/SVGTextMetrics.cpp:
(WebCore::SVGTextMetrics::SVGTextMetrics):
* Source/WebCore/svg/SVGParserUtilities.cpp:
(WebCore::parseGlyphName):
(WebCore::parseKerningUnicodeString):
* Source/WebCore/svg/SVGStringList.cpp:
(WebCore::SVGStringList::parse):
* Source/WebCore/svg/SVGToOTFFontConversion.cpp:
(WebCore::codepointToString):
* Source/WebCore/svg/SVGViewSpec.cpp:
(WebCore::SVGViewSpec::parseViewSpec):
* Source/WebCore/testing/MockCDMFactory.cpp:
(WebCore::MockCDMInstanceSession::updateLicense):
* Source/WebKit/UIProcess/API/APIContentRuleListStore.cpp:
(API::getContentRuleListSourceFromMappedFile):
* Source/WebKit/UIProcess/Cocoa/WebPasteboardProxyCocoa.mm:
(WebKit::WebPasteboardProxy::testIPCSharedMemory):
* Source/WebKit/UIProcess/mac/WebViewImpl.mm:
(WebKit::commandNameForSelector):
* Source/WebKit/WebProcess/Network/webrtc/LibWebRTCResolver.cpp:
(WebKit::LibWebRTCResolver::start):
* Source/WebKitLegacy/mac/WebView/WebHTMLView.mm:
(commandNameForSelector):
* Tools/DumpRenderTree/TestRunner.cpp:
(TestRunner::runUIScript):
* Tools/TestRunnerShared/UIScriptContext/UIScriptContext.cpp:
(UIScriptContext::tryToCompleteUIScriptForCurrentParentCallback):
* Tools/TestWebKitAPI/Tests/WTF/HexNumber.cpp:
* Tools/TestWebKitAPI/Tests/WTF/NativePromise.cpp:
(TestWebKitAPI::PhotoProducer::takePhotoImpl const):
* Tools/TestWebKitAPI/Tests/WTF/StringBuilder.cpp:
(TestWebKitAPI::expectBuilderContent):
(TestWebKitAPI::TEST(StringBuilderTest, Append)):
(TestWebKitAPI::TEST(StringBuilderTest, VariadicAppend)):
* Tools/TestWebKitAPI/Tests/WTF/StringOperators.cpp:
(TestWebKitAPI::TEST(WTF, ConcatenateCharacterArrayAndEmptyString)):
* Tools/TestWebKitAPI/Tests/WTF/StringView.cpp:
(TestWebKitAPI::TEST(WTF, StringViewContainsOnlyASCII)):
* Tools/TestWebKitAPI/Tests/WTF/TextBreakIterator.cpp:
(TestWebKitAPI::makeUTF16):
* Tools/TestWebKitAPI/Tests/WTF/WTFString.cpp:
(TestWebKitAPI::TEST(WTF, StringUnicodeEqualUCharArray)):
* Tools/TestWebKitAPI/Tests/WTF/cocoa/URLExtras.mm:
(TestWebKitAPI::TEST(WTF_URLExtras, URLExtras_ParsingError)):
* Tools/TestWebKitAPI/Tests/WebCore/CBORReaderTest.cpp:
(TestWebKitAPI::TEST(CBORReaderTest, TestReadStringWithNUL)):
* Tools/TestWebKitAPI/Tests/WebCore/FileMonitor.cpp:
(TestWebKitAPI::readContentsOfFile):
* Tools/TestWebKitAPI/Tests/WebCore/SharedBuffer.cpp:
(TestWebKitAPI::TEST_F):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/Download.mm:
(longString):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/EventAttribution.mm:
(TestWebKitAPI::signUnlinkableTokenAndSendSecretToken):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/ServiceWorkerBasic.mm:
((ServiceWorker, ExtensionServiceWorkerDisableCORS)):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebExtensionAPIWebNavigation.mm:
(TestWebKitAPI::longString):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/WebPushDaemon.mm:
* Tools/TestWebKitAPI/cocoa/HTTPServer.mm:
(TestWebKitAPI::HTTPServer::parsePath):
(TestWebKitAPI::HTTPServer::parseBody):
* Tools/WebKitTestRunner/TestController.cpp:
(WTR::TestController::createTestURL):

Canonical link: https://commits.webkit.org/276859@main
@webkit-commit-queue
Copy link
Collaborator

Committed 276859@main (c04fd9f): https://commits.webkit.org/276859@main

Reviewed commits have been landed. Closing PR #26611 and removing active labels.

@webkit-commit-queue webkit-commit-queue merged commit c04fd9f into WebKit:main Mar 30, 2024
@webkit-commit-queue webkit-commit-queue removed the unsafe-merge-queue Applied to send a pull request to merge-queue, but skip building and testing label Mar 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants