bug 910741 fix opening tabs from clicked links in share panel, r=felipe

This commit is contained in:
Shane Caraveo 2013-08-30 09:30:00 -07:00
parent 4b78a28954
commit a2404b3aa3
2 changed files with 8 additions and 7 deletions

View File

@ -322,7 +322,10 @@ SocialUI = {
let containerParent = container.parentNode;
if (containerParent.classList.contains("social-panel") &&
containerParent instanceof Ci.nsIDOMXULPopupElement) {
containerParent.hidePopup();
// allow the link traversal to finish before closing the panel
setTimeout(() => {
containerParent.hidePopup();
}, 0);
}
},
@ -693,7 +696,7 @@ SocialShare = {
onHidden: function() {
this.shareButton.removeAttribute("open");
this.iframe.setAttribute("src", "data:text/plain;charset=utf8,")
this.iframe.setAttribute("src", "data:text/plain;charset=utf8,");
this.currentShare = null;
},

View File

@ -133,12 +133,10 @@ var tests = {
function onTabOpen(event) {
gBrowser.tabContainer.removeEventListener("TabOpen", onTabOpen, true);
is(panel.state, "closed", "flyout should be closed");
ok(true, "Link should open a new tab");
executeSoon(function(){
waitForCondition(function() { return panel.state == "closed" }, function() {
gBrowser.removeTab(event.target);
next();
});
}, "panel should close after tab open");
}
let panel = document.getElementById("social-flyout-panel");
@ -154,7 +152,7 @@ var tests = {
if (e.data.result == "shown") {
// click on our test link
is(panel.state, "open", "flyout should be open");
gBrowser.tabContainer.addEventListener("TabOpen", onTabOpen, true);
gBrowser.tabContainer.addEventListener("TabOpen", onTabOpen, true);
let iframe = panel.firstChild;
iframe.contentDocument.getElementById('traversal').click();
}