Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(518)

Side by Side Diff: test/cctest/test-api.cc

Issue 6347066: Merge bleeding_edge revisions 6524 and 6552 to 3.0 branch. (Closed) Base URL: http://v8.googlecode.com/svn/branches/3.0/
Patch Set: Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/version.cc ('k') | test/mjsunit/debug-backtrace-text.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2007-2009 the V8 project authors. All rights reserved. 1 // Copyright 2007-2009 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 2351 matching lines...) Expand 10 before | Expand all | Expand 10 after
2362 2362
2363 2363
2364 static void check_reference_error_message( 2364 static void check_reference_error_message(
2365 v8::Handle<v8::Message> message, 2365 v8::Handle<v8::Message> message,
2366 v8::Handle<v8::Value> data) { 2366 v8::Handle<v8::Value> data) {
2367 const char* reference_error = "Uncaught ReferenceError: asdf is not defined"; 2367 const char* reference_error = "Uncaught ReferenceError: asdf is not defined";
2368 CHECK(message->Get()->Equals(v8_str(reference_error))); 2368 CHECK(message->Get()->Equals(v8_str(reference_error)));
2369 } 2369 }
2370 2370
2371 2371
2372 // Test that overwritten toString methods are not invoked on uncaught 2372 static v8::Handle<Value> Fail(const v8::Arguments& args) {
2373 // exception formatting. However, they are invoked when performing 2373 ApiTestFuzzer::Fuzz();
2374 // normal error string conversions. 2374 CHECK(false);
2375 return v8::Undefined();
2376 }
2377
2378
2379 // Test that overwritten methods are not invoked on uncaught exception
2380 // formatting. However, they are invoked when performing normal error
2381 // string conversions.
2375 TEST(APIThrowMessageOverwrittenToString) { 2382 TEST(APIThrowMessageOverwrittenToString) {
2376 v8::HandleScope scope; 2383 v8::HandleScope scope;
2377 v8::V8::AddMessageListener(check_reference_error_message); 2384 v8::V8::AddMessageListener(check_reference_error_message);
2378 LocalContext context; 2385 Local<ObjectTemplate> templ = ObjectTemplate::New();
2386 templ->Set(v8_str("fail"), v8::FunctionTemplate::New(Fail));
2387 LocalContext context(NULL, templ);
2388 CompileRun("Array.prototype.pop = fail;");
2389 CompileRun("Object.prototype.hasOwnProperty = fail;");
2390 CompileRun("Object.prototype.toString = function f() { return 'Yikes'; }");
2391 CompileRun("Number.prototype.toString = function f() { return 'Yikes'; }");
2392 CompileRun("String.prototype.toString = function f() { return 'Yikes'; }");
2379 CompileRun("ReferenceError.prototype.toString =" 2393 CompileRun("ReferenceError.prototype.toString ="
2380 " function() { return 'Whoops' }"); 2394 " function() { return 'Whoops' }");
2381 CompileRun("asdf;"); 2395 CompileRun("asdf;");
2382 CompileRun("ReferenceError.prototype.constructor.name = void 0;"); 2396 CompileRun("ReferenceError.prototype.constructor.name = void 0;");
2383 CompileRun("asdf;"); 2397 CompileRun("asdf;");
2384 CompileRun("ReferenceError.prototype.constructor = void 0;"); 2398 CompileRun("ReferenceError.prototype.constructor = void 0;");
2385 CompileRun("asdf;"); 2399 CompileRun("asdf;");
2386 CompileRun("ReferenceError.prototype.__proto__ = new Object();"); 2400 CompileRun("ReferenceError.prototype.__proto__ = new Object();");
2387 CompileRun("asdf;"); 2401 CompileRun("asdf;");
2388 CompileRun("ReferenceError.prototype = new Object();"); 2402 CompileRun("ReferenceError.prototype = new Object();");
(...skipping 3858 matching lines...) Expand 10 before | Expand all | Expand 10 after
6247 Local<Function> cons = templ->GetFunction(); 6261 Local<Function> cons = templ->GetFunction();
6248 context->Global()->Set(v8_str("Fun"), cons); 6262 context->Global()->Set(v8_str("Fun"), cons);
6249 Local<Value> value = CompileRun( 6263 Local<Value> value = CompileRun(
6250 "function test() {" 6264 "function test() {"
6251 " try {" 6265 " try {"
6252 " (new Fun()).blah()" 6266 " (new Fun()).blah()"
6253 " } catch (e) {" 6267 " } catch (e) {"
6254 " var str = String(e);" 6268 " var str = String(e);"
6255 " if (str.indexOf('TypeError') == -1) return 1;" 6269 " if (str.indexOf('TypeError') == -1) return 1;"
6256 " if (str.indexOf('[object Fun]') != -1) return 2;" 6270 " if (str.indexOf('[object Fun]') != -1) return 2;"
6257 " if (str.indexOf('#<a Fun>') == -1) return 3;" 6271 " if (str.indexOf('#<Fun>') == -1) return 3;"
6258 " return 0;" 6272 " return 0;"
6259 " }" 6273 " }"
6260 " return 4;" 6274 " return 4;"
6261 "}" 6275 "}"
6262 "test();"); 6276 "test();");
6263 CHECK_EQ(0, value->Int32Value()); 6277 CHECK_EQ(0, value->Int32Value());
6264 } 6278 }
6265 6279
6266 6280
6267 THREADED_TEST(EvalAliasedDynamic) { 6281 THREADED_TEST(EvalAliasedDynamic) {
(...skipping 5950 matching lines...) Expand 10 before | Expand all | Expand 10 after
12218 v8::Context::Scope context_scope(context.local()); 12232 v8::Context::Scope context_scope(context.local());
12219 12233
12220 v8::Handle<v8::ObjectTemplate> tmpl = v8::ObjectTemplate::New(); 12234 v8::Handle<v8::ObjectTemplate> tmpl = v8::ObjectTemplate::New();
12221 tmpl->SetNamedPropertyHandler(Getter, NULL, NULL, NULL, Enumerator); 12235 tmpl->SetNamedPropertyHandler(Getter, NULL, NULL, NULL, Enumerator);
12222 context->Global()->Set(v8_str("o"), tmpl->NewInstance()); 12236 context->Global()->Set(v8_str("o"), tmpl->NewInstance());
12223 v8::Handle<v8::Array> result = v8::Handle<v8::Array>::Cast(CompileRun( 12237 v8::Handle<v8::Array> result = v8::Handle<v8::Array>::Cast(CompileRun(
12224 "var result = []; for (var k in o) result.push(k); result")); 12238 "var result = []; for (var k in o) result.push(k); result"));
12225 CHECK_EQ(1, result->Length()); 12239 CHECK_EQ(1, result->Length());
12226 CHECK_EQ(v8_str("universalAnswer"), result->Get(0)); 12240 CHECK_EQ(v8_str("universalAnswer"), result->Get(0));
12227 } 12241 }
OLDNEW
« no previous file with comments | « src/version.cc ('k') | test/mjsunit/debug-backtrace-text.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698