Merge remote-tracking branch 'origin/develop' into develop
This commit is contained in:
commit
a2a7668840
1 changed files with 52 additions and 42 deletions
|
@ -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
|
||||||
|
@ -326,7 +327,9 @@ class Tinter {
|
||||||
// Vector Green as any other colour.
|
// Vector Green as any other colour.
|
||||||
// --matthew
|
// --matthew
|
||||||
|
|
||||||
if (ss.href && !ss.href.match(new RegExp('/theme-' + this.theme + '.css$'))) continue;
|
// stylesheets we don't have permission to access (eg. ones from extensions) have a null
|
||||||
|
// href and will throw exceptions if we try to access their rules.
|
||||||
|
if (!ss.href || !ss.href.match(new RegExp('/theme-' + this.theme + '.css$'))) continue;
|
||||||
if (ss.disabled) continue;
|
if (ss.disabled) continue;
|
||||||
if (!ss.cssRules) continue;
|
if (!ss.cssRules) continue;
|
||||||
|
|
||||||
|
@ -349,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 a new issue