Skip to content

Commit

Permalink
Bypass Firefox (iOS) bug (#20244) (#20250)
Browse files Browse the repository at this point in the history
Backport #20244 

* #20240

At the moment, Firefox (iOS) (10x) has an engine bug. See #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
  • Loading branch information
wxiaoguang committed Jul 5, 2022
1 parent f42fc3b commit 01a4fb0
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions web_src/js/bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.`);
}

Expand Down

0 comments on commit 01a4fb0

Please sign in to comment.