Added startup bootloop crash protection

Former-commit-id: 99314185e95591d593378b49b1270041f8cabbdb [formerly bdf19cb0b51ff31fedc57ded86c9071067d5bd39]
Former-commit-id: 53da94c64ca856c1ecf81e154f04b30382c656b0
This commit is contained in:
Jaifroid 2018-10-30 14:42:33 +00:00
parent 3f60eb6b78
commit d05ed09742
2 changed files with 15 additions and 0 deletions

View File

@ -1724,6 +1724,10 @@ define(['jquery', 'zimArchiveLoader', 'util', 'uiUtil', 'cookies', 'q', 'module'
console.log("Initiating Document Ready timer...");
console.time("Time to Document Ready");
//Set startup cookie to guard against boot loop
//Cookie will signal failure until article is fully loaded
document.cookie = 'lastPageLoad=failed;expires=Fri, 31 Dec 9999 23:59:59 GMT';
//Void the localSearch variable to prevent invalid DOM references remainining [kiwix-js-windows #56]
localSearch = {};
@ -2313,6 +2317,9 @@ define(['jquery', 'zimArchiveLoader', 'util', 'uiUtil', 'cookies', 'q', 'module'
loadImages();
//loadJavascript(); //Disabled for now, since it does nothing - also, would have to load before images, ideally through controlled css loads above
//Document has loaded except for images, so we can now change the startup cookie (and delete) [see init.js]
document.cookie = 'lastPageLoad=success;expires=Thu, 21 Sep 1979 00:00:01 UTC';
}
} //End of injectHTML()

View File

@ -60,6 +60,14 @@ params['allowInternetAccess'] = params['allowInternetAccess'] || false; //Do not
params['printIntercept'] = false;
params['printInterception'] = false;
//Prevent app boot loop with problematic pages that cause an app crash
if (getCookie('lastPageLoad') == 'failed') {
params.lastPageVisit = "";
} else {
//Cookie will signal failure until article is fully loaded
document.cookie = 'lastPageLoad=failed;expires=Fri, 31 Dec 9999 23:59:59 GMT';
}
//Initialize checkbox, radio and other values
document.getElementById('cssCacheModeCheck').checked = params.cssCache;
document.getElementById('imageDisplayModeCheck').checked = params.imageDisplay;