Closed Bug 632119 Opened 13 years ago Closed 13 years ago

For all data URI images, "View Image Info" says "Dimensions: 0px x 0px" & has broken "Media Preview"

Categories

(Firefox :: Page Info Window, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
Firefox 11

People

(Reporter: dholbert, Assigned: felix)

References

Details

(Keywords: regression)

Attachments

(2 files)

STEPS TO REPRODUCE:
 1. Load the following data: URI (for a green 100x100 block):

data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00d%00%00%00d%08%06%00%00%00p%E2%95T%00%00%00%01sRGB%00%AE%CE%1C%E9%00%00%00%A2IDATx%DA%ED%D1%01%0D%00%00%08%C3%B0%83%7F%CF%60%83%90N%C2Z%99Lt%A6%B6%00%88%80%00%11%10%20%02%02D%40%80%08%88%80%00%11%10%20%02%02D%40%80%08%88%80%00%11%10%20%02%02D%40%80%08%88%80%00%11%10%20%02%02D%40%80%08%88%80%00%11%10%20%02%02D%40%80%08%88%80%00%11%10%20%02%02D%40%80%08%88%80%00%11%10%20%02%02D%40%80%08%88%80%00%11%10%20%02%02D%40%80%08%88%80%00%11%10%20%02%02D%40%80%08%88%80%00%11%10%20%02%02D%40%80%08%08%10%01%11%10%20%02%02D%40%BE%B7%EBM%02%C6h%7D%EAl%00%00%00%00IEND%AEB%60%82

 2. Right-click on the loaded image, and choose "View Image Info"

ACTUAL RESULTS: The Image Info contains:
  "Dimensions: 0px x 0px"

EXPECTED:
  "Dimensions: 100px x 100px"

If I view the actual PNG image (not as a data URI), I get EXPECTED RESULTS.
Here's the image that's encoded by the data URI in comment 0.  When you view this attached image directly (not as a data URI), you get EXPECTED RESULTS.
Additionally - for data URIs, there's a broken-image icon instead of the actual image, in the "Media Preview" box (at the bottom of the View Image Info).
Summary: "View Image Info" says "Dimensions: 0px x 0px" for all data URI images → For all data URI images, "View Image Info" says "Dimensions: 0px x 0px" & has broken "Media Preview"
See also Bug 599756, which was filed a few months back on similar issues with "moz-filedata:" images.
Hmm.  So the page info code sets img.url and immediately reads the size.  So it assumes some sort of sync cache hit or something happening here.
Actually, it looks like it never sets .url.  Investigating.
And in particular, this check returns false:

  if (/^data:/.test(url) && /^image\//.test(img[COL_IMAGE_NODE].type))

because img[COL_IMAGE_NODE].type is undefined.  So checkProtocol returns false, and page info doesn't do anything with this image.

This is a regression from bug 377349 which moved some code around incorrectly (and replaced "mimeType" with "type" in the process).
Blocks: 377349
Component: ImageLib → Page Info
Keywords: regression
Product: Core → Firefox
QA Contact: imagelib → page.info
Setting to All/All as I can reproduce this on Win7
OS: Linux → All
Hardware: x86_64 → All
so any plan to deal with this in recent? Maybe firefox 8?
Since tmyoung is not around, over to the bug 377349 reviewer.
Assignee: nobody → db48x
Indeed Firefox 10 users wonder
"speaking of which, why in Firefox when I click "View Background
Image" on an average Wikipedia page do I get
data:image/png;base64,iVBORw0... "1x1" pixels and all just white?
and in Page Info > Media there are several more, all "0x0" pixels.
Are they just all white nothingness, or is this a Firefox bug?"
(In reply to jidanni from comment #11)
> Are they just all white nothingness, or is this a Firefox bug?"

They're not white nothingness -- what you're describing is a firefox bug. (It's this bug, in fact! :) )

Note that this affects moz-filedata: URIs as well (e.g. it affects http://mxr.mozilla.org/mozilla-central/source/layout/reftests/svg/as-image/img-blobBuilder-1.html )
Summary: For all data URI images, "View Image Info" says "Dimensions: 0px x 0px" & has broken "Media Preview" → For all data URI & moz-filedata images, "View Image Info" says "Dimensions: 0px x 0px" & has broken "Media Preview"
(ah, sorry -- the moz-filedata brokenness is covered by bug 599756)
Summary: For all data URI & moz-filedata images, "View Image Info" says "Dimensions: 0px x 0px" & has broken "Media Preview" → For all data URI images, "View Image Info" says "Dimensions: 0px x 0px" & has broken "Media Preview"
Gavin, can you find someone to fix this, please?

Note that the "View background image" issue is separate from this bug.  Please file a bug on it, with steps to reproduce.
(In reply to Boris Zbarsky (:bz) from comment #14)
> Note that the "View background image" issue is separate from this bug. 
> Please file a bug on it, with steps to reproduce.
Just view the background image on Wikipedia. Same problem.
That works fine for me (it loads a 1x1 PNG image with a data URI directly). That's all correct so far.

At that point, if I then do view-page-info, *then* we hit this bug (because at that point we're basically following my STR from comment 0).

If that's what you're talking about, cool. If not, please file another bug, as bz requested.
OK filed Bug 703784.
Assignee: db48x → ffung
- Fixed and simplified checkProtocol
Attachment #578578 - Flags: review?(gavin.sharp)
Attachment #578578 - Flags: review?(gavin.sharp) → review+
This fixes the bug introduced by bug 377349 and makes data image URIs work. Is there any reason we don't allow _all_ data URIs to work as long as pageInfo.js can handle the object type (e.g. audio/video elements)?
Felix: since we support audio and video tags already in page info, I would see no harm in this, but I can't remember if there is any other object type that can be handled through data:, if there is something like flash/javascript or another security-sensitive item (since page info currently runs in chrome), that would cause a problem--otherwise, being the person who wrote the original code, I see no problem.
Target Milestone: --- → Firefox 11
https://hg.mozilla.org/mozilla-central/rev/71b2a65fe3f0
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Depends on: 715075
For reference, here's a base64-encoded version of the image in comment 0:
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAYAAABw4pVUAAAAAXNSR0IArs4c6QAAAKJJREFUeNrt0QENAAAIw7CDf89gg5BOwlqZTHSmtgCIgAARECACAkRAgAiIgAARECACAkRAgAiIgAARECACAkRAgAiIgAARECACAkRAgAiIgAARECACAkRAgAiIgAARECACAkRAgAiIgAARECACAkRAgAiIgAARECACAkRAgAiIgAARECACAkRAgAiIgAARECACAkRAgAgIEAERECACAkRAvrfrTQLGaH3qbAAAAABJRU5ErkJggg%3D%3D
(mostly posting for the purposes of discussion on bug 715075)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: