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

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

Issue 30033574: Issue 7419 - Allow wrapping function for abort-on-property-* (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Left Patch Set: Created March 28, 2019, 8:39 p.m.
Right Patch Set: Deal with function base property delayed creation Created March 29, 2019, 3:35 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 | « lib/content/snippets.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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 104
105 testProperty("abpTest5.prop4.bar", true, "TypeError"); 105 testProperty("abpTest5.prop4.bar", true, "TypeError");
106 106
107 window.abpTest5 = {prop4: 42}; 107 window.abpTest5 = {prop4: 42};
108 testProperty("abpTest5.prop4.bar", false); 108 testProperty("abpTest5.prop4.bar", false);
109 window.abpTest5 = {prop4: {}}; 109 window.abpTest5 = {prop4: {}};
110 testProperty("abpTest5.prop4.bar"); 110 testProperty("abpTest5.prop4.bar");
111 111
112 // Check that it works on properties that are functions. 112 // Check that it works on properties that are functions.
113 // https://issues.adblockplus.org/ticket/7419 113 // https://issues.adblockplus.org/ticket/7419
114
115 // Existing function (from the API).
114 await runSnippet(test, "abort-on-property-read", "Object.keys"); 116 await runSnippet(test, "abort-on-property-read", "Object.keys");
Manish Jethani 2019/03/29 07:08:07 In the interest of completeness we could add the f
hub 2019/03/29 14:36:27 for the record, test 8 and 9 already pass. But tha
Manish Jethani 2019/03/29 15:46:27 The reason I thought we should add these tests is
hub 2019/03/29 15:58:02 I was not arguing against. I was just indicating t
Manish Jethani 2019/03/29 15:59:09 Acknowledged.
115 testProperty("Object.keys"); 117 testProperty("Object.keys");
118
119 // Function properties.
120 window.abpTest6 = function() {};
121 window.abpTest6.prop1 = function() {};
122 await runSnippet(test, "abort-on-property-read", "abpTest6.prop1");
123 testProperty("abpTest6.prop1");
124
125 // Function properties, with sub-property set afterwards.
126 window.abpTest7 = function() {};
127 await runSnippet(test, "abort-on-property-read", "abpTest7.prop1");
128 window.abpTest7.prop1 = function() {};
129 testProperty("abpTest7.prop1");
130
131 // Function properties, with base property as function set afterwards.
132 await runSnippet(test, "abort-on-property-read", "abpTest8.prop1");
133 window.abpTest8 = function() {};
134 window.abpTest8.prop1 = function() {};
135 testProperty("abpTest8.prop1");
136
137 // Arrow function properties.
138 window.abpTest9 = () => {};
139 await runSnippet(test, "abort-on-property-read", "abpTest9");
140 testProperty("abpTest9");
141
142 // Class function properties.
143 window.abpTest10 = class {};
144 await runSnippet(test, "abort-on-property-read", "abpTest10");
145 testProperty("abpTest10");
146
147 // Class function properties with prototype function properties.
148 window.abpTest11 = class {};
149 window.abpTest11.prototype.prop1 = function() {};
150 await runSnippet(test, "abort-on-property-read", "abpTest11.prototype.prop1");
151 testProperty("abpTest11.prototype.prop1");
152
153 // Class function properties with prototype function properties, with
154 // prototype property set afterwards.
155 window.abpTest12 = class {};
156 await runSnippet(test, "abort-on-property-read", "abpTest12.prototype.prop1");
157 window.abpTest12.prototype.prop1 = function() {};
158 testProperty("abpTest12.prototype.prop1");
116 159
117 test.done(); 160 test.done();
118 }; 161 };
119 162
120 exports.testAbortCurrentInlineScriptSnippet = async function(test) 163 exports.testAbortCurrentInlineScriptSnippet = async function(test)
121 { 164 {
122 function injectInlineScript(doc, script) 165 function injectInlineScript(doc, script)
123 { 166 {
124 let scriptElement = doc.createElement("script"); 167 let scriptElement = doc.createElement("script");
125 scriptElement.type = "application/javascript"; 168 scriptElement.type = "application/javascript";
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 231
189 if (e && msg) 232 if (e && msg)
190 { 233 {
191 test.equals(e.textContent, "", "result element should be empty"); 234 test.equals(e.textContent, "", "result element should be empty");
192 test.equals(msg.textContent, "ReferenceError", 235 test.equals(msg.textContent, "ReferenceError",
193 "There should have been an error"); 236 "There should have been an error");
194 } 237 }
195 238
196 test.done(); 239 test.done();
197 }; 240 };
LEFTRIGHT

Powered by Google App Engine
This is Rietveld