mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-05 08:35:26 +00:00
Fix for 32087, custom icon support in tabs and url bar. r=andreww, sr=hewitt
This commit is contained in:
parent
c3d26e13d4
commit
6b0e0d0ad9
@ -42,11 +42,14 @@ const XREMOTESERVICE_CONTRACTID = "@mozilla.org/browser/xremoteservice;1";
|
||||
|
||||
var gURLBar = null;
|
||||
var gProxyButton = null;
|
||||
var gProxyFavIcon = null;
|
||||
var gProxyDeck = null;
|
||||
var gNavigatorBundle;
|
||||
var gBrandBundle;
|
||||
var gNavigatorRegionBundle;
|
||||
var gBrandRegionBundle;
|
||||
var gLastValidURL = "";
|
||||
var gLastValidURLStr = "";
|
||||
var gLastValidURL = null;
|
||||
var gHaveUpdatedToolbarState = false;
|
||||
var gClickSelectsAll = -1;
|
||||
|
||||
@ -266,7 +269,7 @@ function Startup()
|
||||
gBrowser = document.getElementById("content");
|
||||
gURLBar = document.getElementById("urlbar");
|
||||
|
||||
SetPageProxyState("invalid");
|
||||
SetPageProxyState("invalid", null);
|
||||
|
||||
var webNavigation;
|
||||
try {
|
||||
@ -1514,7 +1517,7 @@ function handleURLBarRevert()
|
||||
if (url != "about:blank") {
|
||||
gURLBar.value = url;
|
||||
gURLBar.select();
|
||||
SetPageProxyState("valid");
|
||||
SetPageProxyState("valid", null); // XXX Build a URI and pass it in here.
|
||||
} else { //if about:blank, urlbar becomes ""
|
||||
gURLBar.value = "";
|
||||
}
|
||||
@ -1533,23 +1536,39 @@ function handleURLBarCommand(aUserAction)
|
||||
|
||||
function UpdatePageProxyState()
|
||||
{
|
||||
if (gURLBar.value != gLastValidURL)
|
||||
SetPageProxyState("invalid");
|
||||
if (gURLBar.value != gLastValidURLStr)
|
||||
SetPageProxyState("invalid", null);
|
||||
}
|
||||
|
||||
function SetPageProxyState(aState)
|
||||
function SetPageProxyState(aState, aURI)
|
||||
{
|
||||
if (!gProxyButton)
|
||||
gProxyButton = document.getElementById("page-proxy-button");
|
||||
if (!gProxyFavIcon)
|
||||
gProxyFavIcon = document.getElementById("page-proxy-favicon");
|
||||
if (!gProxyDeck)
|
||||
gProxyDeck = document.getElementById("page-proxy-deck");
|
||||
|
||||
gProxyButton.setAttribute("pageproxystate", aState);
|
||||
|
||||
if (aState == "valid") {
|
||||
gLastValidURL = gURLBar.value;
|
||||
gLastValidURLStr = gURLBar.value;
|
||||
gURLBar.addEventListener("input", UpdatePageProxyState, false);
|
||||
} else if (aState == "invalid")
|
||||
if (pref.getBoolPref("browser.chrome.site_icons") && aURI && "schemeIs" in aURI && (aURI.schemeIs("http") || aURI.schemeIs("https"))) {
|
||||
var favurl = gBrowser.buildFavIconString(aURI);
|
||||
if (favurl != gProxyFavIcon.src) {
|
||||
gProxyFavIcon.setAttribute("src", favurl);
|
||||
gProxyDeck.selectedIndex = 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
gProxyDeck.selectedIndex = 0;
|
||||
gProxyFavIcon.removeAttribute("src");
|
||||
}
|
||||
} else if (aState == "invalid") {
|
||||
gURLBar.removeEventListener("input", UpdatePageProxyState, false);
|
||||
|
||||
gProxyDeck.selectedIndex = 0;
|
||||
}
|
||||
}
|
||||
|
||||
function PageProxyDragGesture(aEvent)
|
||||
|
@ -179,9 +179,13 @@ Contributor(s): ______________________________________. -->
|
||||
ontextrevert="return handleURLBarRevert();"
|
||||
onfocus="URLBarFocusHandler(event);"
|
||||
onblur="URLBarBlurHandler(event);">
|
||||
<image id="page-proxy-button" allowevents="true"
|
||||
ondraggesture="PageProxyDragGesture(event);"/>
|
||||
|
||||
<deck id="page-proxy-deck">
|
||||
<image id="page-proxy-button"
|
||||
ondraggesture="PageProxyDragGesture(event);"/>
|
||||
<image id="page-proxy-favicon" validate="never"
|
||||
ondraggesture="PageProxyDragGesture(event);"
|
||||
onload="this.parentNode.selectedIndex = 1; event.stopPropagation(); event.preventBubble();"/>
|
||||
</deck>
|
||||
<menupopup id="ubhist-popup" class="autocomplete-history-popup"
|
||||
popupalign="topleft" popupanchor="bottomleft"
|
||||
onpopupshowing="createUBHistoryMenu(event.target);"
|
||||
|
@ -141,6 +141,11 @@ nsBrowserStatusHandler.prototype =
|
||||
}
|
||||
},
|
||||
|
||||
onLinkIconAvailable : function(aHref) {
|
||||
if (gProxyFavIcon)
|
||||
gProxyFavIcon.setAttribute("src", aHref);
|
||||
},
|
||||
|
||||
onProgressChange : function (aWebProgress, aRequest,
|
||||
aCurSelfProgress, aMaxSelfProgress,
|
||||
aCurTotalProgress, aMaxTotalProgress)
|
||||
@ -261,7 +266,7 @@ nsBrowserStatusHandler.prototype =
|
||||
// Do not update urlbar if there was a subframe navigation
|
||||
if (domWindow == domWindow.top) {
|
||||
this.urlBar.value = location;
|
||||
SetPageProxyState("valid");
|
||||
SetPageProxyState("valid", aLocation);
|
||||
}
|
||||
UpdateBackForwardButtons();
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user