| Index: polyfill.js |
| =================================================================== |
| --- a/polyfill.js |
| +++ b/polyfill.js |
| @@ -84,32 +84,32 @@ |
| // If the property is not writable assigning it will fail, so we use |
| // Object.defineProperty here instead. Assuming the property isn't |
| // inherited its other attributes (e.g. enumerable) are preserved, |
| // except for accessor attributes (e.g. get and set) which are discarded |
| // since we're specifying a value. |
| Object.defineProperty(object, name, { |
| value(...args) |
| { |
| - let callStack = new Error().stack; |
| - |
| if (typeof args[args.length - 1] == "function") |
| return func.apply(object, args); |
| // If the last argument is undefined, we drop it from the list assuming |
| // it stands for the optional callback. We must do this, because we have |
| // to replace it with our own callback. If we simply append our own |
| // callback to the list, it won't match the signature of the function |
| // and will cause an exception. |
| if (typeof args[args.length - 1] == "undefined") |
| args.pop(); |
| let resolvePromise = null; |
| let rejectPromise = null; |
|
Sebastian Noack
2018/09/29 16:07:14
Nit: This blank line seems redundant.
Manish Jethani
2018/09/29 16:39:08
I'd prefer to keep the variable standing out from
|
| + let callStack = new Error().stack; |
| + |
| func.call(object, ...args, result => |
| { |
| let error = browser.runtime.lastError; |
| if (error && !portClosedBeforeResponseError.test(error.message)) |
| { |
| // runtime.lastError is already an Error instance on Edge, while on |
| // Chrome it is a plain object with only a message property. |
| if (!(error instanceof Error)) |