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

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

Issue 16943006: V8 API: Add a missing NULL check into Isolate::GetCurrentContext(). (Closed) Base URL: https://chromium.googlesource.com/external/v8.git@master
Patch Set: Created 7 years, 6 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
« no previous file with comments | « src/api.cc ('k') | no next file » | 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 14297 matching lines...) Expand 10 before | Expand all | Expand 10 after
14308 static v8::Handle<Value> GetCallingContextCallback(const v8::Arguments& args) { 14308 static v8::Handle<Value> GetCallingContextCallback(const v8::Arguments& args) {
14309 ApiTestFuzzer::Fuzz(); 14309 ApiTestFuzzer::Fuzz();
14310 CHECK(Context::GetCurrent() == calling_context0); 14310 CHECK(Context::GetCurrent() == calling_context0);
14311 CHECK(args.GetIsolate()->GetCurrentContext() == calling_context0); 14311 CHECK(args.GetIsolate()->GetCurrentContext() == calling_context0);
14312 CHECK(Context::GetCalling() == calling_context1); 14312 CHECK(Context::GetCalling() == calling_context1);
14313 CHECK(Context::GetEntered() == calling_context2); 14313 CHECK(Context::GetEntered() == calling_context2);
14314 return v8::Integer::New(42); 14314 return v8::Integer::New(42);
14315 } 14315 }
14316 14316
14317 14317
14318 THREADED_TEST(GetCurrentContextWhenNotInContext) {
14319 i::Isolate* isolate = i::Isolate::Current();
14320 CHECK(isolate != NULL);
14321 CHECK(isolate->context() == NULL);
14322 v8::Isolate* v8_isolate = reinterpret_cast<v8::Isolate*>(isolate);
14323 v8::HandleScope scope(v8_isolate);
14324 // The following should not crash, but return an empty handle.
14325 v8::Local<v8::Context> current = v8_isolate->GetCurrentContext();
14326 CHECK(current.IsEmpty());
14327 }
14328
14329
14318 THREADED_TEST(GetCallingContext) { 14330 THREADED_TEST(GetCallingContext) {
14319 v8::Isolate* isolate = v8::Isolate::GetCurrent(); 14331 v8::Isolate* isolate = v8::Isolate::GetCurrent();
14320 v8::HandleScope scope(isolate); 14332 v8::HandleScope scope(isolate);
14321 14333
14322 Local<Context> calling_context0(Context::New(isolate)); 14334 Local<Context> calling_context0(Context::New(isolate));
14323 Local<Context> calling_context1(Context::New(isolate)); 14335 Local<Context> calling_context1(Context::New(isolate));
14324 Local<Context> calling_context2(Context::New(isolate)); 14336 Local<Context> calling_context2(Context::New(isolate));
14325 ::calling_context0 = calling_context0; 14337 ::calling_context0 = calling_context0;
14326 ::calling_context1 = calling_context1; 14338 ::calling_context1 = calling_context1;
14327 ::calling_context2 = calling_context2; 14339 ::calling_context2 = calling_context2;
(...skipping 5125 matching lines...) Expand 10 before | Expand all | Expand 10 after
19453 i::Semaphore* sem_; 19465 i::Semaphore* sem_;
19454 volatile int sem_value_; 19466 volatile int sem_value_;
19455 }; 19467 };
19456 19468
19457 19469
19458 THREADED_TEST(SemaphoreInterruption) { 19470 THREADED_TEST(SemaphoreInterruption) {
19459 ThreadInterruptTest().RunTest(); 19471 ThreadInterruptTest().RunTest();
19460 } 19472 }
19461 19473
19462 #endif // WIN32 19474 #endif // WIN32
OLDNEW
« no previous file with comments | « src/api.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698