| Index: polyfill.js |
| =================================================================== |
| --- a/polyfill.js |
| +++ b/polyfill.js |
| @@ -69,8 +69,15 @@ |
| let func = object[name]; |
| if (!func) |
| return; |
| - |
| - object[name] = function(...args) |
| + let oldDescriptor = Object.getOwnPropertyDescriptor(object, name); |
|
kzar
2017/11/06 08:52:01
How about this (untested):
let descriptor = Objec
Oleksandr
2017/11/06 09:05:00
This doesn't work, because some descriptors can be
kzar
2017/11/06 10:12:38
Which APIs are returned using a getter? I find it
Oleksandr
2017/11/06 10:14:18
For example `setUnintstallUrl`, as it says on the
kzar
2017/11/06 10:37:37
Ah right, well you could just delete the getter an
Oleksandr
2017/11/08 13:58:09
I guess we'll just have to see. I don't know why t
kzar
2017/11/10 14:18:20
What do you think about that Manish?
|
| + // Some descriptors like setUninstallURL are in fact accessor descriptors. |
| + // We convert them to data descriptors. |
| + let descriptor = { |
| + enumerable: oldDescriptor.enumerable, |
| + configurable: oldDescriptor.configurable, |
| + writable: oldDescriptor.writable |
| + }; |
| + descriptor.value = (...args) => |
|
Manish Jethani
2017/11/05 10:13:52
Functions and arrow functions have different seman
kzar
2017/11/06 08:52:01
Agreed
Oleksandr
2017/11/06 09:05:00
Done.
|
| { |
| let callStack = new Error().stack; |
| @@ -111,6 +118,7 @@ |
| }); |
| }); |
| }; |
| + Object.defineProperty(object, name, descriptor); |
| } |
| function shouldWrapAPIs() |