Bug 1305444 - Add test for dispatched method throwing an error; r=Yoric

We didn't have explicit test coverage of this before, surprisingly.

MozReview-Commit-ID: 32ZnxZYLXDg

--HG--
extra : rebase_source : 07110ed90b69c5b0fb73fda8264db2eb755ca6a4
This commit is contained in:
Gregory Szorc 2016-09-24 19:31:48 -07:00
Родитель 2b829e24bb
Коммит 90f5226666
2 изменённых файлов: 14 добавлений и 1 удалений

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

@ -26,5 +26,9 @@ self.addEventListener("message", msg => worker.handleMessage(msg));
var Agent = { var Agent = {
bounce: function(...args) { bounce: function(...args) {
return args; return args;
} },
throwError: function(msg, ...args) {
throw new Error(msg);
},
}; };

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

@ -106,3 +106,12 @@ add_task(function* test_transfer_with_meta() {
Assert.equal(result[i], i); Assert.equal(result[i], i);
} }
}); });
add_task(function* test_throw_error() {
try {
yield worker.post("throwError", ["error message"]);
Assert.ok(false, "should have thrown");
} catch (ex) {
Assert.equal(ex.message, "Error: error message");
}
});