From 01a4fb0ae6328ed2f6c6fa99b65180afedfa374c Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Tue, 5 Jul 2022 23:01:01 +0800 Subject: [PATCH] Bypass Firefox (iOS) bug (#20244) (#20250) Backport #20244 * https://github.com/go-gitea/gitea/issues/20240 At the moment, Firefox (iOS) (10x) has an engine bug. See https://github.com/go-gitea/gitea/issues/20240 If a script inserts a newly created (and content changed) element into DOM, there will be a nonsense error event reporting: Script error: line 0, col 0. This PR ignores such nonsense error event. Fix #20240 --- web_src/js/bootstrap.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/web_src/js/bootstrap.js b/web_src/js/bootstrap.js index cf13b2a559..213c9e41df 100644 --- a/web_src/js/bootstrap.js +++ b/web_src/js/bootstrap.js @@ -20,6 +20,11 @@ export function showGlobalErrorMessage(msg) { * @param {ErrorEvent} e */ function processWindowErrorEvent(e) { + if (!e.error && e.lineno === 0 && e.colno === 0 && e.filename === '' && window.navigator.userAgent.includes('FxiOS/')) { + // At the moment, Firefox (iOS) (10x) has an engine bug. See https://github.com/go-gitea/gitea/issues/20240 + // If a script inserts a newly created (and content changed) element into DOM, there will be a nonsense error event reporting: Script error: line 0, col 0. + return; // ignore such nonsense error event + } showGlobalErrorMessage(`JavaScript error: ${e.message} (${e.filename} @ ${e.lineno}:${e.colno}). Open browser console to see more details.`); }