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

Delta Between Two Patch Sets: test/browser/snippets.js

Issue 29995559: Issue 7236 - Handle sub properties in abort-on-property snippets (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Left Patch Set: more cleanup Created March 20, 2019, 3:09 p.m.
Right Patch Set: tweak property names Created March 20, 2019, 4:18 p.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/browser/elemHideEmulation.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-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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 result, 68 result,
69 `The property "${property}" ${result ? "should" : "shouldn't"} trigger an exception.` 69 `The property "${property}" ${result ? "should" : "shouldn't"} trigger an exception.`
70 ); 70 );
71 test.equal( 71 test.equal(
72 value, 72 value,
73 result ? 1 : undefined, 73 result ? 1 : undefined,
74 `The value for "${property}" ${result ? "shouldn't" : "should"} have been read.` 74 `The value for "${property}" ${result ? "shouldn't" : "should"} have been read.`
75 ); 75 );
76 } 76 }
77 77
78 window.abpTest = "foo"; 78 window.abpTest = "fortytwo";
79 await runSnippet(test, "abort-on-property-read", "abpTest"); 79 await runSnippet(test, "abort-on-property-read", "abpTest");
80 testProperty("abpTest"); 80 testProperty("abpTest");
81 81
82 window.abpTest2 = {prop1: "foo"}; 82 window.abpTest2 = {prop1: "fortytwo"};
Manish Jethani 2019/03/20 15:20:52 Would be nice if we did't use "foo" for the value
hub 2019/03/20 16:19:05 Done.
83 await runSnippet(test, "abort-on-property-read", "abpTest2.prop1"); 83 await runSnippet(test, "abort-on-property-read", "abpTest2.prop1");
84 testProperty("abpTest2.prop1"); 84 testProperty("abpTest2.prop1");
85 85
86 // Test that we try to catch a property that doesn't exist yet. 86 // Test that we try to catch a property that doesn't exist yet.
87 await runSnippet(test, "abort-on-property-read", "abpTest3.prop1"); 87 await runSnippet(test, "abort-on-property-read", "abpTest3.prop1");
88 window.abpTest3 = {prop1: "foo"}; 88 window.abpTest3 = {prop1: "fortytwo"};
89 testProperty("abpTest3.prop1"); 89 testProperty("abpTest3.prop1");
90 90
91 // Test that other properties don't trigger. 91 // Test that other properties don't trigger.
92 testProperty("abpTest3.prop2", false); 92 testProperty("abpTest3.prop2", false);
93 93
94 // Test overwriting the object with another object. 94 // Test overwriting the object with another object.
95 window.abpTest4 = {bar: {}}; 95 window.abpTest4 = {prop3: {}};
Manish Jethani 2019/03/20 15:17:48 If we agree about the convention here then it shou
hub 2019/03/20 16:19:04 Done.
Manish Jethani 2019/03/20 16:43:32 LGTM (What I really meant was that within a new l
hub 2019/03/20 16:52:16 the intent was to really get these unique across t
96 await runSnippet(test, "abort-on-property-read", "abpTest4.bar.lambda"); 96 await runSnippet(test, "abort-on-property-read", "abpTest4.prop3.foo");
97 testProperty("abpTest4.bar.lambda"); 97 testProperty("abpTest4.prop3.foo");
98 window.abpTest4.bar = {}; 98 window.abpTest4.prop3 = {};
99 testProperty("abpTest4.bar.lambda"); 99 testProperty("abpTest4.prop3.foo");
100 100
101 // Test if we start with a non-object. 101 // Test if we start with a non-object.
102 window.abpTest5 = 5; 102 window.abpTest5 = 42;
Manish Jethani 2019/03/20 15:20:52 Nit: Same as above, would be nice to use 42 consis
hub 2019/03/20 16:19:05 Done.
103 await runSnippet(test, "abort-on-property-read", "abpTest5.bar2.lambda"); 103 await runSnippet(test, "abort-on-property-read", "abpTest5.prop4.bar");
104 104
105 testProperty("abpTest5.bar2.lambda", true, "TypeError"); 105 testProperty("abpTest5.prop4.bar", true, "TypeError");
Manish Jethani 2019/03/20 15:17:48 Similarly, `abpTest5.prop1.foo` (Sorry, the next
hub 2019/03/20 16:19:04 Done.
106 106
107 window.abpTest5 = {bar2: 42}; 107 window.abpTest5 = {prop4: 42};
108 testProperty("abpTest5.bar2.lambda", false); 108 testProperty("abpTest5.prop4.bar", false);
109 window.abpTest5 = {bar2: {}}; 109 window.abpTest5 = {prop4: {}};
110 testProperty("abpTest5.bar2.lambda"); 110 testProperty("abpTest5.prop4.bar");
111 111
112 test.done(); 112 test.done();
113 }; 113 };
LEFTRIGHT

Powered by Google App Engine
This is Rietveld