test: add test case for race condition in #153

Closes #158.

Squashed commit of the following:

commit 266f3e16aa59e374ed6c213ffa9a7c354be4b8dc
Author: Nikolay Mikov <nik.mikov@gmail.com>
Date:   Mon May 26 21:40:56 2014 +1200

    Update callback.js

commit 3ae132762ebe4f957950ece996948f16db6d0237
Author: Nikolay Mikov <nik.mikov@gmail.com>
Date:   Mon May 26 21:39:38 2014 +1200

    Update threaded_callback_invokation.cc

commit 72c1e8e4db7fa9afde37d8c244c6d299a470e9e1
Author: Nikolay Mikov <nik.mikov@gmail.com>
Date:   Mon May 26 21:35:05 2014 +1200

    Update threaded_callback_invokation.cc

commit 62996443dcac308187dc5356af5bfe78414911fe
Merge: 33cb7c7 b35d21a
Author: Nikolay Mikov <nik.mikov@gmail.com>
Date:   Mon May 26 01:46:38 2014 +1200

    Merged with upstream

commit 33cb7c7ece520f8273bb671c5345d5a41491518e
Author: Nikolay Mikov <nik.mikov@gmail.com>
Date:   Mon May 26 01:33:08 2014 +1200

    Added test for race condition in #153

commit 4b564f30b7598b29e1c6a33482c371c4d7a88ec9
Author: Nikolay Mikov <nik.mikov@gmail.com>
Date:   Sat May 17 11:42:23 2014 +1200

    fix for race condition when callback is invoked from thread pool