Page MenuHomePhabricator

src attribute of image in MMV view is not related to src of image in page
Closed, ResolvedPublic

Description

long src for image in MMV

Seen as of Feb 19 in http://en.wikipedia.beta.wmflabs.org/wiki/Lightbox_demo

This may be expected behavior and a WONTFIX...

Images in the MMV page seem to have acquired a src attribute that is very long, and that is unrelated to any aspect of the original image in the page. The behavior of MMV seems OK, but this causes the current MMV browser test to fail, see screen shot.

(I would like to re-work this test a bit in the near future, also)


Version: unspecified
Severity: minor

Attached:

src_for_image.png (831×1 px, 541 KB)

Details

Reference
bz61542

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 3:05 AM
bzimport set Reference to bz61542.
bzimport added a subscriber: Unknown Object (MLST).

There are a couple of distinct issues here:

  1. the src isn't just the http(s) src as expected, and
  1. the src is a data: URI, which is horribly inefficient

One could fix 2) by loading a blob instead of an ArrayBuffer and using createObjectURI()... but it would still be a URL that can't be copy-pasted usefully.

However I would probably recommend simply loading the image an an invisible <img> rather than an XHR; you won't get a chance at a full progress bar (just a delay then 'onload' or 'onerror') but the image will interact with things more or less as expected.

The reason for using XHR is that we want to access the headers so that we know whether the image was a cache hit on varnish, and if not, how is loading time split between thumbnail generation and real loading. (Anecdotally, slow rendering seems to be a big issue, with multiple-second image loading times, but we don't now how prevalent the problem is.) On production, this would only happen in an 1/1000 sample, not every request.

The original plan was to preload images via XHR, then set the src to the same URL as in the XHR request, but at least in current Chrome, that causes the image to be re-requested.

Change 114403 had a related patch set uploaded by Gergő Tisza:
Use cross-origin img attribute instead of data URI

https://gerrit.wikimedia.org/r/114403

Change 114403 merged by jenkins-bot:
Use cross-origin img attribute instead of data URI

https://gerrit.wikimedia.org/r/114403