(#2543) - fix call stack exceeded err

In addition to the fix in pouchdb-extend,
we needed to implement a custom JSON.parse/
JSON.stringify just for the rev trees.