Merge pull request #555 from seanrand/shadowdom-exception

try/catch createShadowRoot in contentscripts
This commit is contained in:
Raymond Hill 2015-08-02 23:42:56 -04:00
commit 8e5ff6693b
2 changed files with 12 additions and 2 deletions

View File

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

View File

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