LEFT | RIGHT |
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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 window.abpTest6.prop1 = function() {}; | 121 window.abpTest6.prop1 = function() {}; |
122 await runSnippet(test, "abort-on-property-read", "abpTest6.prop1"); | 122 await runSnippet(test, "abort-on-property-read", "abpTest6.prop1"); |
123 testProperty("abpTest6.prop1"); | 123 testProperty("abpTest6.prop1"); |
124 | 124 |
125 // Function properties, with sub-property set afterwards. | 125 // Function properties, with sub-property set afterwards. |
126 window.abpTest7 = function() {}; | 126 window.abpTest7 = function() {}; |
127 await runSnippet(test, "abort-on-property-read", "abpTest7.prop1"); | 127 await runSnippet(test, "abort-on-property-read", "abpTest7.prop1"); |
128 window.abpTest7.prop1 = function() {}; | 128 window.abpTest7.prop1 = function() {}; |
129 testProperty("abpTest7.prop1"); | 129 testProperty("abpTest7.prop1"); |
130 | 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 |
131 // Arrow function properties. | 137 // Arrow function properties. |
132 window.abpTest8 = () => {}; | 138 window.abpTest9 = () => {}; |
133 await runSnippet(test, "abort-on-property-read", "abpTest8"); | |
134 testProperty("abpTest8"); | |
135 | |
136 // Class function properties. | |
137 window.abpTest9 = class {}; | |
138 await runSnippet(test, "abort-on-property-read", "abpTest9"); | 139 await runSnippet(test, "abort-on-property-read", "abpTest9"); |
139 testProperty("abpTest9"); | 140 testProperty("abpTest9"); |
140 | 141 |
| 142 // Class function properties. |
| 143 window.abpTest10 = class {}; |
| 144 await runSnippet(test, "abort-on-property-read", "abpTest10"); |
| 145 testProperty("abpTest10"); |
| 146 |
141 // Class function properties with prototype function properties. | 147 // Class function properties with prototype function properties. |
142 window.abpTest10 = class {}; | 148 window.abpTest11 = class {}; |
143 window.abpTest10.prototype.prop1 = function() {}; | 149 window.abpTest11.prototype.prop1 = function() {}; |
144 await runSnippet(test, "abort-on-property-read", "abpTest10.prototype.prop1"); | 150 await runSnippet(test, "abort-on-property-read", "abpTest11.prototype.prop1"); |
145 testProperty("abpTest10.prototype.prop1"); | 151 testProperty("abpTest11.prototype.prop1"); |
146 | 152 |
147 // Class function properties with prototype function properties, with | 153 // Class function properties with prototype function properties, with |
148 // prototype property set afterwards. | 154 // prototype property set afterwards. |
149 window.abpTest11 = class {}; | 155 window.abpTest12 = class {}; |
150 await runSnippet(test, "abort-on-property-read", "abpTest11.prototype.prop1"); | 156 await runSnippet(test, "abort-on-property-read", "abpTest12.prototype.prop1"); |
151 window.abpTest11.prototype.prop1 = function() {}; | 157 window.abpTest12.prototype.prop1 = function() {}; |
152 testProperty("abpTest11.prototype.prop1"); | 158 testProperty("abpTest12.prototype.prop1"); |
153 | 159 |
154 test.done(); | 160 test.done(); |
155 }; | 161 }; |
156 | 162 |
157 exports.testAbortCurrentInlineScriptSnippet = async function(test) | 163 exports.testAbortCurrentInlineScriptSnippet = async function(test) |
158 { | 164 { |
159 function injectInlineScript(doc, script) | 165 function injectInlineScript(doc, script) |
160 { | 166 { |
161 let scriptElement = doc.createElement("script"); | 167 let scriptElement = doc.createElement("script"); |
162 scriptElement.type = "application/javascript"; | 168 scriptElement.type = "application/javascript"; |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 | 231 |
226 if (e && msg) | 232 if (e && msg) |
227 { | 233 { |
228 test.equals(e.textContent, "", "result element should be empty"); | 234 test.equals(e.textContent, "", "result element should be empty"); |
229 test.equals(msg.textContent, "ReferenceError", | 235 test.equals(msg.textContent, "ReferenceError", |
230 "There should have been an error"); | 236 "There should have been an error"); |
231 } | 237 } |
232 | 238 |
233 test.done(); | 239 test.done(); |
234 }; | 240 }; |
LEFT | RIGHT |