Index: polyfill.js |
=================================================================== |
--- a/polyfill.js |
+++ b/polyfill.js |
@@ -125,17 +125,17 @@ |
}; |
Object.defineProperty(object, name, descriptor); |
} |
function wrapRuntimeOnMessage() |
{ |
let {onMessage} = browser.runtime; |
- let {addListener, removeListener, hasListener} = onMessage; |
+ let {addListener, removeListener} = onMessage; |
onMessage.addListener = function(listener) |
{ |
if (typeof listener != "function") |
throw new Error(invalidMessageListenerError); |
// Don't add the same listener twice or we end up with multiple wrappers. |
if (messageListeners.has(listener)) |
@@ -148,22 +148,23 @@ |
if (wait instanceof Promise) |
{ |
wait.then(sendResponse, reason => |
{ |
try |
{ |
sendResponse(); |
} |
- finally |
+ catch (error) |
{ |
// sendResponse can throw if the internal port is closed; be sure |
// to throw the original error. |
- throw reason; |
} |
+ |
+ throw reason; |
}); |
} |
return !!wait; |
}; |
addListener.call(onMessage, wrapper); |
messageListeners.set(listener, wrapper); |