mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-11 09:31:01 +01:00
fix #1607
This commit is contained in:
parent
a8cf54c3a0
commit
47b3e26942
1 changed files with 4 additions and 5 deletions
|
@ -1,7 +1,7 @@
|
|||
/*******************************************************************************
|
||||
|
||||
µBlock - a browser extension to block requests.
|
||||
Copyright (C) 2014 Raymond Hill
|
||||
uBlock Origin - a browser extension to block requests.
|
||||
Copyright (C) 2014-2016 Raymond Hill
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -19,8 +19,6 @@
|
|||
Home: https://github.com/gorhill/uBlock
|
||||
*/
|
||||
|
||||
/* global vAPI, µBlock */
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
(function(){
|
||||
|
@ -55,6 +53,7 @@ var matchWhitelistDirective = function(url, hostname, directive) {
|
|||
if ( directive.indexOf('*') === -1 ) {
|
||||
return url === directive;
|
||||
}
|
||||
// TODO: Revisit implementation to avoid creating a regex each time.
|
||||
// Regex escape code inspired from:
|
||||
// "Is there a RegExp.escape function in Javascript?"
|
||||
// http://stackoverflow.com/a/3561711
|
||||
|
@ -177,7 +176,7 @@ var matchWhitelistDirective = function(url, hostname, directive) {
|
|||
'#': []
|
||||
};
|
||||
var reInvalidHostname = /[^a-z0-9.\-\[\]:]/;
|
||||
var reHostnameExtractor = /([a-z0-9\[][a-z0-9.\-:]*[a-z0-9\]])\/(?:[^\x00-\x20\/]|$)[^\x00-\x20]*$/;
|
||||
var reHostnameExtractor = /([a-z0-9\[][a-z0-9.\-]*[a-z0-9\]])(?::[\d*]+)?\/(?:[^\x00-\x20\/]|$)[^\x00-\x20]*$/;
|
||||
var lines = s.split(/[\n\r]+/);
|
||||
var line, matches, key, directive;
|
||||
for ( var i = 0; i < lines.length; i++ ) {
|
||||
|
|
Loading…
Reference in a new issue