keep bisecting to narrow down on the Firefox iOS error

pull/1/head
ansuz 4 years ago
parent 30e1c448d3
commit 713516f751

@ -312,29 +312,15 @@ button.primary:hover{
return bar; return bar;
}; };
var hideSpinner = function () {
try {
document.querySelector('.cp-loading-spinner-container').style.display = 'none';
} catch (err) { return; }
};
var getList = function () {
return document.querySelector('.cp-loading-progress-list') || {};
};
var getProgressBar = function () {
return document.querySelector('.cp-loading-progress-container') || {};
};
var hasErrored = false; var hasErrored = false;
var updateLoadingProgress = function (data) { var updateLoadingProgress = function (data) {
if (!built || !data) { return; } if (!built || !data) { return; }
var c = types.indexOf(data.type); var c = types.indexOf(data.type);
if (c < current) { return console.error(data); } if (c < current) { return console.error(data); }
try { try {
hideSpinner(); document.querySelector('.cp-loading-spinner-container').style.display = 'none';
getList().innerHTML = makeList(data); document.querySelector('.cp-loading-progress-list').innerHTML = makeList(data);
getProgressBar().innerHTML = makeBar(data); document.querySelector('.cp-loading-progress-container').innerHTML = makeBar(data);
} catch (e) { } catch (e) {
if (!hasErrored) { console.error(e); } if (!hasErrored) { console.error(e); }
} }
@ -343,7 +329,6 @@ button.primary:hover{
window.CryptPad_loadingError = function (err) { window.CryptPad_loadingError = function (err) {
if (!built) { return; } if (!built) { return; }
console.error(err);
hasErrored = true; hasErrored = true;
var err2; var err2;
if (err === 'Script error.') { if (err === 'Script error.') {
@ -354,12 +339,10 @@ button.primary:hover{
var node = document.querySelector('.cp-loading-progress'); var node = document.querySelector('.cp-loading-progress');
if (!node) { return; } if (!node) { return; }
if (node.parentNode) { node.parentNode.removeChild(node); } if (node.parentNode) { node.parentNode.removeChild(node); }
hideSpinner(); document.querySelector('.cp-loading-spinner-container').setAttribute('style', 'display:none;');
document.querySelector('#cp-loading-message').setAttribute('style', 'display:block;'); document.querySelector('#cp-loading-message').setAttribute('style', 'display:block;');
document.querySelector('#cp-loading-message').innerText = err2 || err; document.querySelector('#cp-loading-message').innerText = err2 || err;
} catch (e) { } catch (e) { console.error(e); }
console.error(e);
}
}; };
return function () { return function () {
built = true; built = true;

@ -37,42 +37,6 @@ define([
window.alert("CryptPad needs localStorage to work. Try changing your cookie permissions, or using a different browser"); window.alert("CryptPad needs localStorage to work. Try changing your cookie permissions, or using a different browser");
}; };
var getLogElement = function () {
var logger = document.querySelector('#cp-logger');
if (logger) { return logger; }
logger = document.createElement('div');
logger.setAttribute('id', 'cp-logger');
document.body.appendChild(logger);
var css = function(){/* #cp-logger { display: none; } */}.toString().slice(14, -3);
var style = document.createElement('style');
style.type = 'text/css';
style.appendChild(document.createTextNode(css));
document.head.appendChild(style);
return logger;
};
var logToDom = function () {
var pre = document.createElement('pre');
pre.innerText = 'x';
getLogElement().appendChild(pre);
};
if (window.Proxy) {
var c = console;
window.console = new window.Proxy(c, {
get: function (o, k) {
if (k !== 'error') { return o[k]; }
return function () {
var args = Array.prototype.slice.call(arguments);
c.error.apply(null, args);
logToDom();
};
},
});
}
window.onerror = function (e) { window.onerror = function (e) {
if (/requirejs\.org/.test(e)) { if (/requirejs\.org/.test(e)) {
console.log(); console.log();

@ -2056,9 +2056,27 @@ define([
}; };
var userHash; var userHash;
console.error('without this error statement Firefox on iOS throws a script error...');
Nthen(function (waitFor) { Nthen(function () {
var getLogElement = function () {
var logger = document.createElement('div');
logger.setAttribute('id', 'cp-logger');
document.body.appendChild(logger);
var css = function(){/* #cp-logger { display: none; } */}.toString().slice(14, -3);
var style = document.createElement('style');
style.type = 'text/css';
style.appendChild(document.createTextNode(css));
document.head.appendChild(style);
return logger;
};
var logToDom = function () {
var pre = document.createElement('pre');
pre.innerText = 'x';
getLogElement();
getLogElement().appendChild(pre);
};
logToDom();
}).nThen(function (waitFor) {
if (AppConfig.beforeLogin) { if (AppConfig.beforeLogin) {
AppConfig.beforeLogin(LocalStore.isLoggedIn(), waitFor()); AppConfig.beforeLogin(LocalStore.isLoggedIn(), waitFor());
} }

Loading…
Cancel
Save