Bug 995116 - [Tarako][MMS][Gallery] SMS/MMS OOM after attach a large pixel picture from gallery r=azasypkin

This patch does the following changes:

* we use -moz-samplesize to decode the images to resize them
* we try to free data more aggressively by using setTimeout

(Original patch from Steve Schung, then modified)
Merge pull request #18793 from julienw/995116-attachment-reduce-memory

Bug 995116 - [Tarako][MMS][Gallery] SMS/MMS OOM after attach a large pix...