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

Side by Side Diff: chrome/content/tests/filterStorage_readwrite.js

Issue 6423769060999168: Issue 301 - adblockplustests: Use for (.. of ..) (Closed)
Patch Set: Created April 12, 2014, 1:48 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/content/tests/filterNotifier.js ('k') | chrome/content/tests/matcher.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 (function() 1 (function()
2 { 2 {
3 module("Filter storage read/write", { 3 module("Filter storage read/write", {
4 setup: function() 4 setup: function()
5 { 5 {
6 prepareFilterComponents.call(this); 6 prepareFilterComponents.call(this);
7 preparePrefs.call(this); 7 preparePrefs.call(this);
8 8
9 FilterStorage.addSubscription(Subscription.fromURL("~fl~")); 9 FilterStorage.addSubscription(Subscription.fromURL("~fl~"));
10 }, 10 },
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 { 63 {
64 let tempFile = FileUtils.getFile("TmpD", ["temp_patterns1.ini"]); 64 let tempFile = FileUtils.getFile("TmpD", ["temp_patterns1.ini"]);
65 let tempFile2 = FileUtils.getFile("TmpD", ["temp_patterns2.ini"]); 65 let tempFile2 = FileUtils.getFile("TmpD", ["temp_patterns2.ini"]);
66 tempFile.createUnique(tempFile.NORMAL_FILE_TYPE, FileUtils.PERMS_FILE); 66 tempFile.createUnique(tempFile.NORMAL_FILE_TYPE, FileUtils.PERMS_FILE);
67 createTempFile(); 67 createTempFile();
68 68
69 function canonize(data) 69 function canonize(data)
70 { 70 {
71 let curSection = null; 71 let curSection = null;
72 let sections = []; 72 let sections = [];
73 for each (let line in (data + "\n[end]").split(/[\r\n]+/)) 73 for (let line of (data + "\n[end]").split(/[\r\n]+/))
74 { 74 {
75 if (/^\[.*\]$/.test(line)) 75 if (/^\[.*\]$/.test(line))
76 { 76 {
77 if (curSection) 77 if (curSection)
78 sections.push(curSection); 78 sections.push(curSection);
79 79
80 curSection = {header: line, data: []}; 80 curSection = {header: line, data: []};
81 } 81 }
82 else if (curSection && /\S/.test(line)) 82 else if (curSection && /\S/.test(line))
83 curSection.data.push(line); 83 curSection.data.push(line);
84 } 84 }
85 for each (let section in sections) 85 for (let section of sections)
86 { 86 {
87 section.key = section.header + " " + section.data[0]; 87 section.key = section.header + " " + section.data[0];
88 section.data.sort(); 88 section.data.sort();
89 } 89 }
90 sections.sort(function(a, b) 90 sections.sort(function(a, b)
91 { 91 {
92 if (a.key < b.key) 92 if (a.key < b.key)
93 return -1; 93 return -1;
94 else if (a.key > b.key) 94 else if (a.key > b.key)
95 return 1; 95 return 1;
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 } catch (e) {} 349 } catch (e) {}
350 try 350 try
351 { 351 {
352 backupFile3.remove(false); 352 backupFile3.remove(false);
353 } catch (e) {} 353 } catch (e) {}
354 354
355 start(); 355 start();
356 } 356 }
357 }); 357 });
358 })(); 358 })();
OLDNEW
« no previous file with comments | « chrome/content/tests/filterNotifier.js ('k') | chrome/content/tests/matcher.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld