Fix mocks to be serialized in a reasonable way.

@bug W-2425294@

@rev gtorres@
Merging origin/goliver/master-pending-javascriptmocks into master