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

Side by Side Diff: ios/web/web_state/js/resources/core.js

Issue 2565673003: Fix window.history.go() with no parameter. (Closed)
Patch Set: fix bug in javascript Created 4 years 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // This file adheres to closure-compiler conventions in order to enable 5 // This file adheres to closure-compiler conventions in order to enable
6 // compilation with ADVANCED_OPTIMIZATIONS. In particular, members that are to 6 // compilation with ADVANCED_OPTIMIZATIONS. In particular, members that are to
7 // be accessed externally should be specified in this['style'] as opposed to 7 // be accessed externally should be specified in this['style'] as opposed to
8 // this.style because member identifiers are minified by default. 8 // this.style because member identifiers are minified by default.
9 // See http://goo.gl/FwOgy 9 // See http://goo.gl/FwOgy
10 10
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 }; 418 };
419 419
420 // Intercept window.history methods to call back/forward natively. 420 // Intercept window.history methods to call back/forward natively.
421 window.history.back = function() { 421 window.history.back = function() {
422 invokeOnHost_({'command': 'window.history.back'}); 422 invokeOnHost_({'command': 'window.history.back'});
423 }; 423 };
424 window.history.forward = function() { 424 window.history.forward = function() {
425 invokeOnHost_({'command': 'window.history.forward'}); 425 invokeOnHost_({'command': 'window.history.forward'});
426 }; 426 };
427 window.history.go = function(delta) { 427 window.history.go = function(delta) {
428 invokeOnHost_({'command': 'window.history.go', 'value': delta}); 428 invokeOnHost_({'command': 'window.history.go', 'value': delta | 0});
429 }; 429 };
430 window.history.pushState = function(stateObject, pageTitle, pageUrl) { 430 window.history.pushState = function(stateObject, pageTitle, pageUrl) {
431 __gCrWeb.message.invokeOnHost( 431 __gCrWeb.message.invokeOnHost(
432 {'command': 'window.history.willChangeState'}); 432 {'command': 'window.history.willChangeState'});
433 // Calling stringify() on undefined causes a JSON parse error. 433 // Calling stringify() on undefined causes a JSON parse error.
434 var serializedState = 434 var serializedState =
435 typeof(stateObject) == 'undefined' ? '' : 435 typeof(stateObject) == 'undefined' ? '' :
436 __gCrWeb.common.JSONStringify(stateObject); 436 __gCrWeb.common.JSONStringify(stateObject);
437 pageUrl = pageUrl || window.location.href; 437 pageUrl = pageUrl || window.location.href;
438 originalWindowHistoryPushState.call(history, stateObject, 438 originalWindowHistoryPushState.call(history, stateObject,
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
669 }); 669 });
670 }, false); 670 }, false);
671 671
672 addFormEventListeners_(); 672 addFormEventListeners_();
673 673
674 return true; 674 return true;
675 }; 675 };
676 676
677 __gCrWeb.core.documentInject(); 677 __gCrWeb.core.documentInject();
678 }()); // End of anonymous object 678 }()); // End of anonymous object
OLDNEW
« 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