Polyfill document.hidden and remove duplicated page state tracking.