From d754ce8033fbf87c7a8ac712a056282190054106 Mon Sep 17 00:00:00 2001 From: Romain Courteaud <romain@nexedi.com> Date: Mon, 4 May 2020 08:21:36 +0000 Subject: [PATCH] erp5_xhtml_style/erp5_web_renderjs_ui: renderjs 0.24.0 --- .../web_page_module/rjs_renderjs_js.js | 21 +++++++++++++++++++ .../web_page_module/rjs_renderjs_js.xml | 4 ++-- .../erp5_xhtml_style/renderjs.js.js | 21 +++++++++++++++++++ 3 files changed, 44 insertions(+), 2 deletions(-) diff --git a/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_renderjs_js.js b/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_renderjs_js.js index 7f98312f83..0ece8bc159 100644 --- a/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_renderjs_js.js +++ b/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_renderjs_js.js @@ -745,6 +745,27 @@ if (typeof document.contains !== 'function') { Event, URL) { "use strict"; + // Error propagation in jschannel uses JSON.stringify + // Sadly, ... + // JSON.stringify(new TypeError('lala')) -> '{}' + // Change the browser default behaviour to propagate at least the message + // See https://stackoverflow.com/a/18391400 + if (!Error.prototype.hasOwnProperty('toJSON')) { + Object.defineProperty(Error.prototype, 'toJSON', { + value: function () { + var alt = {}; + + Object.getOwnPropertyNames(this).forEach(function (key) { + alt[key] = this[key]; + }, this); + + return alt; + }, + configurable: true, + writable: true + }); + } + ///////////////////////////////////////////////////////////////// // Error ///////////////////////////////////////////////////////////////// diff --git a/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_renderjs_js.xml b/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_renderjs_js.xml index 62b8e0a0ef..ee520ae25c 100644 --- a/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_renderjs_js.xml +++ b/bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_renderjs_js.xml @@ -234,7 +234,7 @@ </item> <item> <key> <string>serial</string> </key> - <value> <string>982.39920.30457.43434</string> </value> + <value> <string>982.46775.50354.51694</string> </value> </item> <item> <key> <string>state</string> </key> @@ -252,7 +252,7 @@ </tuple> <state> <tuple> - <float>1584544790.23</float> + <float>1588580432.81</float> <string>UTC</string> </tuple> </state> diff --git a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/renderjs.js.js b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/renderjs.js.js index 7f98312f83..0ece8bc159 100644 --- a/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/renderjs.js.js +++ b/product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_xhtml_style/renderjs.js.js @@ -745,6 +745,27 @@ if (typeof document.contains !== 'function') { Event, URL) { "use strict"; + // Error propagation in jschannel uses JSON.stringify + // Sadly, ... + // JSON.stringify(new TypeError('lala')) -> '{}' + // Change the browser default behaviour to propagate at least the message + // See https://stackoverflow.com/a/18391400 + if (!Error.prototype.hasOwnProperty('toJSON')) { + Object.defineProperty(Error.prototype, 'toJSON', { + value: function () { + var alt = {}; + + Object.getOwnPropertyNames(this).forEach(function (key) { + alt[key] = this[key]; + }, this); + + return alt; + }, + configurable: true, + writable: true + }); + } + ///////////////////////////////////////////////////////////////// // Error ///////////////////////////////////////////////////////////////// -- 2.30.9