diff options
author | Ryan Dahl <ry@tinyclouds.org> | 2011-02-02 11:44:25 -0800 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2011-02-02 11:44:25 -0800 |
commit | ee092f62caeae1acd088e2707fe15e18b992d17c (patch) | |
tree | a002983ec7742dd7eabe3e6e86ba17eb8b0c768a /deps/v8/test/cctest/test-api.cc | |
parent | f86ec1366f71f33f3b39b769238076ca898fc619 (diff) | |
download | node-new-ee092f62caeae1acd088e2707fe15e18b992d17c.tar.gz |
Upgrade V8 to 3.1.1
Diffstat (limited to 'deps/v8/test/cctest/test-api.cc')
-rw-r--r-- | deps/v8/test/cctest/test-api.cc | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/deps/v8/test/cctest/test-api.cc b/deps/v8/test/cctest/test-api.cc index 9b9f469f60..ee620678a7 100644 --- a/deps/v8/test/cctest/test-api.cc +++ b/deps/v8/test/cctest/test-api.cc @@ -2369,13 +2369,30 @@ 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("asdf;"); + CompileRun("var limit = {};" + "limit.valueOf = fail;" + "Error.stackTraceLimit = limit;"); + CompileRun("asdf"); + 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 =" |