Put Tinter loop body in a try/catch
So whatever other random ways this process fails in don't cause it to take out the whole app.pull/21833/head
parent
91024007aa
commit
dbed29a7cc
|
@ -298,6 +298,7 @@ class Tinter {
|
||||||
|
|
||||||
for (let i = 0; i < document.styleSheets.length; i++) {
|
for (let i = 0; i < document.styleSheets.length; i++) {
|
||||||
const ss = document.styleSheets[i];
|
const ss = document.styleSheets[i];
|
||||||
|
try {
|
||||||
if (!ss) continue; // well done safari >:(
|
if (!ss) continue; // well done safari >:(
|
||||||
// Chromium apparently sometimes returns null here; unsure why.
|
// Chromium apparently sometimes returns null here; unsure why.
|
||||||
// see $14534907369972FRXBx:matrix.org in HQ
|
// see $14534907369972FRXBx:matrix.org in HQ
|
||||||
|
@ -351,6 +352,13 @@ class Tinter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (e) {
|
||||||
|
// Catch any random exceptions that happen here: all sorts of things can go
|
||||||
|
// wrong with this (nulls, SecurityErrors) and mostly it's for other
|
||||||
|
// stylesheets that we don't want to proces anyway. We should not propagate an
|
||||||
|
// exception out since this will cause the app to fail to start.
|
||||||
|
console.log("Failed to calculate CSS fixups for a stylesheet: " + ss.href, e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
console.log("calcCssFixups end (" +
|
console.log("calcCssFixups end (" +
|
||||||
|
|
Loading…
Reference in New Issue