addon/conflict.js
/**
 * Chrome: detect extensions with higher precedence
 *
 * @returns {Promise<Extension[]>}
 */
detect extensions with higher precedence
@returns {Promise}
detect extensions with higher precedence @returns { Promise }
function detectConflicts() {
  if (!isChrome()) {
    return Promise.resolve([]);
  }
  return new Promise(resolve => {
    const details = {};
    const onlyProxyExtensions = e => e.enabled && e.permissions.indexOf('proxy') > -1 && e.id !== browser.runtime.id;
    const mapExtension = e => new Extension(e.id, e.shortName, e.icons[0].url);
    browser.proxy.settings.get(details, ({ levelOfControl }) => {
      if (levelOfControl === 'controlled_by_other_extensions') {
        browser.management.getAll().then(extensions => {
          resolve(extensions.filter(onlyProxyExtensions).map(mapExtension));
        });
        return;
      }
      resolve([]);
    });
  });
}
function detectConflicts ( ) { if ( ! isChrome ( ) ) { return Promise . resolve ( [ ] ) ; } return new Promise ( resolve => { const details = { } ; const onlyProxyExtensions = e => e . enabled && e . permissions . indexOf ( 'proxy' ) > - 1 && e . id !== browser . runtime . id ; const mapExtension = e => new Extension ( e . id , e . shortName , e . icons [ 0 ] . url ) ; browser . proxy . settings . get ( details , ( { levelOfControl } ) => { if ( levelOfControl === 'controlled_by_other_extensions' ) { browser . management . getAll ( ) . then ( extensions => { resolve ( extensions . filter ( onlyProxyExtensions ) . map ( mapExtension ) ) ; } ) ; return ; } resolve ( [ ] ) ; } ) ; } ) ; }
Chrome: detect extensions with higher precedence
 @returns {Promise<Extension[]>}
Chrome : detect extensions with higher precedence @returns { Promise<Extension [] > }