[webkit-changes] [WebKit/WebKit] b40481: Make StaticStringImpl constructors explicit

Žan Doberšek noreply at github.com
Tue Jan 31 11:50:20 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: b4048150686363c3e141d3c47caea49dc1db85ae
      https://github.com/WebKit/WebKit/commit/b4048150686363c3e141d3c47caea49dc1db85ae
  Author: Žan Doberšek <zdobersek at igalia.com>
  Date:   2023-01-31 (Tue, 31 Jan 2023)

  Changed paths:
    M Source/WTF/wtf/text/StringImpl.h
    M Source/WebCore/dom/make_names.pl

  Log Message:
  -----------
  Make StaticStringImpl constructors explicit
https://bugs.webkit.org/show_bug.cgi?id=251422

Reviewed by Darin Adler.

The two StaticStringImpl constructors accepting char or char16_t string literals
are marked as explicit. This prevents accidental construction of String objects
with string literals or C arrays through implicitly constructing temporary
StaticStringImpl objects, which is not how the type is meant to be used.

While private String(const char*) currently already inhibits construction with
char-based string literals and C arrays, construction with char16_t-based string
literals and C arrays through StaticStringImpl is now also inhibited.

* Source/WTF/wtf/text/StringImpl.h:
* Source/WebCore/dom/make_names.pl:
(printTagNameCppFile):

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




More information about the webkit-changes mailing list