Bug 965697 - Fix intermittent browser_sessionHistory.js failures by waiting until the history entry has been replaced. r=smacleod

--HG--
extra : rebase_source : 2c134be33a3ba6e4916d8645eb662141eb1ecbfa
This commit is contained in:
Tim Taubert 2014-07-07 14:11:17 -04:00
parent 41311cf9db
commit c82f01b267
2 changed files with 43 additions and 1 deletions

View File

@ -14,7 +14,7 @@ add_task(function test_load_start() {
// Load a new URI but remove the tab before it has finished loading.
browser.loadURI("about:mozilla");
yield promiseContentMessage(browser, "ss-test:onFrameTreeReset");
yield promiseContentMessage(browser, "ss-test:OnHistoryReplaceEntry");
gBrowser.removeTab(tab);
// Undo close the tab.

View File

@ -7,6 +7,7 @@
let Cu = Components.utils;
let Ci = Components.interfaces;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource:///modules/sessionstore/FrameTree.jsm", this);
let gFrameTree = new FrameTree(this);
@ -20,6 +21,47 @@ gFrameTree.addObserver({
}
});
let webNav = docShell.QueryInterface(Ci.nsIWebNavigation);
webNav.sessionHistory.addSHistoryListener({
OnHistoryNewEntry: function () {
sendAsyncMessage("ss-test:OnHistoryNewEntry");
},
OnHistoryGoBack: function () {
sendAsyncMessage("ss-test:OnHistoryGoBack");
return true;
},
OnHistoryGoForward: function () {
sendAsyncMessage("ss-test:OnHistoryGoForward");
return true;
},
OnHistoryGotoIndex: function () {
sendAsyncMessage("ss-test:OnHistoryGotoIndex");
return true;
},
OnHistoryPurge: function () {
sendAsyncMessage("ss-test:OnHistoryPurge");
return true;
},
OnHistoryReload: function () {
sendAsyncMessage("ss-test:OnHistoryReload");
return true;
},
OnHistoryReplaceEntry: function () {
sendAsyncMessage("ss-test:OnHistoryReplaceEntry");
},
QueryInterface: XPCOMUtils.generateQI([
Ci.nsISHistoryListener,
Ci.nsISupportsWeakReference
])
});
/**
* This frame script is only loaded for sessionstore mochitests. It enables us
* to modify and query docShell data when running with multiple processes.