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); |
+ // 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 = function(...args) |
{ |
let callStack = new Error().stack; |
@@ -111,6 +118,7 @@ |
}); |
}); |
}; |
+ Object.defineProperty(object, name, descriptor); |
} |
function shouldWrapAPIs() |