Closed #4728: window._p cannot be modified in some cases

Replace window._p with var _p.