Bug 1140129 - Don't clear tab title when location changes (r=Mossop)

This commit is contained in:
Bill McCloskey 2015-04-08 16:44:17 -07:00
Родитель a94613d29b
Коммит c53029d62f
5 изменённых файлов: 36 добавлений и 2 удалений

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

@ -139,6 +139,7 @@ let WebProgressListener = {
if (aWebProgress && aWebProgress.isTopLevel) {
json.documentURI = content.document.documentURIObject.spec;
json.title = content.document.title;
json.charset = content.document.characterSet;
json.mayEnableCharacterEncodingMenu = docShell.mayEnableCharacterEncodingMenu;
json.principal = content.document.nodePrincipal;

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

@ -1,5 +1,7 @@
[DEFAULT]
support-files = head.js
support-files =
head.js
file_contentTitle.html
[browser_autoscroll_disabled.js]
skip-if = e10s # Bug ?????? - test touches content (getElementById on the content document)
[browser_browserDrop.js]
@ -10,6 +12,7 @@ skip-if = e10s # Bug 921935 - focusmanager issues with e10s
skip-if = e10s # Bug ?????? - intermittent crash of child process reported when run under e10s
[browser_bug982298.js]
skip-if = e10s # Bug 1064580
[browser_contentTitle.js]
[browser_default_image_filename.js]
skip-if = e10s # Bug 933103 - mochitest's EventUtils.synthesizeMouse functions not e10s friendly
[browser_f7_caret_browsing.js]

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

@ -0,0 +1,16 @@
let url = "https://example.com/browser/toolkit/content/tests/browser/file_contentTitle.html";
add_task(function*() {
let tab = gBrowser.selectedTab = gBrowser.addTab(url);
let browser = tab.linkedBrowser;
yield new Promise((resolve) => {
addEventListener("TestLocationChange", function listener() {
removeEventListener("TestLocationChange", listener);
resolve();
}, true, true);
});
is(gBrowser.contentTitle, "Test Page", "Should have the right title.");
gBrowser.removeTab(tab);
});

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

@ -0,0 +1,14 @@
<html>
<head><title>Test Page</title></head>
<body>
<script type="text/javascript">
dump("Script!\n");
addEventListener("load", () => {
// Trigger an onLocationChange event. We want to make sure the title is still correct afterwards.
location.hash = "#x2";
var event = new Event("TestLocationChange");
document.dispatchEvent(event);
}, false);
</script>
</body>
</html>

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

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