Chromium Code Reviews| Index: ios/testing/data/http_server_files/history_go.js |
| diff --git a/ios/testing/data/http_server_files/history_go.js b/ios/testing/data/http_server_files/history_go.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..ba7d97bb3abd09c09b3ed4e24fe95f285c4d871d |
| --- /dev/null |
| +++ b/ios/testing/data/http_server_files/history_go.js |
| @@ -0,0 +1,69 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +window.onload = function() { |
| + window.addEventListener('popstate', onPopstate); |
| + window.addEventListener('hashchange', onHashChange); |
| + updateOnLoadText('OnLoadText'); |
| +}; |
| + |
| +var onPopstate = function(e) { |
| + updatePopStateReceivedText(true); |
| + updateStateObjectText(e.state); |
| +}; |
| + |
| +var onHashChange = function(e) { |
| + updateHashChangeReceivedText(true); |
| +} |
| + |
| +var updateOnLoadText = function(text) { |
| + document.getElementById('onLoadDiv').innerHTML = text; |
| +} |
| + |
| +var updateNoOpText = function(text) { |
| + document.getElementById('noOpDiv').innerHTML = text; |
| +} |
| + |
| +var updatePopStateReceivedText = function(received) { |
| + var text = received ? 'PopStateReceived' : ''; |
| + document.getElementById('popStateReceivedDiv').innerHTML = text; |
| +} |
| + |
| +var updateStateObjectText = function(state) { |
| + document.getElementById('stateObjectDiv').innerHTML = state; |
| +} |
| + |
| +var updateHashChangeReceivedText = function(received) { |
| + var text = received ? 'HashChangeReceived' : ''; |
| + document.getElementById('hashChangeReceivedDiv').innerHTML = text; |
| +} |
| + |
| +var buttonWasTapped = function() { |
|
Eugene But (OOO till 7-30)
2016/12/09 23:02:16
s/buttonWasTapped/onButtonTap ?
Eugene But (OOO till 7-30)
2016/12/09 23:02:16
Please add comments to all non-trivial functions
kkhorimoto
2016/12/13 00:29:10
Done.
|
| + updateOnLoadText(''); |
| + updateNoOpText(''); |
| + updatePopStateReceivedText(false); |
| + updateStateObjectText(''); |
| + updateHashChangeReceivedText(false); |
| + setTimeout("updateNoOpText('NoOpText')", 1000); |
| +} |
| + |
| +var goNoParameter = function() { |
| + buttonWasTapped(); |
| + window.history.go(); |
| +} |
| + |
| +var goZero = function() { |
| + buttonWasTapped(); |
| + window.history.go(0); |
| +} |
| + |
| +var go2 = function() { |
| + buttonWasTapped(); |
| + window.history.go(2); |
| +} |
| + |
| +var goBack2 = function() { |
| + buttonWasTapped(); |
| + window.history.go(-1); |
| +} |