browser: fix value of document.hidden

This commit is contained in:
Robo 2015-12-19 04:23:30 +05:30
parent c68e38f480
commit ff51e4033a

View file

@ -118,6 +118,12 @@ Object.defineProperty window.history, 'length',
get: -> get: ->
getHistoryOperation 'length' getHistoryOperation 'length'
# Make document.hidden return the correct value. # Make document.hidden and document.visibilityState return the correct value.
Object.defineProperty document, 'hidden', Object.defineProperty document, 'hidden',
get: -> !remote.getCurrentWindow().isVisible() get: ->
currentWindow = remote.getCurrentWindow()
!currentWindow.isFocused() || !currentWindow.isVisible()
Object.defineProperty document, 'visibilityState',
get: ->
if document.hidden then "hidden" else "visible"