Thanks Kyle for this valuable information.

Some more questions:


Le 16/04/2014 20:24, Kyle Huey a écrit :
On Wed, Apr 16, 2014 at 10:45 AM, ben turner <[email protected]> wrote:

---------- Forwarded message ----------
From: Julien Wajsberg <[email protected]>
Date: Wed, Apr 16, 2014 at 9:30 AM
Subject: [b2g] Using blobs to display images
To: dev-b2g <[email protected]>


Hey,

Basically, I'd like to know whether it's better to revoke a blob URL
just after an image has been loaded, even if it's still displayed, or to
keep the blob url valid until the image is hidden.
tl;dr: You should revoke it when the onload or onerror events fire.

Ok, I see that I forgot one important bit of information: I'm actually concerned about background images. For normal images in <img> it's easy to do in onerror/onload.

I tried to do clever things like loading asychronously (after setTimeout) an in-memory image with the same blob url and discarding at onload/onerror but this randomly fails.

The "best" solution I have right now is to put a timer of say 30 seconds and revoke the URL then, but I'm afraid to retain memory in case of memory pressure. But maybe that's good enough?


* if the source is a http URL or a data URL, then gecko is confident
that the source will always be available;
No, it's not.  HTTP is not idempotent.  What happens if you're
offline, or your cookies that you need to view the image have expired?

I was thinking that the data downloaded using HTTP would be cached in the network cache. But you're right, this was a bad assumption.

--
Julien
_______________________________________________
dev-b2g mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-b2g

Reply via email to