diff --git a/browser/base/content/pageinfo/pageInfo.js b/browser/base/content/pageinfo/pageInfo.js index ed7907f5f984..c19102ee592f 100644 --- a/browser/base/content/pageinfo/pageInfo.js +++ b/browser/base/content/pageinfo/pageInfo.js @@ -25,6 +25,7 @@ # Daniel Brooks # Florian QUEZE # Erik Fabert +# Tanner M. Young # # 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); +}