aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaymond Hill <rhill@raymondhill.net>2014-11-27 09:41:28 -0200
committerRaymond Hill <rhill@raymondhill.net>2014-11-27 09:41:28 -0200
commitc6227289a627d48b9c88ff95b4dd2a51836e3c7c (patch)
tree7955bee5347a6209d87169b5341f4165256f75db
parentfb66fd4f368e4e264b0fe0691e475e1fa2bad969 (diff)
downloaduBlock-c6227289a627d48b9c88ff95b4dd2a51836e3c7c.zip
uBlock-c6227289a627d48b9c88ff95b4dd2a51836e3c7c.tar.gz
uBlock-c6227289a627d48b9c88ff95b4dd2a51836e3c7c.tar.bz2
code review
-rw-r--r--src/js/contentscript-end.js16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/js/contentscript-end.js b/src/js/contentscript-end.js
index 6eeda9f..4cd84bc 100644
--- a/src/js/contentscript-end.js
+++ b/src/js/contentscript-end.js
@@ -55,17 +55,19 @@ var messager = vAPI.messaging.channel('contentscript-end.js');
// Ensure injected styles are enforced
// rhill 2014-11-16: not sure this is needed anymore. Test case in
// above issue was fine without the line below..
- if ( vAPI.hideCosmeticFilters ) {
- hideElements(Object.keys(vAPI.hideCosmeticFilters).join(','));
+ var selectors = vAPI.hideCosmeticFilters;
+ if ( typeof selectors === 'object' ) {
+ hideElements(Object.keys(selectors).join(','));
}
// Add exception filters into injected filters collection, in order
// to force them to be seen as "already injected".
- var donthideCosmeticFilters = vAPI.donthideCosmeticFilters;
- for ( var selector in donthideCosmeticFilters ) {
- if ( donthideCosmeticFilters.hasOwnProperty(selector) === false ) {
- continue;
+ selectors = vAPI.donthideCosmeticFilters;
+ if ( typeof selectors === 'object' ) {
+ for ( var selector in selectors ) {
+ if ( selectors.hasOwnProperty(selector) ) {
+ injectedSelectors[selector] = true;
+ }
}
- injectedSelectors[selector] = true;
}
// Now scan content of page
idsFromNodeList(document.querySelectorAll('[id]'));