mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 22:32:46 +00:00
Bug 1318767
- Part 2: Correctly swap web progress listeners when swapping frameloaders, r=dao
MozReview-Commit-ID: KbUd2Os5qac
This commit is contained in:
parent
14a9005e68
commit
5d13424101
@ -2924,11 +2924,29 @@
|
||||
|
||||
<method name="swapBrowsers">
|
||||
<parameter name="aOurTab"/>
|
||||
<parameter name="aOtherBrowser"/>
|
||||
<parameter name="aOtherTab"/>
|
||||
<parameter name="aFlags"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
this._swapBrowserDocShells(aOurTab, aOtherBrowser, aFlags);
|
||||
let otherBrowser = aOtherTab.linkedBrowser;
|
||||
let otherTabBrowser = otherBrowser.getTabBrowser();
|
||||
|
||||
// We aren't closing the other tab so, we also need to swap its tablisteners.
|
||||
let filter = otherTabBrowser._tabFilters.get(aOtherTab);
|
||||
let tabListener = otherTabBrowser._tabListeners.get(aOtherTab);
|
||||
otherBrowser.webProgress.removeProgressListener(filter);
|
||||
filter.removeProgressListener(tabListener);
|
||||
|
||||
// Perform the docshell swap through the common mechanism.
|
||||
this._swapBrowserDocShells(aOurTab, otherBrowser, aFlags);
|
||||
|
||||
// Restore the listeners for the swapped in tab.
|
||||
tabListener = otherTabBrowser.mTabProgressListener(aOtherTab, otherBrowser, false, false);
|
||||
otherTabBrowser._tabListeners.set(aOtherTab, tabListener);
|
||||
|
||||
const notifyAll = Ci.nsIWebProgress.NOTIFY_ALL;
|
||||
filter.addProgressListener(tabListener, notifyAll);
|
||||
otherBrowser.webProgress.addProgressListener(filter, notifyAll);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
@ -1281,16 +1281,16 @@
|
||||
// The request comes from a XPCOM component, we'd want to redirect
|
||||
// the request to tabbrowser so tabbrowser will be setup correctly,
|
||||
// and it will eventually call swapDocShells.
|
||||
let tabbrowser = this.getTabBrowser();
|
||||
if (tabbrowser) {
|
||||
let tab = tabbrowser.getTabForBrowser(this);
|
||||
if (tab) {
|
||||
tabbrowser.swapBrowsers(tab, aOtherBrowser, aFlags);
|
||||
return;
|
||||
}
|
||||
let ourTabBrowser = this.getTabBrowser();
|
||||
let otherTabBrowser = aOtherBrowser.getTabBrowser();
|
||||
if (ourTabBrowser && otherTabBrowser) {
|
||||
let ourTab = ourTabBrowser.getTabForBrowser(this);
|
||||
let otherTab = otherTabBrowser.getTabForBrowser(aOtherBrowser);
|
||||
ourTabBrowser.swapBrowsers(ourTab, otherTab, aFlags);
|
||||
return;
|
||||
}
|
||||
|
||||
// If we're not attached to a tabbrowser, just swap.
|
||||
// One of us is not connected to a tabbrowser, so just swap.
|
||||
this.swapDocShells(aOtherBrowser);
|
||||
]]>
|
||||
</body>
|
||||
|
Loading…
Reference in New Issue
Block a user