mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1254694 - Fix synchronous code path for search engines metadata migration. r=adw, a=sledru
This commit is contained in:
parent
d110f5fc78
commit
07b5f8b9ca
@ -3182,8 +3182,8 @@ SearchService.prototype = {
|
||||
stream = Cc["@mozilla.org/network/file-input-stream;1"].
|
||||
createInstance(Ci.nsIFileInputStream);
|
||||
stream.init(cacheFile, MODE_RDONLY, FileUtils.PERMS_FILE, 0);
|
||||
let metadata = json.decodeFromStream(stream, stream.available());
|
||||
let json;
|
||||
let metadata = parseJsonFromStream(stream);
|
||||
let json = {};
|
||||
if ("[global]" in metadata) {
|
||||
LOG("_readCacheFile: migrating metadata from search-metadata.json");
|
||||
let data = metadata["[global]"];
|
||||
@ -3202,7 +3202,7 @@ SearchService.prototype = {
|
||||
|
||||
return json;
|
||||
} catch(ex) {
|
||||
LOG("_readCacheFile: failed to read old metadata");
|
||||
LOG("_readCacheFile: failed to read old metadata: " + ex);
|
||||
return {};
|
||||
} finally {
|
||||
stream.close();
|
||||
|
@ -13,11 +13,8 @@ function run_test() {
|
||||
run_next_test();
|
||||
}
|
||||
|
||||
add_task(function* test_metadata_migration() {
|
||||
|
||||
yield new Promise(function(resolve) {
|
||||
Services.search.init(resolve);
|
||||
});
|
||||
add_task(function* test_async_metadata_migration() {
|
||||
yield asyncInit();
|
||||
yield promiseAfterCache();
|
||||
|
||||
// Check that the entries are placed as specified correctly
|
@ -0,0 +1,29 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
/* Test that legacy metadata from search-metadata.json is correctly
|
||||
* transferred to the new metadata storage. */
|
||||
|
||||
function run_test() {
|
||||
updateAppInfo();
|
||||
installTestEngine();
|
||||
|
||||
do_get_file("data/metadata.json").copyTo(gProfD, "search-metadata.json");
|
||||
|
||||
run_next_test();
|
||||
}
|
||||
|
||||
add_task(function* test_sync_metadata_migration() {
|
||||
do_check_false(Services.search.isInitialized);
|
||||
let engines = Services.search.getEngines();
|
||||
do_check_true(Services.search.isInitialized);
|
||||
yield promiseAfterCache();
|
||||
|
||||
// Check that the entries are placed as specified correctly
|
||||
let metadata = yield promiseEngineMetadata();
|
||||
do_check_eq(metadata["engine"].order, 1);
|
||||
do_check_eq(metadata["engine"].alias, "foo");
|
||||
|
||||
metadata = yield promiseGlobalMetadata();
|
||||
do_check_eq(metadata["searchDefaultExpir"], 1471013469846);
|
||||
});
|
@ -68,6 +68,7 @@ tags = addons
|
||||
[test_async_addon_no_override.js]
|
||||
tags = addons
|
||||
[test_async_distribution.js]
|
||||
[test_async_migration.js]
|
||||
[test_async_profile_engine.js]
|
||||
[test_sync.js]
|
||||
[test_sync_addon.js]
|
||||
@ -77,6 +78,7 @@ tags = addons
|
||||
[test_sync_distribution.js]
|
||||
[test_sync_fallback.js]
|
||||
[test_sync_delay_fallback.js]
|
||||
[test_sync_migration.js]
|
||||
[test_sync_profile_engine.js]
|
||||
[test_rel_searchform.js]
|
||||
[test_remove_profile_engine.js]
|
||||
@ -84,4 +86,3 @@ tags = addons
|
||||
[test_geodefaults.js]
|
||||
[test_hidden.js]
|
||||
[test_currentEngine_fallback.js]
|
||||
[test_migration.js]
|
||||
|
Loading…
Reference in New Issue
Block a user