| Index: test/cctest/test-api.cc
|
| diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
|
| index 9b9f469f60a7a4d434eed5ca7c5003487f0a4fad..5667e995bbbe7f1e7f3307738d8439ba425646cf 100644
|
| --- a/test/cctest/test-api.cc
|
| +++ b/test/cctest/test-api.cc
|
| @@ -2369,13 +2369,25 @@ static void check_reference_error_message(
|
| }
|
|
|
|
|
| -// Test that overwritten toString methods are not invoked on uncaught
|
| -// exception formatting. However, they are invoked when performing
|
| -// normal error string conversions.
|
| +static v8::Handle<Value> Fail(const v8::Arguments& args) {
|
| + ApiTestFuzzer::Fuzz();
|
| + CHECK(false);
|
| + return v8::Undefined();
|
| +}
|
| +
|
| +
|
| +// Test that overwritten methods are not invoked on uncaught exception
|
| +// formatting. However, they are invoked when performing normal error
|
| +// string conversions.
|
| TEST(APIThrowMessageOverwrittenToString) {
|
| v8::HandleScope scope;
|
| v8::V8::AddMessageListener(check_reference_error_message);
|
| - LocalContext context;
|
| + Local<ObjectTemplate> templ = ObjectTemplate::New();
|
| + templ->Set(v8_str("fail"), v8::FunctionTemplate::New(Fail));
|
| + LocalContext context(NULL, templ);
|
| + CompileRun("Array.prototype.pop = fail;");
|
| + CompileRun("Object.prototype.hasOwnProperty = fail;");
|
| + CompileRun("Object.prototype.toString = function f() { return 'Yikes'; }");
|
| CompileRun("Number.prototype.toString = function f() { return 'Yikes'; }");
|
| CompileRun("String.prototype.toString = function f() { return 'Yikes'; }");
|
| CompileRun("ReferenceError.prototype.toString ="
|
|
|