Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(423)

Unified Diff: ios/web/web_state/js/resources/core.js

Issue 1541023002: Keep original pushState() method for use in JS overwrite (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use pageTitle Created 4 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/web/web_state/js/resources/core.js
diff --git a/ios/web/web_state/js/resources/core.js b/ios/web/web_state/js/resources/core.js
index 4e68df0bea8cf909d1235a8fbf3ede537da6f463..510c504343492c14e2eb708a045d8d76c1e64087 100644
--- a/ios/web/web_state/js/resources/core.js
+++ b/ios/web/web_state/js/resources/core.js
@@ -375,9 +375,10 @@ goog.require('__crWeb.message');
}, 0);
};
- // Keep the original replaceState() method. It's needed to update UIWebView's
- // URL and window.history.state property during history navigations that don't
- // cause a page load.
+ // Keep the original pushState() and replaceState() methods. It's needed to
+ // update the web view's URL and window.history.state property during history
+ // navigations that don't cause a page load.
+ var originalWindowHistoryPushState = window.history.pushState;
var originalWindowHistoryReplaceState = window.history.replaceState;
__gCrWeb['replaceWebViewURL'] = function(url, stateObject) {
originalWindowHistoryReplaceState.call(history, stateObject, '', url);
@@ -401,7 +402,8 @@ goog.require('__crWeb.message');
typeof(stateObject) == 'undefined' ? '' :
__gCrWeb.common.JSONStringify(stateObject);
pageUrl = pageUrl || window.location.href;
- originalWindowHistoryReplaceState.call(history, stateObject, '', pageUrl);
+ originalWindowHistoryPushState.call(history, stateObject,
+ pageTitle, pageUrl);
invokeOnHost_({'command': 'window.history.didPushState',
'stateObject': serializedState,
'baseUrl': document.baseURI,
@@ -416,7 +418,8 @@ goog.require('__crWeb.message');
typeof(stateObject) == 'undefined' ? '' :
__gCrWeb.common.JSONStringify(stateObject);
pageUrl = pageUrl || window.location.href;
- originalWindowHistoryReplaceState.call(history, stateObject, '', pageUrl);
+ originalWindowHistoryReplaceState.call(history, stateObject,
+ pageTitle, pageUrl);
invokeOnHost_({'command': 'window.history.didReplaceState',
'stateObject': serializedState,
'baseUrl': document.baseURI,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698