Bug 1081891: Only reset the browser title when we start to switch to a new document location. r=mconley

--HG--
extra : rebase_source : 1a409e35a48bdcc4f021674dbfae8d10dac71489
extra : amend_source : 921b8dde2fa1711015d39b2a8ccc5fa335e5ba5e
This commit is contained in:
Dave Townsend 2015-02-18 11:57:45 -08:00
Родитель 5f1427fb7e
Коммит 56ca0ed8e4
4 изменённых файлов: 35 добавлений и 1 удалений

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

@ -435,6 +435,7 @@ support-files =
benignPage.html
[browser_typeAheadFind.js]
skip-if = buildapp == 'mulet' || e10s # Bug 921935 - focusmanager issues with e10s (test calls waitForFocus)
[browser_unknownContentType_title.js]
[browser_unloaddialogs.js]
skip-if = e10s # Bug 1100700 - test relies on unload event firing on closed tabs, which it doesn't
[browser_urlHighlight.js]

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

@ -0,0 +1,33 @@
const url = "data:text/html;charset=utf-8,%3C%21DOCTYPE%20html%3E%3Chtml%3E%3Chead%3E%3Ctitle%3ETest%20Page%3C%2Ftitle%3E%3C%2Fhead%3E%3C%2Fhtml%3E";
const unknown_url = "http://example.com/browser/browser/base/content/test/general/unknownContentType_file.pif";
function waitForNewWindow() {
return new Promise(resolve => {
let listener = (win) => {
Services.obs.removeObserver(listener, "toplevel-window-ready");
win.addEventListener("load", () => {
resolve(win);
});
};
Services.obs.addObserver(listener, "toplevel-window-ready", false)
});
}
add_task(function*() {
let tab = gBrowser.selectedTab = gBrowser.addTab(url);
let browser = tab.linkedBrowser;
yield promiseTabLoaded(gBrowser.selectedTab);
is(gBrowser.contentTitle, "Test Page", "Should have the right title.")
browser.loadURI(unknown_url);
let win = yield waitForNewWindow();
is(win.location, "chrome://mozapps/content/downloads/unknownContentType.xul",
"Should have seen the unknown content dialog.");
is(gBrowser.contentTitle, "Test Page", "Should still have the right title.")
win.close();
yield promiseWaitForFocus(window);
gBrowser.removeCurrentTab();
});

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

@ -61,7 +61,6 @@ RemoteWebNavigation.prototype = {
if (aPostData || aHeaders)
throw Components.Exception("RemoteWebNavigation doesn't accept postdata or headers.", Cr.NS_ERROR_INVALID_ARGS);
this._browser._contentTitle = "";
this._sendMessage("WebNavigation:LoadURI", {
uri: aURI,
flags: aLoadFlags,

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

@ -179,6 +179,7 @@ RemoteWebProgressManager.prototype = {
this._browser.webNavigation._currentURI = location;
this._browser._characterSet = json.charset;
this._browser._documentURI = newURI(json.documentURI);
this._browser._contentTitle = "";
this._browser._imageDocument = null;
this._browser._mayEnableCharacterEncodingMenu = json.mayEnableCharacterEncodingMenu;
this._browser._contentPrincipal = json.principal;