summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/Loader
diff options
context:
space:
mode:
authorMax Wipfli <mail@maxwipfli.ch>2021-06-29 16:46:16 +0200
committerAndreas Kling <kling@serenityos.org>2021-06-30 11:13:54 +0200
commitfc6d051dfdddc13835548537d025e760ba186b5b (patch)
tree12a5602dd4efc20f023fea95d390f3e241f6f9cf /Userland/Libraries/LibWeb/Loader
parent9b8f35259c375f6911b76c38ec37e6d422b26bbe (diff)
downloadserenity-fc6d051dfdddc13835548537d025e760ba186b5b.zip
AK+Everywhere: Add and use static APIs for LexicalPath
The LexicalPath instance methods dirname(), basename(), title() and extension() will be changed to return StringView const& in a further commit. Due to this, users creating temporary LexicalPath objects just to call one of those getters will recieve a StringView const& pointing to a possible freed buffer. To avoid this, static methods for those APIs have been added, which will return a String by value to avoid those problems. All cases where temporary LexicalPath objects have been used as described above haven been changed to use the static APIs.
Diffstat (limited to 'Userland/Libraries/LibWeb/Loader')
-rw-r--r--Userland/Libraries/LibWeb/Loader/FrameLoader.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/Userland/Libraries/LibWeb/Loader/FrameLoader.cpp b/Userland/Libraries/LibWeb/Loader/FrameLoader.cpp
index 8e6065deb6..6db5f9b13c 100644
--- a/Userland/Libraries/LibWeb/Loader/FrameLoader.cpp
+++ b/Userland/Libraries/LibWeb/Loader/FrameLoader.cpp
@@ -81,7 +81,7 @@ static bool build_image_document(DOM::Document& document, const ByteBuffer& data
auto title_element = document.create_element("title");
head_element->append_child(title_element);
- auto basename = LexicalPath(document.url().path()).basename();
+ auto basename = LexicalPath::basename(document.url().path());
auto title_text = adopt_ref(*new DOM::Text(document, String::formatted("{} [{}x{}]", basename, bitmap->width(), bitmap->height())));
title_element->append_child(title_text);