From 50d7803c17cb387e550f29cf5a07ef5c8d667d7b Mon Sep 17 00:00:00 2001 From: djmaze Date: Wed, 18 Aug 2021 12:23:48 +0200 Subject: [PATCH] Although this is a browser bug (Fulguris & DuckDuckGo), just show why the browser fails loading resources. See https://github.com/the-djmaze/snappymail/issues/107 --- dev/boot.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/dev/boot.js b/dev/boot.js index 1db5a9026..8ef7dd1a6 100644 --- a/dev/boot.js +++ b/dev/boot.js @@ -14,9 +14,11 @@ const return data ? decodeURIComponent(data[2]) : null; }, - showError = () => { + showError = msg => { + let div = eId('loading-error'); + div.append(' ' + msg); eId('loading').hidden = true; - eId('loading-error').hidden = false; + div.hidden = false; }, loadScript = src => { @@ -26,7 +28,7 @@ const return new Promise((resolve, reject) => { const script = doc.createElement('script'); script.onload = () => resolve(); - script.onerror = () => reject(new Error(src)); + script.onerror = () => reject(new Error('Failed loading ' + src)); script.src = src; // script.async = true; doc.head.append(script); @@ -71,9 +73,9 @@ win.rl = { loadScript(appData.StaticLibJsLink) .then(() => loadScript(appData.StaticAppJsLink)) .then(() => appData.PluginsLink ? loadScript(appData.PluginsLink) : Promise.resolve()) - .then(() => win.__APP_BOOT ? win.__APP_BOOT(showError) : showError()) + .then(() => win.__APP_BOOT()) .catch(e => { - showError(); + showError(e.message); throw e; }); } else {