mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 670318 - Google+ home page creates multiple SHEntries, and if you go back to the first one, you can no longer go forward; r=smaug
This commit is contained in:
parent
ef48533bbc
commit
6f626c2d9a
@ -1284,6 +1284,9 @@ nsSHistory::RemoveDuplicate(PRInt32 aIndex, PRBool aKeepNext)
|
||||
if (mIndex > aIndex) {
|
||||
mIndex = mIndex - 1;
|
||||
}
|
||||
if (mRequestedIndex > aIndex) {
|
||||
mRequestedIndex = mRequestedIndex - 1;
|
||||
}
|
||||
--mLength;
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
@ -62,6 +62,8 @@ _BROWSER_TEST_FILES = \
|
||||
browser_bug655270.js \
|
||||
file_bug655270.html \
|
||||
favicon_bug655270.ico \
|
||||
browser_bug670318.js \
|
||||
file_bug670318.html \
|
||||
$(NULL)
|
||||
|
||||
libs:: $(_BROWSER_TEST_FILES)
|
||||
|
59
docshell/test/browser/browser_bug670318.js
Normal file
59
docshell/test/browser/browser_bug670318.js
Normal file
@ -0,0 +1,59 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
/**
|
||||
* Test for Bug 670318
|
||||
*
|
||||
* When LoadEntry() is called on a browser that has multiple duplicate history
|
||||
* entries, history.index can end up out of range (>= history.count).
|
||||
*/
|
||||
|
||||
const URL = "http://mochi.test:8888/browser/docshell/test/browser/file_bug670318.html";
|
||||
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
|
||||
let count = 0, historyListenerRemoved = false;
|
||||
|
||||
let listener = {
|
||||
OnHistoryNewEntry: function (aNewURI) {
|
||||
if (aNewURI.spec == URL && 5 == ++count) {
|
||||
browser.addEventListener("load", function onLoad() {
|
||||
browser.removeEventListener("load", onLoad, true);
|
||||
|
||||
ok(history.index < history.count, "history.index is valid");
|
||||
finish();
|
||||
}, true);
|
||||
|
||||
history.removeSHistoryListener(listener);
|
||||
historyListenerRemoved = true;
|
||||
|
||||
executeSoon(function () BrowserReload());
|
||||
}
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
OnHistoryReload: function () true,
|
||||
OnHistoryGoBack: function () true,
|
||||
OnHistoryGoForward: function () true,
|
||||
OnHistoryGotoIndex: function () true,
|
||||
OnHistoryPurge: function () true,
|
||||
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsISHistoryListener,
|
||||
Ci.nsISupportsWeakReference])
|
||||
};
|
||||
|
||||
let tab = gBrowser.loadOneTab(URL, {inBackground: false});
|
||||
let browser = tab.linkedBrowser;
|
||||
let history = browser.sessionHistory;
|
||||
|
||||
history.addSHistoryListener(listener);
|
||||
|
||||
registerCleanupFunction(function () {
|
||||
gBrowser.removeTab(tab);
|
||||
|
||||
if (!historyListenerRemoved)
|
||||
history.removeSHistoryListener(listener);
|
||||
});
|
||||
}
|
23
docshell/test/browser/file_bug670318.html
Normal file
23
docshell/test/browser/file_bug670318.html
Normal file
@ -0,0 +1,23 @@
|
||||
<html><head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
<script>
|
||||
function load() {
|
||||
function next() {
|
||||
if (count < 5)
|
||||
iframe.src = 'data:text/html,iframe ' + (++count);
|
||||
}
|
||||
|
||||
var count = 0;
|
||||
var iframe = document.createElement('iframe');
|
||||
iframe.onload = function () { setTimeout(next, 0) };
|
||||
document.body.appendChild(iframe);
|
||||
|
||||
setTimeout(next, 0);
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body onload="load()">
|
||||
Testcase
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user