minimal patch and an ominous warning comment

pull/1/head
ansuz 4 years ago
parent 713516f751
commit 700ea4c282

@ -2057,26 +2057,34 @@ define([
var userHash; var userHash;
Nthen(function () { (function iOSFirefoxFix () {
var getLogElement = function () { /*
var logger = document.createElement('div'); For some bizarre reason Firefox on iOS throws an error during the
logger.setAttribute('id', 'cp-logger'); loading process unless we call this function. Drawing these elements
document.body.appendChild(logger); to the DOM presumably causes the JS engine to wait just a little bit longer
var css = function(){/* #cp-logger { display: none; } */}.toString().slice(14, -3); until some APIs we need are ready. This occurs despite all this code being
run after the usual dom-ready events. This fix was discovered while trying
to log the error messages to the DOM because it's extremely difficult
to debug Firefox iOS in the usual ways. In summary, computers are terrible.
*/
try {
var style = document.createElement('style'); var style = document.createElement('style');
style.type = 'text/css'; style.type = 'text/css';
style.appendChild(document.createTextNode(css)); style.appendChild(document.createTextNode('#cp-logger { display: none; }'));
document.head.appendChild(style); document.head.appendChild(style);
return logger;
}; var logger = document.createElement('div');
var logToDom = function () { logger.setAttribute('id', 'cp-logger');
document.body.appendChild(logger);
var pre = document.createElement('pre'); var pre = document.createElement('pre');
pre.innerText = 'x'; pre.innerText = 'x';
getLogElement(); pre.style.display = 'none';
getLogElement().appendChild(pre); logger.appendChild(pre);
}; } catch (err) { console.error(err); }
logToDom(); }());
}).nThen(function (waitFor) {
Nthen(function (waitFor) {
if (AppConfig.beforeLogin) { if (AppConfig.beforeLogin) {
AppConfig.beforeLogin(LocalStore.isLoggedIn(), waitFor()); AppConfig.beforeLogin(LocalStore.isLoggedIn(), waitFor());
} }

Loading…
Cancel
Save