Make javascript function calls record-able and replay-able