From bab67075d40d83eeef67916e035348d79119edfe Mon Sep 17 00:00:00 2001 From: Jason Etheridge Date: Tue, 17 May 2011 22:24:21 -0400 Subject: [PATCH] Can't use encodeURI and decodeURI for everything with persist_helper (in particular, something like "%macro1% %macro2%" as a custom entry in the label interface), so try/catch them and fall back to the original behavior. Signed-off-by: Jason Etheridge --- .../chrome/content/OpenILS/global_util.js | 16 ++++++++++++++-- 1 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Open-ILS/xul/staff_client/chrome/content/OpenILS/global_util.js b/Open-ILS/xul/staff_client/chrome/content/OpenILS/global_util.js index c1c104c..58d6484 100644 --- a/Open-ILS/xul/staff_client/chrome/content/OpenILS/global_util.js +++ b/Open-ILS/xul/staff_client/chrome/content/OpenILS/global_util.js @@ -231,7 +231,13 @@ dump('on_oils_persist: <<< ' + target.nodeName + '.id = ' + target.id + '\t' + bk + '\n'); for (var j = 0; j < attribute_list.length; j++) { var key = base_key + attribute_list[j]; - var value = encodeURI(target.getAttribute( attribute_list[j] )); + var value; + try { + value = encodeURI(target.getAttribute( attribute_list[j] )); + } catch(E) { + dump('Error in persist_helper with encodeURI: ' + E + '\n'); + value = target.getAttribute( attribute_list[j] ); + } if ( attribute_list[j] == 'checked' && ['checkbox','toolbarbutton'].indexOf( target.nodeName ) > -1 ) { value = target.checked; dump('\t' + value + ' <== .' + attribute_list[j] + '\n'); @@ -281,7 +287,13 @@ for (var j = 0; j < attribute_list.length; j++) { var key = base_key + attribute_list[j]; var has_key = prefs.prefHasUserValue(key); - var value = has_key ? decodeURI(prefs.getCharPref(key)) : null; + var value; + try { + value = has_key ? decodeURI(prefs.getCharPref(key)) : null; + } catch(E) { + dump('Error in persist_helper with decodeURI: ' + E + '\n'); + value = has_key ? prefs.getCharPref(key) : null; + } if (value == 'true') { value = true; } if (value == 'false') { value = false; } if (has_key) { -- 1.7.2.5