update messages
use beforeunload event in app mode
fix app mode test
fix #18: cooperate with codemirror/ace