Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: test/filterClasses.js

Issue 29356018: Issue 4450 - Prevent ElemHide filters with empty domains (Closed)
Left Patch Set: Created Oct. 5, 2016, 2:24 p.m.
Right Patch Set: Addressed feedback Created Oct. 6, 2016, 8:50 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « test/elemHide.js ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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-2016 Eyeo GmbH 3 * Copyright (C) 2006-2016 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 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 compareFilter(test, "foo.com##aaa [-abp-properties='abc'] bbb", ["type=cssrule ", "text=foo.com##aaa [-abp-properties='abc'] bbb", "selectorDomain=foo.com", "s elector=aaa [-abp-properties='abc'] bbb", "domains=FOO.COM", "prefix=aaa ", "reg exp=abc", "suffix= bbb"]); 364 compareFilter(test, "foo.com##aaa [-abp-properties='abc'] bbb", ["type=cssrule ", "text=foo.com##aaa [-abp-properties='abc'] bbb", "selectorDomain=foo.com", "s elector=aaa [-abp-properties='abc'] bbb", "domains=FOO.COM", "prefix=aaa ", "reg exp=abc", "suffix= bbb"]);
365 compareFilter(test, "foo.com##[-abp-properties='|background-image: url(data:*) ']", ["type=cssrule", "text=foo.com##[-abp-properties='|background-image: url(da ta:*)']", "selectorDomain=foo.com", "selector=[-abp-properties='|background-imag e: url(data:*)']", "domains=FOO.COM", "regexp=^background\\-image\\:\\ url\\(dat a\\:.*\\)"]); 365 compareFilter(test, "foo.com##[-abp-properties='|background-image: url(data:*) ']", ["type=cssrule", "text=foo.com##[-abp-properties='|background-image: url(da ta:*)']", "selectorDomain=foo.com", "selector=[-abp-properties='|background-imag e: url(data:*)']", "domains=FOO.COM", "regexp=^background\\-image\\:\\ url\\(dat a\\:.*\\)"]);
366 366
367 test.done(); 367 test.done();
368 }; 368 };
369 369
370 exports.testEmptyElemHideDomains = function(test) 370 exports.testEmptyElemHideDomains = function(test)
371 { 371 {
372 let emptyDomainFilters = [ 372 let emptyDomainFilters = [
373 ",##selector", ",,,##selector", "~,foo.com##selector", "foo.com,##selector", 373 ",##selector", ",,,##selector", "~,foo.com##selector", "foo.com,##selector",
374 ",foo.com##selector", "foo.com,~##selector" 374 ",foo.com##selector", "foo.com,~##selector",
Wladimir Palant 2016/10/06 08:06:14 What about empty domains in the middle? foo.com,,b
kzar 2016/10/06 08:53:56 Done.
375 "foo.com,,bar.com##selector", "foo.com,~,bar.com##selector"
375 ]; 376 ];
376 377
377 for (let filterText of emptyDomainFilters) 378 for (let filterText of emptyDomainFilters)
378 { 379 {
379 let filter = Filter.fromText(filterText); 380 let filter = Filter.fromText(filterText);
380 test.ok(filter instanceof InvalidFilter); 381 test.ok(filter instanceof InvalidFilter);
381 test.equal(filter.reason, "filter_empty_domain"); 382 test.equal(filter.reason, "filter_invalid_domain");
382 } 383 }
383 384
384 test.done(); 385 test.done();
385 }; 386 };
LEFTRIGHT

Powered by Google App Engine
This is Rietveld