Skip to content
This repository has been archived by the owner on Feb 26, 2022. It is now read-only.

Commit

Permalink
Bug 656298: Addon bar keeps displaying on new window or restart event…
Browse files Browse the repository at this point in the history
… if user hide it r=dietrich
  • Loading branch information
ochameau committed May 16, 2011
1 parent 178ff5b commit 8d01e9c
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/addon-kit/lib/widget.js
Expand Up @@ -633,7 +633,10 @@ BrowserWindow.prototype = {
// Finally insert our widget in the right toolbar and in the right position
container.insertItem(id, nextNode, null, false);

// Update DOM in order to save position if we remove/readd the widget
container.setAttribute("currentset", container.currentSet);
// Save DOM attribute in order to save position on new window opened
this.window.document.persist(container.id, "currentset");
}
}

Expand Down
30 changes: 30 additions & 0 deletions packages/addon-kit/tests/test-widget.js
Expand Up @@ -457,6 +457,36 @@ exports.testConstructor = function(test) {
});
}});
});

tests.push(function testAddonBarHide() {
// Hide the addon-bar
browserWindow.setToolbarVisibility(container(), false);

// Then open a browser window and verify that the addon-bar remains hidden
tabBrowser.addTab("about:blank", { inNewWindow: true, onLoad: function(e) {
let browserWindow = e.target.defaultView;
let doc = browserWindow.document;
function container2() doc.getElementById("addon-bar");
function widgetCount2() container2() ? container2().childNodes.length : 0;
let widgetStartCount2 = widgetCount2();

let w1Opts = {id:"first", label: "first widget", content: "first content"};
let w1 = testSingleWidget(w1Opts);
test.assertEqual(widgetCount2(), widgetStartCount2 + 1, "2nd window has correct number of child elements after widget creation");

w1.destroy();
test.assertEqual(widgetCount2(), widgetStartCount2, "2nd window has correct number of child elements after widget destroy");

test.assert(container().collapsed, "1st window has an hidden addon-bar");
test.assert(container2().collapsed, "2nd window has an hidden addon-bar");

browserWindow.setToolbarVisibility(container(), true);

closeBrowserWindow(browserWindow, function() {
doneTest();
});
}});
});

// test widget.width
tests.push(function testWidgetWidth() testSingleWidget({
Expand Down

0 comments on commit 8d01e9c

Please sign in to comment.