From 31cb9bab26f928d73ecdff2909261d81bb4a454d Mon Sep 17 00:00:00 2001 From: louyihua Date: Fri, 27 Dec 2013 20:31:12 +0800 Subject: [PATCH 1/2] The function tzAbbr() causes null-reference exception when the browse returns a non-English timezone string. --- common/static/js/vendor/tzAbbr.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/common/static/js/vendor/tzAbbr.js b/common/static/js/vendor/tzAbbr.js index ad43ab180cf6..b6188115dfe3 100644 --- a/common/static/js/vendor/tzAbbr.js +++ b/common/static/js/vendor/tzAbbr.js @@ -9,7 +9,7 @@ stringified date as best it can and returns `null` in the few cases where no friendly timezone name is found (so far, just Opera). Device tested & works in: -* IE 6, 7, 8, and 9 (latest versions of all) +* IE 6 [through] 11 (latest versions of all) * Firefox 3 [through] 16 (16 = latest version to date) * Chrome 22 (latest version to date) * Safari 6 (latest version to date) @@ -44,7 +44,19 @@ define([], function() { if (tzAbbr) { // Old Firefox uses the long timezone name (e.g., "Central // Daylight Time" instead of "CDT") - tzAbbr = tzAbbr[1].match(/[A-Z]/g).join(""); + /* + If the timezone string does not cotain capital English letters + (For example, the timezone string may be a Chinese string), + then the following code line will produce a null-reference + exception, and the execution of the javascript codes will + be stopped, which may cause some strange behaviors. So a + try-catch is needed here to prevent the execution being stopped. + */ + try { + tzAbbr = tzAbbr[1].match(/[A-Z]/g).join(""); + } catch(err) { + tzAbbr = tzAbbr[1]; + } } // Uncomment these lines to return a GMT offset for browsers From fefb7757e70239f0e989feeae4fc139b836aa9a1 Mon Sep 17 00:00:00 2001 From: louyihua Date: Mon, 30 Dec 2013 23:29:00 +0800 Subject: [PATCH 2/2] Add 'Yihua Lou ' to the AUTHORS file. --- AUTHORS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AUTHORS b/AUTHORS index 69ebe78e8b62..a049b416408f 100644 --- a/AUTHORS +++ b/AUTHORS @@ -101,4 +101,4 @@ Daniel Cebrián Robles Carson Gee Gang Chen Bertrand Marron - +Yihua Lou