Backout 519787a56627 (bug 972712, part 6) and the follow-up 5c9a4a1f2c0b (bug 978227) because ASAN is complaining intermittently about the former. r=me.

--HG--
extra : rebase_source : 31e2b96c57703caf94f65fed1d0c007d6984421e