Description
Couldn't find this in any of the other postings so thought I'd bring it up.
Using Plotly.js v.1.16.0 (latest) in Firefox throws the error "SecurityError: The operation is insecure error" due to function getAllRuleSelectors at line 94271. This appears to be due to a possible cross-domain access of style sheets that only Firefox checks for. Got around the error by wrapping the code in a try/catch block to handle the error.
Shout out to the original poster on SO I got the solution from http://stackoverflow.com/questions/21642277/security-error-the-operation-is-insecure-in-firefox-document-stylesheets
`
// Gets all the rules currently attached to the document
exports.getAllRuleSelectors = function getAllRuleSelectors(sourceDocument) {
var allSelectors = [];
for(var i = 0; i < sourceDocument.styleSheets.length; i++) {
var styleSheet = sourceDocument.styleSheets[i];
try {
// In Firefox, if stylesheet originates from a different domain, trying
// to access styleSheet.cssRules will throw a SecurityError. Hence, we must use
// try/catch to detect this condition in Firefox.
if(!styleSheet.cssRules) continue; // It's possible for rules to be undefined
for(var j = 0; j < styleSheet.cssRules.length; j++) {
var cssRule = styleSheet.cssRules[j];
allSelectors.push(cssRule.selectorText);
}
} catch(e) {
// Rethrow exception if it's not a SecurityError. Note that SecurityError
// exception is specific to Firefox.
if(e.name !== 'SecurityError')
throw e;
}
}
return allSelectors;
};`