Title: [265252] trunk/Source/WTF
Revision
265252
Author
achristen...@apple.com
Date
2020-08-04 11:14:25 -0700 (Tue, 04 Aug 2020)

Log Message

about: scheme URL constants should be backed by StaticStringImpl
https://bugs.webkit.org/show_bug.cgi?id=215113

Reviewed by Darin Adler.

* wtf/URL.cpp:
(WTF::aboutBlankURL):
(WTF::aboutSrcDocURL):

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (265251 => 265252)


--- trunk/Source/WTF/ChangeLog	2020-08-04 17:18:50 UTC (rev 265251)
+++ trunk/Source/WTF/ChangeLog	2020-08-04 18:14:25 UTC (rev 265252)
@@ -1,3 +1,14 @@
+2020-08-04  Alex Christensen  <achristen...@webkit.org>
+
+        about: scheme URL constants should be backed by StaticStringImpl
+        https://bugs.webkit.org/show_bug.cgi?id=215113
+
+        Reviewed by Darin Adler.
+
+        * wtf/URL.cpp:
+        (WTF::aboutBlankURL):
+        (WTF::aboutSrcDocURL):
+
 2020-08-03  Wenson Hsieh  <wenson_hs...@apple.com>
 
         Remove the ENABLE_DATA_INTERACTION feature flag

Modified: trunk/Source/WTF/wtf/URL.cpp (265251 => 265252)


--- trunk/Source/WTF/wtf/URL.cpp	2020-08-04 17:18:50 UTC (rev 265251)
+++ trunk/Source/WTF/wtf/URL.cpp	2020-08-04 18:14:25 UTC (rev 265252)
@@ -820,14 +820,24 @@
 
 const URL& aboutBlankURL()
 {
-    static NeverDestroyed<URL> staticBlankURL(URL(), "about:blank"_s);
+    static NeverDestroyed<URL> staticBlankURL;
+    static std::once_flag onceFlag;
+    std::call_once(onceFlag, [&] {
+        static constexpr const char* aboutBlank = "about:blank";
+        staticBlankURL.get() = URL(URL(), StringImpl::createStaticStringImpl(aboutBlank, strlen(aboutBlank)));
+    });
     return staticBlankURL;
 }
 
 const URL& aboutSrcDocURL()
 {
-    static NeverDestroyed<URL> staticAboutSrcDocURL(URL(), "about:srcdoc"_s);
-    return staticAboutSrcDocURL;
+    static NeverDestroyed<URL> staticSrcDocURL;
+    static std::once_flag onceFlag;
+    std::call_once(onceFlag, [&] {
+        static constexpr const char* aboutSrcDoc = "about:srcdoc";
+        staticSrcDocURL.get() = URL(URL(), StringImpl::createStaticStringImpl(aboutSrcDoc, strlen(aboutSrcDoc)));
+    });
+    return staticSrcDocURL;
 }
 
 bool URL::protocolIsAbout() const
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to