Bug 883741 - Part 2: testing for null in crypto legacy. r=bz

This commit is contained in:
Yoshi Huang 2013-08-01 15:14:44 +08:00
Родитель 2e2cee1761
Коммит 40c1e002ad
1 изменённых файлов: 28 добавлений и 0 удалений

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

@ -24,5 +24,33 @@ ok("signText" in window.crypto, "signText in window.crypto");
ok("disableRightClick" in window.crypto,
"disableRightClick in window.crypto");
function jsCallback () {
}
try {
window.crypto.generateCRMFRequest(null, null, null, null, jsCallback.toString());
ok(false, "window.crypto.generateCRMFRequest failed, should throw error");
} catch (e) {
ok(e.toString().search(/Failure/) > -1,
"Expected error: ReqDN cannot be null");
}
try {
window.crypto.generateCRMFRequest(document.documentElement, null, null, null,
null);
ok(false, "window.crypto.generateCRMFRequest failed, should throw error");
} catch (e) {
ok(e.toString().search(/Failure/) > -1,
"Expected error: jsCallback cannot be null");
}
try {
window.crypto.generateCRMFRequest(document.documentElement, null, null, null,
jsCallback.toString(), 1024);
ok(false, "window.crypto.generateCRMFRequest failed, should throw error");
} catch (e) {
ok(e.toString().search(/TypeError/) > -1,
"Expected error: Not enough arguments");
}
</script>
</body></html>