From f46aff6ee482e56eb3e885c65cd8d5989ac133af Mon Sep 17 00:00:00 2001 From: "ananta@chromium.org" Date: Thu, 16 Oct 2008 07:58:05 +0000 Subject: This fixes http://code.google.com/p/chromium/issues/detail?id=146&, which was an issue with navigation attempts initiated by Flash not working correctly in Chrome. The plugin would initiate a navigation in response to a user click. This would eventually result in a call to a script on the page, which would query the history in a timer, and would end up resetting the selected URL to the original URL as the history length would not be updated as yet. The reason being the following:- 1. A Frame navigation is initiated by the renderer in response to the user click. 2. This is sent as an async message to the browser UI thread. 3. When the navigation in the browser completes we update the history info in render view asynchronously. The fix is to attempt to update the history count when we receive notifications from webkit. These include notifications for items being added to the history, navigations based on history (like history.back/forward/goto, etc). These counts continue to be updated as before from the browser as well. Added UI tests to test these cases. Bug=146 R=jam Review URL: http://codereview.chromium.org/7412 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3457 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/test/data/History/HistoryHelper.js | 55 ++++++++++++++++++ chrome/test/data/History/history_length_test1.html | 66 ++++++++++++++++++++++ chrome/test/data/History/history_length_test2.html | 33 +++++++++++ 3 files changed, 154 insertions(+) create mode 100644 chrome/test/data/History/HistoryHelper.js create mode 100644 chrome/test/data/History/history_length_test1.html create mode 100644 chrome/test/data/History/history_length_test2.html (limited to 'chrome/test/data') diff --git a/chrome/test/data/History/HistoryHelper.js b/chrome/test/data/History/HistoryHelper.js new file mode 100644 index 0000000..93e0a94 --- /dev/null +++ b/chrome/test/data/History/HistoryHelper.js @@ -0,0 +1,55 @@ +// +// This script provides some mechanics for testing History +// +function onSuccess(name, id) +{ + setTimeout(onFinished, 0, name, id, "OK"); +} + +function onFailure(name, id, status) +{ + setTimeout(onFinished, 0, name, id, status); +} + +// Finish running a test by setting the status +// and the cookie. +function onFinished(name, id, result) +{ + var statusPanel = document.getElementById("statusPanel"); + if (statusPanel) { + statusPanel.innerHTML = result; + } + + var cookie = name + "." + id + ".status=" + result + "; path=/"; + document.cookie = cookie; +} + +function readCookie(name) { + var cookie_name = name + "="; + var ca = document.cookie.split(';'); + + for(var i = 0 ; i < ca.length ; i++) { + var c = ca[i]; + while (c.charAt(0) == ' ') { + c = c.substring(1,c.length); + } + if (c.indexOf(cookie_name) == 0) { + return c.substring(cookie_name.length, c.length); + } + } + return null; +} + +function createCookie(name,value,days) { + var expires = ""; + if (days) { + var date = new Date(); + date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000)); + expires = "; expires=" + date.toGMTString(); + } + document.cookie = name+"="+value+expires+"; path=/"; +} + +function eraseCookie(name) { + createCookie(name, "", -1); +} diff --git a/chrome/test/data/History/history_length_test1.html b/chrome/test/data/History/history_length_test1.html new file mode 100644 index 0000000..4a44fa9 --- /dev/null +++ b/chrome/test/data/History/history_length_test1.html @@ -0,0 +1,66 @@ + +History test1 + + + + +
+History Test1 running.... + + + + \ No newline at end of file diff --git a/chrome/test/data/History/history_length_test2.html b/chrome/test/data/History/history_length_test2.html new file mode 100644 index 0000000..2bae3ac --- /dev/null +++ b/chrome/test/data/History/history_length_test2.html @@ -0,0 +1,33 @@ + +History test2 + + + + +
+History test2.... +
+ + + + \ No newline at end of file -- cgit v1.1