From 65183f7180c167131a0ec3741b0cd96ab806312a Mon Sep 17 00:00:00 2001 From: gorhill Date: Mon, 4 May 2015 17:10:55 -0400 Subject: [PATCH] this fixes #171 --- src/js/pagestore.js | 4 ++-- src/js/ublock.js | 13 ++++++++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/js/pagestore.js b/src/js/pagestore.js index da201e151..5a7d64bb3 100644 --- a/src/js/pagestore.js +++ b/src/js/pagestore.js @@ -19,7 +19,7 @@ Home: https://github.com/gorhill/uBlock */ -/* global vAPI, µBlock */ +/* global µBlock */ /******************************************************************************* @@ -435,7 +435,7 @@ PageStore.prototype.getNetFilteringSwitch = function() { // https://github.com/chrisaljoudi/uBlock/issues/1078 // Use both the raw and normalized URLs. this.netFiltering = µb.getNetFilteringSwitch(tabContext.normalURL); - if ( this.netFiltering && tabContext.rawURL !== tabContext.pageURL ) { + if ( this.netFiltering && tabContext.rawURL !== tabContext.normalURL ) { this.netFiltering = µb.getNetFilteringSwitch(tabContext.rawURL); } this.netFilteringReadTime = Date.now(); diff --git a/src/js/ublock.js b/src/js/ublock.js index dfd6e81c3..aa2c3f157 100644 --- a/src/js/ublock.js +++ b/src/js/ublock.js @@ -180,6 +180,12 @@ var matchWhitelistDirective = function(url, hostname, directive) { var line, matches, key, directive; for ( var i = 0; i < lines.length; i++ ) { line = lines[i].trim(); + // https://github.com/gorhill/uBlock/issues/171 + // Skip empty lines + if ( line === '' ) { + continue; + } + // Don't throw out commented out lines: user might want to fix them if ( line.charAt(0) === '#' ) { key = '#'; @@ -208,9 +214,14 @@ var matchWhitelistDirective = function(url, hostname, directive) { } } + // https://github.com/gorhill/uBlock/issues/171 + // Skip empty keys + if ( key === '' ) { + continue; + } + // Be sure this stays fixed: // https://github.com/chrisaljoudi/uBlock/issues/185 - if ( whitelist.hasOwnProperty(key) === false ) { whitelist[key] = []; }