issue #1108: improve restart method, it can run in the appDelegate.cpp, but can not run in js code