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

Side by Side Diff: polyfill.js

Issue 29697596: Issue 6388 - Wrap inherited function properties as well (Closed)
Patch Set: Created Feb. 14, 2018, 2:46 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 let descriptor = Object.getOwnPropertyDescriptor(object, name); 81 let descriptor;
82 let objectProto = object;
83 do
Manish Jethani 2018/02/15 13:17:51 By the way I find this nicer too: let descrip
84 {
85 descriptor = Object.getOwnPropertyDescriptor(objectProto, name);
86 }
87 while (!descriptor && (objectProto = Object.getPrototypeOf(objectProto)));
Manish Jethani 2018/02/15 09:59:24 I think we should have a separate function called
82 88
83 delete descriptor["get"]; 89 delete descriptor["get"];
84 delete descriptor["set"]; 90 delete descriptor["set"];
85 91
86 descriptor.value = function(...args) 92 descriptor.value = function(...args)
87 { 93 {
88 let callStack = new Error().stack; 94 let callStack = new Error().stack;
89 95
90 if (typeof args[args.length - 1] == "function") 96 if (typeof args[args.length - 1] == "function")
91 return func.apply(object, args); 97 return func.apply(object, args);
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 234
229 // Workaround since HTMLCollection, NodeList, StyleSheetList, and CSSRuleList 235 // Workaround since HTMLCollection, NodeList, StyleSheetList, and CSSRuleList
230 // didn't have iterator support before Chrome 51. 236 // didn't have iterator support before Chrome 51.
231 // https://bugs.chromium.org/p/chromium/issues/detail?id=401699 237 // https://bugs.chromium.org/p/chromium/issues/detail?id=401699
232 for (let object of [HTMLCollection, NodeList, StyleSheetList, CSSRuleList]) 238 for (let object of [HTMLCollection, NodeList, StyleSheetList, CSSRuleList])
233 { 239 {
234 if (!(Symbol.iterator in object.prototype)) 240 if (!(Symbol.iterator in object.prototype))
235 object.prototype[Symbol.iterator] = Array.prototype[Symbol.iterator]; 241 object.prototype[Symbol.iterator] = Array.prototype[Symbol.iterator];
236 } 242 }
237 } 243 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld