Bug 1411518 - Update follow-on search add-on to 0.9.6. r=past, a=ritu
authorMark Banner <standard8@mozilla.com>
Wed, 25 Oct 2017 10:58:52 +0100
changeset 432788 18fc5fc8bf7c695329cbb92f2e2d04e630398d79
parent 432787 d87eb6ee94579001e9729d91208c7c6df9dc4e06
child 432789 f99471c1c261403be073cb2fe516f58affedb9ae
push id8060
push userryanvm@gmail.com
push dateThu, 26 Oct 2017 18:20:20 +0000
treeherdermozilla-beta@c060b92db7ee [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspast, ritu
bugs1411518
milestone57.0
Bug 1411518 - Update follow-on search add-on to 0.9.6. r=past, a=ritu
browser/extensions/followonsearch/content/followonsearch-fs.js
browser/extensions/followonsearch/install.rdf
--- a/browser/extensions/followonsearch/content/followonsearch-fs.js
+++ b/browser/extensions/followonsearch/content/followonsearch-fs.js
@@ -17,52 +17,43 @@ const kLastSearchQueueDepth = 10;
 
 /**
  * A map of search domains with their expected codes.
  */
 let searchDomains = [{
   "domains": [ "search.yahoo.co.jp" ],
   "search": "p",
   "followOnSearch": "ai",
-  "prefix": "fr",
+  "prefix": ["fr"],
   "codes": ["mozff"],
   "sap": "yahoo",
 }, {
   "domains": [ "www.bing.com" ],
   "search": "q",
-  "prefix": "pc",
+  "prefix": ["pc"],
   "reportPrefix": "form",
   "codes": ["MOZI", "MOZD", "MZSL01", "MZSL02", "MZSL03", "MOZ2"],
   "sap": "bing",
 }, {
   // The Yahoo domains to watch for.
   "domains": [
     "search.yahoo.com", "ca.search.yahoo.com", "hk.search.yahoo.com",
-    "tw.search.yahoo.com", "mozilla.search.yahoo.com", "us.search.yahoo.com"
-  ],
-  "search": "p",
-  "followOnSearch": "fr2",
-  "prefix": "hspart",
-  "reportPrefix": "hsimp",
-  "codes": ["mozilla"],
-  "sap": "yahoo",
-}, {
-  // The Yahoo legacy domains.
-  "domains": [
+    "tw.search.yahoo.com", "mozilla.search.yahoo.com", "us.search.yahoo.com",
     "no.search.yahoo.com", "ar.search.yahoo.com", "br.search.yahoo.com",
     "ch.search.yahoo.com", "cl.search.yahoo.com", "de.search.yahoo.com",
     "uk.search.yahoo.com", "es.search.yahoo.com", "espanol.search.yahoo.com",
     "fi.search.yahoo.com", "fr.search.yahoo.com", "nl.search.yahoo.com",
     "id.search.yahoo.com", "in.search.yahoo.com", "it.search.yahoo.com",
     "mx.search.yahoo.com", "se.search.yahoo.com", "sg.search.yahoo.com",
   ],
   "search": "p",
   "followOnSearch": "fr2",
-  "prefix": "fr",
-  "codes": ["moz35"],
+  "prefix": ["hspart", "fr"],
+  "reportPrefix": "hsimp",
+  "codes": ["mozilla", "moz35"],
   "sap": "yahoo",
 }, {
   // The Google domains.
   "domains": [
     "www.google.com", "www.google.ac", "www.google.ad", "www.google.ae",
     "www.google.com.af", "www.google.com.ag", "www.google.com.ai",
     "www.google.al", "www.google.am", "www.google.co.ao", "www.google.com.ar",
     "www.google.as", "www.google.at", "www.google.com.au", "www.google.az",
@@ -111,17 +102,17 @@ let searchDomains = [{
     "www.google.tn", "www.google.com.tr", "www.google.tt", "www.google.com.tw",
     "www.google.co.tz", "www.google.com.ua", "www.google.co.ug",
     "www.google.co.uk", "www.google.us", "www.google.com.uy", "www.google.co.uz",
     "www.google.com.vc", "www.google.co.ve", "www.google.vg", "www.google.co.vi",
     "www.google.com.vn", "www.google.vu", "www.google.ws", "www.google.co.za",
     "www.google.co.zm", "www.google.co.zw",
   ],
   "search": "q",
-  "prefix": "client",
+  "prefix": ["client"],
   "followOnSearch": "oq",
   "codes": ["firefox-b-ab", "firefox-b"],
   "sap": "google",
 }];
 
 function getSearchDomainCodes(host) {
   for (let domainInfo of searchDomains) {
     if (domainInfo.domains.includes(host)) {
@@ -183,17 +174,23 @@ var webProgressListener = {
       }
       let domainInfo = getSearchDomainCodes(aLocation.host);
       if (!domainInfo) {
         searchingGoogle = false;
         return;
       }
 
       let queries = new URLSearchParams(aLocation.query);
-      let code = queries.get(domainInfo.prefix);
+      // Yahoo has switched to Unified search so we can get
+      // different codes on the same domain. Hack for now
+      // to allow two different prefixes for codes
+      let code = queries.get(domainInfo.prefix[0]);
+      if (!code && domainInfo.prefix.length > 1) {
+        code = queries.get(domainInfo.prefix[1]);
+      }
       // Special case Google so we can track searches
       // without codes from the browser.
       if (domainInfo.sap == "google") {
         if (aLocation.filePath == "/search") {
           gLastSearchQueue.push(aLocation.spec);
           // Our engine currently sends oe and ie - no one else does
           if (queries.get("oe") && queries.get("ie")) {
             sendSaveTelemetryMsg(code ? code : "none", code ? domainInfo.sap : "google-nocodes", "sap");
--- a/browser/extensions/followonsearch/install.rdf
+++ b/browser/extensions/followonsearch/install.rdf
@@ -2,17 +2,17 @@
 <!-- This Source Code Form is subject to the terms of the Mozilla Public
    - License, v. 2.0. If a copy of the MPL was not distributed with this
    - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
 <RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
      xmlns:em="http://www.mozilla.org/2004/em-rdf#">
   <Description about="urn:mozilla:install-manifest">
     <em:id>followonsearch@mozilla.com</em:id>
     <em:name>Follow-on Search Telemetry</em:name>
-    <em:version>0.9.5</em:version>
+    <em:version>0.9.6</em:version>
     <em:type>2</em:type>
     <em:bootstrap>true</em:bootstrap>
     <em:multiprocessCompatible>true</em:multiprocessCompatible>
     <em:targetApplication>
       <Description>
         <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
         <em:minVersion>52.0</em:minVersion>
         <em:maxVersion>59.*</em:maxVersion>