зеркало из https://github.com/mozilla/gecko-dev.git
Bug 408415 - fix favicon disappearance for hash changes during load, r=jaws
MozReview-Commit-ID: KCdXMKX5sIH --HG-- rename : browser/base/content/test/general/browser_bug550565.js => browser/base/content/test/general/browser_bug408415.js rename : browser/base/content/test/general/file_bug550565_favicon.ico => browser/base/content/test/general/file_generic_favicon.ico rename : browser/base/content/test/general/file_bug550565_popup.html => browser/base/content/test/general/file_with_favicon.html extra : rebase_source : d95d2f911b855fda7ad4b100d59de96dfabec15a
This commit is contained in:
Родитель
c56f803b17
Коммит
639ffd2893
|
@ -747,6 +747,8 @@
|
|||
let topLevel = aWebProgress.isTopLevel;
|
||||
|
||||
if (topLevel) {
|
||||
let isSameDocument =
|
||||
!!(aFlags & Ci.nsIWebProgressListener.LOCATION_CHANGE_SAME_DOCUMENT);
|
||||
// If userTypedClear > 0, the document loaded correctly and we should be
|
||||
// clearing the user typed value. We also need to clear the typed value
|
||||
// if the document failed to load, to make sure the urlbar reflects the
|
||||
|
@ -758,14 +760,12 @@
|
|||
if (this.mBrowser.userTypedClear > 0 ||
|
||||
((aFlags & Ci.nsIWebProgressListener.LOCATION_CHANGE_ERROR_PAGE) &&
|
||||
aLocation.spec != "about:blank") ||
|
||||
aFlags & Ci.nsIWebProgressListener.LOCATION_CHANGE_SAME_DOCUMENT) {
|
||||
isSameDocument) {
|
||||
this.mBrowser.userTypedValue = null;
|
||||
}
|
||||
|
||||
// If the browser was playing audio, we should remove the playing state.
|
||||
if (this.mTab.hasAttribute("soundplaying") &&
|
||||
(!this.mBrowser.lastURI ||
|
||||
this.mBrowser.lastURI.spec != aLocation.spec)) {
|
||||
if (this.mTab.hasAttribute("soundplaying") && !isSameDocument) {
|
||||
this.mTab.removeAttribute("soundplaying");
|
||||
this.mTabBrowser._tabAttrModified(this.mTab, ["soundplaying"]);
|
||||
}
|
||||
|
@ -788,9 +788,9 @@
|
|||
}
|
||||
|
||||
// Don't clear the favicon if this onLocationChange was
|
||||
// triggered by a pushState or a replaceState. See bug 550565.
|
||||
if (aWebProgress.isLoadingDocument &&
|
||||
!(aWebProgress.loadType & Ci.nsIDocShell.LOAD_CMD_PUSHSTATE)) {
|
||||
// triggered by a pushState or a replaceState (bug 550565) or
|
||||
// a hash change (bug 408415).
|
||||
if (aWebProgress.isLoadingDocument && !isSameDocument) {
|
||||
this.mBrowser.mIconURL = null;
|
||||
}
|
||||
|
||||
|
|
|
@ -29,8 +29,8 @@ support-files =
|
|||
download_page.html
|
||||
dummy_page.html
|
||||
feed_tab.html
|
||||
file_bug550565_favicon.ico
|
||||
file_bug550565_popup.html
|
||||
file_generic_favicon.ico
|
||||
file_with_favicon.html
|
||||
file_bug822367_1.html
|
||||
file_bug822367_1.js
|
||||
file_bug822367_2.html
|
||||
|
@ -165,6 +165,7 @@ skip-if = e10s # Bug 1236991 - Update or remove tests that use fillInPageTooltip
|
|||
[browser_bug380960.js]
|
||||
[browser_bug386835.js]
|
||||
[browser_bug406216.js]
|
||||
[browser_bug408415.js]
|
||||
[browser_bug409481.js]
|
||||
[browser_bug409624.js]
|
||||
[browser_bug413915.js]
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
function test() {
|
||||
waitForExplicitFinish();
|
||||
|
||||
let testPath = getRootDirectory(gTestPath);
|
||||
|
||||
let tab = gBrowser.addTab(testPath + "file_with_favicon.html");
|
||||
|
||||
tab.linkedBrowser.addEventListener("DOMContentLoaded", function() {
|
||||
tab.linkedBrowser.removeEventListener("DOMContentLoaded", arguments.callee, true);
|
||||
|
||||
let expectedIcon = testPath + "file_generic_favicon.ico";
|
||||
|
||||
is(gBrowser.getIcon(tab), expectedIcon, "Correct icon before hash change.");
|
||||
tab.linkedBrowser.contentWindow.location.href += "#foo";
|
||||
is(gBrowser.getIcon(tab), expectedIcon, "Correct icon after hash change.");
|
||||
|
||||
gBrowser.removeTab(tab);
|
||||
|
||||
finish();
|
||||
}, true);
|
||||
}
|
|
@ -3,12 +3,12 @@ function test() {
|
|||
|
||||
let testPath = getRootDirectory(gTestPath);
|
||||
|
||||
let tab = gBrowser.addTab(testPath + "file_bug550565_popup.html");
|
||||
let tab = gBrowser.addTab(testPath + "file_with_favicon.html");
|
||||
|
||||
tab.linkedBrowser.addEventListener("DOMContentLoaded", function() {
|
||||
tab.linkedBrowser.removeEventListener("DOMContentLoaded", arguments.callee, true);
|
||||
|
||||
let expectedIcon = testPath + "file_bug550565_favicon.ico";
|
||||
let expectedIcon = testPath + "file_generic_favicon.ico";
|
||||
|
||||
is(gBrowser.getIcon(tab), expectedIcon, "Correct icon before pushState.");
|
||||
tab.linkedBrowser.contentWindow.history.pushState("page2", "page2", "page2");
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test file for bug 550565.</title>
|
||||
|
||||
<!--Set a favicon; that's the whole point of this file.-->
|
||||
<link rel="icon" href="file_bug550565_favicon.ico">
|
||||
</head>
|
||||
<body>
|
||||
Test file for bug 550565.
|
||||
</body>
|
||||
</html>
|
До Ширина: | Высота: | Размер: 1.4 KiB После Ширина: | Высота: | Размер: 1.4 KiB |
|
@ -0,0 +1,12 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test file for bugs with favicons</title>
|
||||
|
||||
<!--Set a favicon; that's the whole point of this file.-->
|
||||
<link rel="icon" href="file_generic_favicon.ico">
|
||||
</head>
|
||||
<body>
|
||||
Test file for bugs with favicons
|
||||
</body>
|
||||
</html>
|
Загрузка…
Ссылка в новой задаче