[extensions-web] extensions.js: properly detect browser extension API presense.



commit a070ffc36371bf873b8b04c9f6d80a95e4fa988b
Author: Yuri Konotopov <ykonotopov gnome org>
Date:   Wed Mar 8 21:39:32 2017 +0400

    extensions.js: properly detect browser extension API presense.

 sweettooth/static/js/extensions.js |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/sweettooth/static/js/extensions.js b/sweettooth/static/js/extensions.js
index 04d9a21..33c2cac 100644
--- a/sweettooth/static/js/extensions.js
+++ b/sweettooth/static/js/extensions.js
@@ -46,7 +46,7 @@ define(['jquery', 'messages', 'dbus!_', 'extensionUtils', 'templates', 'paginato
                {
                        // We don't have a proper DBus proxy, however API may be exported.
                        // If API is exported let's assume that browser extension is installed and will 
handle errors.
-                       if(!('SweetTooth' in window))
+                       if(!window.SweetTooth || typeof(window.SweetTooth.initialize) !== 'function')
                        {
                                if (IS_CHROME || IS_FIREFOX || IS_OPERA) // browser_extension.js should be 
included globally
                                {


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