Bug 586506 - unregisterOpenPage should not be called before registerOpenPage if removeTab is called immediately. r=dao a=dietrich

This commit is contained in:
Marco Bonardo 2010-08-13 21:52:30 -04:00
Родитель 8707c34765
Коммит c722631d3c
2 изменённых файлов: 41 добавлений и 17 удалений

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

@ -510,9 +510,12 @@
this.mBrowser.mIconURL = null;
let browserHistory = this.mTabBrowser.mBrowserHistory;
if (this.mBrowser.lastURI)
browserHistory.unregisterOpenPage(this.mBrowser.lastURI);
if (this.mBrowser.registeredOpenURI) {
browserHistory.unregisterOpenPage(this.mBrowser.registeredOpenURI);
delete this.mBrowser.registeredOpenURI;
}
browserHistory.registerOpenPage(aLocation);
this.mBrowser.registeredOpenURI = aLocation;
}
if (!this.mBlank) {
@ -1433,8 +1436,10 @@
filter.removeProgressListener(this.mTabListeners[aTab._tPos]);
this.mTabListeners[aTab._tPos].destroy();
if (browser.currentURI)
this.mBrowserHistory.unregisterOpenPage(browser.currentURI);
if (browser.registeredOpenURI) {
this.mBrowserHistory.unregisterOpenPage(browser.registeredOpenURI);
delete browser.registeredOpenURI;
}
// We are no longer the primary content area.
browser.setAttribute("type", "content-targetable");
@ -2309,7 +2314,10 @@
<![CDATA[
for (var i = 0; i < this.mTabListeners.length; ++i) {
let browser = this.getBrowserAtIndex(i);
this.mBrowserHistory.unregisterOpenPage(browser.currentURI);
if (browser.registeredOpenURI) {
this.mBrowserHistory.unregisterOpenPage(browser.registeredOpenURI);
delete browser.registeredOpenURI;
}
browser.webProgress.removeProgressListener(this.mTabFilters[i]);
this.mTabFilters[i].removeProgressListener(this.mTabListeners[i]);
this.mTabFilters[i] = null;

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

@ -37,7 +37,6 @@
* ***** END LICENSE BLOCK ***** */
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
Components.utils.import("resource://gre/modules/Services.jsm");
const TEST_URL_BASES = [
"http://example.org/browser/browser/base/content/test/dummy_page.html#tabmatch",
@ -119,7 +118,14 @@ var gTestSteps = [
});
}, true);
tab.linkedBrowser.loadURI('data:text/html,<body><iframe src=""></iframe></body>');
}
},
function() {
info("Running step 7 - remove tab immediately");
let tab = gBrowser.addTab("about:blank");
gBrowser.removeTab(tab);
ensure_opentabs_match_db();
nextStep();
},
];
@ -130,9 +136,17 @@ function test() {
}
function loadTab(tab, url) {
// Because adding visits is async, we will not be notified immediately.
let visited = false;
tab.linkedBrowser.addEventListener("load", function (event) {
tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
Services.obs.addObserver(
function (aSubject, aTopic, aData) {
if (url != aSubject.QueryInterface(Ci.nsIURI).spec)
return;
Services.obs.removeObserver(arguments.callee, aTopic);
if (--gTabWaitCount > 0)
return;
is(gTabWaitCount, 0,
@ -145,7 +159,9 @@ function loadTab(tab, url) {
}
executeSoon(nextStep);
}, "uri-visit-saved", false);
}, true);
gTabWaitCount++;
tab.linkedBrowser.loadURI(url);
}