Simplify isBrowserExtension() implementation

parent 51fb81e2
...@@ -111,13 +111,7 @@ function configFuncSettingsFrom(window_) { ...@@ -111,13 +111,7 @@ function configFuncSettingsFrom(window_) {
* *
*/ */
function isBrowserExtension(config) { function isBrowserExtension(config) {
if (config.app.indexOf('chrome-extension://') === 0 || return !(config.app.startsWith('http://') || config.app.startsWith('https://'));
config.app.indexOf('moz-extension://') === 0 ||
config.app.indexOf('ms-browser-extension://') === 0) {
return true;
}
return false;
} }
module.exports = { module.exports = {
......
...@@ -259,9 +259,10 @@ describe('annotation.config.settings', function() { ...@@ -259,9 +259,10 @@ describe('annotation.config.settings', function() {
url: 'https://partner.org', url: 'https://partner.org',
returns: false, returns: false,
}, },
// It considers anything not http(s) to be a browser extension.
{ {
url: 'ftp://partner.org', url: 'ftp://partner.org',
returns: false, returns: true,
}, },
].forEach(function(test) { ].forEach(function(test) {
it('returns ' + test.returns + ' for ' + test.url, function() { it('returns ' + test.returns + ' for ' + test.url, function() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment