neovov / Fullscreen-API-Polyfill

MIT License
64 stars 17 forks source link

Reject exitFullscreen promise in the next run loop #20

Closed mbixby closed 8 years ago

mbixby commented 8 years ago

Previously if you did document.exitFullscreen().catch(function(){}) if there's no fullscreen element, an 'uncaught error in promise' would pop up in Chrome. By deferring the rejection I can catch the exception. The spec asks to do the rejection in the next animation frame task. By the way, if you do that in Chrome without a polyfill (exiting fullscreen without a fullscreen element; document.webkitExitFullscreen), no exception is thrown.

neovov commented 8 years ago

Seems good, thanks! 👍