Back out a7923665bfa0 (bug 1121417) for e10s bc1 bustage

CLOSED TREE
This commit is contained in:
Phil Ringnalda 2015-02-23 21:18:22 -08:00
Родитель 475fd32578
Коммит f8430495ed
9 изменённых файлов: 15 добавлений и 136 удалений

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

@ -1186,11 +1186,13 @@
list.firstChild.remove();
let hiddenList;
let ns = {};
Cu.import("resource://gre/modules/Preferences.jsm", ns);
let pref =
ns.Preferences.get("browser.search.hiddenOneOffs");
hiddenList = pref ? pref.split(",") : [];
try {
let pref =
Services.prefs.getCharPref("browser.search.hiddenOneOffs");
hiddenList = pref ? pref.split(",") : [];
} catch(e) {
hiddenList = [];
}
let currentEngineName = Services.search.currentEngine.name;
let engines = Services.search.getVisibleEngines()

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

@ -430,14 +430,12 @@ BrowserGlue.prototype = {
// an engine, and that newly added engines are visible.
if (data == "engine-added" || data == "engine-removed") {
let engineName = subject.QueryInterface(Ci.nsISearchEngine).name;
let ns = {};
Cu.import("resource://gre/modules/Preferences.jsm", ns);
let hiddenPref =
ns.Preferences.get("browser.search.hiddenOneOffs");
Services.prefs.getCharPref("browser.search.hiddenOneOffs");
let hiddenEngines = hiddenPref ? hiddenPref.split(",") : [];
hiddenEngines = hiddenEngines.filter(x => x !== engineName);
ns.Preferences.set("browser.search.hiddenOneOffs",
hiddenEngines.join(","));
Services.prefs.setCharPref("browser.search.hiddenOneOffs",
hiddenEngines.join(","));
}
if (data != "engine-default" && data != "engine-current") {

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

@ -8,7 +8,7 @@
<!-- One off providers -->
<preference id="browser.search.hiddenOneOffs"
name="browser.search.hiddenOneOffs"
type="unichar"/>
type="string"/>
</preferences>

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

@ -28,7 +28,7 @@
<!-- One off providers -->
<preference id="browser.search.hiddenOneOffs"
name="browser.search.hiddenOneOffs"
type="unichar"/>
type="string"/>
</preferences>

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

@ -9,7 +9,6 @@ support-files =
test.html
testEngine.src
testEngine.xml
testEngine_diacritics.xml
testEngine_dupe.xml
testEngine_mozsearch.xml
webapi.html
@ -35,7 +34,6 @@ skip-if = e10s # Bug ?????? - some issue with progress listeners [JavaScript Err
skip-if = e10s # Bug ?????? - some issue with progress listeners [JavaScript Error: "req.originalURI is null" {file: "chrome://mochitests/content/browser/browser/components/search/test/browser_bing_behavior.js" line: 127}]
[browser_healthreport.js]
[browser_hiddenOneOffs_cleanup.js]
[browser_hiddenOneOffs_diacritics.js]
[browser_private_search_perwindowpb.js]
skip-if = e10s # Bug ?????? - Test uses load event and checks event.target.
[browser_yahoo.js]

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

@ -67,30 +67,6 @@ add_task(function* test_add() {
"Adding an engine does not remove engines from hidden list.");
});
add_task(function* test_diacritics() {
const diacritic_engine = "Foo \u2661";
let ns = {};
Cu.import("resource://gre/modules/Preferences.jsm", ns);
ns.Preferences.set("browser.search.hiddenOneOffs", diacritic_engine);
yield promiseNewEngine("testEngine_diacritics.xml");
let hiddenOneOffs =
ns.Preferences.get("browser.search.hiddenOneOffs").split(",");
is(hiddenOneOffs.some(x => x == diacritic_engine), false,
"Observer cleans up added hidden engines that include a diacritic.");
ns.Preferences.set("browser.search.hiddenOneOffs", diacritic_engine);
info("Removing testEngine_diacritics.xml");
Services.search.removeEngine(Services.search.getEngineByName(diacritic_engine));
hiddenOneOffs =
ns.Preferences.get("browser.search.hiddenOneOffs").split(",");
is(hiddenOneOffs.some(x => x == diacritic_engine), false,
"Observer cleans up removed hidden engines that include a diacritic.");
});
registerCleanupFunction(() => {
info("Removing testEngine.xml");
Services.search.removeEngine(Services.search.getEngineByName("Foo"));

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

@ -1,79 +0,0 @@
/* 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/. */
// Tests that keyboard navigation in the search panel works as designed.
const searchbar = document.getElementById("searchbar");
const textbox = searchbar._textbox;
const searchPopup = document.getElementById("PopupSearchAutoComplete");
const diacritic_engine = "Foo \u2661";
let ns = {};
Cu.import("resource://gre/modules/Preferences.jsm", ns);
// Get an array of the one-off buttons.
function getOneOffs() {
let oneOffs = [];
let oneOff =
document.getAnonymousElementByAttribute(searchPopup, "anonid",
"search-panel-one-offs");
for (oneOff = oneOff.firstChild; oneOff; oneOff = oneOff.nextSibling) {
if (oneOff.classList.contains("dummy"))
break;
oneOffs.push(oneOff);
}
return oneOffs;
}
add_task(function* init() {
const cachedPref = Services.prefs.getCharPref("browser.search.hiddenOneOffs");
let currentEngine = Services.search.currentEngine;
yield promiseNewEngine("testEngine_diacritics.xml", false);
// Add testEngine and use it as the current search service so that the diacritic
// engine will be in the shownOneOffs list and so that the search bar won't
// attempt to call a remote search service during testing.
yield promiseNewEngine("testEngine.xml", false);
Services.search.currentEngine = Services.search.getEngineByName("Foo");
textbox.value = "Foo";
registerCleanupFunction(() => {
textbox.value = "";
Services.search.currentEngine = currentEngine;
ns.Preferences.set("browser.search.hiddenOneOffs", cachedPref);
});
});
add_task(function* test_hidden() {
ns.Preferences.set("browser.search.hiddenOneOffs", diacritic_engine);
let promise = promiseEvent(searchPopup, "popupshown");
searchbar.focus();
yield promise;
ok(!getOneOffs().some(x => x.getAttribute("label") == diacritic_engine),
"Search engines with diacritics are hidden when added to hiddenOneOffs preference.");
promise = promiseEvent(searchPopup, "popuphidden");
searchPopup.hidePopup();
yield promise;
gURLBar.focus();
});
add_task(function* test_shown() {
ns.Preferences.set("browser.search.hiddenOneOffs", "");
let promise = promiseEvent(searchPopup, "popupshown");
searchbar.focus();
yield promise;
ok(getOneOffs().some(x => x.getAttribute("label") == diacritic_engine),
"Search engines with diacritics are shown when removed from hiddenOneOffs preference.");
promise = promiseEvent(searchPopup, "popuphidden");
searchPopup.hidePopup();
yield promise;
});

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

@ -136,7 +136,7 @@ function* promiseOnLoad() {
});
}
function promiseNewEngine(basename, swapCurrent = true) {
function promiseNewEngine(basename) {
return new Promise((resolve, reject) => {
info("Waiting for engine to be added: " + basename);
Services.search.init({
@ -146,13 +146,9 @@ function promiseNewEngine(basename, swapCurrent = true) {
Services.search.addEngine(url, Ci.nsISearchEngine.TYPE_MOZSEARCH, "", false, {
onSuccess: function (engine) {
info("Search engine added: " + basename);
if (swapCurrent) {
Services.search.currentEngine = engine;
}
Services.search.currentEngine = engine;
registerCleanupFunction(() => {
if (swapCurrent) {
Services.search.currentEngine = current;
}
Services.search.currentEngine = current;
Services.search.removeEngine(engine);
info("Search engine removed: " + basename);
});

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

@ -1,12 +0,0 @@
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/"
xmlns:moz="http://www.mozilla.org/2006/browser/search/">
<ShortName>Foo &#9825;</ShortName>
<Description>Diacritics Test Engine</Description>
<InputEncoding>utf-8</InputEncoding>
<Image width="16" height="16">data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAABGklEQVQoz2NgGB6AnZ1dUlJSXl4eSDIyMhLW4Ovr%2B%2Fr168uXL69Zs4YoG%2BLi4i5dusTExMTGxsbNzd3f37937976%2BnpmZmagbHR09J49e5YvX66kpATVEBYW9ubNm2nTphkbG7e2tp44cQLIuHfvXm5urpaWFlDKysqqu7v73LlzECMYIiIiHj58mJCQoKKicvXq1bS0NKBgW1vbjh074uPjgeqAXE1NzSdPnvDz84M0AEUvXLgAsW379u1z5swBen3jxo2zZ892cHB4%2BvQp0KlAfwI1cHJyghQFBwfv2rULokFXV%2FfixYu7d%2B8GGqGgoMDKyrpu3br9%2B%2FcDuXl5eVA%2FAEWBfoWHAdAYoNuAYQ0XAeoUERFhGDYAAPoUaT2dfWJuAAAAAElFTkSuQmCC</Image>
<Url type="text/html" method="GET" template="http://mochi.test:8888/browser/browser/components/search/test/?search">
<Param name="test" value="{searchTerms}"/>
</Url>
<moz:SearchForm>http://mochi.test:8888/browser/browser/components/search/test/</moz:SearchForm>
<moz:Alias>diacriticalias</moz:Alias>
</OpenSearchDescription>