diff --git a/mozilla/browser/base/content/browser.js b/mozilla/browser/base/content/browser.js index df10bd1ddf5..987e539b5d8 100644 --- a/mozilla/browser/base/content/browser.js +++ b/mozilla/browser/base/content/browser.js @@ -126,20 +126,15 @@ function loadEventHandlers(event) // some event handlers want to be told what the original browser/listener is var targetBrowser = null; - var targetListener = null; if (gBrowser.mTabbedMode) { var targetBrowserIndex = gBrowser.getBrowserIndexForDocument(event.originalTarget); if (targetBrowserIndex == -1) return; targetBrowser = gBrowser.getBrowserAtIndex(targetBrowserIndex); - targetListener = gBrowser.mTabListeners[targetBrowserIndex]; } else { targetBrowser = gBrowser.mCurrentBrowser; - targetListener = null; // no listener for non-tabbed-mode } - updatePageFavIcon(targetBrowser, targetListener); - // update the last visited date if (targetBrowser.currentURI.spec) BMSVC.updateLastVisitedDate(targetBrowser.currentURI.spec, @@ -2110,24 +2105,12 @@ function SetPageProxyState(aState) gProxyButton.setAttribute("pageproxystate", aState); // the page proxy state is set to valid via OnLocationChange, which - // gets called when we switch tabs. We'll let updatePageFavIcon - // take care of updating the mFavIconURL because it knows exactly - // for which tab to update things, instead of confusing the issue - // here. + // gets called when we switch tabs. if (aState == "valid") { gLastValidURLStr = gURLBar.value; gURLBar.addEventListener("input", UpdatePageProxyState, false); - if (gBrowser.mCurrentBrowser.mFavIconURL != null) { - if (gBrowser.isFavIconKnownMissing(gBrowser.mCurrentBrowser.mFavIconURL)) { - gBrowser.mFavIconURL = null; - PageProxyClearIcon(); - } else { - PageProxySetIcon(gBrowser.mCurrentBrowser.mFavIconURL); - } - } else { - PageProxyClearIcon(); - } + PageProxySetIcon(gBrowser.mCurrentBrowser.mIconURL); } else if (aState == "invalid") { gURLBar.removeEventListener("input", UpdatePageProxyState, false); PageProxyClearIcon(); @@ -2139,7 +2122,9 @@ function PageProxySetIcon (aURL) if (!gProxyFavIcon) return; - if (gProxyFavIcon.getAttribute("src") != aURL) + if (!aURL) + PageProxyClearIcon(); + else if (gProxyFavIcon.getAttribute("src") != aURL) gProxyFavIcon.setAttribute("src", aURL); else if (gProxyDeck.selectedIndex != 1) gProxyDeck.selectedIndex = 1; @@ -3177,16 +3162,14 @@ nsBrowserStatusHandler.prototype = } }, - onLinkIconAvailable : function(aBrowser, aHref) + onLinkIconAvailable : function(aBrowser) { if (gProxyFavIcon && gBrowser.mCurrentBrowser == aBrowser && gBrowser.userTypedValue === null) { - PageProxySetIcon(aHref); + PageProxySetIcon(aBrowser.mIconURL); } - - aBrowser.mFavIconURL = aHref; }, onProgressChange : function (aWebProgress, aRequest, @@ -3211,15 +3194,6 @@ nsBrowserStatusHandler.prototype = // stray request (the first request outside of the document load), // initialize the throbber and his friends. - // always reset the favicon - if (gBrowser.mTabbedMode) { - var browserIndex = gBrowser.getBrowserIndexForDocument(aWebProgress.DOMWindow); - if (browserIndex != -1) - gBrowser.getBrowserAtIndex(browserIndex).mFavIconURL = null; - } - else - gBrowser.mCurrentBrowser.mFavIconURL = null; - // Call start document load listeners (only if this is a network load) if (aStateFlags & nsIWebProgressListener.STATE_IS_NETWORK && aRequest && aWebProgress.DOMWindow == content) @@ -3244,9 +3218,14 @@ nsBrowserStatusHandler.prototype = } else if (aStateFlags & nsIWebProgressListener.STATE_STOP) { if (aStateFlags & nsIWebProgressListener.STATE_IS_NETWORK) { - if (aRequest) { - if (aWebProgress.DOMWindow == content) + if (aWebProgress.DOMWindow == content) { + if (aRequest) this.endDocumentLoad(aRequest, aStatus); + var browser = gBrowser.mCurrentBrowser; + if (!gBrowser.mTabbedMode && !browser.mIconURL) + gBrowser.useDefaultIcon(gBrowser.mCurrentTab); + if (browser.mIconURL) + BookmarksUtils.loadFavIcon(browser.currentURI.spec, browser.mIconURL); } } @@ -3357,6 +3336,9 @@ nsBrowserStatusHandler.prototype = if (browser.userTypedClear) browser.userTypedValue = null; + if (!gBrowser.mTabbedMode) + gBrowser.setIcon(gBrowser.mCurrentTab, null); + if (findField) setTimeout(function() { findField.value = browser.findString; }, 0, findField, browser); @@ -5749,31 +5731,6 @@ function livemarkAddMark(wincontent, data) { BookmarksUtils.addLivemark(wincontent.document.baseURI, data, title, description); } -function updatePageFavIcon(aBrowser, aListener) { - var uri = aBrowser.currentURI; - - if (!gBrowser.shouldLoadFavIcon(uri)) - return; - - // if we made it here with this null, then no was found for - // the page load. We try to fetch a generic favicon.ico. - if (aBrowser.mFavIconURL == null) { - aBrowser.mFavIconURL = gBrowser.buildFavIconString(uri); - // give it to the listener as well - // XXX - there is no listener for non-tabbed-mode: this is why - // the urlbar has no favicon when you switch from tabbed mode to - // non-tabbed-mode. - if (aListener) - aListener.mIcon = aBrowser.mFavIconURL; - } - - if (aBrowser == gBrowser.mCurrentBrowser) - PageProxySetIcon(aBrowser.mFavIconURL); - - if (aBrowser.mFavIconURL != null) - BookmarksUtils.loadFavIcon(uri.spec, aBrowser.mFavIconURL); -} - function GetFrameDocumentsFromWindow(aWindow){ if (aWindow.getComputedStyle(aWindow.document.body, "").direction == "ltr") aWindow.document.dir = "rtl"; diff --git a/mozilla/toolkit/content/widgets/browser.xml b/mozilla/toolkit/content/widgets/browser.xml index 1311ea986cd..1d72b8fe24e 100644 --- a/mozilla/toolkit/content/widgets/browser.xml +++ b/mozilla/toolkit/content/widgets/browser.xml @@ -165,7 +165,7 @@ catch (e) { } } - this.mFavIconURL = null; + this.mIconURL = null; this.webNavigation.loadURI(aURI, aFlags, aReferrerURI, aPostData, null); ]]> @@ -535,7 +535,7 @@ false - null + null false diff --git a/mozilla/toolkit/content/widgets/tabbrowser.xml b/mozilla/toolkit/content/widgets/tabbrowser.xml index 23b2e19bb43..a04950a0375 100644 --- a/mozilla/toolkit/content/widgets/tabbrowser.xml +++ b/mozilla/toolkit/content/widgets/tabbrowser.xml @@ -280,7 +280,6 @@ mTab: aTab, mBrowser: aBrowser, mBlank: aStartsBlank, - mIcon: null, mLastURI: null, onProgressChange : function (aWebProgress, aRequest, @@ -308,9 +307,6 @@ const nsIWebProgressListener = Components.interfaces.nsIWebProgressListener; const nsIChannel = Components.interfaces.nsIChannel; - if (aStateFlags & nsIWebProgressListener.STATE_START) - this.mBrowser.mFavIconURL = null; - if (aStateFlags & nsIWebProgressListener.STATE_START && aStateFlags & nsIWebProgressListener.STATE_IS_NETWORK) { // It's okay to clear what the user typed when we start @@ -323,9 +319,8 @@ if (!this.mBlank) { this.mTab.setAttribute("busy", "true"); + this.mTabBrowser.updateIcon(this.mTab); this.mTab.label = this.mTabBrowser.mStringBundle.getString("tabs.loading"); - this.mTab.removeAttribute("image"); - this.mIcon = null; if (this.mTabBrowser.mCurrentTab == this.mTab) this.mTabBrowser.mIsBusy = true; @@ -333,15 +328,20 @@ } else if (aStateFlags & nsIWebProgressListener.STATE_STOP && aStateFlags & nsIWebProgressListener.STATE_IS_NETWORK) { - // The document is done loading, it's okay to clear - // the value again. - if (aWebProgress.DOMWindow == this.mBrowser.contentWindow) + if (aWebProgress.DOMWindow == this.mBrowser.contentWindow) { + // The document is done loading, it's okay to clear + // the value again. this.mBrowser.userTypedClear = false; + if (!this.mBrowser.mIconURL) + this.mTabBrowser.useDefaultIcon(this.mTab); + } + if (this.mBlank) this.mBlank = false; this.mTab.removeAttribute("busy"); + this.mTabBrowser.updateIcon(this.mTab); var location = aRequest.QueryInterface(nsIChannel).URI; @@ -349,13 +349,6 @@ if (location.scheme == "keyword") 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")) this.mTabBrowser.setTabTitle(this.mTab); @@ -378,6 +371,9 @@ if (this.mBrowser.userTypedClear) this.mBrowser.userTypedValue = null; + if (aWebProgress.DOMWindow == this.mBrowser.contentWindow) + this.mTabBrowser.setIcon(this.mTab, null); + if (!this.mBlank && this.mTabBrowser.mCurrentTab == this.mTab) { for (var i = 0; i < this.mTabBrowser.mProgressListeners.length; 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) { if (aIID.equals(Components.interfaces.nsIWebProgressListener) || @@ -432,12 +421,34 @@ - + + + + + + + + + @@ -453,19 +464,20 @@ - - - - + + @@ -508,7 +520,7 @@ - + @@ -923,11 +910,7 @@ this.mCurrentBrowser.addEventListener("DOMTitleChanged", this.onTitleChanged, false); this.setTabTitle(this.mCurrentTab); - - // Hook up our favicon. - var uri = this.mCurrentBrowser.currentURI; - if (this.shouldLoadFavIcon(uri)) - this.loadFavIcon(uri, "image", this.mCurrentTab); + this.setIcon(this.mCurrentTab, this.mCurrentBrowser.mIconURL); var filter; if (this.mTabFilters.length > 0) {