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

Side by Side Diff: test/subscriptionClasses.js

Issue 29339071: Issue 3873 - Replace object literals using __proto__ with Object.create(null) (Closed)
Patch Set: Created March 24, 2016, 5:26 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 | « test/filterClasses.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 14 matching lines...) Expand all
25 function compareSubscription(test, url, expected, postInit) 25 function compareSubscription(test, url, expected, postInit)
26 { 26 {
27 expected.push("[Subscription]") 27 expected.push("[Subscription]")
28 let subscription = Subscription.fromURL(url); 28 let subscription = Subscription.fromURL(url);
29 if (postInit) 29 if (postInit)
30 postInit(subscription) 30 postInit(subscription)
31 let result = []; 31 let result = [];
32 subscription.serialize(result); 32 subscription.serialize(result);
33 test.equal(result.sort().join("\n"), expected.sort().join("\n"), url); 33 test.equal(result.sort().join("\n"), expected.sort().join("\n"), url);
34 34
35 let map = {__proto__: null}; 35 let map = Object.create(null);
36 for (let line of result.slice(1)) 36 for (let line of result.slice(1))
37 { 37 {
38 if (/(.*?)=(.*)/.test(line)) 38 if (/(.*?)=(.*)/.test(line))
39 map[RegExp.$1] = RegExp.$2; 39 map[RegExp.$1] = RegExp.$2;
40 } 40 }
41 let subscription2 = Subscription.fromObject(map); 41 let subscription2 = Subscription.fromObject(map);
42 test.equal(subscription.toString(), subscription2.toString(), url + " deserial ization"); 42 test.equal(subscription.toString(), subscription2.toString(), url + " deserial ization");
43 } 43 }
44 44
45 exports.testSubscriptionClassDefinitions = function(test) 45 exports.testSubscriptionClassDefinitions = function(test)
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 subscription.requiredVersion = "0.6"; 78 subscription.requiredVersion = "0.6";
79 }); 79 });
80 compareSubscription(test, "~wl~", ["url=~wl~", "disabled=true", "title=Test gr oup"], function(subscription) 80 compareSubscription(test, "~wl~", ["url=~wl~", "disabled=true", "title=Test gr oup"], function(subscription)
81 { 81 {
82 subscription.title = "Test group"; 82 subscription.title = "Test group";
83 subscription.disabled = true; 83 subscription.disabled = true;
84 }); 84 });
85 85
86 test.done(); 86 test.done();
87 }; 87 };
OLDNEW
« no previous file with comments | « test/filterClasses.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld