Bug 959118 - Support layers dump on the viewer

1. Handle layers dump and layerscope packets.
2. Convert layers dump tree into JSON string