From 0eb3a5d387da8769eb7a1a2a579b22b2736c289d Mon Sep 17 00:00:00 2001 From: ed Date: Thu, 22 Jul 2021 10:08:39 +0200 Subject: [PATCH] ignorable exceptions --- copyparty/web/up2k.js | 9 +++++--- copyparty/web/util.js | 49 +++++++++++++++++++++++++++++++------------ 2 files changed, 42 insertions(+), 16 deletions(-) diff --git a/copyparty/web/up2k.js b/copyparty/web/up2k.js index 84bda25c..c610303c 100644 --- a/copyparty/web/up2k.js +++ b/copyparty/web/up2k.js @@ -926,8 +926,11 @@ function up2k_init(subtle) { return; clearTimeout(tto); + if (crashed) + return defer(); + running = true; - while (window['vis_exh']) { + while (true) { var now = Date.now(), is_busy = 0 != st.todo.head.length + @@ -1009,7 +1012,7 @@ function up2k_init(subtle) { mou_ikkai = true; } - if (!mou_ikkai) + if (!mou_ikkai || crashed) return defer(); } } @@ -1519,7 +1522,7 @@ function up2k_init(subtle) { try { orz(xhr); } catch (ex) { vis_exh(ex + '', '', '', '', ex); } }; xhr.onerror = function (xev) { - if (!window['vis_exh']) + if (crashed) return; console.log('chunkpit onerror, retrying', t); diff --git a/copyparty/web/util.js b/copyparty/web/util.js index 1bb52cd0..e3e2617c 100644 --- a/copyparty/web/util.js +++ b/copyparty/web/util.js @@ -11,6 +11,12 @@ var is_touch = 'ontouchstart' in window, ANDROID = /android/i.test(navigator.userAgent); +var ebi = document.getElementById.bind(document), + QS = document.querySelector.bind(document), + QSA = document.querySelectorAll.bind(document), + mknod = document.createElement.bind(document); + + // error handler for mobile devices function esc(txt) { return txt.replace(/[&"<>]/g, function (c) { @@ -22,16 +28,18 @@ function esc(txt) { }[c]; }); } +var crashed = false, ignexd = {}; function vis_exh(msg, url, lineNo, columnNo, error) { if ((msg + '').indexOf('ResizeObserver') !== -1) return; // chrome issue 809574 (benign, from