Added support for top-level replace/revive when JSON is not available.
Moved browser polyfills to JavaScript.as.
Fixed another [object Error] error message.

Change-Id: I367f315c7fcd309b05d89f431d038c3e43a67bb6