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.
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.