Bug 860681 - Icons revert to default in 3rd party apps r=vivien

* hopefully finally fix reliably the "ensure panning" test by mocking
  `requestAnimationFrame`
* call `markDirtyState` in all situations ensure that our state is saved in
  IndexedDB
* add tests to ensure the state is saved in these situations. Had to move the
  initialization of some objects to `doInit` so that we can correctly reset the
  object state.
* don't try to load a default icon if we already have an icon
(cherry picked from commit af3fdcea435e24bb3f760779e734e0c12d299328)

Conflicts:
	apps/homescreen/js/grid.js
	apps/homescreen/test/unit/grid_test.js