| Left: | ||
| Right: |
| 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 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 520 "http://content.server/file/foo.txt"); | 520 "http://content.server/file/foo.txt"); |
| 521 | 521 |
| 522 // checking for same origin. | 522 // checking for same origin. |
| 523 let rewriteDiffOrigin = | 523 let rewriteDiffOrigin = |
| 524 "/content\\.server(\\/file\\/.*\\.txt)\\?.*$/$rewrite=foo.com$1"; | 524 "/content\\.server(\\/file\\/.*\\.txt)\\?.*$/$rewrite=foo.com$1"; |
| 525 let filterDiffOrigin = Filter.fromText(rewriteDiffOrigin); | 525 let filterDiffOrigin = Filter.fromText(rewriteDiffOrigin); |
| 526 | 526 |
| 527 // no rewrite occured because of a different origin. | 527 // no rewrite occured because of a different origin. |
| 528 test.equal( | 528 test.equal( |
| 529 filterDiffOrigin.rewriteUrl("http://content.server/file/foo.txt?bar"), | 529 filterDiffOrigin.rewriteUrl("http://content.server/file/foo.txt?bar"), |
| 530 "http://content.server/file/foo.txt?bar"); | 530 "http://content.server/file/foo.txt?bar" |
| 531 ); | |
| 531 | 532 |
| 532 // relative path. | 533 // relative path. |
| 533 let rewriteRelative = "/(\\/file\\/.*\\.txt)\\?.*$/$rewrite=$1/disable"; | 534 let rewriteRelative = "/(\\/file\\/.*\\.txt)\\?.*$/$rewrite=$1/disable"; |
| 534 let filterRelative = Filter.fromText(rewriteRelative); | 535 let filterRelative = Filter.fromText(rewriteRelative); |
| 535 | 536 |
| 536 test.equal( | 537 test.equal( |
| 537 filterRelative.rewriteUrl("http://content.server/file/foo.txt?bar"), | 538 filterRelative.rewriteUrl("http://content.server/file/foo.txt?bar"), |
| 538 "http://content.server/file/foo.txt/disable"); | 539 "http://content.server/file/foo.txt/disable" |
|
kzar
2018/05/15 14:08:58
Nit: We normally put the closing parenthesis on th
hub
2018/05/15 16:16:31
Done.
But the linter doesn't catch this.
kzar
2018/05/16 09:22:40
Yea, we made the linting rules as strict as possib
| |
| 540 ); | |
| 539 test.equal( | 541 test.equal( |
| 540 filterRelative.rewriteUrl("http://example.com/file/foo.txt?bar"), | 542 filterRelative.rewriteUrl("http://example.com/file/foo.txt?bar"), |
| 541 "http://example.com/file/foo.txt/disable"); | 543 "http://example.com/file/foo.txt/disable" |
| 542 | 544 ); |
| 543 test.done(); | 545 |
| 544 }; | 546 test.done(); |
| 547 }; | |
| LEFT | RIGHT |