Bug 1253859 - Properly stringify thrown symbol in console. r=fitzgen

This commit is contained in:
Tooru Fujisawa 2016-03-09 01:32:34 +09:00
parent 0ec9e41aa6
commit a9ce01a3e6
2 changed files with 16 additions and 1 deletions

View File

@ -888,7 +888,7 @@ WebConsoleActor.prototype =
error.unsafeDereference();
errorMessage = unsafeDereference && unsafeDereference.toString
? unsafeDereference.toString()
: "" + error;
: String(error);
}
}

View File

@ -62,6 +62,21 @@ function onAttach(aState, aResponse)
});
});
let symbolTestValues = [
["Symbol.iterator", "Symbol(Symbol.iterator)"],
["Symbol('foo')", "Symbol(foo)"],
["Symbol()", "Symbol()"],
];
symbolTestValues.forEach(function([expr, message]) {
tests.push(function() {
aState.client.evaluateJS("throw " + expr + ";", function(aResponse) {
is(aResponse.exceptionMessage, message,
"response.exception for throw " + expr);
nextTest();
});
});
});
runTests(tests, endTest.bind(null, aState));
}