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

Unified Diff: polyfill.js

Issue 29590603: Issue 5954 - Read-only properties cannot be assigned in strict mode in Edge (Closed)
Patch Set: Delete accessor methods explicitly Created Nov. 8, 2017, 1:57 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: polyfill.js
===================================================================
--- a/polyfill.js
+++ b/polyfill.js
@@ -69,8 +69,12 @@
let func = object[name];
if (!func)
return;
-
- object[name] = function(...args)
+ let descriptor = Object.getOwnPropertyDescriptor(object, name);
+ // Some descriptors like setUninstallURL are in fact accessor descriptors.
kzar 2017/11/10 14:16:14 Nit: This comment doesn't read too well and I don'
+ // We convert them to data descriptors.
+ delete descriptor["get"];
+ delete descriptor["set"];
+ descriptor.value = function(...args)
{
let callStack = new Error().stack;
@@ -111,6 +115,7 @@
});
});
};
+ Object.defineProperty(object, name, descriptor);
}
function shouldWrapAPIs()
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld