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

Unified Diff: chrome/content/tests/matcher.js

Issue 6423769060999168: Issue 301 - adblockplustests: Use for (.. of ..) (Closed)
Patch Set: Created April 12, 2014, 1:48 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/content/tests/filterStorage_readwrite.js ('k') | chrome/content/tests/notification.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/content/tests/matcher.js
===================================================================
--- a/chrome/content/tests/matcher.js
+++ b/chrome/content/tests/matcher.js
@@ -1,19 +1,19 @@
(function()
{
module("Filter matcher", {setup: prepareFilterComponents, teardown: restoreFilterComponents});
function compareKeywords(text, expected)
{
- for each (let filter in [Filter.fromText(text), Filter.fromText("@@" + text)])
+ for (let filter of [Filter.fromText(text), Filter.fromText("@@" + text)])
{
let matcher = new Matcher();
let result = [];
- for each (let dummy in expected)
+ for (let dummy of expected)
{
keyword = matcher.findKeyword(filter);
result.push(keyword);
if (keyword)
{
let dummyFilter = Filter.fromText('^' + keyword + '^');
dummyFilter.filterCount = Infinity;
matcher.add(dummyFilter);
@@ -22,29 +22,29 @@
equal(result.join(", "), expected.join(", "), "Keyword candidates for " + filter.text);
}
}
function checkMatch(filters, location, contentType, docDomain, thirdParty, expected)
{
let matcher = new Matcher();
- for each (let filter in filters)
+ for (let filter of filters)
matcher.add(Filter.fromText(filter));
let result = matcher.matchesAny(location, contentType, docDomain, thirdParty);
if (result)
result = result.text;
equal(result, expected, "match(" + location + ", " + contentType + ", " + docDomain + ", " + (thirdParty ? "third-party" : "first-party") + ") with:\n" + filters.join("\n"));
let combinedMatcher = new CombinedMatcher();
for (let i = 0; i < 2; i++)
{
- for each (let filter in filters)
+ for (let filter of filters)
combinedMatcher.add(Filter.fromText(filter));
let result = combinedMatcher.matchesAny(location, contentType, docDomain, thirdParty);
if (result)
result = result.text;
equal(result, expected, "combinedMatch(" + location + ", " + contentType + ", " + docDomain + ", " + (thirdParty ? "third-party" : "first-party") + ") with:\n" + filters.join("\n"));
« no previous file with comments | « chrome/content/tests/filterStorage_readwrite.js ('k') | chrome/content/tests/notification.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld