summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2018-12-11 12:30:48 +0300
committerAndrew Dolgov <[email protected]>2018-12-11 12:30:48 +0300
commit2cbc2f5261b521d8c62c1bd999647aac4f52c080 (patch)
tree2153bf84f32862b18bf773f0b8f22ea96a0b1ddf
parentf3c04fc5d85d1e411e731af95074e604e60abafb (diff)
bring back frontend sanity check w/ App.checkBrowserFeatures()
-rwxr-xr-xjs/common.js13
-rw-r--r--js/tt-rss.js19
2 files changed, 27 insertions, 5 deletions
diff --git a/js/common.js b/js/common.js
index 210a1c6cc..17d1fe444 100755
--- a/js/common.js
+++ b/js/common.js
@@ -266,15 +266,18 @@ function fatalError(code, msg, ext_info) {
msg = ERRORS[code];
}
- let content = "<div><b>Error code:</b> " + code + "</div>" +
- "<p>" + msg + "</p>";
+ let content = `<div><b>Error code:</b> ${code} </div>
+ <p>${msg}</p>`;
if (ext_info) {
- content = content + "<div><b>Additional information:</b></div>" +
- "<textarea style='width: 100%' readonly=\"1\">" +
- ext_info + "</textarea>";
+ content = content + `<div><b>Additional information:</b></div>
+ <textarea style='width: 100%' readonly="1">${ext_info}</textarea>`;
}
+ content += `<div style='text-align : center'>
+ <button dojoType="dijit.form.Button" onclick="window.location.reload()">
+ ${__('Try again')}</button></div>`;
+
const dialog = new dijit.Dialog({
title: "Fatal error",
style: "width: 600px",
diff --git a/js/tt-rss.js b/js/tt-rss.js
index 143546ad0..26b1f7bba 100644
--- a/js/tt-rss.js
+++ b/js/tt-rss.js
@@ -65,6 +65,9 @@ require(["dojo/_base/kernel",
constructor: function () {
parser.parse();
+ if (!this.checkBrowserFeatures())
+ return;
+
this.setLoadingProgress(30);
this.initHotkeyActions();
@@ -89,6 +92,22 @@ require(["dojo/_base/kernel",
}
});
},
+ checkBrowserFeatures: function() {
+ let errorMsg = "";
+
+ ['requestIdleCallback', 'MutationObserver'].each(function(wf) {
+ if (! (wf in window)) {
+ errorMsg = `Browser feature check failed: <code>window.${wf}</code> not found.`;
+ throw $break;
+ }
+ });
+
+ if (errorMsg) {
+ fatalError(4, errorMsg, navigator.userAgent);
+ }
+
+ return errorMsg == "";
+ },
initSecondStage: function () {
this.enableCsrfSupport();