From 312ff22ee5202c7d15c677af62ebe86a3c2c3e5e Mon Sep 17 00:00:00 2001 From: Atul Pratap Singh Date: Thu, 8 Jan 2015 02:24:47 +0530 Subject: [PATCH] [bugs:#4694] js error on marking table as favorite in Safari (in private mode) Signed-off-by: Atul Pratap Singh --- ChangeLog | 1 + js/functions.js | 6 +++--- js/messages.php | 1 + js/navigation.js | 5 ++--- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 652882e0d6..0f45502663 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,7 @@ phpMyAdmin - ChangeLog ====================== 4.3.7.0 (not yet released) +- bug #4694 js error on marking table as favorite in Safari (in private mode) 4.3.6.0 (2015-01-07) - bug Undefined index notices while configuring recent and favorite tables diff --git a/js/functions.js b/js/functions.js index 2de4521393..d1fb1c1235 100644 --- a/js/functions.js +++ b/js/functions.js @@ -3840,14 +3840,13 @@ AJAX.registerOnload('functions.js', function () { cache: false, type: 'POST', data: { - favorite_tables: (window.localStorage && window.localStorage.favorite_tables - !== undefined) + favorite_tables: (isStorageSupported('localStorage')) ? window.localStorage['favorite_tables'] : '' }, success: function (data) { // Update localStorage. - if (window.localStorage && window.localStorage !== undefined) { + if (isStorageSupported('localStorage')) { window.localStorage.favorite_tables = data.favorite_tables; } @@ -4652,6 +4651,7 @@ function isStorageSupported(type) } } catch(error) { // Not supported + PMA_ajaxShowMessage(PMA_messages.strNoLocalStorage, false); } return false; } diff --git a/js/messages.php b/js/messages.php index 51a3eadf2f..d1284124e1 100644 --- a/js/messages.php +++ b/js/messages.php @@ -526,6 +526,7 @@ $js_messages['phpErrorsBeingSubmitted'] = '
' $js_messages['strConsoleRequeryConfirm'] = __('Execute this query again?'); $js_messages['strConsoleDeleteBookmarkConfirm'] = __('Do you really want to delete this bookmark?'); +$js_messages['strNoLocalStorage'] = __('Your web browser does not support local storage of settings or the quota limit has been reached, some features may not work properly for you. In Safari, such problem is commonly caused by "Private Mode Browsing".'); echo "var PMA_messages = new Array();\n"; foreach ($js_messages as $name => $js_message) { diff --git a/js/navigation.js b/js/navigation.js index a72647dc7e..472b231157 100644 --- a/js/navigation.js +++ b/js/navigation.js @@ -330,8 +330,7 @@ $(function () { cache: false, type: 'POST', data: { - favorite_tables: (window.localStorage && window.localStorage.favorite_tables - !== undefined) + favorite_tables: (isStorageSupported('localStorage')) ? window.localStorage.favorite_tables : '' }, @@ -345,7 +344,7 @@ $(function () { $('#' + anchor_id).attr("title") ); // Update localStorage. - if (window.localStorage && window.localStorage !== undefined) { + if (isStorageSupported('localStorage')) { window.localStorage.favorite_tables = data.favorite_tables; } } else {