Bug 862921 - Generalize AssertSequentialIsOK logic and improve its message. r=nmatsakis

1. If one passes a `mode` argument without a property named `mode`,
       the previous version will fall into the ThrowError branch
       (because mode.mode => undefined and undefined !== "seq")

    2. The old error message used the strings "par" and "seq", which might
       make the reader think that the assertion is solely about the
       appropriate value for the `mode` property, which happens to take on
       the values "par" or "seq" in some cases.  But the real condition
       being signalled here is not about the string values "par" or "seq";
       it is instead about the dynamic behavior of the runtime system.
       This changes the error message to use longer phrases, which should
       hopefully make the intent clearer.

    There is a third change I want to make, changing the logic of the
    conditional guard further, but that change is not as important to me
    as the two above.
This commit is contained in:
Felix S. Klock II 2013-04-17 17:53:31 +02:00
parent febd320fc7
commit 3b88aa7514

View File

@ -1247,8 +1247,8 @@ function ParallelArrayToString() {
* sequential execution
*/
function AssertSequentialIsOK(mode) {
if (mode && mode.mode !== "seq" && ParallelTestsShouldPass())
ThrowError(JSMSG_WRONG_VALUE, "par", "seq");
if (mode && mode.mode && mode.mode !== "seq" && ParallelTestsShouldPass())
ThrowError(JSMSG_WRONG_VALUE, "parallel execution", "sequential was forced");
}
/**