Bug 377349 - Page info : Media Tab. The broken image indicator is often wrong. r=db48x

This commit is contained in:
Tanner M. Young 2010-06-23 14:24:02 -05:00
Родитель 085f1f3ffa
Коммит bb4910fc47
1 изменённых файлов: 18 добавлений и 7 удалений

Просмотреть файл

@ -25,6 +25,7 @@
# Daniel Brooks <db48x@yahoo.com>
# Florian QUEZE <f.qu@queze.net>
# Erik Fabert <jerfa@yahoo.com>
# Tanner M. Young <mozilla@alyoung.com>
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
@ -175,8 +176,11 @@ gImageView._ltrAtom = atomSvc.getAtom("ltr");
gImageView._brokenAtom = atomSvc.getAtom("broken");
gImageView.getCellProperties = function(row, col, props) {
if (gImageView.data[row][COL_IMAGE_SIZE] == gStrings.unknown &&
!/^https:/.test(gImageView.data[row][COL_IMAGE_ADDRESS]))
var data = gImageView.data[row];
var item = gImageView.data[row][COL_IMAGE_NODE];
if (!checkProtocol(data) ||
item instanceof HTMLEmbedElement ||
(item instanceof HTMLObjectElement && !/^image\//.test(item.type)))
props.AppendElement(this._brokenAtom);
if (col.element.id == "image-address")
@ -928,10 +932,7 @@ function makePreview(row)
var imageContainer = document.getElementById("theimagecontainer");
var oldImage = document.getElementById("thepreviewimage");
const regex = /^(https?|ftp|file|about|chrome|resource):/;
var isProtocolAllowed = regex.test(url);
if (/^data:/.test(url) && /^image\//.test(mimeType))
isProtocolAllowed = true;
var isProtocolAllowed = checkProtocol(gImageView.data[row]);
var newImage = new Image;
newImage.id = "thepreviewimage";
@ -1215,7 +1216,8 @@ function doSelectAll()
elem.view.selection.selectAll();
}
function selectImage() {
function selectImage()
{
if (!gImageElement)
return;
@ -1230,3 +1232,12 @@ function selectImage() {
}
}
}
function checkProtocol(img)
{
var url = img[COL_IMAGE_ADDRESS];
if (/^data:/.test(url) && /^image\//.test(img[COL_IMAGE_NODE].type))
return true;
const regex = /^(https?|ftp|file|about|chrome|resource):/;
return regex.test(url);
}