Left: | ||
Right: |
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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
71 object = object[node]; | 71 object = object[node]; |
72 | 72 |
73 if (!object) | 73 if (!object) |
74 return; | 74 return; |
75 } | 75 } |
76 | 76 |
77 let func = object[name]; | 77 let func = object[name]; |
78 if (!func) | 78 if (!func) |
79 return; | 79 return; |
80 | 80 |
81 // If the property is not writable assigning will fail, so we use | 81 // If the property is not writable assigning it will fail, so we use |
82 // Object.defineProperty here instead. Assuming the property isn't | 82 // Object.defineProperty here instead. Assuming the property isn't |
83 // inherited its other attributes (e.g. enumerable) are presereved, | 83 // inherited its other attributes (e.g. enumerable) are preserved, |
Manish Jethani
2018/02/16 14:03:53
Nit: "preserved" (spelling)
kzar
2018/02/16 16:41:08
Done.
| |
84 // except accessor properties since we're specifying a value. | 84 // except for accessor attributes (e.g. get and set) which are discarded |
Manish Jethani
2018/02/16 14:03:53
Nit: "except accessor attributes" (?)
kzar
2018/02/16 16:41:08
How's this?
Manish Jethani
2018/02/16 16:47:38
Since "enumerable" is referred to as an attribute
| |
85 // since we're specifying a value. | |
85 Object.defineProperty(object, name, { | 86 Object.defineProperty(object, name, { |
86 value: function(...args) | 87 value(...args) |
Manish Jethani
2018/02/16 14:03:53
Since we're using an object literal here now we ca
kzar
2018/02/16 16:41:08
Good point, eslint picked that up I just forgot to
| |
87 { | 88 { |
kzar
2018/02/16 13:36:46
Sorry for changing the indentation here, it makes
| |
88 let callStack = new Error().stack; | 89 let callStack = new Error().stack; |
89 | 90 |
90 if (typeof args[args.length - 1] == "function") | 91 if (typeof args[args.length - 1] == "function") |
91 return func.apply(object, args); | 92 return func.apply(object, args); |
92 | 93 |
93 // If the last argument is undefined, we drop it from the list assuming | 94 // If the last argument is undefined, we drop it from the list assuming |
94 // it stands for the optional callback. We must do this, because we have | 95 // it stands for the optional callback. We must do this, because we have |
95 // to replace it with our own callback. If we simply append our own | 96 // to replace it with our own callback. If we simply append our own |
96 // callback to the list, it won't match the signature of the function | 97 // callback to the list, it won't match the signature of the function |
97 // and will cause an exception. | 98 // and will cause an exception. |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
227 | 228 |
228 // Workaround since HTMLCollection, NodeList, StyleSheetList, and CSSRuleList | 229 // Workaround since HTMLCollection, NodeList, StyleSheetList, and CSSRuleList |
229 // didn't have iterator support before Chrome 51. | 230 // didn't have iterator support before Chrome 51. |
230 // https://bugs.chromium.org/p/chromium/issues/detail?id=401699 | 231 // https://bugs.chromium.org/p/chromium/issues/detail?id=401699 |
231 for (let object of [HTMLCollection, NodeList, StyleSheetList, CSSRuleList]) | 232 for (let object of [HTMLCollection, NodeList, StyleSheetList, CSSRuleList]) |
232 { | 233 { |
233 if (!(Symbol.iterator in object.prototype)) | 234 if (!(Symbol.iterator in object.prototype)) |
234 object.prototype[Symbol.iterator] = Array.prototype[Symbol.iterator]; | 235 object.prototype[Symbol.iterator] = Array.prototype[Symbol.iterator]; |
235 } | 236 } |
236 } | 237 } |
LEFT | RIGHT |