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

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

Issue 10914201: Fix edge case of extension with NULL as source string. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 3 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/objects.h ('k') | test/cctest/test-strings.cc » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 4653 matching lines...) Expand 10 before | Expand all | Expand 10 after
4664 v8::RegisterExtension(new Extension("simpletest", kSimpleExtensionSource)); 4664 v8::RegisterExtension(new Extension("simpletest", kSimpleExtensionSource));
4665 const char* extension_names[] = { "simpletest" }; 4665 const char* extension_names[] = { "simpletest" };
4666 v8::ExtensionConfiguration extensions(1, extension_names); 4666 v8::ExtensionConfiguration extensions(1, extension_names);
4667 v8::Handle<Context> context = Context::New(&extensions); 4667 v8::Handle<Context> context = Context::New(&extensions);
4668 Context::Scope lock(context); 4668 Context::Scope lock(context);
4669 v8::Handle<Value> result = Script::Compile(v8_str("Foo()"))->Run(); 4669 v8::Handle<Value> result = Script::Compile(v8_str("Foo()"))->Run();
4670 CHECK_EQ(result, v8::Integer::New(4)); 4670 CHECK_EQ(result, v8::Integer::New(4));
4671 } 4671 }
4672 4672
4673 4673
4674 THREADED_TEST(NullExtensions) {
4675 v8::HandleScope handle_scope;
4676 v8::RegisterExtension(new Extension("nulltest", NULL));
4677 const char* extension_names[] = { "nulltest" };
4678 v8::ExtensionConfiguration extensions(1, extension_names);
4679 v8::Handle<Context> context = Context::New(&extensions);
4680 Context::Scope lock(context);
4681 v8::Handle<Value> result = Script::Compile(v8_str("1+3"))->Run();
4682 CHECK_EQ(result, v8::Integer::New(4));
4683 }
4684
4685
4674 static const char* kEmbeddedExtensionSource = 4686 static const char* kEmbeddedExtensionSource =
4675 "function Ret54321(){return 54321;}~~@@$" 4687 "function Ret54321(){return 54321;}~~@@$"
4676 "$%% THIS IS A SERIES OF NON-NULL-TERMINATED STRINGS."; 4688 "$%% THIS IS A SERIES OF NON-NULL-TERMINATED STRINGS.";
4677 static const int kEmbeddedExtensionSourceValidLen = 34; 4689 static const int kEmbeddedExtensionSourceValidLen = 34;
4678 4690
4679 4691
4680 THREADED_TEST(ExtensionMissingSourceLength) { 4692 THREADED_TEST(ExtensionMissingSourceLength) {
4681 v8::HandleScope handle_scope; 4693 v8::HandleScope handle_scope;
4682 v8::RegisterExtension(new Extension("srclentest_fail", 4694 v8::RegisterExtension(new Extension("srclentest_fail",
4683 kEmbeddedExtensionSource)); 4695 kEmbeddedExtensionSource));
(...skipping 12760 matching lines...) Expand 10 before | Expand all | Expand 10 after
17444 17456
17445 i::Semaphore* sem_; 17457 i::Semaphore* sem_;
17446 volatile int sem_value_; 17458 volatile int sem_value_;
17447 }; 17459 };
17448 17460
17449 17461
17450 THREADED_TEST(SemaphoreInterruption) { 17462 THREADED_TEST(SemaphoreInterruption) {
17451 ThreadInterruptTest().RunTest(); 17463 ThreadInterruptTest().RunTest();
17452 } 17464 }
17453 #endif // WIN32 17465 #endif // WIN32
OLDNEW
« no previous file with comments | « src/objects.h ('k') | test/cctest/test-strings.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698