LEFT | RIGHT |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
3 * Copyright (C) 2006-present eyeo GmbH | 3 * Copyright (C) 2006-present 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 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 function hostnameToURL(hostname) | 310 function hostnameToURL(hostname) |
311 { | 311 { |
312 return new URL("http://" + hostname); | 312 return new URL("http://" + hostname); |
313 } | 313 } |
314 | 314 |
315 function testThirdParty(requestHostname, documentHostname, expected, | 315 function testThirdParty(requestHostname, documentHostname, expected, |
316 message) | 316 message) |
317 { | 317 { |
318 assert.equal( | 318 assert.equal( |
319 isThirdParty( | 319 isThirdParty( |
320 hostnameToURL(requestHostname), | 320 hostnameToURL(requestHostname).hostname, |
321 | 321 |
322 // Chrome's URL object normalizes IP addresses. So some test | 322 // Chrome's URL object normalizes IP addresses. So some test |
323 // will fail if we don't normalize the document host as well. | 323 // will fail if we don't normalize the document host as well. |
324 hostnameToURL(documentHostname).hostname | 324 hostnameToURL(documentHostname).hostname |
325 ), | 325 ), |
326 expected, | 326 expected, |
327 message | 327 message |
328 ); | 328 ); |
329 } | 329 } |
330 | 330 |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 "us-east-1.amazonaws.com" | 475 "us-east-1.amazonaws.com" |
476 ); | 476 ); |
477 assert.equal(getBaseDomain("example.amazonaws.com"), "amazonaws.com"); | 477 assert.equal(getBaseDomain("example.amazonaws.com"), "amazonaws.com"); |
478 assert.equal(getBaseDomain("amazonaws.com"), "amazonaws.com"); | 478 assert.equal(getBaseDomain("amazonaws.com"), "amazonaws.com"); |
479 | 479 |
480 // Edge case. | 480 // Edge case. |
481 assert.equal(getBaseDomain(""), ""); | 481 assert.equal(getBaseDomain(""), ""); |
482 }); | 482 }); |
483 }); | 483 }); |
484 | 484 |
LEFT | RIGHT |