mozilla / voicefill

A WebExtension To Add Speech To Text Support to Web Pages
Mozilla Public License 2.0
92 stars 29 forks source link

Missing https://search.yahoo.com/ in manifest.json? #185

Closed pdehaan closed 7 years ago

pdehaan commented 7 years ago

I randomly noticed that we had an odd number of matches in the extension/manifest.json file, so I did a quick check...

Found 441 matches in manifest.json Missing https://search.yahoo.com/

Seems like we have a "search.yahoo.com/*" but no "search.yahoo.com". ¯\_(ツ)_/¯

Not sure if it's a big deal or not, so here we are...


const fetch = require('node-fetch');
const {matches} = require('./extension/manifest.json').content_scripts.pop();

const nonWildcardMatches = matches.filter(uri => !uri.endsWith('*')).sort();
const wildcardMatches = matches.filter(uri => uri.endsWith('*')).sort();

console.log(`Found ${matches.length} matches in manifest.json`);

// Confirm every `https://foo.bar/*` entry has a matching `https://foo.bar/` entry.
wildcardMatches.forEach(uri => {
    const nonWildcardURI = uri.replace(/\*$/, '');
    const nonWildcardExists = matches.includes(nonWildcardURI);
    if (!nonWildcardExists) {
      console.log(`Missing ${nonWildcardURI}`);
    }
  });

// Confirm every `https://foo.bar/` entry has a matching `https://foo.bar/*` entry.
nonWildcardMatches.forEach(uri => {
    const wildcardURI = `${uri}*`;
    const wildcardExists = matches.includes(wildcardURI);
    if (!wildcardExists) {
      console.log(`Missing ${wildcardURI}`);
    }
  });

/*
  // Check that each `https://foo.bar/` entry returns a success response when trying the endpoint.
  Promise.all(nonWildcardMatches.map(uri => ping(uri)))
    .then(data => data.filter(res => !res.success))
    .then(data => console.log(data))
    .catch(err => console.error(err));

  async function ping(uri) {
    try {
      const {status} = await fetch(uri, {method: 'HEAD'});
      const success = (status === 200);
      return {uri, success};
    } catch (err) {
      return {uri, success: false, err};
    }
  }
*/
andrenatal commented 7 years ago

Hi @pdehaan , yes, seems that's not a big issue since the icon is being displayed on https://search.yahoo.com/ for me:

screenshot 2017-09-18 15 29 13

Please feel free to reopen this if you find any other issue related.