Skip to content
This repository was archived by the owner on Apr 3, 2020. It is now read-only.

Commit cbb0ba3

Browse files
author
Kurt Horimoto
committed
Manually fetch favicons after hash changes.
Hash changes don't trigger |-didFinishNavigation|, so favicons must be fetched manually. BUG=531267 Review URL: https://codereview.chromium.org/1360543004 Cr-Commit-Position: refs/heads/master@{#372731} (cherry picked from commit 61b25a2) Review URL: https://codereview.chromium.org/1663463002 . Cr-Commit-Position: refs/branch-heads/2623@{#242} Cr-Branched-From: 92d7753-refs/heads/master@{#369907}
1 parent 53b5c91 commit cbb0ba3

File tree

4 files changed

+12
-4
lines changed

4 files changed

+12
-4
lines changed

ios/web/web_state/js/resources/core.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,11 @@ goog.require('__crWeb.message');
434434
return anchor.href;
435435
};
436436

437+
__gCrWeb['sendFaviconsToHost'] = function() {
438+
__gCrWeb.message.invokeOnHost({'command': 'document.favicons',
439+
'favicons': __gCrWeb.common.getFavicons()});
440+
}
441+
437442
// Tracks whether user is in the middle of scrolling/dragging. If user is
438443
// scrolling, ignore window.scrollTo() until user stops scrolling.
439444
var webViewScrollViewIsDragging_ = false;

ios/web/web_state/js/resources/core_dynamic_ui.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,7 @@ __gCrWeb.core_dynamic = {};
116116
var loaded_ = function() {
117117
invokeOnHost_({'command': 'document.loaded'});
118118
// Send the favicons to the browser.
119-
invokeOnHost_({'command': 'document.favicons',
120-
'favicons': __gCrWeb.common.getFavicons()});
119+
__gCrWeb.sendFaviconsToHost();
121120
// Add placeholders for plugin content.
122121
if (__gCrWeb.common.updatePluginPlaceholders())
123122
__gCrWeb.message.invokeOnHost({'command': 'addPluginPlaceholders'});

ios/web/web_state/js/resources/core_dynamic_wk.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@ __gCrWeb.core_dynamic = {};
4141
*/
4242
__gCrWeb.didFinishNavigation = function() {
4343
// Send the favicons to the browser.
44-
__gCrWeb.message.invokeOnHost({'command': 'document.favicons',
45-
'favicons': __gCrWeb.common.getFavicons()});
44+
__gCrWeb.sendFaviconsToHost();
4645
// Add placeholders for plugin content.
4746
if (__gCrWeb.common.updatePluginPlaceholders())
4847
__gCrWeb.message.invokeOnHost({'command': 'addPluginPlaceholders'});

ios/web/web_state/ui/crw_web_controller.mm

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2426,6 +2426,11 @@ - (BOOL)handleWindowHashChangeMessage:(base::DictionaryValue*)message
24262426
context:(NSDictionary*)context {
24272427
[self checkForUnexpectedURLChange];
24282428

2429+
// Because hash changes don't trigger |-didFinishNavigation|, fetch favicons
2430+
// for the new page manually.
2431+
[self evaluateJavaScript:@"__gCrWeb.sendFaviconsToHost();"
2432+
stringResultHandler:nil];
2433+
24292434
// Notify the observers.
24302435
_webStateImpl->OnUrlHashChanged();
24312436
return YES;

0 commit comments

Comments
 (0)