| Index: include.postload.js |
| =================================================================== |
| --- a/include.postload.js |
| +++ b/include.postload.js |
| @@ -279,11 +279,6 @@ |
| else if (elt.src) |
| url = elt.src; |
| - // Only normalize when the element contains a URL (issue 328.) |
| - // The URL is not always normalized, so do it here |
| - if (url) |
| - url = normalizeURL(relativeToAbsoluteUrl(url)); |
| - |
| // Construct filters. The popup will retrieve these. |
| // Only one ID |
| var elementId = elt.id ? elt.id.split(' ').join('') : null; |
| @@ -316,7 +311,9 @@ |
| if (url) |
| { |
| - clickHideFilters.push(relativeToAbsoluteUrl(url)); |
| + url = relativeToAbsoluteUrl(url); |
| + |
| + clickHideFilters.push(normalizeURL(url)); |
|
Wladimir Palant
2014/06/27 07:30:53
I wonder what will happen to src="about:blank" or
Sebastian Noack
2014/06/28 09:42:50
See http://codereview.adblockplus.org/594587757104
|
| selectorList.push(elt.localName + '[src="' + url + '"]'); |
|
Wladimir Palant
2014/06/27 07:30:53
Just noticed - this one won't work correctly, it n
Sebastian Noack
2014/06/28 09:42:50
Done.
|
| } |
| @@ -397,15 +394,13 @@ |
| // Does some degree of URL normalization |
| function normalizeURL(url) |
| { |
| - var components = url.match(/(.+:\/\/.+?)\/(.*)/); |
| + var components = url.match(/(.+:\/\/)(.+?)\/(.*)/); |
|
Wladimir Palant
2014/06/27 07:30:53
We should really start using the URI class from ba
Sebastian Noack
2014/06/28 09:42:50
Any reasons why we "normalize" the URL in the firs
Sebastian Noack
2014/09/25 08:36:25
As discussed in http://codereview.adblockplus.org/
|
| if(!components) |
| return url; |
| - var newPath = removeDotSegments(components[2]); |
| - if(newPath.length == 0) |
| - return components[1]; |
| - if(newPath[0] != '/') |
| + var newPath = removeDotSegments(components[3]); |
| + if(newPath != '' && newPath[0] != '/') |
|
Wladimir Palant
2014/06/27 07:30:53
It should actually be: newPath == "" || newPath[0]
Sebastian Noack
2014/06/28 09:42:50
Then you can just check for newPath[0] != "/" with
|
| newPath = '/' + newPath; |
| - return components[1] + newPath; |
| + return '||' + components[2] + newPath; |
| } |
| // Content scripts are apparently invoked on non-HTML documents, so we have to |