diff --git a/src/fullscreen.js b/src/fullscreen.js index 9fa84f07..1b80464c 100644 --- a/src/fullscreen.js +++ b/src/fullscreen.js @@ -67,10 +67,14 @@ return document.fullscreenElement; }; fullScreenApi.requestFullScreen = function( element ) { - return element.requestFullscreen(); + return element.requestFullscreen().catch(function (msg) { + $.console.error('Fullscreen request failed: ', msg); + }); }; fullScreenApi.exitFullScreen = function() { - document.exitFullscreen(); + document.exitFullscreen().catch(function (msg) { + $.console.error('Error while exiting fullscreen: ', msg); + }); }; fullScreenApi.fullScreenEventName = "fullscreenchange"; fullScreenApi.fullScreenErrorEventName = "fullscreenerror"; diff --git a/test/modules/basic.js b/test/modules/basic.js index 457adeab..49c70365 100644 --- a/test/modules/basic.js +++ b/test/modules/basic.js @@ -224,7 +224,7 @@ }); QUnit.test('FullScreen', function(assert) { - var done = assert.async(); + const done = assert.async(); if (!OpenSeadragon.supportsFullScreen) { assert.expect(0); done(); @@ -234,7 +234,7 @@ viewer.addHandler("open", function () { assert.ok(!OpenSeadragon.isFullScreen(), 'Started out not fullscreen'); - var checkEnteringPreFullScreen = function(event) { + const checkEnteringPreFullScreen = function(event) { viewer.removeHandler('pre-full-screen', checkEnteringPreFullScreen); assert.ok(event.fullScreen, 'Switching to fullscreen'); assert.ok(!OpenSeadragon.isFullScreen(), 'Not yet fullscreen'); @@ -242,7 +242,7 @@ // The fullscreen mode is always denied during tests so we are // exiting directly. - var checkExitingFullScreen = function(event) { + const checkExitingFullScreen = function(event) { viewer.removeHandler('full-screen', checkExitingFullScreen); assert.ok(!event.fullScreen, 'Exiting fullscreen'); assert.ok(!OpenSeadragon.isFullScreen(), 'Disabled fullscreen');