mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1254694 - Fix search engines metadata migration for engines from language packs. r=adw, a=sledru
This commit is contained in:
parent
07b5f8b9ca
commit
8d0bcd1ad8
@ -1311,7 +1311,11 @@ function Engine(aLocation, aIsReadOnly) {
|
||||
|
||||
// Build the id used for the legacy metadata storage, so that we
|
||||
// can do a one-time import of data from old profiles.
|
||||
if (this._isDefault) {
|
||||
if (this._isDefault ||
|
||||
(uri && uri.spec.startsWith(APP_SEARCH_PREFIX))) {
|
||||
// The second part of the check is to catch engines from language packs.
|
||||
// They aren't default engines (because they aren't app-shipped), but we
|
||||
// still need to give their id an [app] prefix for backward compat.
|
||||
this._id = "[app]/" + this._shortName + ".xml";
|
||||
}
|
||||
else if (!aIsReadOnly) {
|
||||
|
@ -0,0 +1,5 @@
|
||||
{
|
||||
"[app]/bug645970.xml": {
|
||||
"alias": "lp"
|
||||
}
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
function run_test() {
|
||||
removeMetadata();
|
||||
removeCacheFile();
|
||||
|
||||
do_load_manifest("data/chrome.manifest");
|
||||
|
||||
configureToLoadJarEngines();
|
||||
|
||||
// Unless we unset the XPCSHELL_TEST_PROFILE_DIR environment variable,
|
||||
// engine._isDefault will be true for engines from the resource:// scheme,
|
||||
// bypassing the codepath we want to test.
|
||||
let env = Cc["@mozilla.org/process/environment;1"]
|
||||
.getService(Ci.nsIEnvironment);
|
||||
env.set("XPCSHELL_TEST_PROFILE_DIR", "");
|
||||
|
||||
do_get_file("data/langpack-metadata.json").copyTo(gProfD, "search-metadata.json");
|
||||
|
||||
do_check_false(Services.search.isInitialized);
|
||||
|
||||
run_next_test();
|
||||
}
|
||||
|
||||
add_task(function* async_init() {
|
||||
let commitPromise = promiseAfterCache()
|
||||
yield asyncInit();
|
||||
|
||||
let engine = Services.search.getEngineByName("bug645970");
|
||||
do_check_neq(engine, null);
|
||||
do_check_eq(engine.wrappedJSObject._id, "[app]/bug645970.xml");
|
||||
|
||||
yield commitPromise;
|
||||
let metadata = yield promiseEngineMetadata();
|
||||
do_check_eq(metadata["bug645970"].alias, "lp");
|
||||
});
|
@ -22,6 +22,7 @@ support-files =
|
||||
data/invalid-engine.xml
|
||||
data/install.rdf
|
||||
data/list.txt
|
||||
data/langpack-metadata.json
|
||||
data/metadata.json
|
||||
data/search-metadata.json
|
||||
data/search.json
|
||||
@ -59,6 +60,7 @@ support-files =
|
||||
[test_parseSubmissionURL.js]
|
||||
[test_SearchStaticData.js]
|
||||
[test_addEngine_callback.js]
|
||||
[test_migration_langpack.js]
|
||||
[test_multipleIcons.js]
|
||||
[test_resultDomain.js]
|
||||
[test_searchSuggest.js]
|
||||
|
Loading…
Reference in New Issue
Block a user