author | Tanner M. Young <mozilla.bugs@alyoung.com> |
Wed, 23 Jun 2010 14:24:02 -0500 | |
changeset 46167 | 99d33490f673bb251906d23212ace3a1f27b87d5 |
parent 44203 | fae939d0a47a4a865784fa72da65e70827cee6c8 |
child 46168 | 1797219270cfebfc8a157ffc15e48e0fb8680498 |
push id | 14049 |
push user | db48x@yahoo.com |
push date | Thu, 24 Jun 2010 17:19:28 +0000 |
treeherder | mozilla-central@1797219270cf [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | db48x |
bugs | 377349 |
milestone | 1.9.3a6pre |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/browser/base/content/pageinfo/pageInfo.js +++ b/browser/base/content/pageinfo/pageInfo.js @@ -20,16 +20,17 @@ # the Initial Developer. All Rights Reserved. # # Contributor(s): # smorrison@gte.com # Terry Hayes <thayes@netscape.com> # 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 # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), # in which case the provisions of the GPL or the LGPL are applicable instead # of those above. If you wish to allow use of your version of this file only # under the terms of either the GPL or the LGPL, and not to allow others to # use your version of this file under the terms of the MPL, indicate your @@ -170,18 +171,21 @@ var gImageView = new pageInfoTreeView(CO var atomSvc = Components.classes["@mozilla.org/atom-service;1"] .getService(Components.interfaces.nsIAtomService); 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") props.AppendElement(this._ltrAtom); }; var gImageHash = { }; @@ -923,20 +927,17 @@ function makePreview(row) // We couldn't find the type, fall back to the value in the treeview imageType = gImageView.data[row][COL_IMAGE_TYPE]; } setItemValue("imagetypetext", imageType); 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"; var physWidth = 0, physHeight = 0; var width = 0, height = 0; if ((item instanceof HTMLLinkElement || item instanceof HTMLInputElement || item instanceof HTMLImageElement || @@ -1210,23 +1211,33 @@ function doCopy() function doSelectAll() { var elem = document.commandDispatcher.focusedElement; if (elem && "treeBoxObject" in elem) elem.view.selection.selectAll(); } -function selectImage() { +function selectImage() +{ if (!gImageElement) return; var tree = document.getElementById("imagetree"); for (var i = 0; i < tree.view.rowCount; i++) { if (gImageElement == gImageView.data[i][COL_IMAGE_NODE] && !gImageView.data[i][COL_IMAGE_BG]) { tree.view.selection.select(i); tree.treeBoxObject.ensureRowIsVisible(i); tree.focus(); return; } } } + +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); +}