Bug 808243 - sidebar load event should be removed when sidebar not visible. r=felipe a=lsblakk

This commit is contained in:
Mark Hammond 2012-11-06 10:26:33 +11:00
Родитель 090ea82899
Коммит da9b36ca51
1 изменённых файлов: 8 добавлений и 7 удалений

Просмотреть файл

@ -1006,6 +1006,7 @@ var SocialSidebar = {
let sbrowser = document.getElementById("social-sidebar-browser");
if (hideSidebar) {
sbrowser.removeEventListener("load", SocialSidebar._loadListener, true);
this.setSidebarVisibilityState(false);
// If we've been disabled, unload the sidebar content immediately;
// if the sidebar was just toggled to invisible, wait a timeout
@ -1028,19 +1029,19 @@ var SocialSidebar = {
if (sbrowser.getAttribute("origin") != Social.provider.origin) {
sbrowser.setAttribute("origin", Social.provider.origin);
sbrowser.setAttribute("src", Social.provider.sidebarURL);
sbrowser.addEventListener("load", function sidebarOnShow() {
sbrowser.removeEventListener("load", sidebarOnShow, true);
// let load finish, then fire our event
setTimeout(function () {
SocialSidebar.setSidebarVisibilityState(true);
}, 0);
}, true);
sbrowser.addEventListener("load", SocialSidebar._loadListener, true);
} else {
this.setSidebarVisibilityState(true);
}
}
},
_loadListener: function SocialSidebar_loadListener() {
let sbrowser = document.getElementById("social-sidebar-browser");
sbrowser.removeEventListener("load", SocialSidebar._loadListener, true);
SocialSidebar.setSidebarVisibilityState(true);
},
unloadSidebar: function SocialSidebar_unloadSidebar() {
let sbrowser = document.getElementById("social-sidebar-browser");
if (!sbrowser.hasAttribute("origin"))