https://fedorahosted.org/freeipa/ticket/5643 -- Petr Vobornik
From 006be0e198b79fd07dd413afcb05f0cf8f7cb57d Mon Sep 17 00:00:00 2001 From: Petr Vobornik <pvobo...@redhat.com> Date: Tue, 26 Jan 2016 18:55:06 +0100 Subject: [PATCH] webui: crash nicely if sessionStorage is not available
https://fedorahosted.org/freeipa/ticket/5643 --- install/ui/src/freeipa/Application_controller.js | 17 +++++++++++------ install/ui/src/freeipa/app_container.js | 8 ++++++++ 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/install/ui/src/freeipa/Application_controller.js b/install/ui/src/freeipa/Application_controller.js index 69b9cd1c3c5873e10729f808ca3ec27688a1ecf2..5c040e4a05a140a1842f7265c036cd0eae962a35 100644 --- a/install/ui/src/freeipa/Application_controller.js +++ b/install/ui/src/freeipa/Application_controller.js @@ -257,15 +257,20 @@ define([ 'class': 'error-details' }).appendTo(error_container); - details.append($('<p/>', { text: 'Web UI got in unrecoverable state during "' + error.phase + '" phase' })); + details.append($('<p/>', { text: 'Web UI got in unrecoverable state during "' + error.phase + '" phase.' })); if (error.name) window.console.error(error.name); if (error.results) { - var msg = error.results.message; - var stack = error.results.stack.toString(); - window.console.error(stack); details.append('<h3>Technical details:</h3>'); - details.append($('<div/>', { text: error.results.message })); - details.append($('<div/>').append($('<code/>', { text: stack }))); + var msg = error.results.message; + if (msg) { + window.console.error(msg); + details.append($('<div/>', { text: msg })); + } + if (error.results.stack) { + var stack = error.results.stack.toString(); + window.console.error(stack); + details.append($('<div/>').append($('<code/>', { text: stack }))); + } } }, diff --git a/install/ui/src/freeipa/app_container.js b/install/ui/src/freeipa/app_container.js index 0a49307e31f4875724ee430f32c9483a23c6b51e..1194fd14263a1b6f1a5a0a2fa4bc605f344ef417 100644 --- a/install/ui/src/freeipa/app_container.js +++ b/install/ui/src/freeipa/app_container.js @@ -63,6 +63,14 @@ define([ phases.on('init', lang.hitch(this, function() { var deferred = new Deferred(); + if (!window.sessionStorage) { + deferred.reject({ + message: "Web UI requires sessionStorage enabled. " + + "This might be caused by too strict browser " + + "configuration." + }); + return deferred.promise; + } if (window.sessionStorage.getItem('logout')) { window.sessionStorage.removeItem('logout'); var login_facet = reg.facet.get('login'); -- 2.4.3
-- Manage your subscription for the Freeipa-devel mailing list: https://www.redhat.com/mailman/listinfo/freeipa-devel Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code