Skip to content
Permalink
Browse files
Make the StringView(const char*) constructor explicit
https://bugs.webkit.org/show_bug.cgi?id=240754

Reviewed by Darin Adler.

Make the StringView(const char*) constructor explicit, to encourage people to use
ASCIILiteral / ""_s. StringView::fromLatin1() is available when the caller
really has a non-string literal. In a future patch, I will make this constructor
private.

* Source/WTF/wtf/Assertions.cpp:
* Source/WTF/wtf/text/StringBuilder.h:
(WTF::StringBuilder::append):
* Source/WTF/wtf/text/StringView.h:
* Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCRtpTransceiverBackend.cpp:
(WebCore::toRtpCodecCapability):
* Source/WebCore/css/typedom/ComputedStylePropertyMapReadOnly.cpp:
(WebCore::ComputedStylePropertyMapReadOnly::entries const):
* Source/WebCore/dom/DatasetDOMStringMap.cpp:
(WebCore::isValidAttributeName):
(WebCore::propertyNameMatchesAttributeName):
* Source/WebCore/dom/ViewportArguments.cpp:
(WebCore::viewportErrorMessage):
* Source/WebCore/editing/cocoa/HTMLConverter.mm:
(HTMLConverterCaches::elementHasOwnBackgroundColor):
* Source/WebCore/history/BackForwardCache.cpp:
(WebCore::canCacheFrame):
* Source/WebCore/html/URLDecomposition.cpp:
(WebCore::URLDecomposition::setPort):
* Source/WebCore/html/track/WebVTTParser.cpp:
(WebCore::WebVTTParser::checkAndCreateRegion):
(WebCore::WebVTTParser::checkAndStoreStyleSheet):
* Source/WebCore/loader/PrivateClickMeasurement.cpp:
(WebCore::PrivateClickMeasurement::parseAttributionRequest):
(WebCore::PrivateClickMeasurement::appStoreURLAdamID):
* Source/WebCore/loader/mac/LoaderNSURLExtras.mm:
(suggestedFilenameWithMIMEType):
* Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp:
(WebCore::GraphicsContextGLANGLE::getUnmangledInfoLog):
* Source/WebCore/platform/graphics/avfoundation/CDMPrivateMediaSourceAVFObjC.mm:
(WebCore::CDMPrivateMediaSourceAVFObjC::parseKeySystem):
* Source/WebKit/NetworkProcess/Classifier/ResourceLoadStatisticsDatabaseStore.cpp:
(WebKit::ResourceLoadStatisticsDatabaseStore::migrateDataToPCMDatabaseIfNecessary):
(WebKit::ResourceLoadStatisticsDatabaseStore::aggregatedThirdPartyData const):
* Source/WebKit/NetworkProcess/NetworkSchemeRegistry.cpp:
(WebKit::NetworkSchemeRegistry::shouldTreatURLSchemeAsCORSEnabled):
* Source/WebKit/NetworkProcess/WebStorage/LocalStorageDatabaseTracker.cpp:
(WebKit::LocalStorageDatabaseTracker::LocalStorageDatabaseTracker):
* Source/WebKit/NetworkProcess/cache/NetworkCacheBlobStorage.cpp:
(WebKit::NetworkCache::BlobStorage::blobPathForHash const):
* Source/WebKit/NetworkProcess/cache/NetworkCacheStorage.cpp:
* Source/WebKit/Platform/unix/EnvironmentUtilities.cpp:
(WebKit::EnvironmentUtilities::removeValuesEndingWith):
* Source/WebKit/Shared/Cocoa/XPCEndpoint.mm:
(WebKit::XPCEndpoint::XPCEndpoint):
* Source/WebKit/Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceEntryPoint.mm:
(WebKit::XPCServiceInitializerDelegate::getProcessIdentifier):
* Source/WebKit/UIProcess/API/APIContentRuleListStore.cpp:
(API::constructedPathPrefix):
* Source/WebKit/UIProcess/API/APIProcessPoolConfiguration.h:
* Source/WebKit/UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
(-[_WKProcessPoolConfiguration additionalReadAccessAllowedURLs]):
(-[_WKProcessPoolConfiguration setAdditionalReadAccessAllowedURLs:]):
* Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm:
(WebKit::WebPageProxy::createSandboxExtensionsIfNeeded):
(WebKit::WebPageProxy::isQuarantinedAndNotUserApproved):
* Source/WebKit/UIProcess/Cocoa/WebProcessProxyCocoa.mm:
(WebKit::WebProcessProxy::messageSourceIsValidWebContentProcess):
* Source/WebKit/UIProcess/DeviceIdHashSaltStorage.cpp:
(WebKit::DeviceIdHashSaltStorage::deleteHashSaltFromDisk):
* Source/WebKit/UIProcess/ViewGestureController.cpp:
(WebKit::ViewGestureController::SnapshotRemovalTracker::resume):
(WebKit::ViewGestureController::SnapshotRemovalTracker::start):
(WebKit::ViewGestureController::SnapshotRemovalTracker::fireRemovalCallbackImmediately):
(WebKit::ViewGestureController::SnapshotRemovalTracker::watchdogTimerFired):
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::maybeInitializeSandboxExtensionHandle):
(WebKit::WebPageProxy::savePDFToFileInDownloadsFolder):
* Source/WebKit/UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::resolvePathsForSandboxExtensions):
* Source/WebKit/UIProcess/mac/WebPageProxyMac.mm:
(WebKit::WebPageProxy::savePDFToTemporaryFolderAndOpenWithNativeApplication):
* Source/WebKit/UIProcess/mac/WebProcessProxyMac.mm:
(WebKit::WebProcessProxy::shouldAllowNonValidInjectedCode const):
* Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundle.cpp:
(WKBundleSetDatabaseQuota):
* Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp:
(WebKit::WebLoaderStrategy::tryLoadingUsingPDFJSHandler):
* Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm:
(WebKit::PDFPlugin::streamDidReceiveResponse):
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
(WebKit::dumpHistoryItem):
* Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::WebPage::shouldUsePDFPlugin const):
(WebKit::WebPage::platformCanHandleRequest):
* Source/WebKit/webpushd/AppBundleRequest.mm:
(WebPushD::AppBundleRequest::start):
* Source/WebKit/webpushd/PushClientConnection.mm:
(WebPushD::ClientConnection::connectionClosed):
* Source/WebKit/webpushd/WebPushDaemon.mm:
(WebPushD::Daemon::broadcastAllConnectionIdentities):
(WebPushD::Daemon::injectPushMessageForTesting):
(WebPushD::Daemon::injectEncryptedPushMessageForTesting):
* Source/WebKitLegacy/mac/WebView/WebHTMLRepresentation.mm:
(regExpForLabels):
(matchLabelsAgainstString):
* Tools/DumpRenderTree/mac/DumpRenderTree.mm:
(changeWindowScaleIfNeeded):
* Tools/TestWebKitAPI/Tests/WTF/FileSystem.cpp:
(TestWebKitAPI::TEST_F):
* Tools/TestWebKitAPI/Tests/WTF/SortedArrayMap.cpp:
(TEST):
* Tools/TestWebKitAPI/Tests/WTF/StringImpl.cpp:
(TestWebKitAPI::TEST):
(TestWebKitAPI::doStaticStringImplTests):
* Tools/TestWebKitAPI/Tests/WTF/StringToIntegerConversion.cpp:
(TestWebKitAPI::TEST):
* Tools/TestWebKitAPI/Tests/WTF/StringView.cpp:
(TestWebKitAPI::TEST):
* Tools/TestWebKitAPI/Tests/WTF/URL.cpp:
(TestWebKitAPI::TEST_F):
* Tools/TestWebKitAPI/Tests/WTF/URLParser.cpp:
(TestWebKitAPI::invalidParts):
(TestWebKitAPI::shouldFail):
(TestWebKitAPI::TEST_F):
(TestWebKitAPI::testUserPassword):
* Tools/TestWebKitAPI/Tests/WTF/UUID.cpp:
(TEST):
* Tools/TestWebKitAPI/Tests/WebCore/ContentExtensions.cpp:
(TestWebKitAPI::TEST_F):
* Tools/TestWebKitAPI/Tests/WebCore/DFACombiner.cpp:
(TestWebKitAPI::TEST_F):
* Tools/TestWebKitAPI/Tests/WebCore/DFAHelpers.h:
(TestWebKitAPI::buildDFAFromPatterns):
* Tools/TestWebKitAPI/Tests/WebCore/DFAMinimizer.cpp:
(TestWebKitAPI::TEST_F):
* Tools/TestWebKitAPI/Tests/WebCore/FileMonitor.cpp:
(TestWebKitAPI::readContentsOfFile):
* Tools/TestWebKitAPI/Tests/WebCore/HTMLParserIdioms.cpp:
(TestWebKitAPI::TEST):
* Tools/TestWebKitAPI/Tests/WebCore/HTTPParsers.cpp:
(TestWebKitAPI::TEST):
* Tools/TestWebKitAPI/Tests/WebKit/EnvironmentUtilitiesTest.cpp:
(TestWebKitAPI::testStrip):
(TestWebKitAPI::TEST):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/ContentRuleListNotification.mm:
(TEST):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/CopyHTML.mm:
(TEST):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/FTP.mm:
(TestWebKitAPI::TEST):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/IDBCheckpointWAL.mm:
(TEST):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/IDBIndexUpgradeToV2.mm:
(TEST):
(runMultipleIndicesTestWithDatabase):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/IDBObjectStoreInfoUpgradeToV2.mm:
(TEST):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/IndexedDBFileName.mm:
(TEST):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/IndexedDBPersistence.mm:
* Tools/TestWebKitAPI/Tests/WebKitCocoa/IndexedDBTempFileSize.mm:
(TEST):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/MediaLoading.mm:
(TestWebKitAPI::parseUserAgent):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/MediaSession.mm:
(TestWebKitAPI::TEST_F):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/PrivateClickMeasurement.mm:
(addAttributedPCMv2):
(addUnattributedPCMv2):
(addAttributedPCMv3):
(addUnattributedPCMv3):
(addUnattributedPCMv4):
(addAttributedPCMv4):
(addAttributedPCMv5):
(createAndPopulateObservedDomainTable):
(createAndPopulatePCMObservedDomainTable):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:
* Tools/TestWebKitAPI/Tests/WebKitCocoa/ServiceWorkerBasic.mm:
(-[ServiceWorkerSchemeHandler webView:startURLSchemeTask:]):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/StorageQuota.mm:
* Tools/TestWebKitAPI/Tests/WebKitCocoa/StoreBlobThenDelete.mm:
(TEST):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/WKURLSchemeHandler-1.mm:
* Tools/TestWebKitAPI/Tests/WebKitCocoa/WebSocket.mm:
(TestWebKitAPI::TEST):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/WebsiteDataStoreCustomPaths.mm:
(TEST):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/WebsitePolicies.mm:
(ParsedRange::ParsedRange):
* Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
(WTR::InjectedBundlePage::didFinishProgress):
(WTR::InjectedBundlePage::dump):
(WTR::InjectedBundlePage::didDisplayInsecureContentForFrame):
(WTR::InjectedBundlePage::didRunInsecureContentForFrame):
(WTR::InjectedBundlePage::didDetectXSSForFrame):
(WTR::InjectedBundlePage::willSendRequestForFrame):
(WTR::InjectedBundlePage::willAddMessageToConsole):
(WTR::InjectedBundlePage::supportsFullScreen):
(WTR::InjectedBundlePage::enterFullScreenForElement):
(WTR::InjectedBundlePage::exitFullScreenForElement):
(WTR::InjectedBundlePage::beganEnterFullScreen):
(WTR::InjectedBundlePage::beganExitFullScreen):
(WTR::InjectedBundlePage::closeFullScreen):
* Tools/WebKitTestRunner/TestController.cpp:
(WTR::TestController::configureContentExtensionForTest):
* Tools/WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::TestInvocation):
(WTR::TestInvocation::urlContains const):
(WTR::TestInvocation::shouldLogHistoryClientCallbacks const):
* Tools/WebKitTestRunner/TestInvocation.h:
* Tools/WebKitTestRunner/mac/TestControllerMac.mm:
(WTR::TestController::configureContentExtensionForTest):

Canonical link: https://commits.webkit.org/250986@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@294852 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
cdumez committed May 26, 2022
1 parent 6abda06 commit 2414d35395c931a94b7b8cedf131a2ca17fd8566
Showing 159 changed files with 1,782 additions and 1,784 deletions.
@@ -825,7 +825,7 @@ static URL currentWorkingDirectory()
DWORD lengthNotIncludingNull = ::GetCurrentDirectoryW(bufferLength, buffer.data());
String directoryString(buffer.data(), lengthNotIncludingNull);
// We don't support network path like \\host\share\<path name>.
if (directoryString.startsWith("\\\\"))
if (directoryString.startsWith("\\\\"_s))
return { };

#else
@@ -548,7 +548,7 @@ void WTFInitializeLogChannelStatesFromString(WTFLogChannel* channels[], size_t c
}
#endif

for (auto logLevelComponent : StringView(logLevel).split(',')) {
for (auto logLevelComponent : StringView::fromLatin1(logLevel).split(',')) {
auto componentInfo = logLevelComponent.split('=');
auto it = componentInfo.begin();
if (it == componentInfo.end())
@@ -70,7 +70,7 @@ static size_t computeMemoryFootprint()
}
if (scannedCount == 7) {
StringView pathString(path);
isAnonymous = pathString == "[heap]" || pathString.startsWith("[stack");
isAnonymous = pathString == "[heap]"_s || pathString.startsWith("[stack"_s);
return;
}
}
@@ -234,7 +234,7 @@ inline void StringBuilder::appendSubstring(const String& string, unsigned offset

inline void StringBuilder::append(const char* characters)
{
append(StringView { characters });
append(StringView::fromLatin1(characters));
}

inline void StringBuilder::appendCharacter(UChar32 c)
@@ -70,7 +70,7 @@ class StringView final {
StringView(ASCIILiteral);

// FIXME: Make private once all call sites have been ported to fromLatin1.
StringView(const char*);
explicit StringView(const char*);

ALWAYS_INLINE static StringView fromLatin1(const char* characters) { return StringView { characters }; }

@@ -215,7 +215,7 @@ bool GStreamerMediaEndpoint::setConfiguration(MediaEndpointConfiguration& config
for (auto& server : configuration.iceServers) {
bool stunSet = false;
for (auto& url : server.urls) {
if (url.protocol().startsWith("turn")) {
if (url.protocol().startsWith("turn"_s)) {
auto valid = makeStringByReplacingAll(url.string().isolatedCopy(), "turn:"_s, "turn://"_s);
valid = makeStringByReplacingAll(valid, "turns:"_s, "turns://"_s);
URL validURL(URL(), valid);
@@ -229,7 +229,7 @@ bool GStreamerMediaEndpoint::setConfiguration(MediaEndpointConfiguration& config
if (!result)
GST_WARNING("Unable to use TURN server: %s", validURL.string().utf8().data());
}
if (!stunSet && url.protocol().startsWith("stun")) {
if (!stunSet && url.protocol().startsWith("stun"_s)) {
auto valid = makeStringByReplacingAll(url.string().isolatedCopy(), "stun:"_s, "stun://"_s);
URL validURL(URL(), valid);
// FIXME: libnice currently doesn't seem to handle IPv6 addresses very well.
@@ -923,7 +923,7 @@ void GStreamerMediaEndpoint::addIceCandidate(GStreamerIceCandidate& candidate, P
{
GST_DEBUG_OBJECT(m_pipeline.get(), "Adding ICE candidate %s", candidate.candidate.utf8().data());

if (!candidate.candidate.startsWith("candidate:")) {
if (!candidate.candidate.startsWith("candidate:"_s)) {
callOnMainThread([task = createSharedTask<PeerConnectionBackend::AddIceCandidateCallbackFunction>(WTFMove(callback))]() mutable {
task->run(Exception { OperationError, "Expect line: candidate:<candidate-str>"_s });
});
@@ -96,7 +96,7 @@ bool GStreamerRtpTransceiverBackend::stopped() const

static inline WARN_UNUSED_RETURN ExceptionOr<GstCaps*> toRtpCodecCapability(const RTCRtpCodecCapability& codec)
{
if (!codec.mimeType.startsWith("video/") && !codec.mimeType.startsWith("audio/"))
if (!codec.mimeType.startsWith("video/"_s) && !codec.mimeType.startsWith("audio/"_s))
return Exception { InvalidModificationError, "RTCRtpCodecCapability bad mimeType"_s };

auto components = codec.mimeType.split('/');
@@ -203,7 +203,7 @@ std::optional<RTCIceCandidate::Fields> parseIceCandidateSDP(const String& sdp)
{
ensureDebugCategoryInitialized();
GST_DEBUG("Parsing ICE Candidate: %s", sdp.utf8().data());
if (!sdp.startsWith("candidate:"))
if (!sdp.startsWith("candidate:"_s))
return { };

String foundation;
@@ -84,9 +84,9 @@ bool LibWebRTCRtpTransceiverBackend::stopped() const
static inline ExceptionOr<webrtc::RtpCodecCapability> toRtpCodecCapability(const RTCRtpCodecCapability& codec)
{
webrtc::RtpCodecCapability rtcCodec;
if (codec.mimeType.startsWith("video/"))
if (codec.mimeType.startsWith("video/"_s))
rtcCodec.kind = cricket::MEDIA_TYPE_VIDEO;
else if (codec.mimeType.startsWith("audio/"))
else if (codec.mimeType.startsWith("audio/"_s))
rtcCodec.kind = cricket::MEDIA_TYPE_AUDIO;
else
return Exception { InvalidModificationError, "RTCRtpCodecCapability bad mimeType"_s };
@@ -57,14 +57,14 @@ namespace WebCore::ContentExtensions {
#else
static void makeSecureIfNecessary(ContentRuleListResults& results, const URL& url, const URL& redirectFrom = { })
{
if (redirectFrom.host() == url.host() && redirectFrom.protocolIs("https"))
if (redirectFrom.host() == url.host() && redirectFrom.protocolIs("https"_s))
return;

if (!url.protocolIs("http"))
if (!url.protocolIs("http"_s))
return;
if (url.host() == "www.opengl.org"
|| url.host() == "webkit.org"
|| url.host() == "download")
if (url.host() == "www.opengl.org"_s
|| url.host() == "webkit.org"_s
|| url.host() == "download"_s)
results.summary.madeHTTPS = true;
}
#endif
@@ -129,13 +129,13 @@ Vector<StylePropertyMapReadOnly::StylePropertyMapEntry> ComputedStylePropertyMap
std::sort(values.begin(), values.end(), [](const auto& a, const auto& b) {
const auto& nameA = a.key;
const auto& nameB = b.key;
if (nameA.startsWith("--"))
return nameB.startsWith("--") && codePointCompareLessThan(nameA, nameB);
if (nameA.startsWith("--"_s))
return nameB.startsWith("--"_s) && codePointCompareLessThan(nameA, nameB);

if (nameA.startsWith("-"))
return nameB.startsWith("--") || (nameB.startsWith("-") && codePointCompareLessThan(nameA, nameB));
if (nameA.startsWith('-'))
return nameB.startsWith("--"_s) || (nameB.startsWith('-') && codePointCompareLessThan(nameA, nameB));

return nameB.startsWith("-") || codePointCompareLessThan(nameA, nameB);
return nameB.startsWith('-') || codePointCompareLessThan(nameA, nameB);
});

return values;
@@ -38,7 +38,7 @@ WTF_MAKE_ISO_ALLOCATED_IMPL(DatasetDOMStringMap);

static bool isValidAttributeName(const String& name)
{
if (!name.startsWith("data-"))
if (!name.startsWith("data-"_s))
return false;

unsigned length = name.length();
@@ -73,7 +73,7 @@ static String convertAttributeNameToPropertyName(const String& name)

static bool propertyNameMatchesAttributeName(const String& propertyName, const String& attributeName)
{
if (!attributeName.startsWith("data-"))
if (!attributeName.startsWith("data-"_s))
return false;

unsigned propertyLength = propertyName.length();
@@ -428,10 +428,10 @@ static String viewportErrorMessage(ViewportErrorCode errorCode, StringView repla
{
String message = viewportErrorMessageTemplate(errorCode);
if (!replacement1.isNull())
message = makeStringByReplacingAll(message, "%replacement1", replacement1);
message = makeStringByReplacingAll(message, "%replacement1"_s, replacement1);
// FIXME: This will do the wrong thing if replacement1 contains the substring "%replacement2".
if (!replacement2.isNull())
message = makeStringByReplacingAll(message, "%replacement2", replacement2);
message = makeStringByReplacingAll(message, "%replacement2"_s, replacement2);

if ((errorCode == UnrecognizedViewportArgumentValueError || errorCode == TruncatedViewportArgumentValueError) && replacement1.contains(';'))
message = makeString(message, " Note that ';' is not a separator in viewport values. The list should be comma-separated."_s);
@@ -833,7 +833,7 @@ static inline bool floatValueFromPrimitiveValue(CSSPrimitiveValue& primitiveValu
return false;
// In the text system, text blocks (table elements) and documents (body elements)
// have their own background colors, which should not be inherited.
return element.hasTagName(htmlTag) || element.hasTagName(bodyTag) || propertyValueForNode(element, CSSPropertyDisplay).startsWith("table");
return element.hasTagName(htmlTag) || element.hasTagName(bodyTag) || propertyValueForNode(element, CSSPropertyDisplay).startsWith("table"_s);
}

Element* HTMLConverter::_blockLevelElementForNode(Node* node)
@@ -135,7 +135,7 @@ static bool canCacheFrame(Frame& frame, DiagnosticLoggingClient& diagnosticLoggi
logBackForwardCacheFailureDiagnosticMessage(diagnosticLoggingClient, DiagnosticLoggingKeys::isErrorPageKey());
isCacheable = false;
}
if (frame.isMainFrame() && frame.document() && frame.document()->url().protocolIs("https") && documentLoader->response().cacheControlContainsNoStore()) {
if (frame.isMainFrame() && frame.document() && frame.document()->url().protocolIs("https"_s) && documentLoader->response().cacheControlContainsNoStore()) {
PCLOG(" -Frame is HTTPS, and cache control prohibits storing");
logBackForwardCacheFailureDiagnosticMessage(diagnosticLoggingClient, DiagnosticLoggingKeys::httpsNoStoreKey());
isCacheable = false;
@@ -197,7 +197,7 @@ static std::optional<std::optional<uint16_t>> parsePort(StringView string, Strin
void URLDecomposition::setPort(StringView value)
{
auto fullURL = this->fullURL();
if (fullURL.host().isEmpty() || fullURL.cannotBeABaseURL() || fullURL.protocolIs("file") || !fullURL.canSetHostOrPort())
if (fullURL.host().isEmpty() || fullURL.cannotBeABaseURL() || fullURL.protocolIs("file"_s) || !fullURL.canSetHostOrPort())
return;
auto port = parsePort(value, fullURL.protocol());
if (!port)
@@ -323,7 +323,7 @@ bool WebVTTParser::checkAndCreateRegion(StringView line)
// line starts with the substring "REGION" and remaining characters
// zero or more U+0020 SPACE characters or U+0009 CHARACTER TABULATION
// (tab) characters expected other than these charecters it is invalid.
if (line.startsWith("REGION") && line.substring(regionIdentifierLength).isAllSpecialCharacters<isASpace>()) {
if (line.startsWith("REGION"_s) && line.substring(regionIdentifierLength).isAllSpecialCharacters<isASpace>()) {
m_currentRegion = VTTRegion::create(m_document);
return true;
}
@@ -396,7 +396,7 @@ bool WebVTTParser::checkAndStoreStyleSheet(StringView line)
auto selector = selectorList.selectorAt(0);
auto selectorText = selector->selectorText();

bool isCue = selectorText == "::cue" || selectorText.startsWith("::cue(");
bool isCue = selectorText == "::cue"_s || selectorText.startsWith("::cue("_s);
if (!isCue)
return true;