Bug 914438. Prevent propagation of SSTabRestored events in tests when we close the relevant tab. r=dao

This commit is contained in:
Boris Zbarsky 2013-09-11 23:19:07 -04:00
parent f05f2d9054
commit 74048d8b72
3 changed files with 15 additions and 2 deletions

View File

@ -28,6 +28,9 @@ function test() {
is(newBrowser.contentWindow.scrollY, 1200, "still scrolled vertically");
gBrowser.removeTab(newTab);
// Call stopPropagation on the event so we won't fire the
// tabbrowser's SSTabRestored listeners.
e.stopPropagation();
finish();
}, true);

View File

@ -24,17 +24,24 @@ function test() {
tabState.entries[0].referrer = REFERRER2;
ss.setTabState(tab, JSON.stringify(tabState));
tab.addEventListener("SSTabRestored", function() {
tab.addEventListener("SSTabRestored", function(e) {
tab.removeEventListener("SSTabRestored", arguments.callee, true);
is(window.content.document.referrer, REFERRER2, "document.referrer matches referrer set via setTabState.");
gBrowser.removeTab(tab);
// Call stopPropagation on the event so we won't fire the
// tabbrowser's SSTabRestored listeners.
e.stopPropagation();
let newTab = ss.undoCloseTab(window, 0);
newTab.addEventListener("SSTabRestored", function() {
newTab.addEventListener("SSTabRestored", function(e) {
newTab.removeEventListener("SSTabRestored", arguments.callee, true);
is(window.content.document.referrer, REFERRER2, "document.referrer is still correct after closing and reopening the tab.");
gBrowser.removeTab(newTab);
// Call stopPropagation on the event so we won't fire the
// tabbrowser's SSTabRestored listeners.
e.stopPropagation();
finish();
}, true);

View File

@ -98,6 +98,9 @@ function testTabRestoreData(aFormData, aExpectedValues, aCallback) {
// clean up
gBrowser.removeTab(tab);
// Call stopPropagation on the event so we won't fire the
// tabbrowser's SSTabRestored listeners.
aEvent.stopPropagation();
aCallback();
});