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 = [];
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;
var tags = svgDoc.getElementsByTagName("*");
for (var j = 0; j < tags.length; j++) {