Left: | ||
Right: |
OLD | NEW |
---|---|
1 /* | 1 /* |
2 * This file is part of Adblock Plus <http://adblockplus.org/>, | 2 * This file is part of Adblock Plus <http://adblockplus.org/>, |
3 * Copyright (C) 2006-2014 Eyeo GmbH | 3 * Copyright (C) 2006-2014 Eyeo GmbH |
4 * | 4 * |
5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
8 * | 8 * |
9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
380 } | 380 } |
381 return r; | 381 return r; |
382 } else { | 382 } else { |
383 return u; | 383 return u; |
384 } | 384 } |
385 } | 385 } |
386 | 386 |
387 // Does some degree of URL normalization | 387 // Does some degree of URL normalization |
388 function normalizeURL(url) | 388 function normalizeURL(url) |
389 { | 389 { |
390 url = encodeURI(url); | |
Wladimir Palant
2014/09/18 18:53:02
What if the URL we get is already encoded? This fu
Sebastian Noack
2014/09/19 10:13:32
Thomas, can you please explain / figure out why th
Thomas Greiner
2014/09/19 10:47:13
Now I see what you mean. Element.src does give us
Sebastian Noack
2014/09/19 11:14:50
Yes, .src always returns a quoted URL no matter ho
Wladimir Palant
2014/09/21 18:37:42
The other advantage here is that element.src retur
Thomas Greiner
2014/09/22 09:37:33
I didn't find any reason against applying it to ob
| |
390 var components = url.match(/(.+:\/\/.+?)\/(.*)/); | 391 var components = url.match(/(.+:\/\/.+?)\/(.*)/); |
391 if(!components) | 392 if(!components) |
392 return url; | 393 return url; |
393 var newPath = removeDotSegments(components[2]); | 394 var newPath = removeDotSegments(components[2]); |
394 if(newPath.length == 0) | 395 if(newPath.length == 0) |
395 return components[1]; | 396 return components[1]; |
396 if(newPath[0] != '/') | 397 if(newPath[0] != '/') |
397 newPath = '/' + newPath; | 398 newPath = '/' + newPath; |
398 return components[1] + newPath; | 399 return components[1] + newPath; |
399 } | 400 } |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
559 | 560 |
560 clickHide_deactivate(); | 561 clickHide_deactivate(); |
561 } | 562 } |
562 break; | 563 break; |
563 default: | 564 default: |
564 sendResponse({}); | 565 sendResponse({}); |
565 break; | 566 break; |
566 } | 567 } |
567 }); | 568 }); |
568 } | 569 } |
OLD | NEW |