1
0
mirror of https://github.com/matrix-org/matrix-react-sdk.git synced 2025-11-08 21:42:24 +03:00

try to trap SecurityError exceptions for linux FFs who don't like you calling .contentDocument on an SVG (assuming that's where the error comes from)

This commit is contained in:
Matthew Hodgson
2016-01-23 18:59:37 +00:00
parent add8ef3c59
commit 001b9ad7cc

View File

@@ -182,7 +182,20 @@ module.exports = {
var fixups = []; var fixups = [];
for (var i = 0; i < svgs.length; i++) { for (var i = 0; i < svgs.length; i++) {
var svgDoc = svgs[i].contentDocument; var svgDoc;
try {
svgDoc = svgs[i].contentDocument;
}
catch(e) {
var msg = 'Failed to get svg.contentDocument of ' + svgs[i].toString();
if (e.message) {
msg += e.message;
}
if (e.stack) {
msg += ' | stack: ' + e.stack;
}
console.error(e);
}
if (!svgDoc) continue; if (!svgDoc) continue;
var tags = svgDoc.getElementsByTagName("*"); var tags = svgDoc.getElementsByTagName("*");
for (var j = 0; j < tags.length; j++) { for (var j = 0; j < tags.length; j++) {