bug 919803 fix panel sizing by not removing panel iframe unecessarily, r=markh

This commit is contained in:
Shane Caraveo 2013-09-26 10:55:08 -07:00
parent 4a1b198331
commit 504fa94de0

View File

@ -874,18 +874,27 @@ SocialToolbar = {
let toggleNotificationsCommand = document.getElementById("Social:ToggleNotifications");
toggleNotificationsCommand.setAttribute("hidden", !socialEnabled);
let parent = document.getElementById("social-notification-panel");
while (parent.hasChildNodes()) {
let frame = parent.firstChild;
SharedFrame.forgetGroup(frame.id);
parent.removeChild(frame);
}
// we need to remove buttons and frames if !socialEnabled or the provider
// has changed (frame origin does not match current provider). We only
// remove frames that are "attached" to buttons in this toolbar button since
// other buttons may also be using grouped frames.
let tbi = document.getElementById("social-provider-button");
if (tbi) {
// buttons after social-provider-button are ambient icons
while (tbi.nextSibling) {
tbi.parentNode.removeChild(tbi.nextSibling);
let next = tbi.nextSibling;
let currentOrigin = Social.provider ? Social.provider.origin : null;
while (next) {
let button = next;
next = next.nextSibling;
// get the frame for this button
let frameId = button.getAttribute("notificationFrameId");
let frame = document.getElementById(frameId);
if (!socialEnabled || frame.getAttribute("origin") != currentOrigin) {
SharedFrame.forgetGroup(frame.id);
frame.parentNode.removeChild(frame);
button.parentNode.removeChild(button);
}
}
}
},