Skip to content

Instantly share code, notes, and snippets.

@stuartphilp
Created August 18, 2015 14:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stuartphilp/d48d4f13b97bbfc3fdc7 to your computer and use it in GitHub Desktop.
Save stuartphilp/d48d4f13b97bbfc3fdc7 to your computer and use it in GitHub Desktop.
Telemetry Searches
var maxSearches = 10;
var time = 0;
var searchEngines = ["Google", "Yahoo", "Bing", "Wikipedia (en)", "Amazon.com", "DuckDuckGo", "eBay", "Twitter"]
var searchInitiators = ["urlbar", "searchbar", "abouthome", "newtab", "contextmenu"]
for (var key in searchInitiators) {
for (var k in searchEngines){
var searchInitiator = searchInitiators[key];
var searchEngine = searchEngines[k];
console.log("Searching for " + searchEngine + "." + searchInitiator + " " + maxSearches + " times")
for (var i = 0; i < maxSearches; i++) {
time += 0; //if you are running real searches you might need to add a throttle
(function (s, e) {
setTimeout(function() {
//let engine = BrowserSearch._loadSearch("test search ", false, s);
let engine = Services.search.getEngineByName(e);
if (engine) {
BrowserSearch.recordSearchInHealthReport(engine, s);
}
}, time);
})(searchInitiator, searchEngine)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment