Bug 1387303 - fix test_places_guid_downgrade.js to work correctly in the new async-sync world. r=eoger

MozReview-Commit-ID: 4bmu45qUmFA

--HG--
extra : rebase_source : bd610c5cbd8be72c0239dd72122f422bea9d02fa
This commit is contained in:
Mark Hammond 2017-08-04 11:49:15 +10:00
Родитель a869597b17
Коммит d382e46b84
1 изменённых файлов: 13 добавлений и 12 удалений

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

@ -109,17 +109,10 @@ add_task(async function test_history_guids() {
}]
}
];
PlacesUtils.asyncHistory.updatePlaces(places, {
handleError: function handleError() {
do_throw("Unexpected error in adding visit.");
},
handleResult: function handleResult() {},
handleCompletion: onVisitAdded
});
function onVisitAdded() {
let fxguid = store.GUIDForUri(fxuri, true);
let tbguid = store.GUIDForUri(tburi, true);
async function onVisitAdded() {
let fxguid = await store.GUIDForUri(fxuri, true);
let tbguid = await store.GUIDForUri(tburi, true);
dump("fxguid: " + fxguid + "\n");
dump("tbguid: " + tbguid + "\n");
@ -151,9 +144,17 @@ add_task(async function test_history_guids() {
result = Async.querySpinningly(stmt, ["guid"]);
do_check_eq(result.length, 0);
stmt.finalize();
run_next_test();
}
await new Promise((resolve, reject) => {
PlacesUtils.asyncHistory.updatePlaces(places, {
handleError: function handleError() {
do_throw("Unexpected error in adding visit.");
},
handleResult: function handleResult() {},
handleCompletion: () => {onVisitAdded().then(resolve, reject)},
});
});
});
add_task(async function test_bookmark_guids() {