From b43b9f13e97258d6d546e62a2fd280b44045a610 Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Mon, 25 Jul 2016 17:47:14 -0700 Subject: [PATCH] Fix integration tests --- app/scripts/lib/extension-instance.js | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/app/scripts/lib/extension-instance.js b/app/scripts/lib/extension-instance.js index b9d0ed06d..eb3b8a1e9 100644 --- a/app/scripts/lib/extension-instance.js +++ b/app/scripts/lib/extension-instance.js @@ -26,10 +26,25 @@ function Extension () { const _this = this apis.forEach(function (api) { - _this[api] = chrome !== undefined && chrome[api] ? chrome[api] - : window[api] ? window[api] - : browser && browser.extension && browser.extension[api] - ? browser.extension[api] : null + + _this[api] = null + + try { + if (chrome[api]) { + _this[api] = chrome[api] + } + } catch (e) {} + + try { + if (window[api]) { + _this[api] = window[api] + } + } catch (e) {} + + try { + _this.api = browser.extension[api] + } catch (e) {} + }) }