Bug 424444, Sidebar bookmarks folders do not expand when reopening the sidebar, r+a1.9=mconnor, + fix a testcase

This commit is contained in:
Olli.Pettay@helsinki.fi 2008-03-23 05:58:32 -07:00
parent 5b74840c1a
commit 6dbb18d788
2 changed files with 14 additions and 4 deletions

View File

@ -2437,6 +2437,7 @@ function toggleAffectedChrome(aHide)
gChromeState.notificationsOpen = !notificationBox.notificationsHidden;
notificationBox.notificationsHidden = aHide;
document.getElementById("sidebar").setAttribute("src", "about:blank");
var statusbar = document.getElementById("status-bar");
gChromeState.statusbarOpen = !statusbar.hidden;
statusbar.hidden = aHide;
@ -4497,6 +4498,7 @@ function toggleSidebar(commandID, forceOpen) {
sidebarBroadcaster.removeAttribute("checked");
sidebarBox.setAttribute("sidebarcommand", "");
sidebarTitle.value = "";
sidebar.setAttribute("src", "about:blank");
sidebarBox.hidden = true;
sidebarSplitter.hidden = true;
content.focus();

View File

@ -3,10 +3,14 @@ function test() {
// XXX This looks a bit odd, but is needed to avoid throwing when removing the
// event listeners below. See bug 310955.
document.getElementById("sidebar").addEventListener("load", function() { setTimeout(openPanelUrl, 100) }, true);
document.getElementById("sidebar").addEventListener("load", delayedOpenUrl, true);
toggleSidebar("viewWebPanelsSidebar", true);
}
function delayedOpenUrl() {
setTimeout(openPanelUrl, 100);
}
function openPanelUrl(event) {
ok(!document.getElementById("sidebar-box").hidden, "Sidebar showing");
@ -14,16 +18,20 @@ function openPanelUrl(event) {
var root = sidebar.contentDocument.documentElement;
ok(root.nodeName != "parsererror", "Sidebar is well formed");
sidebar.removeEventListener("load", openPanelUrl, true);
sidebar.removeEventListener("load", delayedOpenUrl, true);
// XXX See comment above
sidebar.contentDocument.addEventListener("load", function() { setTimeout(runTest, 100) }, true);
sidebar.contentDocument.addEventListener("load", delayedRunTest, true);
var url = 'data:text/html,<div%20id="test_bug409481">Content!</div>';
sidebar.contentWindow.loadWebPanel(url);
}
function delayedRunTest() {
setTimeout(runTest, 100);
}
function runTest(event) {
var sidebar = document.getElementById("sidebar");
sidebar.contentDocument.removeEventListener("load", runTest, true);
sidebar.contentDocument.removeEventListener("load", delayedRunTest, true);
var browser = sidebar.contentDocument.getElementById("web-panels-browser");
var div = browser && browser.contentDocument.getElementById("test_bug409481");