Revert "Bug 976363 - Assert that the work queue is empty when a MessageLoop goes away, and delete the tasks in the deferred queue"

This reverts commit c5838b712fcb8c1219960bdef865422b089b703a.
Revert "Revert "Bug 976363 - Do not leak chromium Task objects when a MessageLoop goes away""

This reverts commit 5706f25df70a592945bb3a77496c0e539557c65e.
correctly handle nullptr weak ptrs