Bug 1215948 - "Hey Cortana" searches in Windows 10 default to Bing. r=jaws
authorJustin Dolske <dolske@mozilla.com>
Thu, 19 Nov 2015 15:13:32 -0800
changeset 273384 c43d530f61c2672dd059a64c1ad04279f9650dd5
parent 273383 0c351448cd9f4224bf98709d04e6623b52eef8b0
child 273385 1b2e15608f34fef0f23369731c80138f55f00cf2
push id29701
push usercbook@mozilla.com
push dateFri, 20 Nov 2015 12:11:50 +0000
treeherdermozilla-central@1b2e15608f34 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjaws
bugs1215948
milestone45.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1215948 - "Hey Cortana" searches in Windows 10 default to Bing. r=jaws
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"
+            var allowedParams = ["WNSGPH", "WNSBOX", "WNSFC2", "WNSHCO", "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;
             }