зеркало из https://github.com/mozilla/pjs.git
b=109672, site icon for iframe content is shown as proxy icon, patch from bugzilla.mozilla.org@chsc.dk, r=vladimir,a=asa
This commit is contained in:
Родитель
749e8b8db2
Коммит
e48009554a
|
@ -280,7 +280,6 @@
|
||||||
mTab: aTab,
|
mTab: aTab,
|
||||||
mBrowser: aBrowser,
|
mBrowser: aBrowser,
|
||||||
mBlank: aStartsBlank,
|
mBlank: aStartsBlank,
|
||||||
mIcon: null,
|
|
||||||
mLastURI: null,
|
mLastURI: null,
|
||||||
|
|
||||||
onProgressChange : function (aWebProgress, aRequest,
|
onProgressChange : function (aWebProgress, aRequest,
|
||||||
|
@ -308,9 +307,6 @@
|
||||||
const nsIWebProgressListener = Components.interfaces.nsIWebProgressListener;
|
const nsIWebProgressListener = Components.interfaces.nsIWebProgressListener;
|
||||||
const nsIChannel = Components.interfaces.nsIChannel;
|
const nsIChannel = Components.interfaces.nsIChannel;
|
||||||
|
|
||||||
if (aStateFlags & nsIWebProgressListener.STATE_START)
|
|
||||||
this.mBrowser.mFavIconURL = null;
|
|
||||||
|
|
||||||
if (aStateFlags & nsIWebProgressListener.STATE_START &&
|
if (aStateFlags & nsIWebProgressListener.STATE_START &&
|
||||||
aStateFlags & nsIWebProgressListener.STATE_IS_NETWORK) {
|
aStateFlags & nsIWebProgressListener.STATE_IS_NETWORK) {
|
||||||
// It's okay to clear what the user typed when we start
|
// It's okay to clear what the user typed when we start
|
||||||
|
@ -323,9 +319,8 @@
|
||||||
|
|
||||||
if (!this.mBlank) {
|
if (!this.mBlank) {
|
||||||
this.mTab.setAttribute("busy", "true");
|
this.mTab.setAttribute("busy", "true");
|
||||||
|
this.mTabBrowser.updateIcon(this.mTab);
|
||||||
this.mTab.label = this.mTabBrowser.mStringBundle.getString("tabs.loading");
|
this.mTab.label = this.mTabBrowser.mStringBundle.getString("tabs.loading");
|
||||||
this.mTab.removeAttribute("image");
|
|
||||||
this.mIcon = null;
|
|
||||||
|
|
||||||
if (this.mTabBrowser.mCurrentTab == this.mTab)
|
if (this.mTabBrowser.mCurrentTab == this.mTab)
|
||||||
this.mTabBrowser.mIsBusy = true;
|
this.mTabBrowser.mIsBusy = true;
|
||||||
|
@ -333,15 +328,20 @@
|
||||||
}
|
}
|
||||||
else if (aStateFlags & nsIWebProgressListener.STATE_STOP &&
|
else if (aStateFlags & nsIWebProgressListener.STATE_STOP &&
|
||||||
aStateFlags & nsIWebProgressListener.STATE_IS_NETWORK) {
|
aStateFlags & nsIWebProgressListener.STATE_IS_NETWORK) {
|
||||||
// The document is done loading, it's okay to clear
|
if (aWebProgress.DOMWindow == this.mBrowser.contentWindow) {
|
||||||
// the value again.
|
// The document is done loading, it's okay to clear
|
||||||
if (aWebProgress.DOMWindow == this.mBrowser.contentWindow)
|
// the value again.
|
||||||
this.mBrowser.userTypedClear = false;
|
this.mBrowser.userTypedClear = false;
|
||||||
|
|
||||||
|
if (!this.mBrowser.mIconURL)
|
||||||
|
this.mTabBrowser.useDefaultIcon(this.mTab);
|
||||||
|
}
|
||||||
|
|
||||||
if (this.mBlank)
|
if (this.mBlank)
|
||||||
this.mBlank = false;
|
this.mBlank = false;
|
||||||
|
|
||||||
this.mTab.removeAttribute("busy");
|
this.mTab.removeAttribute("busy");
|
||||||
|
this.mTabBrowser.updateIcon(this.mTab);
|
||||||
|
|
||||||
var location = aRequest.QueryInterface(nsIChannel).URI;
|
var location = aRequest.QueryInterface(nsIChannel).URI;
|
||||||
|
|
||||||
|
@ -349,13 +349,6 @@
|
||||||
if (location.scheme == "keyword")
|
if (location.scheme == "keyword")
|
||||||
this.mBrowser.userTypedValue = null;
|
this.mBrowser.userTypedValue = null;
|
||||||
|
|
||||||
if (this.mTabBrowser.shouldLoadFavIcon(location)) {
|
|
||||||
if (this.mIcon)
|
|
||||||
this.mTab.setAttribute("image", this.mIcon);
|
|
||||||
else
|
|
||||||
this.mTabBrowser.loadFavIcon(location, "image", this.mTab);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.mTab.label == this.mTabBrowser.mStringBundle.getString("tabs.loading"))
|
if (this.mTab.label == this.mTabBrowser.mStringBundle.getString("tabs.loading"))
|
||||||
this.mTabBrowser.setTabTitle(this.mTab);
|
this.mTabBrowser.setTabTitle(this.mTab);
|
||||||
|
|
||||||
|
@ -378,6 +371,9 @@
|
||||||
if (this.mBrowser.userTypedClear)
|
if (this.mBrowser.userTypedClear)
|
||||||
this.mBrowser.userTypedValue = null;
|
this.mBrowser.userTypedValue = null;
|
||||||
|
|
||||||
|
if (aWebProgress.DOMWindow == this.mBrowser.contentWindow)
|
||||||
|
this.mTabBrowser.setIcon(this.mTab, null);
|
||||||
|
|
||||||
if (!this.mBlank && this.mTabBrowser.mCurrentTab == this.mTab) {
|
if (!this.mBlank && this.mTabBrowser.mCurrentTab == this.mTab) {
|
||||||
for (var i = 0; i < this.mTabBrowser.mProgressListeners.length; i++) {
|
for (var i = 0; i < this.mTabBrowser.mProgressListeners.length; i++) {
|
||||||
var p = this.mTabBrowser.mProgressListeners[i];
|
var p = this.mTabBrowser.mProgressListeners[i];
|
||||||
|
@ -412,13 +408,6 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
setIcon : function(aURI)
|
|
||||||
{
|
|
||||||
this.mIcon = aURI;
|
|
||||||
if (!this.mTab.hasAttribute("busy"))
|
|
||||||
this.mTab.setAttribute("image", aURI);
|
|
||||||
},
|
|
||||||
|
|
||||||
QueryInterface : function(aIID)
|
QueryInterface : function(aIID)
|
||||||
{
|
{
|
||||||
if (aIID.equals(Components.interfaces.nsIWebProgressListener) ||
|
if (aIID.equals(Components.interfaces.nsIWebProgressListener) ||
|
||||||
|
@ -432,12 +421,34 @@
|
||||||
</body>
|
</body>
|
||||||
</method>
|
</method>
|
||||||
|
|
||||||
<method name="buildFavIconString">
|
<method name="setIcon">
|
||||||
|
<parameter name="aTab"/>
|
||||||
<parameter name="aURI"/>
|
<parameter name="aURI"/>
|
||||||
<body>
|
<body>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
var end = (aURI.port == -1) ? "/favicon.ico" : (":" + aURI.port + "/favicon.ico");
|
var browser = this.getBrowserForTab(aTab);
|
||||||
return aURI.scheme + "://" + aURI.host + end;
|
browser.mIconURL = aURI;
|
||||||
|
|
||||||
|
this.updateIcon(aTab);
|
||||||
|
|
||||||
|
for (var i = 0; i < this.mProgressListeners.length; i++) {
|
||||||
|
var p = this.mProgressListeners[i];
|
||||||
|
if ('onLinkIconAvailable' in p)
|
||||||
|
p.onLinkIconAvailable(browser);
|
||||||
|
}
|
||||||
|
]]>
|
||||||
|
</body>
|
||||||
|
</method>
|
||||||
|
|
||||||
|
<method name="updateIcon">
|
||||||
|
<parameter name="aTab"/>
|
||||||
|
<body>
|
||||||
|
<![CDATA[
|
||||||
|
var browser = this.getBrowserForTab(aTab);
|
||||||
|
if (!aTab.hasAttribute("busy") && browser.mIconURL)
|
||||||
|
aTab.setAttribute("image", browser.mIconURL);
|
||||||
|
else
|
||||||
|
aTab.removeAttribute("image");
|
||||||
]]>
|
]]>
|
||||||
</body>
|
</body>
|
||||||
</method>
|
</method>
|
||||||
|
@ -453,19 +464,20 @@
|
||||||
</body>
|
</body>
|
||||||
</method>
|
</method>
|
||||||
|
|
||||||
<method name="loadFavIcon">
|
<method name="useDefaultIcon">
|
||||||
<parameter name="aURI"/>
|
<parameter name="aTab"/>
|
||||||
<parameter name="aAttr"/>
|
|
||||||
<parameter name="aElt"/>
|
|
||||||
<body>
|
<body>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
var iconURL;
|
var browser = this.getBrowserForTab(aTab);
|
||||||
if (this.contentDocument instanceof ImageDocument)
|
if (browser.contentDocument instanceof ImageDocument) {
|
||||||
iconURL = this.currentURI.spec;
|
if (this.mPrefs.getBoolPref("browser.chrome.site_icons"))
|
||||||
else
|
this.setIcon(aTab, browser.currentURI.spec);
|
||||||
iconURL = this.buildFavIconString(aURI);
|
}
|
||||||
if (!this.isFavIconKnownMissing(iconURL))
|
else if (this.shouldLoadFavIcon(browser.currentURI)) {
|
||||||
aElt.setAttribute(aAttr, iconURL);
|
var url = browser.currentURI.prePath + "/favicon.ico";
|
||||||
|
if (!this.isIconKnownMissing(url))
|
||||||
|
this.setIcon(aTab, url);
|
||||||
|
}
|
||||||
]]>
|
]]>
|
||||||
</body>
|
</body>
|
||||||
</method>
|
</method>
|
||||||
|
@ -508,7 +520,7 @@
|
||||||
</body>
|
</body>
|
||||||
</method>
|
</method>
|
||||||
|
|
||||||
<method name="isFavIconKnownMissing">
|
<method name="isIconKnownMissing">
|
||||||
<parameter name="key"/>
|
<parameter name="key"/>
|
||||||
<body>
|
<body>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
|
@ -638,13 +650,6 @@
|
||||||
p.onLocationChange(webProgress, null, loc);
|
p.onLocationChange(webProgress, null, loc);
|
||||||
if (securityUI)
|
if (securityUI)
|
||||||
p.onSecurityChange(webProgress, null, securityUI.state);
|
p.onSecurityChange(webProgress, null, securityUI.state);
|
||||||
var listener = this.mTabListeners[this.mTabContainer.selectedIndex];
|
|
||||||
if (listener.mIcon) {
|
|
||||||
if (this.isFavIconKnownMissing(listener.mIcon))
|
|
||||||
listener.mIcon = null;
|
|
||||||
else if ('onLinkIconAvailable' in p)
|
|
||||||
p.onLinkIconAvailable(newBrowser, listener.mIcon);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.mCurrentBrowser.userTypedClear = userTypedClear;
|
this.mCurrentBrowser.userTypedClear = userTypedClear;
|
||||||
|
@ -797,27 +802,9 @@
|
||||||
// no browser? no favicon.
|
// no browser? no favicon.
|
||||||
if (browserIndex == -1)
|
if (browserIndex == -1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var listener = tabBrowser.mTabListeners[browserIndex];
|
var tab = tabBrowser.mTabContainer.childNodes[browserIndex];
|
||||||
// there's no tab listener for non-tabbed mode browser 0
|
tabBrowser.setIcon(tab, href);
|
||||||
|
|
||||||
if (tabBrowser.isFavIconKnownMissing(href)) {
|
|
||||||
if (listener)
|
|
||||||
listener.mIcon = null;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (listener)
|
|
||||||
listener.setIcon(href);
|
|
||||||
|
|
||||||
if (tabBrowser.mProgressListeners) {
|
|
||||||
var targetBrowser = tabBrowser.getBrowserAtIndex(browserIndex);
|
|
||||||
for (i = 0; i < tabBrowser.mProgressListeners.length; i++) {
|
|
||||||
var p = tabBrowser.mProgressListeners[i];
|
|
||||||
if (p && 'onLinkIconAvailable' in p)
|
|
||||||
p.onLinkIconAvailable(targetBrowser, href);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]]>
|
]]>
|
||||||
</body>
|
</body>
|
||||||
</method>
|
</method>
|
||||||
|
@ -923,11 +910,7 @@
|
||||||
this.mCurrentBrowser.addEventListener("DOMTitleChanged", this.onTitleChanged, false);
|
this.mCurrentBrowser.addEventListener("DOMTitleChanged", this.onTitleChanged, false);
|
||||||
|
|
||||||
this.setTabTitle(this.mCurrentTab);
|
this.setTabTitle(this.mCurrentTab);
|
||||||
|
this.setIcon(this.mCurrentTab, this.mCurrentBrowser.mIconURL);
|
||||||
// Hook up our favicon.
|
|
||||||
var uri = this.mCurrentBrowser.currentURI;
|
|
||||||
if (this.shouldLoadFavIcon(uri))
|
|
||||||
this.loadFavIcon(uri, "image", this.mCurrentTab);
|
|
||||||
|
|
||||||
var filter;
|
var filter;
|
||||||
if (this.mTabFilters.length > 0) {
|
if (this.mTabFilters.length > 0) {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче