Bug 1215948 - Whitelist more params for "Hey Cortana" searches in Windows 10. r=jaws, a=lizzard
authorJustin Dolske <dolske@mozilla.com>
Thu, 19 Nov 2015 15:13:32 -0800
changeset 305696 943f61d3178335be894792ee2ea12a829c04b2d2
parent 305695 ea94de8a09f0f06adcf45bbb23b4b56f956abde3
child 305697 e576dd92d0f27df387320ed59fce50803549828c
push id1001
push userraliiev@mozilla.com
push dateMon, 18 Jan 2016 19:06:03 +0000
treeherdermozilla-release@8b89261f3ac4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjaws, lizzard
bugs1215948
milestone44.0a2
Bug 1215948 - Whitelist more params for "Hey Cortana" searches in Windows 10. r=jaws, a=lizzard
browser/components/nsBrowserContentHandler.js
--- a/browser/components/nsBrowserContentHandler.js
+++ b/browser/components/nsBrowserContentHandler.js
@@ -779,24 +779,27 @@ nsDefaultCommandLineHandler.prototype = 
         if (redirectWinSearch &&
             (uriScheme == "http" || uriScheme == "https") &&
             uriHost.endsWith(".bing.com") && uriPath.startsWith("/search")) {
           try {
             var url = uri.QueryInterface(Components.interfaces.nsIURL);
             var params = new URLSearchParams(url.query);
             // We don't want to rewrite all Bing URLs coming from external apps. Look
             // for the magic URL parm that's present in searches from the task bar.
-            // (Typed searches use "form=WNSGPH", Cortana voice searches use "FORM=WNSBOX"
-            // for direct results, or "FORM=WNSFC2" for "see more results on
-            // Bing.com")
+            // * Typed searches use "form=WNSGPH"
+            // * Cortana voice searches use "FORM=WNSBOX" or direct results, or "FORM=WNSFC2"
+            //   for "see more results on Bing.com")
+            // * Cortana voice searches started from "Hey, Cortana" use "form=WNSHCO"
+            //   or "form=WNSSSV" or "form=WNSSCX"
+            var allowedParams = ["WNSGPH", "WNSBOX", "WNSFC2", "WNSHCO", "WNSSCX", "WNSSSV"];
             var formParam = params.get("form");
             if (!formParam) {
               formParam = params.get("FORM");
             }
-            if (formParam == "WNSGPH" || formParam == "WNSBOX" || formParam == "WNSFC2") {
+            if (allowedParams.indexOf(formParam) != -1) {
               var term = params.get("q");
               var ss = Components.classes["@mozilla.org/browser/search-service;1"]
                                  .getService(nsIBrowserSearchService);
               var engine = ss.defaultEngine;
               logSystemBasedSearch(engine);
               var submission = engine.getSubmission(term, null, "system");
               uri = submission.uri;
             }