try/catch createShadowRoot in contentscripts

This commit is contained in:
Sean Rand 2015-08-03 01:15:50 +02:00
parent 1b56636be4
commit b0072eab57
2 changed files with 12 additions and 2 deletions

View File

@ -470,7 +470,12 @@ var uBlockCollapser = (function() {
if ( shadow !== null && shadow.className === sessionId ) {
continue;
}
shadow = elem.createShadowRoot();
// not all nodes can be shadowed
try {
shadow = elem.createShadowRoot();
} catch (ex) {
continue;
}
shadow.className = sessionId;
}
};

View File

@ -181,7 +181,12 @@ var hideElements = function(selectors) {
if ( shadow !== null && shadow.className === sessionId ) {
continue;
}
shadow = elem.createShadowRoot();
// not all nodes can be shadowed
try {
shadow = elem.createShadowRoot();
} catch (ex) {
continue;
}
shadow.className = sessionId;
}
};