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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 object = object[node]; | 63 object = object[node]; |
64 | 64 |
65 if (!object) | 65 if (!object) |
66 return; | 66 return; |
67 } | 67 } |
68 | 68 |
69 let func = object[name]; | 69 let func = object[name]; |
70 if (!func) | 70 if (!func) |
71 return; | 71 return; |
72 let descriptor = Object.getOwnPropertyDescriptor(object, name); | 72 let descriptor = Object.getOwnPropertyDescriptor(object, name); |
73 // Some descriptors like setUninstallURL are in fact accessor descriptors. | |
74 // We convert them to data descriptors. | |
75 delete descriptor["get"]; | 73 delete descriptor["get"]; |
76 delete descriptor["set"]; | 74 delete descriptor["set"]; |
77 descriptor.value = function(...args) | 75 descriptor.value = function(...args) |
78 { | 76 { |
79 let callStack = new Error().stack; | 77 let callStack = new Error().stack; |
80 | 78 |
81 if (typeof args[args.length - 1] == "function") | 79 if (typeof args[args.length - 1] == "function") |
82 return func.apply(object, args); | 80 return func.apply(object, args); |
83 | 81 |
84 // If the last argument is undefined, we drop it from the list assuming | 82 // If the last argument is undefined, we drop it from the list assuming |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 | 143 |
146 // Workaround since HTMLCollection, NodeList, StyleSheetList, and CSSRuleList | 144 // Workaround since HTMLCollection, NodeList, StyleSheetList, and CSSRuleList |
147 // didn't have iterator support before Chrome 51. | 145 // didn't have iterator support before Chrome 51. |
148 // https://bugs.chromium.org/p/chromium/issues/detail?id=401699 | 146 // https://bugs.chromium.org/p/chromium/issues/detail?id=401699 |
149 for (let object of [HTMLCollection, NodeList, StyleSheetList, CSSRuleList]) | 147 for (let object of [HTMLCollection, NodeList, StyleSheetList, CSSRuleList]) |
150 { | 148 { |
151 if (!(Symbol.iterator in object.prototype)) | 149 if (!(Symbol.iterator in object.prototype)) |
152 object.prototype[Symbol.iterator] = Array.prototype[Symbol.iterator]; | 150 object.prototype[Symbol.iterator] = Array.prototype[Symbol.iterator]; |
153 } | 151 } |
154 } | 152 } |
LEFT | RIGHT |