Bug 1335778 - Synchronize navigate() for trigger methods using generators. r=ato

In the case when the trigger callback inside navigate() uses a generator,
the code has to be synchronized and needs to wait until the contained
command has been completed.

MozReview-Commit-ID: 8qKUMvH7HpS

--HG--
extra : rebase_source : 3bc63d130c370354dab27bf40bbf13ec441bd423
This commit is contained in:
Henrik Skupin 2017-04-07 21:44:32 +02:00
Родитель be39489f68
Коммит 4e01e939f1
1 изменённых файлов: 12 добавлений и 9 удалений

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

@ -273,19 +273,22 @@ var loadListener = {
this.start(command_id, timeout, startTime, true);
}
try {
trigger();
} catch (e) {
return Task.spawn(function* () {
yield trigger();
}).then(val => {
if (!loadEventExpected) {
sendOk(command_id);
}
}).catch(err => {
if (loadEventExpected) {
this.stop();
}
sendError(new UnknownCommandError(e.message), command_id);
return;
}
if (!loadEventExpected) {
sendOk(command_id);
}
sendError(err, command_id);
return;
});
},
}