Clear the page title on reload.

This change makes it so that Blink, as it loads a page,
always reports a title, removing guesswork from the higher
layers.

BUG=96041, 783529

Cq-Include-Trybots: master.tryserver.chromium.linux:linux_site_isolation;master.tryserver.chromium.linux:linux_site_isolation,linux_chromium_browser_side_navigation_rel
Change-Id: Ide09c91342cdb3d36f8a02fccf2f4755d551a64f
Reviewed-on: https://chromium-review.googlesource.com/590273
Reviewed-by: Hayato Ito <hayato@chromium.org>
Reviewed-by: Marc Treib <treib@chromium.org>
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Reviewed-by: Charlie Reis <creis@chromium.org>
Commit-Queue: Avi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#516133}
diff --git a/chrome/browser/ui/search/search_tab_helper.cc b/chrome/browser/ui/search/search_tab_helper.cc
index bc37ed6..450b86a 100644
--- a/chrome/browser/ui/search/search_tab_helper.cc
+++ b/chrome/browser/ui/search/search_tab_helper.cc
@@ -224,24 +224,27 @@
                               search::CACHEABLE_NTP_LOAD_SUCCEEDED,
                               search::CACHEABLE_NTP_LOAD_MAX);
   }
+}
+
+void SearchTabHelper::TitleWasSet(content::NavigationEntry* entry) {
+  if (is_setting_title_)
+    return;
 
   // Always set the title on the new tab page to be the one from our UI
-  // resources. Normally, we set the title when we begin a NTP load, but it can
-  // get reset in several places (like when you press Reload). This check
-  // ensures that the title is properly set to the string defined by the Chrome
-  // UI language (rather than the server language) in all cases.
+  // resources. This check ensures that the title is properly set to the string
+  // defined by the Chrome UI language (rather than the server language) in all
+  // cases.
   //
   // We only override the title when it's nonempty to allow the page to set the
   // title if it really wants. An empty title means to use the default. There's
   // also a race condition between this code and the page's SetTitle call which
   // this rule avoids.
-  content::NavigationEntry* entry =
-      web_contents_->GetController().GetLastCommittedEntry();
-  if (entry && entry->GetTitle().empty() &&
-      (entry->GetVirtualURL() == chrome::kChromeUINewTabURL ||
-       search::NavEntryIsInstantNTP(web_contents_, entry))) {
+  if (entry->GetTitle().empty() &&
+      search::NavEntryIsInstantNTP(web_contents_, entry)) {
+    is_setting_title_ = true;
     web_contents_->UpdateTitleForEntry(
         entry, l10n_util::GetStringUTF16(IDS_NEW_TAB_TITLE));
+    is_setting_title_ = false;
   }
 }
 
diff --git a/chrome/browser/ui/search/search_tab_helper.h b/chrome/browser/ui/search/search_tab_helper.h
index a15e1627..a999637 100644
--- a/chrome/browser/ui/search/search_tab_helper.h
+++ b/chrome/browser/ui/search/search_tab_helper.h
@@ -83,6 +83,7 @@
       content::NavigationHandle* navigation_handle) override;
   void DidFinishNavigation(
       content::NavigationHandle* navigation_handle) override;
+  void TitleWasSet(content::NavigationEntry* entry) override;
   void DidFinishLoad(content::RenderFrameHost* render_frame_host,
                      const GURL& validated_url) override;
   void NavigationEntryCommitted(
@@ -122,6 +123,8 @@
 
   InstantService* instant_service_;
 
+  bool is_setting_title_ = false;
+
   DISALLOW_COPY_AND_ASSIGN(SearchTabHelper);
 };
 
diff --git a/chrome/browser/ui/search/search_tab_helper_unittest.cc b/chrome/browser/ui/search/search_tab_helper_unittest.cc
index 104f4bf..421ea21 100644
--- a/chrome/browser/ui/search/search_tab_helper_unittest.cc
+++ b/chrome/browser/ui/search/search_tab_helper_unittest.cc
@@ -220,34 +220,8 @@
   EXPECT_FALSE(search_tab_helper->HistorySyncCheck());
 }
 
-class TabTitleObserver : public content::WebContentsObserver {
- public:
-  explicit TabTitleObserver(content::WebContents* contents)
-      : WebContentsObserver(contents) {}
-
-  base::string16 title_on_start() { return title_on_start_; }
-  base::string16 title_on_commit() { return title_on_commit_; }
-
- private:
-  void DidStartNavigation(
-      content::NavigationHandle* navigation_handle) override {
-    title_on_start_ = web_contents()->GetTitle();
-  }
-
-  void DidFinishNavigation(
-      content::NavigationHandle* navigation_handle) override {
-    title_on_commit_ = web_contents()->GetTitle();
-  }
-
-  base::string16 title_on_start_;
-  base::string16 title_on_commit_;
-};
-
 TEST_F(SearchTabHelperTest, TitleIsSetForNTP) {
-  TabTitleObserver title_observer(web_contents());
   NavigateAndCommit(GURL(chrome::kChromeUINewTabURL));
-  const base::string16 title = l10n_util::GetStringUTF16(IDS_NEW_TAB_TITLE);
-  EXPECT_EQ(title, title_observer.title_on_start());
-  EXPECT_EQ(title, title_observer.title_on_commit());
-  EXPECT_EQ(title, web_contents()->GetTitle());
+  EXPECT_EQ(l10n_util::GetStringUTF16(IDS_NEW_TAB_TITLE),
+            web_contents()->GetTitle());
 }
diff --git a/chrome/test/data/extensions/api_test/tabs/on_updated/test.js b/chrome/test/data/extensions/api_test/tabs/on_updated/test.js
index 16688a2f..7fcd443f 100644
--- a/chrome/test/data/extensions/api_test/tabs/on_updated/test.js
+++ b/chrome/test/data/extensions/api_test/tabs/on_updated/test.js
@@ -49,19 +49,15 @@
 
   function newTab() {
     // Test for crbug.com/27208.
+    //
+    // Note the two title settings. That is expected and due to the unusual way
+    // the NTP code ensures a set title.
     expect([
-      { title : "New Tab" },
       { status: 'loading', url: 'chrome://newtab/' },
+      { title : "New Tab" },
+      { title : "New Tab" },
       { status: 'complete' }
-    ], function(info) {
-      // TODO(jam): remove this logic and the title line above when PlzNavigate
-      // is turned on by default. Right now the test has to handle both cases
-      // which have different timing. http://crbug.com/368813
-      if (info.status === 'loading' && capturedEventData.length == 0) {
-        expectedEventData.shift();
-      }
-      return false;
-    });
+    ]);
 
     chrome.tabs.create({ url: 'chrome://newtab/' });
   },
diff --git a/content/browser/frame_host/navigation_controller_impl_browsertest.cc b/content/browser/frame_host/navigation_controller_impl_browsertest.cc
index 3491cef..2214e77 100644
--- a/content/browser/frame_host/navigation_controller_impl_browsertest.cc
+++ b/content/browser/frame_host/navigation_controller_impl_browsertest.cc
@@ -6878,6 +6878,67 @@
   ASSERT_EQ(controller.GetPendingEntry(), nullptr);
 }
 
+// Tests that reloading a page that has no title doesn't inherit the title from
+// the previous version of the page.
+IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest, ReloadDoesntKeepTitle) {
+  NavigationController& controller = shell()->web_contents()->GetController();
+  GURL start_url(embedded_test_server()->GetURL(
+      "/navigation_controller/simple_page_1.html"));
+  GURL intermediate_url(embedded_test_server()->GetURL(
+      "/navigation_controller/simple_page_2.html"));
+  base::string16 title = base::UTF8ToUTF16("title");
+
+  // Reload from the browser side.
+  {
+    EXPECT_TRUE(NavigateToURL(shell(), start_url));
+
+    NavigationEntry* entry = controller.GetLastCommittedEntry();
+    EXPECT_TRUE(entry->GetTitle().empty());
+    entry->SetTitle(title);
+
+    controller.Reload(ReloadType::NORMAL, false);
+    EXPECT_TRUE(WaitForLoadStop(shell()->web_contents()));
+
+    EXPECT_TRUE(entry->GetTitle().empty());
+  }
+
+  // Load an unrelated page; this disconnects these two tests.
+  EXPECT_TRUE(NavigateToURL(shell(), intermediate_url));
+
+  // Reload from the renderer side.
+  {
+    EXPECT_TRUE(NavigateToURL(shell(), start_url));
+
+    NavigationEntry* entry = controller.GetLastCommittedEntry();
+    EXPECT_TRUE(entry->GetTitle().empty());
+    entry->SetTitle(title);
+
+    TestNavigationObserver reload_observer(shell()->web_contents());
+    EXPECT_TRUE(ExecuteScript(shell(), "location.reload()"));
+    reload_observer.Wait();
+
+    EXPECT_TRUE(entry->GetTitle().empty());
+  }
+
+  // Load an unrelated page; this disconnects these two tests.
+  EXPECT_TRUE(NavigateToURL(shell(), intermediate_url));
+
+  // "Reload" by loading the same page again.
+  {
+    EXPECT_TRUE(NavigateToURL(shell(), start_url));
+
+    NavigationEntry* entry1 = controller.GetLastCommittedEntry();
+    EXPECT_TRUE(entry1->GetTitle().empty());
+    entry1->SetTitle(title);
+
+    EXPECT_TRUE(NavigateToURL(shell(), start_url));
+    NavigationEntry* entry2 = controller.GetLastCommittedEntry();
+
+    EXPECT_EQ(entry1, entry2);
+    EXPECT_TRUE(entry1->GetTitle().empty());
+  }
+}
+
 // Verify that session history navigations (back/forward) correctly hit the
 // cache instead of going to the server. The test loads a page with no-cache
 // header, stops the server, and goes back expecting successful navigation.
diff --git a/content/renderer/render_view_browsertest.cc b/content/renderer/render_view_browsertest.cc
index aec8ac8c..5540c399 100644
--- a/content/renderer/render_view_browsertest.cc
+++ b/content/renderer/render_view_browsertest.cc
@@ -654,6 +654,7 @@
   request_params.data_url_as_string =
       "data:text/html,<html><head><title>Data page</title></head></html>";
 
+  render_thread_->sink().ClearMessages();
   frame()->Navigate(common_params, StartNavigationParams(),
                     request_params);
   const IPC::Message* frame_title_msg = nullptr;
diff --git a/third_party/WebKit/LayoutTests/fast/loader/subframe-removes-itself-expected.txt b/third_party/WebKit/LayoutTests/fast/loader/subframe-removes-itself-expected.txt
index de246c9..dfd8f14 100644
--- a/third_party/WebKit/LayoutTests/fast/loader/subframe-removes-itself-expected.txt
+++ b/third_party/WebKit/LayoutTests/fast/loader/subframe-removes-itself-expected.txt
@@ -1,4 +1,6 @@
+frame "<!--framePath //<!--frame0-->-->" - didReceiveTitle: 
 frame "<!--framePath //<!--frame0-->-->" - didStartProvisionalLoadForFrame
+main frame - didReceiveTitle: 
 main frame - didFinishDocumentLoadForFrame
 frame "<!--framePath //<!--frame0-->-->" - didCommitLoadForFrame
 frame "<!--framePath //<!--frame0-->-->" - didFailLoadWithError
diff --git a/third_party/WebKit/LayoutTests/http/tests/loading/307-after-303-after-post-expected.txt b/third_party/WebKit/LayoutTests/http/tests/loading/307-after-303-after-post-expected.txt
index 5181925..0f5e7ac9 100644
--- a/third_party/WebKit/LayoutTests/http/tests/loading/307-after-303-after-post-expected.txt
+++ b/third_party/WebKit/LayoutTests/http/tests/loading/307-after-303-after-post-expected.txt
@@ -1,5 +1,6 @@
 main frame - didStartProvisionalLoadForFrame
 main frame - didCommitLoadForFrame
+main frame - didReceiveTitle: 
 main frame - didFinishDocumentLoadForFrame
 main frame - didHandleOnloadEventsForFrame
 main frame - didFinishLoadForFrame
@@ -11,6 +12,7 @@
 main frame - didReceiveServerRedirectForProvisionalLoadForFrame
 http://127.0.0.1:8000/loading/resources/307-post-output-target.php - didReceiveResponse <NSURLResponse http://127.0.0.1:8000/loading/resources/307-post-output-target.php, http status code 200>
 main frame - didCommitLoadForFrame
+main frame - didReceiveTitle: 
 main frame - didFinishDocumentLoadForFrame
 main frame - didHandleOnloadEventsForFrame
 main frame - didFinishLoadForFrame
diff --git a/third_party/WebKit/LayoutTests/http/tests/loading/bad-scheme-subframe-expected.txt b/third_party/WebKit/LayoutTests/http/tests/loading/bad-scheme-subframe-expected.txt
index 6f1893d7..cf6b2f90 100644
--- a/third_party/WebKit/LayoutTests/http/tests/loading/bad-scheme-subframe-expected.txt
+++ b/third_party/WebKit/LayoutTests/http/tests/loading/bad-scheme-subframe-expected.txt
@@ -1,6 +1,8 @@
 main frame - didStartProvisionalLoadForFrame
 main frame - didCommitLoadForFrame
+main frame - didReceiveTitle: 
 main frame - didFinishDocumentLoadForFrame
+frame "f1" - didReceiveTitle: 
 frame "f1" - didStartProvisionalLoadForFrame
 main frame - didHandleOnloadEventsForFrame
 frame "f1" - didFailProvisionalLoadWithError
diff --git a/third_party/WebKit/LayoutTests/http/tests/loading/bad-server-subframe-expected.txt b/third_party/WebKit/LayoutTests/http/tests/loading/bad-server-subframe-expected.txt
index 0e3eb93..ac8966b2 100644
--- a/third_party/WebKit/LayoutTests/http/tests/loading/bad-server-subframe-expected.txt
+++ b/third_party/WebKit/LayoutTests/http/tests/loading/bad-server-subframe-expected.txt
@@ -1,6 +1,8 @@
 main frame - didStartProvisionalLoadForFrame
 main frame - didCommitLoadForFrame
+frame "f1" - didReceiveTitle: 
 frame "f1" - didStartProvisionalLoadForFrame
+main frame - didReceiveTitle: 
 main frame - didFinishDocumentLoadForFrame
 frame "f1" - didFailProvisionalLoadWithError
 frame "f1" - didStartProvisionalLoadForFrame
diff --git a/third_party/WebKit/LayoutTests/http/tests/loading/basic-expected.txt b/third_party/WebKit/LayoutTests/http/tests/loading/basic-expected.txt
index f124c4f..868aa22d 100644
--- a/third_party/WebKit/LayoutTests/http/tests/loading/basic-expected.txt
+++ b/third_party/WebKit/LayoutTests/http/tests/loading/basic-expected.txt
@@ -1,5 +1,6 @@
 main frame - didStartProvisionalLoadForFrame
 main frame - didCommitLoadForFrame
+main frame - didReceiveTitle: 
 main frame - didFinishDocumentLoadForFrame
 main frame - didHandleOnloadEventsForFrame
 main frame - didFinishLoadForFrame
diff --git a/third_party/WebKit/LayoutTests/http/tests/loading/dont-preload-non-img-srcset-expected.txt b/third_party/WebKit/LayoutTests/http/tests/loading/dont-preload-non-img-srcset-expected.txt
index da3e30e..857057b 100644
--- a/third_party/WebKit/LayoutTests/http/tests/loading/dont-preload-non-img-srcset-expected.txt
+++ b/third_party/WebKit/LayoutTests/http/tests/loading/dont-preload-non-img-srcset-expected.txt
@@ -1,20 +1,26 @@
 main frame - didStartProvisionalLoadForFrame
 main frame - didCommitLoadForFrame
+frame "<!--framePath //<!--frame0-->-->" - didReceiveTitle: 
 frame "<!--framePath //<!--frame0-->-->" - didStartProvisionalLoadForFrame
 frame "<!--framePath //<!--frame0-->-->" - didCommitLoadForFrame
+frame "<!--framePath //<!--frame0-->-->" - didReceiveTitle: 
 frame "<!--framePath //<!--frame0-->-->" - didFinishDocumentLoadForFrame
 frame "<!--framePath //<!--frame0-->-->" - didHandleOnloadEventsForFrame
 frame "<!--framePath //<!--frame0-->-->" - didFinishLoadForFrame
+main frame - didReceiveTitle: 
 main frame - didFinishDocumentLoadForFrame
 main frame - didHandleOnloadEventsForFrame
 main frame - didFinishLoadForFrame
 main frame - didStartProvisionalLoadForFrame
 main frame - didCommitLoadForFrame
+frame "<!--framePath //<!--frame0-->-->" - didReceiveTitle: 
 frame "<!--framePath //<!--frame0-->-->" - didStartProvisionalLoadForFrame
 frame "<!--framePath //<!--frame0-->-->" - didCommitLoadForFrame
+frame "<!--framePath //<!--frame0-->-->" - didReceiveTitle: 
 frame "<!--framePath //<!--frame0-->-->" - didFinishDocumentLoadForFrame
 frame "<!--framePath //<!--frame0-->-->" - didHandleOnloadEventsForFrame
 frame "<!--framePath //<!--frame0-->-->" - didFinishLoadForFrame
+main frame - didReceiveTitle: 
 main frame - didFinishDocumentLoadForFrame
 main frame - didHandleOnloadEventsForFrame
 main frame - didFinishLoadForFrame
diff --git a/third_party/WebKit/LayoutTests/http/tests/loading/empty-subframe-expected.txt b/third_party/WebKit/LayoutTests/http/tests/loading/empty-subframe-expected.txt
index db76e6f..c91610e 100644
--- a/third_party/WebKit/LayoutTests/http/tests/loading/empty-subframe-expected.txt
+++ b/third_party/WebKit/LayoutTests/http/tests/loading/empty-subframe-expected.txt
@@ -1,10 +1,13 @@
 main frame - didStartProvisionalLoadForFrame
 main frame - didCommitLoadForFrame
+frame "f1" - didReceiveTitle: 
 frame "f1" - didStartProvisionalLoadForFrame
 frame "f1" - didCommitLoadForFrame
+frame "f1" - didReceiveTitle: 
 frame "f1" - didFinishDocumentLoadForFrame
 frame "f1" - didHandleOnloadEventsForFrame
 frame "f1" - didFinishLoadForFrame
+main frame - didReceiveTitle: 
 main frame - didFinishDocumentLoadForFrame
 main frame - didHandleOnloadEventsForFrame
 main frame - didFinishLoadForFrame
diff --git a/third_party/WebKit/LayoutTests/http/tests/loading/fire-error-event-empty-404-script-expected.txt b/third_party/WebKit/LayoutTests/http/tests/loading/fire-error-event-empty-404-script-expected.txt
index 35efd46..1e069ec 100644
--- a/third_party/WebKit/LayoutTests/http/tests/loading/fire-error-event-empty-404-script-expected.txt
+++ b/third_party/WebKit/LayoutTests/http/tests/loading/fire-error-event-empty-404-script-expected.txt
@@ -1,5 +1,6 @@
 main frame - didStartProvisionalLoadForFrame
 main frame - didCommitLoadForFrame
+main frame - didReceiveTitle: 
 main frame - didFinishDocumentLoadForFrame
 main frame - didHandleOnloadEventsForFrame
 main frame - didFinishLoadForFrame
diff --git a/third_party/WebKit/LayoutTests/http/tests/loading/fire-error-event-script-no-content-type-expected.txt b/third_party/WebKit/LayoutTests/http/tests/loading/fire-error-event-script-no-content-type-expected.txt
index 27dabce..d7b552c 100644
--- a/third_party/WebKit/LayoutTests/http/tests/loading/fire-error-event-script-no-content-type-expected.txt
+++ b/third_party/WebKit/LayoutTests/http/tests/loading/fire-error-event-script-no-content-type-expected.txt
@@ -1,5 +1,6 @@
 main frame - didStartProvisionalLoadForFrame
 main frame - didCommitLoadForFrame
+main frame - didReceiveTitle: 
 main frame - didFinishDocumentLoadForFrame
 main frame - didHandleOnloadEventsForFrame
 main frame - didFinishLoadForFrame
diff --git a/third_party/WebKit/LayoutTests/http/tests/loading/load-javascript-after-many-xhrs-expected.txt b/third_party/WebKit/LayoutTests/http/tests/loading/load-javascript-after-many-xhrs-expected.txt
index 24597fe..637c4a1 100644
--- a/third_party/WebKit/LayoutTests/http/tests/loading/load-javascript-after-many-xhrs-expected.txt
+++ b/third_party/WebKit/LayoutTests/http/tests/loading/load-javascript-after-many-xhrs-expected.txt
@@ -1,5 +1,6 @@
 main frame - didStartProvisionalLoadForFrame
 main frame - didCommitLoadForFrame
+main frame - didReceiveTitle: 
 main frame - didFinishDocumentLoadForFrame
 main frame - didHandleOnloadEventsForFrame
 main frame - didFinishLoadForFrame
diff --git a/third_party/WebKit/LayoutTests/http/tests/loading/location-hash-reload-cycle-expected.txt b/third_party/WebKit/LayoutTests/http/tests/loading/location-hash-reload-cycle-expected.txt
index 479091f8..032a21dd 100644
--- a/third_party/WebKit/LayoutTests/http/tests/loading/location-hash-reload-cycle-expected.txt
+++ b/third_party/WebKit/LayoutTests/http/tests/loading/location-hash-reload-cycle-expected.txt
@@ -1,5 +1,6 @@
 main frame - didStartProvisionalLoadForFrame
 main frame - didCommitLoadForFrame
+main frame - didReceiveTitle: 
 main frame - didFinishDocumentLoadForFrame
 main frame - didHandleOnloadEventsForFrame
 main frame - didFinishLoadForFrame
diff --git a/third_party/WebKit/LayoutTests/http/tests/loading/module-script-wrong-mime-expected.txt b/third_party/WebKit/LayoutTests/http/tests/loading/module-script-wrong-mime-expected.txt
index b158e45..665ff33 100644
--- a/third_party/WebKit/LayoutTests/http/tests/loading/module-script-wrong-mime-expected.txt
+++ b/third_party/WebKit/LayoutTests/http/tests/loading/module-script-wrong-mime-expected.txt
@@ -1,6 +1,7 @@
 main frame - didStartProvisionalLoadForFrame
 main frame - didCommitLoadForFrame
 CONSOLE ERROR: Failed to load module script: The server responded with a non-JavaScript MIME type of "text/plain". Strict MIME type checking is enforced for module scripts per HTML spec.
+main frame - didReceiveTitle: 
 main frame - didFinishDocumentLoadForFrame
 main frame - didHandleOnloadEventsForFrame
 main frame - didFinishLoadForFrame
diff --git a/third_party/WebKit/LayoutTests/http/tests/loading/nested_bad_objects-expected.txt b/third_party/WebKit/LayoutTests/http/tests/loading/nested_bad_objects-expected.txt
index c582edb..21b5929 100644
--- a/third_party/WebKit/LayoutTests/http/tests/loading/nested_bad_objects-expected.txt
+++ b/third_party/WebKit/LayoutTests/http/tests/loading/nested_bad_objects-expected.txt
@@ -1,5 +1,6 @@
 main frame - didStartProvisionalLoadForFrame
 main frame - didCommitLoadForFrame
+main frame - didReceiveTitle: 
 main frame - didFinishDocumentLoadForFrame
 main frame - didHandleOnloadEventsForFrame
 main frame - didFinishLoadForFrame
diff --git a/third_party/WebKit/LayoutTests/http/tests/loading/onload-vs-immediate-refresh-expected.txt b/third_party/WebKit/LayoutTests/http/tests/loading/onload-vs-immediate-refresh-expected.txt
index cf0d001..7cefb1d 100644
--- a/third_party/WebKit/LayoutTests/http/tests/loading/onload-vs-immediate-refresh-expected.txt
+++ b/third_party/WebKit/LayoutTests/http/tests/loading/onload-vs-immediate-refresh-expected.txt
@@ -1,11 +1,13 @@
 main frame - didStartProvisionalLoadForFrame
 main frame - didCommitLoadForFrame
+main frame - didReceiveTitle: 
 main frame - didFinishDocumentLoadForFrame
 ALERT: SUCCESS
 main frame - didHandleOnloadEventsForFrame
 main frame - didFinishLoadForFrame
 main frame - didStartProvisionalLoadForFrame
 main frame - didCommitLoadForFrame
+main frame - didReceiveTitle: 
 main frame - didFinishDocumentLoadForFrame
 main frame - didHandleOnloadEventsForFrame
 main frame - didFinishLoadForFrame
diff --git a/third_party/WebKit/LayoutTests/http/tests/loading/pdf-commit-load-callbacks-expected.txt b/third_party/WebKit/LayoutTests/http/tests/loading/pdf-commit-load-callbacks-expected.txt
index 2a3bf3d..743c297 100644
--- a/third_party/WebKit/LayoutTests/http/tests/loading/pdf-commit-load-callbacks-expected.txt
+++ b/third_party/WebKit/LayoutTests/http/tests/loading/pdf-commit-load-callbacks-expected.txt
@@ -1,6 +1,8 @@
 main frame - didStartProvisionalLoadForFrame
 main frame - didCommitLoadForFrame
+frame "<!--framePath //<!--frame0-->-->" - didReceiveTitle: 
 frame "<!--framePath //<!--frame0-->-->" - didStartProvisionalLoadForFrame
+main frame - didReceiveTitle: 
 main frame - didFinishDocumentLoadForFrame
 frame "<!--framePath //<!--frame0-->-->" - didFailProvisionalLoadWithError
 main frame - didHandleOnloadEventsForFrame
diff --git a/third_party/WebKit/LayoutTests/http/tests/loading/pending-script-leak-expected.txt b/third_party/WebKit/LayoutTests/http/tests/loading/pending-script-leak-expected.txt
index d51532b1..008c1c02 100644
--- a/third_party/WebKit/LayoutTests/http/tests/loading/pending-script-leak-expected.txt
+++ b/third_party/WebKit/LayoutTests/http/tests/loading/pending-script-leak-expected.txt
@@ -1,10 +1,13 @@
 main frame - didStartProvisionalLoadForFrame
 main frame - didCommitLoadForFrame
+frame "<!--framePath //<!--frame0-->-->" - didReceiveTitle: 
 frame "<!--framePath //<!--frame0-->-->" - didStartProvisionalLoadForFrame
 frame "<!--framePath //<!--frame0-->-->" - didCommitLoadForFrame
+frame "<!--framePath //<!--frame0-->-->" - didReceiveTitle: 
 frame "<!--framePath //<!--frame0-->-->" - didFinishDocumentLoadForFrame
 frame "<!--framePath //<!--frame0-->-->" - didHandleOnloadEventsForFrame
 frame "<!--framePath //<!--frame0-->-->" - didFinishLoadForFrame
+main frame - didReceiveTitle: 
 main frame - didFinishDocumentLoadForFrame
 main frame - didHandleOnloadEventsForFrame
 main frame - didFinishLoadForFrame
diff --git a/third_party/WebKit/LayoutTests/http/tests/loading/preload-append-scan-expected.txt b/third_party/WebKit/LayoutTests/http/tests/loading/preload-append-scan-expected.txt
index b19870c..e94d4a8 100644
--- a/third_party/WebKit/LayoutTests/http/tests/loading/preload-append-scan-expected.txt
+++ b/third_party/WebKit/LayoutTests/http/tests/loading/preload-append-scan-expected.txt
@@ -1,5 +1,6 @@
 main frame - didStartProvisionalLoadForFrame
 main frame - didCommitLoadForFrame
+main frame - didReceiveTitle: 
 main frame - didFinishDocumentLoadForFrame
 main frame - didHandleOnloadEventsForFrame
 main frame - didFinishLoadForFrame
diff --git a/third_party/WebKit/LayoutTests/http/tests/loading/preload-css-test-expected.txt b/third_party/WebKit/LayoutTests/http/tests/loading/preload-css-test-expected.txt
index f9d223d..f201d25 100644
--- a/third_party/WebKit/LayoutTests/http/tests/loading/preload-css-test-expected.txt
+++ b/third_party/WebKit/LayoutTests/http/tests/loading/preload-css-test-expected.txt
@@ -1,5 +1,6 @@
 main frame - didStartProvisionalLoadForFrame
 main frame - didCommitLoadForFrame
+main frame - didReceiveTitle: 
 main frame - didFinishDocumentLoadForFrame
 main frame - didHandleOnloadEventsForFrame
 main frame - didFinishLoadForFrame
diff --git a/third_party/WebKit/LayoutTests/http/tests/loading/preload-ignore-invalid-base-expected.txt b/third_party/WebKit/LayoutTests/http/tests/loading/preload-ignore-invalid-base-expected.txt
index e1b56d76..42fd5ea2 100644
--- a/third_party/WebKit/LayoutTests/http/tests/loading/preload-ignore-invalid-base-expected.txt
+++ b/third_party/WebKit/LayoutTests/http/tests/loading/preload-ignore-invalid-base-expected.txt
@@ -1,5 +1,6 @@
 main frame - didStartProvisionalLoadForFrame
 main frame - didCommitLoadForFrame
+main frame - didReceiveTitle: 
 main frame - didFinishDocumentLoadForFrame
 main frame - didHandleOnloadEventsForFrame
 main frame - didFinishLoadForFrame
diff --git a/third_party/WebKit/LayoutTests/http/tests/loading/preload-image-sizes-2x-expected.txt b/third_party/WebKit/LayoutTests/http/tests/loading/preload-image-sizes-2x-expected.txt
index bd558f9e..df57f07 100644
--- a/third_party/WebKit/LayoutTests/http/tests/loading/preload-image-sizes-2x-expected.txt
+++ b/third_party/WebKit/LayoutTests/http/tests/loading/preload-image-sizes-2x-expected.txt
@@ -1,10 +1,12 @@
 main frame - didStartProvisionalLoadForFrame
 main frame - didCommitLoadForFrame
+main frame - didReceiveTitle: 
 main frame - didFinishDocumentLoadForFrame
 main frame - didHandleOnloadEventsForFrame
 main frame - didFinishLoadForFrame
 main frame - didStartProvisionalLoadForFrame
 main frame - didCommitLoadForFrame
+main frame - didReceiveTitle: 
 main frame - didFinishDocumentLoadForFrame
 main frame - didHandleOnloadEventsForFrame
 main frame - didFinishLoadForFrame
diff --git a/third_party/WebKit/LayoutTests/http/tests/loading/preload-image-sizes-expected.txt b/third_party/WebKit/LayoutTests/http/tests/loading/preload-image-sizes-expected.txt
index 8fcd5be..1543f19 100644
--- a/third_party/WebKit/LayoutTests/http/tests/loading/preload-image-sizes-expected.txt
+++ b/third_party/WebKit/LayoutTests/http/tests/loading/preload-image-sizes-expected.txt
@@ -1,5 +1,6 @@
 main frame - didStartProvisionalLoadForFrame
 main frame - didCommitLoadForFrame
+main frame - didReceiveTitle: 
 main frame - didFinishDocumentLoadForFrame
 main frame - didHandleOnloadEventsForFrame
 main frame - didFinishLoadForFrame
diff --git a/third_party/WebKit/LayoutTests/http/tests/loading/preload-image-src-expected.txt b/third_party/WebKit/LayoutTests/http/tests/loading/preload-image-src-expected.txt
index c5f6202..f6158446 100644
--- a/third_party/WebKit/LayoutTests/http/tests/loading/preload-image-src-expected.txt
+++ b/third_party/WebKit/LayoutTests/http/tests/loading/preload-image-src-expected.txt
@@ -1,5 +1,6 @@
 main frame - didStartProvisionalLoadForFrame
 main frame - didCommitLoadForFrame
+main frame - didReceiveTitle: 
 main frame - didFinishDocumentLoadForFrame
 main frame - didHandleOnloadEventsForFrame
 main frame - didFinishLoadForFrame
diff --git a/third_party/WebKit/LayoutTests/http/tests/loading/preload-image-srcset-2x-expected.txt b/third_party/WebKit/LayoutTests/http/tests/loading/preload-image-srcset-2x-expected.txt
index 5924722..605daadc 100644
--- a/third_party/WebKit/LayoutTests/http/tests/loading/preload-image-srcset-2x-expected.txt
+++ b/third_party/WebKit/LayoutTests/http/tests/loading/preload-image-srcset-2x-expected.txt
@@ -1,10 +1,12 @@
 main frame - didStartProvisionalLoadForFrame
 main frame - didCommitLoadForFrame
+main frame - didReceiveTitle: 
 main frame - didFinishDocumentLoadForFrame
 main frame - didHandleOnloadEventsForFrame
 main frame - didFinishLoadForFrame
 main frame - didStartProvisionalLoadForFrame
 main frame - didCommitLoadForFrame
+main frame - didReceiveTitle: 
 main frame - didFinishDocumentLoadForFrame
 main frame - didHandleOnloadEventsForFrame
 main frame - didFinishLoadForFrame
diff --git a/third_party/WebKit/LayoutTests/http/tests/loading/preload-image-srcset-duplicate-expected.txt b/third_party/WebKit/LayoutTests/http/tests/loading/preload-image-srcset-duplicate-expected.txt
index a95c887..c93c039 100644
--- a/third_party/WebKit/LayoutTests/http/tests/loading/preload-image-srcset-duplicate-expected.txt
+++ b/third_party/WebKit/LayoutTests/http/tests/loading/preload-image-srcset-duplicate-expected.txt
@@ -1,10 +1,12 @@
 main frame - didStartProvisionalLoadForFrame
 main frame - didCommitLoadForFrame
+main frame - didReceiveTitle: 
 main frame - didFinishDocumentLoadForFrame
 main frame - didHandleOnloadEventsForFrame
 main frame - didFinishLoadForFrame
 main frame - didStartProvisionalLoadForFrame
 main frame - didCommitLoadForFrame
+main frame - didReceiveTitle: 
 main frame - didFinishDocumentLoadForFrame
 main frame - didHandleOnloadEventsForFrame
 main frame - didFinishLoadForFrame
diff --git a/third_party/WebKit/LayoutTests/http/tests/loading/preload-image-srcset-expected.txt b/third_party/WebKit/LayoutTests/http/tests/loading/preload-image-srcset-expected.txt
index 29ec75b..4a2d7a3 100644
--- a/third_party/WebKit/LayoutTests/http/tests/loading/preload-image-srcset-expected.txt
+++ b/third_party/WebKit/LayoutTests/http/tests/loading/preload-image-srcset-expected.txt
@@ -1,10 +1,12 @@
 main frame - didStartProvisionalLoadForFrame
 main frame - didCommitLoadForFrame
+main frame - didReceiveTitle: 
 main frame - didFinishDocumentLoadForFrame
 main frame - didHandleOnloadEventsForFrame
 main frame - didFinishLoadForFrame
 main frame - didStartProvisionalLoadForFrame
 main frame - didCommitLoadForFrame
+main frame - didReceiveTitle: 
 main frame - didFinishDocumentLoadForFrame
 main frame - didHandleOnloadEventsForFrame
 main frame - didFinishLoadForFrame
diff --git a/third_party/WebKit/LayoutTests/http/tests/loading/preload-image-srcset-reverse-order-expected.txt b/third_party/WebKit/LayoutTests/http/tests/loading/preload-image-srcset-reverse-order-expected.txt
index f39f550..9a0af49 100644
--- a/third_party/WebKit/LayoutTests/http/tests/loading/preload-image-srcset-reverse-order-expected.txt
+++ b/third_party/WebKit/LayoutTests/http/tests/loading/preload-image-srcset-reverse-order-expected.txt
@@ -1,10 +1,12 @@
 main frame - didStartProvisionalLoadForFrame
 main frame - didCommitLoadForFrame
+main frame - didReceiveTitle: 
 main frame - didFinishDocumentLoadForFrame
 main frame - didHandleOnloadEventsForFrame
 main frame - didFinishLoadForFrame
 main frame - didStartProvisionalLoadForFrame
 main frame - didCommitLoadForFrame
+main frame - didReceiveTitle: 
 main frame - didFinishDocumentLoadForFrame
 main frame - didHandleOnloadEventsForFrame
 main frame - didFinishLoadForFrame
diff --git a/third_party/WebKit/LayoutTests/http/tests/loading/preload-image-srcset-src-preloaded-expected.txt b/third_party/WebKit/LayoutTests/http/tests/loading/preload-image-srcset-src-preloaded-expected.txt
index 7f8c62f..c3c5743 100644
--- a/third_party/WebKit/LayoutTests/http/tests/loading/preload-image-srcset-src-preloaded-expected.txt
+++ b/third_party/WebKit/LayoutTests/http/tests/loading/preload-image-srcset-src-preloaded-expected.txt
@@ -1,10 +1,12 @@
 main frame - didStartProvisionalLoadForFrame
 main frame - didCommitLoadForFrame
+main frame - didReceiveTitle: 
 main frame - didFinishDocumentLoadForFrame
 main frame - didHandleOnloadEventsForFrame
 main frame - didFinishLoadForFrame
 main frame - didStartProvisionalLoadForFrame
 main frame - didCommitLoadForFrame
+main frame - didReceiveTitle: 
 main frame - didFinishDocumentLoadForFrame
 main frame - didHandleOnloadEventsForFrame
 main frame - didFinishLoadForFrame
diff --git a/third_party/WebKit/LayoutTests/http/tests/loading/preload-image-srcset-src-preloaded-reverse-order-expected.txt b/third_party/WebKit/LayoutTests/http/tests/loading/preload-image-srcset-src-preloaded-reverse-order-expected.txt
index 1e9a220..a4e2e27 100644
--- a/third_party/WebKit/LayoutTests/http/tests/loading/preload-image-srcset-src-preloaded-reverse-order-expected.txt
+++ b/third_party/WebKit/LayoutTests/http/tests/loading/preload-image-srcset-src-preloaded-reverse-order-expected.txt
@@ -1,10 +1,12 @@
 main frame - didStartProvisionalLoadForFrame
 main frame - didCommitLoadForFrame
+main frame - didReceiveTitle: 
 main frame - didFinishDocumentLoadForFrame
 main frame - didHandleOnloadEventsForFrame
 main frame - didFinishLoadForFrame
 main frame - didStartProvisionalLoadForFrame
 main frame - didCommitLoadForFrame
+main frame - didReceiveTitle: 
 main frame - didFinishDocumentLoadForFrame
 main frame - didHandleOnloadEventsForFrame
 main frame - didFinishLoadForFrame
diff --git a/third_party/WebKit/LayoutTests/http/tests/loading/preload-picture-invalid-expected.txt b/third_party/WebKit/LayoutTests/http/tests/loading/preload-picture-invalid-expected.txt
index a69a993..48588c5 100644
--- a/third_party/WebKit/LayoutTests/http/tests/loading/preload-picture-invalid-expected.txt
+++ b/third_party/WebKit/LayoutTests/http/tests/loading/preload-picture-invalid-expected.txt
@@ -1,5 +1,6 @@
 main frame - didStartProvisionalLoadForFrame
 main frame - didCommitLoadForFrame
+main frame - didReceiveTitle: 
 main frame - didFinishDocumentLoadForFrame
 main frame - didHandleOnloadEventsForFrame
 main frame - didFinishLoadForFrame
diff --git a/third_party/WebKit/LayoutTests/http/tests/loading/preload-picture-nested-expected.txt b/third_party/WebKit/LayoutTests/http/tests/loading/preload-picture-nested-expected.txt
index dbdb351..3a5bc03 100644
--- a/third_party/WebKit/LayoutTests/http/tests/loading/preload-picture-nested-expected.txt
+++ b/third_party/WebKit/LayoutTests/http/tests/loading/preload-picture-nested-expected.txt
@@ -1,5 +1,6 @@
 main frame - didStartProvisionalLoadForFrame
 main frame - didCommitLoadForFrame
+main frame - didReceiveTitle: 
 main frame - didFinishDocumentLoadForFrame
 main frame - didHandleOnloadEventsForFrame
 main frame - didFinishLoadForFrame
diff --git a/third_party/WebKit/LayoutTests/http/tests/loading/preload-picture-sizes-2x-expected.txt b/third_party/WebKit/LayoutTests/http/tests/loading/preload-picture-sizes-2x-expected.txt
index 61169ec..cb37a6c7 100644
--- a/third_party/WebKit/LayoutTests/http/tests/loading/preload-picture-sizes-2x-expected.txt
+++ b/third_party/WebKit/LayoutTests/http/tests/loading/preload-picture-sizes-2x-expected.txt
@@ -1,12 +1,14 @@
 main frame - didStartProvisionalLoadForFrame
 main frame - didCommitLoadForFrame
 CONSOLE WARNING: <source src> with a <picture> parent is invalid and therefore ignored. Please use <source srcset> instead.
+main frame - didReceiveTitle: 
 main frame - didFinishDocumentLoadForFrame
 main frame - didHandleOnloadEventsForFrame
 main frame - didFinishLoadForFrame
 main frame - didStartProvisionalLoadForFrame
 main frame - didCommitLoadForFrame
 CONSOLE WARNING: <source src> with a <picture> parent is invalid and therefore ignored. Please use <source srcset> instead.
+main frame - didReceiveTitle: 
 main frame - didFinishDocumentLoadForFrame
 main frame - didHandleOnloadEventsForFrame
 main frame - didFinishLoadForFrame
diff --git a/third_party/WebKit/LayoutTests/http/tests/loading/preload-picture-sizes-expected.txt b/third_party/WebKit/LayoutTests/http/tests/loading/preload-picture-sizes-expected.txt
index 7b43d0e..96e747e 100644
--- a/third_party/WebKit/LayoutTests/http/tests/loading/preload-picture-sizes-expected.txt
+++ b/third_party/WebKit/LayoutTests/http/tests/loading/preload-picture-sizes-expected.txt
@@ -1,6 +1,7 @@
 main frame - didStartProvisionalLoadForFrame
 main frame - didCommitLoadForFrame
 CONSOLE WARNING: <source src> with a <picture> parent is invalid and therefore ignored. Please use <source srcset> instead.
+main frame - didReceiveTitle: 
 main frame - didFinishDocumentLoadForFrame
 main frame - didHandleOnloadEventsForFrame
 main frame - didFinishLoadForFrame
diff --git a/third_party/WebKit/LayoutTests/http/tests/loading/preload-video-poster-expected.txt b/third_party/WebKit/LayoutTests/http/tests/loading/preload-video-poster-expected.txt
index 06c3cef..817a481 100644
--- a/third_party/WebKit/LayoutTests/http/tests/loading/preload-video-poster-expected.txt
+++ b/third_party/WebKit/LayoutTests/http/tests/loading/preload-video-poster-expected.txt
@@ -1,5 +1,6 @@
 main frame - didStartProvisionalLoadForFrame
 main frame - didCommitLoadForFrame
+main frame - didReceiveTitle: 
 main frame - didFinishDocumentLoadForFrame
 main frame - didHandleOnloadEventsForFrame
 main frame - didFinishLoadForFrame
diff --git a/third_party/WebKit/LayoutTests/http/tests/loading/redirect-methods-expected.txt b/third_party/WebKit/LayoutTests/http/tests/loading/redirect-methods-expected.txt
index 3b614893..14a38f5 100644
--- a/third_party/WebKit/LayoutTests/http/tests/loading/redirect-methods-expected.txt
+++ b/third_party/WebKit/LayoutTests/http/tests/loading/redirect-methods-expected.txt
@@ -1,10 +1,13 @@
 main frame - didStartProvisionalLoadForFrame
 main frame - didCommitLoadForFrame
+main frame - didReceiveTitle: 
 main frame - didFinishDocumentLoadForFrame
 main frame - didHandleOnloadEventsForFrame
 main frame - didFinishLoadForFrame
+frame "0" - didReceiveTitle: 
 frame "0" - didStartProvisionalLoadForFrame
 frame "0" - didCommitLoadForFrame
+frame "0" - didReceiveTitle: 
 frame "0" - didFinishDocumentLoadForFrame
 frame "0" - didHandleOnloadEventsForFrame
 frame "0" - didFinishLoadForFrame
@@ -12,6 +15,7 @@
 http://127.0.0.1:8000/loading/resources/redirect-methods-form.html - willSendRequest <NSURLRequest URL http://127.0.0.1:8000/loading/resources/redirect-methods-form.html, main document URL http://127.0.0.1:8000/loading/redirect-methods.html, http method GET>
 http://127.0.0.1:8000/loading/resources/redirect-methods-form.html - didReceiveResponse <NSURLResponse http://127.0.0.1:8000/loading/resources/redirect-methods-form.html, http status code 200>
 frame "0" - didCommitLoadForFrame
+frame "0" - didReceiveTitle: 
 frame "0" - didFinishDocumentLoadForFrame
 frame "0" - didHandleOnloadEventsForFrame
 frame "0" - didFinishLoadForFrame
@@ -21,9 +25,12 @@
 frame "0" - didReceiveServerRedirectForProvisionalLoadForFrame
 http://127.0.0.1:8000/loading/resources/redirect-methods-result.php?redirected=true - didReceiveResponse <NSURLResponse http://127.0.0.1:8000/loading/resources/redirect-methods-result.php?redirected=true, http status code 200>
 frame "0" - didCommitLoadForFrame
+frame "0" - didReceiveTitle: 
 frame "0" - didFinishDocumentLoadForFrame
+frame "1" - didReceiveTitle: 
 frame "1" - didStartProvisionalLoadForFrame
 frame "1" - didCommitLoadForFrame
+frame "1" - didReceiveTitle: 
 frame "1" - didFinishDocumentLoadForFrame
 frame "1" - didHandleOnloadEventsForFrame
 frame "1" - didFinishLoadForFrame
@@ -33,6 +40,7 @@
 http://127.0.0.1:8000/loading/resources/redirect-methods-form.html - willSendRequest <NSURLRequest URL http://127.0.0.1:8000/loading/resources/redirect-methods-form.html, main document URL http://127.0.0.1:8000/loading/redirect-methods.html, http method GET>
 http://127.0.0.1:8000/loading/resources/redirect-methods-form.html - didReceiveResponse <NSURLResponse http://127.0.0.1:8000/loading/resources/redirect-methods-form.html, http status code 200>
 frame "1" - didCommitLoadForFrame
+frame "1" - didReceiveTitle: 
 frame "1" - didFinishDocumentLoadForFrame
 frame "1" - didHandleOnloadEventsForFrame
 frame "1" - didFinishLoadForFrame
@@ -42,9 +50,12 @@
 frame "1" - didReceiveServerRedirectForProvisionalLoadForFrame
 http://127.0.0.1:8000/loading/resources/redirect-methods-result.php?redirected=true - didReceiveResponse <NSURLResponse http://127.0.0.1:8000/loading/resources/redirect-methods-result.php?redirected=true, http status code 200>
 frame "1" - didCommitLoadForFrame
+frame "1" - didReceiveTitle: 
 frame "1" - didFinishDocumentLoadForFrame
+frame "2" - didReceiveTitle: 
 frame "2" - didStartProvisionalLoadForFrame
 frame "2" - didCommitLoadForFrame
+frame "2" - didReceiveTitle: 
 frame "2" - didFinishDocumentLoadForFrame
 frame "2" - didHandleOnloadEventsForFrame
 frame "2" - didFinishLoadForFrame
@@ -54,6 +65,7 @@
 http://127.0.0.1:8000/loading/resources/redirect-methods-form.html - willSendRequest <NSURLRequest URL http://127.0.0.1:8000/loading/resources/redirect-methods-form.html, main document URL http://127.0.0.1:8000/loading/redirect-methods.html, http method GET>
 http://127.0.0.1:8000/loading/resources/redirect-methods-form.html - didReceiveResponse <NSURLResponse http://127.0.0.1:8000/loading/resources/redirect-methods-form.html, http status code 200>
 frame "2" - didCommitLoadForFrame
+frame "2" - didReceiveTitle: 
 frame "2" - didFinishDocumentLoadForFrame
 frame "2" - didHandleOnloadEventsForFrame
 frame "2" - didFinishLoadForFrame
@@ -63,9 +75,12 @@
 frame "2" - didReceiveServerRedirectForProvisionalLoadForFrame
 http://127.0.0.1:8000/loading/resources/redirect-methods-result.php?redirected=true - didReceiveResponse <NSURLResponse http://127.0.0.1:8000/loading/resources/redirect-methods-result.php?redirected=true, http status code 200>
 frame "2" - didCommitLoadForFrame
+frame "2" - didReceiveTitle: 
 frame "2" - didFinishDocumentLoadForFrame
+frame "3" - didReceiveTitle: 
 frame "3" - didStartProvisionalLoadForFrame
 frame "3" - didCommitLoadForFrame
+frame "3" - didReceiveTitle: 
 frame "3" - didFinishDocumentLoadForFrame
 frame "3" - didHandleOnloadEventsForFrame
 frame "3" - didFinishLoadForFrame
@@ -75,6 +90,7 @@
 http://127.0.0.1:8000/loading/resources/redirect-methods-form.html - willSendRequest <NSURLRequest URL http://127.0.0.1:8000/loading/resources/redirect-methods-form.html, main document URL http://127.0.0.1:8000/loading/redirect-methods.html, http method GET>
 http://127.0.0.1:8000/loading/resources/redirect-methods-form.html - didReceiveResponse <NSURLResponse http://127.0.0.1:8000/loading/resources/redirect-methods-form.html, http status code 200>
 frame "3" - didCommitLoadForFrame
+frame "3" - didReceiveTitle: 
 frame "3" - didFinishDocumentLoadForFrame
 frame "3" - didHandleOnloadEventsForFrame
 frame "3" - didFinishLoadForFrame
@@ -84,6 +100,7 @@
 frame "3" - didReceiveServerRedirectForProvisionalLoadForFrame
 http://127.0.0.1:8000/loading/resources/redirect-methods-result.php?redirected=true - didReceiveResponse <NSURLResponse http://127.0.0.1:8000/loading/resources/redirect-methods-result.php?redirected=true, http status code 200>
 frame "3" - didCommitLoadForFrame
+frame "3" - didReceiveTitle: 
 frame "3" - didFinishDocumentLoadForFrame
 frame "3" - didHandleOnloadEventsForFrame
 frame "3" - didFinishLoadForFrame
diff --git a/third_party/WebKit/LayoutTests/http/tests/loading/redirect-with-no-location-crash-expected.txt b/third_party/WebKit/LayoutTests/http/tests/loading/redirect-with-no-location-crash-expected.txt
index dc5bb7a3d..46480fe 100644
--- a/third_party/WebKit/LayoutTests/http/tests/loading/redirect-with-no-location-crash-expected.txt
+++ b/third_party/WebKit/LayoutTests/http/tests/loading/redirect-with-no-location-crash-expected.txt
@@ -1,9 +1,11 @@
 main frame - didStartProvisionalLoadForFrame
 main frame - didCommitLoadForFrame
 main frame - didReceiveTitle: Test for https://bugs.webkit.org/show_bug.cgi?id=29293
+frame "<!--framePath //<!--frame0-->-->" - didReceiveTitle: 
 frame "<!--framePath //<!--frame0-->-->" - didStartProvisionalLoadForFrame
 main frame - didFinishDocumentLoadForFrame
 frame "<!--framePath //<!--frame0-->-->" - didCommitLoadForFrame
+frame "<!--framePath //<!--frame0-->-->" - didReceiveTitle: 
 frame "<!--framePath //<!--frame0-->-->" - didFinishDocumentLoadForFrame
 frame "<!--framePath //<!--frame0-->-->" - didHandleOnloadEventsForFrame
 frame "<!--framePath //<!--frame0-->-->" - didFinishLoadForFrame
diff --git a/third_party/WebKit/LayoutTests/http/tests/loading/remove-child-triggers-parser-expected.txt b/third_party/WebKit/LayoutTests/http/tests/loading/remove-child-triggers-parser-expected.txt
index 61f91cbd..1dac025 100644
--- a/third_party/WebKit/LayoutTests/http/tests/loading/remove-child-triggers-parser-expected.txt
+++ b/third_party/WebKit/LayoutTests/http/tests/loading/remove-child-triggers-parser-expected.txt
@@ -1,5 +1,6 @@
 main frame - didStartProvisionalLoadForFrame
 main frame - didCommitLoadForFrame
+main frame - didReceiveTitle: 
 main frame - didFinishDocumentLoadForFrame
 main frame - didHandleOnloadEventsForFrame
 main frame - didFinishLoadForFrame
diff --git a/third_party/WebKit/LayoutTests/http/tests/loading/slow-parsing-subframe-expected.txt b/third_party/WebKit/LayoutTests/http/tests/loading/slow-parsing-subframe-expected.txt
index 45ce7fa3..486737daa 100644
--- a/third_party/WebKit/LayoutTests/http/tests/loading/slow-parsing-subframe-expected.txt
+++ b/third_party/WebKit/LayoutTests/http/tests/loading/slow-parsing-subframe-expected.txt
@@ -1,8 +1,11 @@
 main frame - didStartProvisionalLoadForFrame
 main frame - didCommitLoadForFrame
+frame "f1" - didReceiveTitle: 
 frame "f1" - didStartProvisionalLoadForFrame
+main frame - didReceiveTitle: 
 main frame - didFinishDocumentLoadForFrame
 frame "f1" - didCommitLoadForFrame
+frame "f1" - didReceiveTitle: 
 frame "f1" - didFinishDocumentLoadForFrame
 frame "f1" - didHandleOnloadEventsForFrame
 frame "f1" - didFinishLoadForFrame
diff --git a/third_party/WebKit/LayoutTests/http/tests/loading/state-object-security-exception-expected.txt b/third_party/WebKit/LayoutTests/http/tests/loading/state-object-security-exception-expected.txt
index f9d6d56..ff7c27f 100644
--- a/third_party/WebKit/LayoutTests/http/tests/loading/state-object-security-exception-expected.txt
+++ b/third_party/WebKit/LayoutTests/http/tests/loading/state-object-security-exception-expected.txt
@@ -1,5 +1,6 @@
 main frame - didStartProvisionalLoadForFrame
 main frame - didCommitLoadForFrame
+main frame - didReceiveTitle: 
 main frame - didFinishDocumentLoadForFrame
 main frame - didHandleOnloadEventsForFrame
 main frame - didFinishLoadForFrame
diff --git a/third_party/WebKit/LayoutTests/http/tests/loading/stop-load-at-commit-expected.txt b/third_party/WebKit/LayoutTests/http/tests/loading/stop-load-at-commit-expected.txt
index d8ce6ca..282f638 100644
--- a/third_party/WebKit/LayoutTests/http/tests/loading/stop-load-at-commit-expected.txt
+++ b/third_party/WebKit/LayoutTests/http/tests/loading/stop-load-at-commit-expected.txt
@@ -1,10 +1,12 @@
 main frame - didStartProvisionalLoadForFrame
 main frame - didCommitLoadForFrame
+main frame - didReceiveTitle: 
 main frame - didFinishDocumentLoadForFrame
 main frame - didHandleOnloadEventsForFrame
 main frame - didFinishLoadForFrame
 main frame - didStartProvisionalLoadForFrame
 main frame - didCommitLoadForFrame
+main frame - didReceiveTitle: 
 main frame - didFinishDocumentLoadForFrame
 main frame - didHandleOnloadEventsForFrame
 main frame - didFinishLoadForFrame
diff --git a/third_party/WebKit/LayoutTests/http/tests/loading/text-content-type-with-binary-extension-expected.txt b/third_party/WebKit/LayoutTests/http/tests/loading/text-content-type-with-binary-extension-expected.txt
index 76a04ac..74c24b9 100644
--- a/third_party/WebKit/LayoutTests/http/tests/loading/text-content-type-with-binary-extension-expected.txt
+++ b/third_party/WebKit/LayoutTests/http/tests/loading/text-content-type-with-binary-extension-expected.txt
@@ -1,6 +1,8 @@
 main frame - didStartProvisionalLoadForFrame
 main frame - didCommitLoadForFrame
+frame "iframe" - didReceiveTitle: 
 frame "iframe" - didStartProvisionalLoadForFrame
+main frame - didReceiveTitle: 
 main frame - didFinishDocumentLoadForFrame
 frame "iframe" - didFailProvisionalLoadWithError
 main frame - didHandleOnloadEventsForFrame
diff --git a/third_party/WebKit/LayoutTests/http/tests/navigation/cross-origin-fragment-navigation-is-async-expected.txt b/third_party/WebKit/LayoutTests/http/tests/navigation/cross-origin-fragment-navigation-is-async-expected.txt
index 833e883..218ea59 100644
--- a/third_party/WebKit/LayoutTests/http/tests/navigation/cross-origin-fragment-navigation-is-async-expected.txt
+++ b/third_party/WebKit/LayoutTests/http/tests/navigation/cross-origin-fragment-navigation-is-async-expected.txt
@@ -1,6 +1,9 @@
+frame "<!--framePath //<!--frame0-->-->" - didReceiveTitle: 
 frame "<!--framePath //<!--frame0-->-->" - didStartProvisionalLoadForFrame
+main frame - didReceiveTitle: 
 main frame - didFinishDocumentLoadForFrame
 frame "<!--framePath //<!--frame0-->-->" - didCommitLoadForFrame
+frame "<!--framePath //<!--frame0-->-->" - didReceiveTitle: 
 frame "<!--framePath //<!--frame0-->-->" - didFinishDocumentLoadForFrame
 frame "<!--framePath //<!--frame0-->-->" - didHandleOnloadEventsForFrame
 frame "<!--framePath //<!--frame0-->-->" - didFinishLoadForFrame
diff --git a/third_party/WebKit/LayoutTests/http/tests/navigation/same-origin-fragment-navigation-is-sync-expected.txt b/third_party/WebKit/LayoutTests/http/tests/navigation/same-origin-fragment-navigation-is-sync-expected.txt
index ece19eb..f287363 100644
--- a/third_party/WebKit/LayoutTests/http/tests/navigation/same-origin-fragment-navigation-is-sync-expected.txt
+++ b/third_party/WebKit/LayoutTests/http/tests/navigation/same-origin-fragment-navigation-is-sync-expected.txt
@@ -1,6 +1,9 @@
+frame "<!--framePath //<!--frame0-->-->" - didReceiveTitle: 
 frame "<!--framePath //<!--frame0-->-->" - didStartProvisionalLoadForFrame
+main frame - didReceiveTitle: 
 main frame - didFinishDocumentLoadForFrame
 frame "<!--framePath //<!--frame0-->-->" - didCommitLoadForFrame
+frame "<!--framePath //<!--frame0-->-->" - didReceiveTitle: 
 frame "<!--framePath //<!--frame0-->-->" - didFinishDocumentLoadForFrame
 frame "<!--framePath //<!--frame0-->-->" - didCommitLoadForFrame
 frame "<!--framePath //<!--frame0-->-->" - didHandleOnloadEventsForFrame
diff --git a/third_party/WebKit/LayoutTests/http/tests/security/mixedContent/insecure-iframe-with-hsts.https-expected.txt b/third_party/WebKit/LayoutTests/http/tests/security/mixedContent/insecure-iframe-with-hsts.https-expected.txt
index e1c6778..121dc87 100644
--- a/third_party/WebKit/LayoutTests/http/tests/security/mixedContent/insecure-iframe-with-hsts.https-expected.txt
+++ b/third_party/WebKit/LayoutTests/http/tests/security/mixedContent/insecure-iframe-with-hsts.https-expected.txt
@@ -1,6 +1,8 @@
+main frame - didReceiveTitle: 
 main frame - didFinishDocumentLoadForFrame
 main frame - didHandleOnloadEventsForFrame
 main frame - didFinishLoadForFrame
+frame "<!--framePath //<!--frame0-->-->" - didReceiveTitle: 
 frame "<!--framePath //<!--frame0-->-->" - didStartProvisionalLoadForFrame
 CONSOLE ERROR: line 18: Mixed Content: The page at 'https://127.0.0.1:8443/security/mixedContent/insecure-iframe-with-hsts.https.html' was loaded over HTTPS, but requested an insecure resource 'http://hsts-example.test:8443/security/resources/hsts.php'. This request has been blocked; the content must be served over HTTPS.
 frame "<!--framePath //<!--frame0-->-->" - didFailProvisionalLoadWithError
diff --git a/third_party/WebKit/LayoutTests/platform/linux/http/tests/loading/simple-subframe-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/http/tests/loading/simple-subframe-expected.txt
index 721ea61..0618293 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/http/tests/loading/simple-subframe-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/linux/http/tests/loading/simple-subframe-expected.txt
@@ -1,8 +1,11 @@
 main frame - didStartProvisionalLoadForFrame
 main frame - didCommitLoadForFrame
+frame "f1" - didReceiveTitle: 
 frame "f1" - didStartProvisionalLoadForFrame
+main frame - didReceiveTitle: 
 main frame - didFinishDocumentLoadForFrame
 frame "f1" - didCommitLoadForFrame
+frame "f1" - didReceiveTitle: 
 frame "f1" - didFinishDocumentLoadForFrame
 frame "f1" - didHandleOnloadEventsForFrame
 frame "f1" - didFinishLoadForFrame
diff --git a/third_party/WebKit/LayoutTests/platform/mac/http/tests/loading/simple-subframe-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/http/tests/loading/simple-subframe-expected.txt
index 99d33e0..25ae0da3 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/http/tests/loading/simple-subframe-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/http/tests/loading/simple-subframe-expected.txt
@@ -1,8 +1,11 @@
 main frame - didStartProvisionalLoadForFrame
 main frame - didCommitLoadForFrame
+frame "f1" - didReceiveTitle: 
 frame "f1" - didStartProvisionalLoadForFrame
+main frame - didReceiveTitle: 
 main frame - didFinishDocumentLoadForFrame
 frame "f1" - didCommitLoadForFrame
+frame "f1" - didReceiveTitle: 
 frame "f1" - didFinishDocumentLoadForFrame
 frame "f1" - didHandleOnloadEventsForFrame
 frame "f1" - didFinishLoadForFrame
diff --git a/third_party/WebKit/LayoutTests/platform/win/http/tests/loading/simple-subframe-expected.txt b/third_party/WebKit/LayoutTests/platform/win/http/tests/loading/simple-subframe-expected.txt
index 01637970..868789b 100644
--- a/third_party/WebKit/LayoutTests/platform/win/http/tests/loading/simple-subframe-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win/http/tests/loading/simple-subframe-expected.txt
@@ -1,8 +1,11 @@
 main frame - didStartProvisionalLoadForFrame
 main frame - didCommitLoadForFrame
+frame "f1" - didReceiveTitle: 
 frame "f1" - didStartProvisionalLoadForFrame
+main frame - didReceiveTitle: 
 main frame - didFinishDocumentLoadForFrame
 frame "f1" - didCommitLoadForFrame
+frame "f1" - didReceiveTitle: 
 frame "f1" - didFinishDocumentLoadForFrame
 frame "f1" - didHandleOnloadEventsForFrame
 frame "f1" - didFinishLoadForFrame
diff --git a/third_party/WebKit/Source/core/dom/Document.cpp b/third_party/WebKit/Source/core/dom/Document.cpp
index 6a13dda..1fd0453 100644
--- a/third_party/WebKit/Source/core/dom/Document.cpp
+++ b/third_party/WebKit/Source/core/dom/Document.cpp
@@ -1637,6 +1637,10 @@
 
   if (!frame_ || old_title == title_)
     return;
+  DispatchDidReceiveTitle();
+}
+
+void Document::DispatchDidReceiveTitle() {
   frame_->Client()->DispatchDidReceiveTitle(title_);
 }
 
@@ -5783,6 +5787,11 @@
   well_formed_ = parser && parser->WellFormed();
 
   if (LocalFrame* frame = GetFrame()) {
+    // Guarantee at least one call to the client specifying a title. (If
+    // |title_| is not empty, then the title has already been dispatched.)
+    if (title_.IsEmpty())
+      DispatchDidReceiveTitle();
+
     // Don't update the layout tree if we haven't requested the main resource
     // yet to avoid adding extra latency. Note that the first layout tree update
     // can be expensive since it triggers the parsing of the default stylesheets
diff --git a/third_party/WebKit/Source/core/dom/Document.h b/third_party/WebKit/Source/core/dom/Document.h
index 7865d0f..1b3dc50 100644
--- a/third_party/WebKit/Source/core/dom/Document.h
+++ b/third_party/WebKit/Source/core/dom/Document.h
@@ -1475,6 +1475,7 @@
   ShadowCascadeOrder shadow_cascade_order_ = kShadowCascadeNone;
 
   void UpdateTitle(const String&);
+  void DispatchDidReceiveTitle();
   void UpdateFocusAppearanceTimerFired(TimerBase*);
   void UpdateBaseURL();
 
diff --git a/third_party/WebKit/Source/core/exported/WebFrameTest.cpp b/third_party/WebKit/Source/core/exported/WebFrameTest.cpp
index 486e0bb..5005a47 100644
--- a/third_party/WebKit/Source/core/exported/WebFrameTest.cpp
+++ b/third_party/WebKit/Source/core/exported/WebFrameTest.cpp
@@ -9007,7 +9007,10 @@
   ~SwapMainFrameWhenTitleChangesWebFrameClient() override {}
 
   // FrameTestHelpers::TestWebFrameClient:
-  void DidReceiveTitle(const WebString&, WebTextDirection) override {
+  void DidReceiveTitle(const WebString& title, WebTextDirection) override {
+    if (title.IsEmpty())
+      return;
+
     if (!Frame()->Parent())
       Frame()->Swap(FrameTestHelpers::CreateRemote());
   }