1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-11-16 23:42:39 +01:00
This commit is contained in:
gorhill 2015-05-04 17:14:56 -04:00
parent a01113a1e7
commit ffdd3dfe63
2 changed files with 14 additions and 3 deletions

View File

@ -20,7 +20,7 @@
*/ */
/* jshint bitwise: false */ /* jshint bitwise: false */
/* global vAPI, µBlock */ /* global µBlock */
/******************************************************************************* /*******************************************************************************
@ -438,7 +438,7 @@ PageStore.prototype.getNetFilteringSwitch = function() {
// https://github.com/chrisaljoudi/uBlock/issues/1078 // https://github.com/chrisaljoudi/uBlock/issues/1078
// Use both the raw and normalized URLs. // Use both the raw and normalized URLs.
this.netFiltering = µb.getNetFilteringSwitch(tabContext.normalURL); 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.netFiltering = µb.getNetFilteringSwitch(tabContext.rawURL);
} }
this.netFilteringReadTime = Date.now(); this.netFilteringReadTime = Date.now();

View File

@ -180,6 +180,12 @@ var matchWhitelistDirective = function(url, hostname, directive) {
var line, matches, key, directive; var line, matches, key, directive;
for ( var i = 0; i < lines.length; i++ ) { for ( var i = 0; i < lines.length; i++ ) {
line = lines[i].trim(); 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 // Don't throw out commented out lines: user might want to fix them
if ( line.charAt(0) === '#' ) { if ( line.charAt(0) === '#' ) {
key = '#'; 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: // Be sure this stays fixed:
// https://github.com/chrisaljoudi/uBlock/issues/185 // https://github.com/chrisaljoudi/uBlock/issues/185
if ( whitelist.hasOwnProperty(key) === false ) { if ( whitelist.hasOwnProperty(key) === false ) {
whitelist[key] = []; whitelist[key] = [];
} }