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

@ -37,42 +37,6 @@ define([
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) {
if (/requirejs\.org/.test(e)) {
console.log();

@ -2056,9 +2056,27 @@ define([
};
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) {
AppConfig.beforeLogin(LocalStore.isLoggedIn(), waitFor());
}

Loading…
Cancel
Save