Bug 502486 - Don't strip the www off urls for the block-image context menu label. r=dao, ui-r=faaborg

This commit is contained in:
Nochum Sossonko 2009-08-28 20:26:17 +02:00
parent 943115b9ac
commit d8cc15d0c9

View File

@ -271,6 +271,7 @@ nsContextMenu.prototype = {
this.showItem("context-bidi-page-direction-toggle",
!this.onTextInput && top.gBidiUI);
var hostLabel = "";
if (this.onImage) {
var blockImage = document.getElementById("context-blockimage");
@ -280,16 +281,14 @@ nsContextMenu.prototype = {
// this throws if the image URI doesn't have a host (eg, data: image URIs)
// see bug 293758 for details
var hostLabel = "";
try {
hostLabel = uri.host;
} catch (ex) { }
if (hostLabel) {
var shortenedUriHost = hostLabel.replace(/^www\./i,"");
if (shortenedUriHost.length > 15)
shortenedUriHost = shortenedUriHost.substr(0,15) + this.ellipsis;
blockImage.label = gNavigatorBundle.getFormattedString("blockImages", [shortenedUriHost]);
if (hostLabel.length > 15)
hostLabel = hostLabel.substr(0,15) + this.ellipsis;
blockImage.label = gNavigatorBundle.getFormattedString("blockImages", [hostLabel]);
if (this.isImageBlocked())
blockImage.setAttribute("checked", "true");