Don't clear the page's cached favicon URL when iframe navigations start

https://chromium-review.googlesource.com/c/chromium/src/+/1959334
upstreamed the favicon caching functionality of ContentFaviconDriver
into WebContentsImpl. One thing that it missed was making clearing
the favicon cache on navigation start conditional that the main frame
was being navigated.

This CL adds that conditional and fixes a bug where delayed iframe
loads would prevent "Create shortcut..." from working as it would wait
indefinitely for a favicon URL event when it saw there was none.

Bug: 1046883
Change-Id: I520531558dec2d2daa8817884a33701b75f017bd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2068266
Reviewed-by: Mikel Astiz <[email protected]>
Reviewed-by: Kinuko Yasuda <[email protected]>
Commit-Queue: Kinuko Yasuda <[email protected]>
Auto-Submit: Alan Cutter <[email protected]>
Cr-Commit-Position: refs/heads/master@{#743907}
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 4b85f236..e6abd33d 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -4412,7 +4412,8 @@
 void WebContentsImpl::DidStartNavigation(NavigationHandle* navigation_handle) {
   TRACE_EVENT1("navigation", "WebContentsImpl::DidStartNavigation",
                "navigation_handle", navigation_handle);
-  favicon_urls_.clear();
+  if (navigation_handle->IsInMainFrame())
+    favicon_urls_.clear();
 
   for (auto& observer : observers_)
     observer.DidStartNavigation(navigation_handle);