[chrome-gnome-shell] compat: fixed external messaging for Firefox 54.



commit 7d99523e90805cb65027cc2f5f1191a957dcf276
Author: Yuri Konotopov <ykonotopov gnome org>
Date:   Fri Mar 24 00:53:50 2017 +0400

    compat: fixed external messaging for Firefox 54.
    
    In Firefox 54 runtime.onMessageExternal was implemented, however external
    messaging still in progress.
    Make sure that compatibility code is used for Firefox 54+ instead of
    native runtime.onMessageExternal.
    Also runtime.id is differs from i18n.getMessage('@@extension_id') in
    Firefox so make sure to use first one.
    
    Fixes: https://github.com/nE0sIghT/chrome-gnome-shell-mirror/issues/52
    Fixes: https://bugzilla.gnome.org/show_bug.cgi?id=780393

 extension/include/compat-common.js         |    2 +-
 extension/include/compat-content-script.js |    2 +-
 extension/include/constants.js             |    2 +-
 extension/manifest.firefox.json            |    3 +--
 4 files changed, 4 insertions(+), 5 deletions(-)
---
diff --git a/extension/include/compat-common.js b/extension/include/compat-common.js
index e8117cb..61b7b13 100644
--- a/extension/include/compat-common.js
+++ b/extension/include/compat-common.js
@@ -14,7 +14,7 @@ COMPAT.PERMISSIONS_CONTAINS           = true;
 COMPAT.SYNC_STORAGE                            = (!COMPAT.IS_OPERA || false);
 COMPAT.NOTIFICATIONS_BUTTONS   = (!COMPAT.IS_OPERA && !COMPAT.IS_FIREFOX || false);
 
-if(typeof(chrome.runtime.onMessageExternal) === 'undefined')
+if(COMPAT.IS_FIREFOX)
 {
        chrome.runtime.onMessageExternal = {
                addListener: chrome.runtime.onMessage.addListener
diff --git a/extension/include/compat-content-script.js b/extension/include/compat-content-script.js
index 620d0ba..ee1ec25 100644
--- a/extension/include/compat-content-script.js
+++ b/extension/include/compat-content-script.js
@@ -15,7 +15,7 @@ if(COMPAT.IS_FIREFOX)
                var externalMessaging = {
                        runtime: {
                                sendMessage: function (extensionId, message, options, responseCallback) {
-                                       if(extensionId !== chrome.i18n.getMessage('@@extension_id'))
+                                       if(extensionId !== chrome.runtime.id)
                                        {
                                                console.error('Wrong extension id provided.')
                                                return;
diff --git a/extension/include/constants.js b/extension/include/constants.js
index 51dff10..5ab74d5 100644
--- a/extension/include/constants.js
+++ b/extension/include/constants.js
@@ -8,7 +8,7 @@
     (at your option) any later version.
  */
 
-GS_CHROME_ID                           = chrome.i18n.getMessage('@@extension_id');
+GS_CHROME_ID                           = chrome.runtime.id;
 PLATFORMS_WHITELIST                    = ["linux", "openbsd"];
 
 COMPAT = {
diff --git a/extension/manifest.firefox.json b/extension/manifest.firefox.json
index 540dbbd..8111644 100644
--- a/extension/manifest.firefox.json
+++ b/extension/manifest.firefox.json
@@ -2,8 +2,7 @@
   "applications": {
     "gecko": {
       "id": "chrome-gnome-shell gnome org",
-      "strict_min_version": "52.0",
-      "strict_max_version": "53.*"
+      "strict_min_version": "52.0"
     }
   },
   "permissions": [


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]