Fixup![M120 Migration] Return visible entry title instead of last entry 33/318033/2
authorfr.fang <fr.fang@samsung.com>
Mon, 23 Sep 2024 14:27:19 +0000 (22:27 +0800)
committerfr.fang <fr.fang@samsung.com>
Tue, 24 Sep 2024 10:42:36 +0000 (18:42 +0800)
fixup Iced04c6c79e62c6bfb19cb8aa03ff7e67ede936c crash issue on riscV

Change-Id: Ic6d033eab13e11b60f786e440da8127755369018
Signed-off-by: fr.fang <fr.fang@samsung.com>
content/browser/web_contents/web_contents_impl.cc
content/browser/web_contents/web_contents_impl.h

index 910d9a5f41cc164efe1de92672eeaf313271c16f..66d2165e9ab31c9e8fa4ad5b82996b063c2048cc 100644 (file)
@@ -2326,8 +2326,10 @@ const std::u16string& WebContentsImpl::GetTitle() {
   // proceses.
   {
     NavigationEntry* entry = GetController().GetVisibleEntry();
-    if (entry && entry->GetTitle().empty())
-      return std::u16string();
+    if (entry && entry->GetTitle().empty()) {
+      page_title_when_no_navigation_entry_ = std::u16string();
+      return page_title_when_no_navigation_entry_;
+    }
   }
 #endif
 
index 89af5e9788eb51c4573ff302f3d14c3098523259..32f1744b7bb6ab55e2f32ab6ccd18aecd3a3f086 100644 (file)
@@ -2116,6 +2116,9 @@ class CONTENT_EXPORT WebContentsImpl : public WebContents,
 
   // Data for current page -----------------------------------------------------
 
+  // When a title cannot be taken from any entry, this title will be used.
+  std::u16string page_title_when_no_navigation_entry_;
+
   // The last published theme color.
   absl::optional<SkColor> last_sent_theme_color_;