Bug 1426467: Part 1: Rewrite test_cache_worker_gc.html to use async functions. r=baku

This just cleans up the function a bit to make the next change easier to see. No
behavior change intended.

Differential Revision: https://phabricator.services.mozilla.com/D9217

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Jim Blandy 2018-10-22 15:34:21 +00:00
Родитель 1fecf36e2c
Коммит 12b557b02d
1 изменённых файлов: 9 добавлений и 8 удалений

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

@ -29,18 +29,19 @@ function gc() {
});
}
var weakWorker;
SimpleTest.waitForExplicitFinish();
startWorker().then(w => {
weakWorker = SpecialPowers.Cu.getWeakReference(w);
async function test() {
let w = await startWorker();
let weakWorker = SpecialPowers.Cu.getWeakReference(w);
ok(weakWorker, 'worker supports weak reference');
}).then(_ => {
return gc();
}).then(_ => {
w = null;
await gc();
ok(!weakWorker.get(), 'worker weak reference should be garbage collected');
SimpleTest.finish();
});
}
test();
</script>
</body>
</html>