Bug 1280362 - Move assertThrowsInstanceOf into shell.js's IIFE. r=arai

--HG--
extra : rebase_source : 658e8d233b5f387598b10d8228f5aef3699df58c
This commit is contained in:
Jeff Walden 2016-04-23 17:51:15 -07:00
Родитель 73045413bb
Коммит 520c357e28
1 изменённых файлов: 23 добавлений и 16 удалений

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

@ -55,6 +55,29 @@
}
global.assertThrows = assertThrows;
function assertThrowsInstanceOf(f, ctor, msg) {
var fullmsg;
try {
f();
} catch (exc) {
if (exc instanceof ctor)
return;
fullmsg =
"Assertion failed: expected exception " + ctor.name + ", got " + exc;
}
if (fullmsg === undefined) {
fullmsg =
"Assertion failed: expected exception " + ctor.name + ", " +
"no exception thrown";
}
if (msg !== undefined)
fullmsg += " - " + msg;
throw new Error(fullmsg);
}
global.assertThrowsInstanceOf = assertThrowsInstanceOf;
/****************************
* UTILITY FUNCTION EXPORTS *
****************************/
@ -936,19 +959,3 @@ function assertEqArray(a1, a2) {
}
}
}
function assertThrowsInstanceOf(f, ctor, msg) {
var fullmsg;
try {
f();
} catch (exc) {
if (exc instanceof ctor)
return;
fullmsg = "Assertion failed: expected exception " + ctor.name + ", got " + exc;
}
if (fullmsg === undefined)
fullmsg = "Assertion failed: expected exception " + ctor.name + ", no exception thrown";
if (msg !== undefined)
fullmsg += " - " + msg;
throw new Error(fullmsg);
};