* Asserts that the given condition holds. If it doesn't, the given message is * dumped, a stack trace is printed, and an exception is thrown to attempt to * stop execution (which unfortunately must rely upon the exception not being * accidentally swallowed by the code that uses it).
(cond, msg)
| 66 | * accidentally swallowed by the code that uses it). |
| 67 | */ |
| 68 | function NS_ASSERT(cond, msg) |
| 69 | { |
| 70 | if (DEBUG && !cond) |
| 71 | { |
| 72 | dumpn("###!!!"); |
| 73 | dumpn("###!!! ASSERTION" + (msg ? ": " + msg : "!")); |
| 74 | dumpn("###!!! Stack follows:"); |
| 75 | |
| 76 | var stack = new Error().stack.split(/\n/); |
| 77 | dumpn(stack.map(function(val) { return "###!!! " + val; }).join("\n")); |
| 78 | |
| 79 | throw Cr.NS_ERROR_ABORT; |
| 80 | } |
| 81 | } |
| 82 | |
| 83 | /** Constructs an HTTP error object. */ |
| 84 | this.HttpError = function HttpError(code, description) |
no test coverage detected