From 0fde7eb7e797368cab5e2af5524887fa0872eb39 Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Thu, 31 Aug 2023 22:59:15 +0900 Subject: [PATCH] Use console.error() instead of console.warn() in Firefox, because it doesn't show stack trace for warnings --- common/js/x.js | 6 +++++- common/js/xml_handler.js | 28 ++++++++++++++++++++++++---- 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/common/js/x.js b/common/js/x.js index 7ce450de2..0daad0e45 100644 --- a/common/js/x.js +++ b/common/js/x.js @@ -6,7 +6,11 @@ function xDeprecate(funcName) { var msg = 'DEPRECATED : '+funcName+'() is deprecated in Rhymix.'; if (typeof console == 'object' && typeof console.warn == 'function') { - console.warn(msg); + if (navigator.userAgent.match(/Firefox/)) { + console.error(msg); + } else { + console.warn(msg); + } } } diff --git a/common/js/xml_handler.js b/common/js/xml_handler.js index eeeaad0f9..0b130ce5e 100644 --- a/common/js/xml_handler.js +++ b/common/js/xml_handler.js @@ -32,7 +32,12 @@ // Display deprecation notice. if (typeof console == "object" && typeof console.warn == "function") { - console.warn("DEPRECATED : exec_xml() is deprecated in Rhymix. Use exec_json() instead."); + var msg = "DEPRECATED : exec_xml() is deprecated in Rhymix. Use exec_json() instead."; + if (navigator.userAgent.match(/Firefox/)) { + console.error(msg); + } else { + console.warn(msg); + } } // Define callback functions. @@ -87,7 +92,12 @@ // This way of calling an error handler is deprecated. Do not use it. if ($.isFunction($.exec_xml.onerror)) { if (typeof console == "object" && typeof console.warn == "function") { - console.warn("DEPRECATED : $.exec_xml.onerror() is deprecated in Rhymix."); + var msg = "DEPRECATED : $.exec_xml.onerror() is deprecated in Rhymix."; + if (navigator.userAgent.match(/Firefox/)) { + console.error(msg); + } else { + console.warn(msg); + } } return $.exec_xml.onerror(module, act, data, callback_success, return_fields, callback_success_arg, fo_obj); } @@ -338,7 +348,12 @@ */ window.exec_html = $.fn.exec_html = function() { if (typeof console == "object" && typeof console.warn == "function") { - console.warn("DEPRECATED : exec_html() is obsolete in Rhymix."); + var msg = "DEPRECATED : exec_html() is obsolete in Rhymix."; + if (navigator.userAgent.match(/Firefox/)) { + console.error(msg); + } else { + console.warn(msg); + } } }; @@ -452,7 +467,12 @@ function send_by_form(url, params) { // This function is deprecated! if (typeof console == "object" && typeof console.warn == "function") { - console.warn("DEPRECATED : send_by_form() is deprecated in Rhymix."); + var msg = "DEPRECATED : send_by_form() is deprecated in Rhymix."; + if (navigator.userAgent.match(/Firefox/)) { + console.error(msg); + } else { + console.warn(msg); + } } // Create the hidden iframe.