Add bootloop protection

Former-commit-id: 42ac1b0e3e5424cc74263faef0e7607c8221d0a1 [formerly 7bf19905cf1315ab406df465397e220122321276]
Former-commit-id: d0bbbb3d5ff2b9ff2afee1e9bed917b9267290bd
This commit is contained in:
Jaifroid 2019-08-02 17:58:37 +01:00
parent 1709398e1e
commit 7378e01a37
2 changed files with 7 additions and 0 deletions

View File

@ -2397,6 +2397,9 @@ define(['jquery', 'zimArchiveLoader', 'uiUtil', 'util', 'utf8', 'images', 'cooki
console.time("Time to First Paint");
//return;
// App appears to have successfully launched
params.appIsLaunching = 'false';
// Calculate the current article's ZIM baseUrl to use when processing relative links
var baseUrl = dirEntry.namespace + '/' + dirEntry.url.replace(/[^/]+$/, '');
@ -3215,6 +3218,9 @@ define(['jquery', 'zimArchiveLoader', 'uiUtil', 'util', 'utf8', 'images', 'cooki
}
}).fail(function () {
console.error("Error reading article with title " + title);
if (params.appIsLaunching) goToMainArticle();
// Line below prevents bootloop
params.appIsLaunching = false;
});
}

View File

@ -77,6 +77,7 @@ params['themeChanged'] = params['themeChanged'] || false;
params['allowInternetAccess'] = params['allowInternetAccess'] || false; //Do not get value from cookie, should be explicitly set by user on a per-session basis
params['printIntercept'] = false;
params['printInterception'] = false;
params['appIsLaunching'] = true; //Allows some routines to tell if the app has just been launched
//Prevent app boot loop with problematic pages that cause an app crash
if (getCookie('lastPageLoad') == 'failed') {