fix some debug problems found by the RStudio team

Problems fixed:
- While debugging, source file keeps getting reopened on every prompt (Hadley)
- JavaScript exceptions thrown if environment state is not persisted as expected (JJ)
- Console prints errors when browser() occurs inside a function being executed during lapply (Winston)
- Environment pane may not draw correctly for some pathological object types (e.g. quote (...)) -- fix not complete, just less busted now (Hadley)