[chrome-gnome-shell/feature/firefox] firefox-compat: check if callback is defined in sendMessage
- From: Yuri Konotopov <ykonotopov src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chrome-gnome-shell/feature/firefox] firefox-compat: check if callback is defined in sendMessage
- Date: Thu, 22 Dec 2016 18:01:55 +0000 (UTC)
commit 3e74d31347c7ad2feb5cbb0d0580d5f555aaa13c
Author: Yuri Konotopov <ykonotopov gnome org>
Date: Thu Dec 22 22:01:42 2016 +0400
firefox-compat: check if callback is defined in sendMessage
extension/include/compat-content-script.js | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/extension/include/compat-content-script.js b/extension/include/compat-content-script.js
index 96900b9..8bedd05 100644
--- a/extension/include/compat-content-script.js
+++ b/extension/include/compat-content-script.js
@@ -30,7 +30,10 @@ if(COMPAT.IS_FIREFOX)
chrome.runtime.sendMessage(extensionId, message, options)
.then(result => {
- responseCallback(cloneInto(result, window));
+ if(typeof(responseCallback) == 'function')
+ {
+ responseCallback(cloneInto(result, window));
+ }
})
.catch(err => {
console.error("firefox-external-messaging:
runtime.sendMessage error", err);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]