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

Commit

Permalink
Manually fetch favicons after hash changes.
Browse files Browse the repository at this point in the history
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}
  • Loading branch information
Kurt Horimoto committed Feb 2, 2016
1 parent 53b5c91 commit cbb0ba3
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
5 changes: 5 additions & 0 deletions ios/web/web_state/js/resources/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,11 @@ goog.require('__crWeb.message');
return anchor.href;
};

__gCrWeb['sendFaviconsToHost'] = function() {
__gCrWeb.message.invokeOnHost({'command': 'document.favicons',
'favicons': __gCrWeb.common.getFavicons()});
}

// Tracks whether user is in the middle of scrolling/dragging. If user is
// scrolling, ignore window.scrollTo() until user stops scrolling.
var webViewScrollViewIsDragging_ = false;
Expand Down
3 changes: 1 addition & 2 deletions ios/web/web_state/js/resources/core_dynamic_ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,7 @@ __gCrWeb.core_dynamic = {};
var loaded_ = function() {
invokeOnHost_({'command': 'document.loaded'});
// Send the favicons to the browser.
invokeOnHost_({'command': 'document.favicons',
'favicons': __gCrWeb.common.getFavicons()});
__gCrWeb.sendFaviconsToHost();
// Add placeholders for plugin content.
if (__gCrWeb.common.updatePluginPlaceholders())
__gCrWeb.message.invokeOnHost({'command': 'addPluginPlaceholders'});
Expand Down
3 changes: 1 addition & 2 deletions ios/web/web_state/js/resources/core_dynamic_wk.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ __gCrWeb.core_dynamic = {};
*/
__gCrWeb.didFinishNavigation = function() {
// Send the favicons to the browser.
__gCrWeb.message.invokeOnHost({'command': 'document.favicons',
'favicons': __gCrWeb.common.getFavicons()});
__gCrWeb.sendFaviconsToHost();
// Add placeholders for plugin content.
if (__gCrWeb.common.updatePluginPlaceholders())
__gCrWeb.message.invokeOnHost({'command': 'addPluginPlaceholders'});
Expand Down
5 changes: 5 additions & 0 deletions ios/web/web_state/ui/crw_web_controller.mm
Original file line number Diff line number Diff line change
Expand Up @@ -2426,6 +2426,11 @@ - (BOOL)handleWindowHashChangeMessage:(base::DictionaryValue*)message
context:(NSDictionary*)context {
[self checkForUnexpectedURLChange];

// Because hash changes don't trigger |-didFinishNavigation|, fetch favicons
// for the new page manually.
[self evaluateJavaScript:@"__gCrWeb.sendFaviconsToHost();"
stringResultHandler:nil];

// Notify the observers.
_webStateImpl->OnUrlHashChanged();
return YES;
Expand Down

0 comments on commit cbb0ba3

Please sign in to comment.