mozilla-b2g/gaia — pull request #16721 by lissyx (2014-02-27 21:05:44+00:00)
Title: Bug 970832 - Balance pending image loading counter

Contacts pictures were not correctly imported because the onscroll
handler was checking the |imgsLoading| counter to be able to stop
pending requests. However, decrementing this variable was only performed
in the onsuccess handler of the image loading. If for any reason you
have some that fails, they would not get accounted as not loading
anymore. Upon onscroll event, this would trigger window.stop() call,
which will at the end break in the middle your pending XHR that perform
pictures import. Thus, we also perform decrementation in the error
handler.