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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/api.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-api.cc
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
index 8f96a4a9d1637784c0cc1175bfb72a6af7a993f3..5debeeb33ed98465436e364e4c778e4e7647234f 100755
--- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc
@@ -14315,6 +14315,18 @@ static v8::Handle<Value> GetCallingContextCallback(const v8::Arguments& args) {
}
+THREADED_TEST(GetCurrentContextWhenNotInContext) {
+ i::Isolate* isolate = i::Isolate::Current();
+ CHECK(isolate != NULL);
+ CHECK(isolate->context() == NULL);
+ v8::Isolate* v8_isolate = reinterpret_cast<v8::Isolate*>(isolate);
+ v8::HandleScope scope(v8_isolate);
+ // The following should not crash, but return an empty handle.
+ v8::Local<v8::Context> current = v8_isolate->GetCurrentContext();
+ CHECK(current.IsEmpty());
+}
+
+
THREADED_TEST(GetCallingContext) {
v8::Isolate* isolate = v8::Isolate::GetCurrent();
v8::HandleScope scope(isolate);
« 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