Bug 634077 - tabviewshown/hidden events are dispatched before Storage.saveVisibilityData() was called [r=ian, a=sdwilsh]

This commit is contained in:
Tim Taubert 2011-02-15 19:56:57 +01:00
parent db0d4b9abc
commit c6b27635a0
3 changed files with 30 additions and 4 deletions

View File

@ -479,6 +479,8 @@ let UI = {
let event = document.createEvent("Events");
event.initEvent("tabviewshown", true, false);
Storage.saveVisibilityData(gWindow, "true");
// Close the active group if it was empty. This will happen when the
// user returns to Panorama after looking at an app tab, having
// closed all other tabs. (If the user is looking at an orphan tab, then
@ -523,8 +525,6 @@ let UI = {
TabItems.resumePainting();
}
Storage.saveVisibilityData(gWindow, "true");
},
// ----------
@ -558,11 +558,11 @@ let UI = {
#ifdef XP_MACOSX
this.setTitlebarColors(false);
#endif
Storage.saveVisibilityData(gWindow, "false");
let event = document.createEvent("Events");
event.initEvent("tabviewhidden", true, false);
dispatchEvent(event);
Storage.saveVisibilityData(gWindow, "false");
},
#ifdef XP_MACOSX

View File

@ -112,6 +112,7 @@ _BROWSER_FILES = \
browser_tabview_bug630102.js \
browser_tabview_bug630157.js \
browser_tabview_bug631662.js \
browser_tabview_bug634077.js \
browser_tabview_dragdrop.js \
browser_tabview_exit_button.js \
browser_tabview_expander.js \

View File

@ -0,0 +1,25 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
function test() {
let ss = Cc["@mozilla.org/browser/sessionstore;1"]
.getService(Ci.nsISessionStore);
let assertVisibilityDataEquals = function (val, msg) {
is(ss.getWindowValue(window, TabView.VISIBILITY_IDENTIFIER), val, msg);
}
waitForExplicitFinish();
ss.setWindowValue(window, window.TabView.VISIBILITY_IDENTIFIER, "null");
assertVisibilityDataEquals("null", "we start with <null>");
showTabView(function () {
assertVisibilityDataEquals("true", "after showing visibility data is <true>");
hideTabView(function () {
assertVisibilityDataEquals("false", "after hiding visibility data is <false>");
finish();
});
});
}