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

Delta Between Two Patch Sets: polyfill.js

Issue 29590603: Issue 5954 - Read-only properties cannot be assigned in strict mode in Edge (Closed)
Left Patch Set: Use function instead of arrow function. Created Nov. 6, 2017, 9:01 a.m.
Right Patch Set: Remove the comment Created Nov. 13, 2017, 11:06 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 { 62 {
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 oldDescriptor = Object.getOwnPropertyDescriptor(object, name); 72 let descriptor = Object.getOwnPropertyDescriptor(object, name);
73 // Some descriptors like setUninstallURL are in fact accessor descriptors. 73 delete descriptor["get"];
74 // We convert them to data descriptors. 74 delete descriptor["set"];
75 let descriptor = {
76 enumerable: oldDescriptor.enumerable,
77 configurable: oldDescriptor.configurable,
78 writable: oldDescriptor.writable
79 };
80 descriptor.value = function(...args) 75 descriptor.value = function(...args)
81 { 76 {
82 let callStack = new Error().stack; 77 let callStack = new Error().stack;
83 78
84 if (typeof args[args.length - 1] == "function") 79 if (typeof args[args.length - 1] == "function")
85 return func.apply(object, args); 80 return func.apply(object, args);
86 81
87 // 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
88 // it stands for the optional callback. We must do this, because we have 83 // it stands for the optional callback. We must do this, because we have
89 // to replace it with our own callback. If we simply append our own 84 // to replace it with our own callback. If we simply append our own
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 143
149 // Workaround since HTMLCollection, NodeList, StyleSheetList, and CSSRuleList 144 // Workaround since HTMLCollection, NodeList, StyleSheetList, and CSSRuleList
150 // didn't have iterator support before Chrome 51. 145 // didn't have iterator support before Chrome 51.
151 // https://bugs.chromium.org/p/chromium/issues/detail?id=401699 146 // https://bugs.chromium.org/p/chromium/issues/detail?id=401699
152 for (let object of [HTMLCollection, NodeList, StyleSheetList, CSSRuleList]) 147 for (let object of [HTMLCollection, NodeList, StyleSheetList, CSSRuleList])
153 { 148 {
154 if (!(Symbol.iterator in object.prototype)) 149 if (!(Symbol.iterator in object.prototype))
155 object.prototype[Symbol.iterator] = Array.prototype[Symbol.iterator]; 150 object.prototype[Symbol.iterator] = Array.prototype[Symbol.iterator];
156 } 151 }
157 } 152 }
LEFTRIGHT
« no previous file | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld