зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
be39489f68
Коммит
4e01e939f1
|
@ -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;
|
||||
});
|
||||
},
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче