Bug 1287622 - Remove Cortana-related code from Firefox as it no longer works after Microsoft hard-coded search results to Edge. r=jaws

This commit is contained in:
Filipe 2016-09-15 20:56:58 +02:00
Родитель f9783c3c60
Коммит 225d8af6d8
4 изменённых файлов: 1 добавлений и 75 удалений

Просмотреть файл

@ -377,12 +377,6 @@ pref("browser.search.context.loadInBackground", false);
// comma seperated list of of engines to hide in the search panel.
pref("browser.search.hiddenOneOffs", "");
#ifdef XP_WIN
pref("browser.search.redirectWindowsSearch", true);
#else
pref("browser.search.redirectWindowsSearch", false);
#endif
pref("browser.search.reset.enabled", true);
pref("browser.usedOnWindows10", false);
@ -1525,4 +1519,4 @@ pref("browser.crashReports.unsubmittedCheck.enabled", true);
// without a user choice before we suppress the notification for
// some number of days.
pref("browser.crashReports.unsubmittedCheck.chancesUntilSuppress", 4);
pref("browser.crashReports.unsubmittedCheck.autoSubmit", false);
pref("browser.crashReports.unsubmittedCheck.autoSubmit", false);

Просмотреть файл

@ -2,8 +2,6 @@
* 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/. */
Components.utils.importGlobalProperties(["URLSearchParams"]);
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
Components.utils.import("resource://gre/modules/Services.jsm");
Components.utils.import("resource://gre/modules/AppConstants.jsm");
@ -744,60 +742,10 @@ nsDefaultCommandLineHandler.prototype = {
}
}
let redirectWinSearch = false;
if (AppConstants.isPlatformAndVersionAtLeast("win", "10")) {
redirectWinSearch = Services.prefs.getBoolPref("browser.search.redirectWindowsSearch");
}
try {
var ar;
while ((ar = cmdLine.handleFlagWithParam("url", false))) {
var uri = resolveURIInternal(cmdLine, ar);
// Searches in the Windows 10 task bar searchbox simply open the default browser
// with a URL for a search on Bing. Here we extract the search term and use the
// user's default search engine instead.
var uriScheme = "", uriHost = "", uriPath = "";
try {
uriScheme = uri.scheme;
uriHost = uri.host;
uriPath = uri.path;
} catch (e) {
}
// Most Windows searches are "https://www.bing.com/search...", but bug
// 1182308 reports a Chinese edition of Windows 10 using
// "http://cn.bing.com/search...", so be a bit flexible in what we match.
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" 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 (allowedParams.indexOf(formParam) != -1) {
var term = params.get("q");
var engine = Services.search.defaultEngine;
logSystemBasedSearch(engine);
var submission = engine.getSubmission(term, null, "system");
uri = submission.uri;
}
} catch (e) {
Components.utils.reportError("Couldn't redirect Windows search: " + e);
}
}
urilist.push(uri);
}
}

Просмотреть файл

@ -3,8 +3,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "AppConstants",
"resource://gre/modules/AppConstants.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils",
"resource://gre/modules/PlacesUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Task",
@ -12,12 +10,6 @@ XPCOMUtils.defineLazyModuleGetter(this, "Task",
const ENGINE_FLAVOR = "text/x-moz-search-engine";
document.addEventListener("Initialized", () => {
if (!AppConstants.isPlatformAndVersionAtLeast("win", "10")) {
document.getElementById("redirectSearchCheckbox").hidden = true;
}
});
var gEngineView = null;
var gSearchPane = {

Просмотреть файл

@ -12,10 +12,6 @@
name="browser.search.hiddenOneOffs"
type="unichar"/>
<preference id="browser.search.redirectWindowsSearch"
name="browser.search.redirectWindowsSearch"
type="bool"/>
</preferences>
<script type="application/javascript"
@ -51,10 +47,6 @@
<label flex="1">&urlBarSuggestionsPermanentPB.label;</label>
</hbox>
</vbox>
<checkbox id="redirectSearchCheckbox"
label="&redirectWindowsSearch.label;"
accesskey="&redirectWindowsSearch.accesskey;"
preference="browser.search.redirectWindowsSearch"/>
</groupbox>
<groupbox id="oneClickSearchProvidersGroup" data-category="paneSearch">