Index: test/browser/snippets.js |
=================================================================== |
--- a/test/browser/snippets.js |
+++ b/test/browser/snippets.js |
@@ -104,16 +104,58 @@ |
testProperty("abpTest5.prop4.bar", true, "TypeError"); |
window.abpTest5 = {prop4: 42}; |
testProperty("abpTest5.prop4.bar", false); |
window.abpTest5 = {prop4: {}}; |
testProperty("abpTest5.prop4.bar"); |
+ // Check that it works on properties that are functions. |
+ // https://issues.adblockplus.org/ticket/7419 |
+ |
+ // Existing function (from the API). |
+ await runSnippet(test, "abort-on-property-read", "Object.keys"); |
+ testProperty("Object.keys"); |
+ |
+ // Function properties. |
+ window.abpTest6 = function() {}; |
+ window.abpTest6.prop1 = function() {}; |
+ await runSnippet(test, "abort-on-property-read", "abpTest6.prop1"); |
+ testProperty("abpTest6.prop1"); |
+ |
+ // Function properties, with sub-property set afterwards. |
+ window.abpTest7 = function() {}; |
+ await runSnippet(test, "abort-on-property-read", "abpTest7.prop1"); |
+ window.abpTest7.prop1 = function() {}; |
+ testProperty("abpTest7.prop1"); |
+ |
+ // Arrow function properties. |
+ window.abpTest8 = () => {}; |
+ await runSnippet(test, "abort-on-property-read", "abpTest8"); |
+ testProperty("abpTest8"); |
+ |
+ // Class function properties. |
+ window.abpTest9 = class {}; |
+ await runSnippet(test, "abort-on-property-read", "abpTest9"); |
+ testProperty("abpTest9"); |
+ |
+ // Class function properties with prototype function properties. |
+ window.abpTest10 = class {}; |
+ window.abpTest10.prototype.prop1 = function() {}; |
+ await runSnippet(test, "abort-on-property-read", "abpTest10.prototype.prop1"); |
+ testProperty("abpTest10.prototype.prop1"); |
+ |
+ // Class function properties with prototype function properties, with |
+ // prototype property set afterwards. |
+ window.abpTest11 = class {}; |
+ await runSnippet(test, "abort-on-property-read", "abpTest11.prototype.prop1"); |
+ window.abpTest11.prototype.prop1 = function() {}; |
+ testProperty("abpTest11.prototype.prop1"); |
+ |
test.done(); |
}; |
exports.testAbortCurrentInlineScriptSnippet = async function(test) |
{ |
function injectInlineScript(doc, script) |
{ |
let scriptElement = doc.createElement("script"); |