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

Unified Diff: test/cctest/test-api.cc

Issue 16073010: ReturnValue::Set needs to check for empty handles (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 7 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 | « include/v8.h ('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 2eb47adf1102a4df3b77ef8246620fb13685c5c0..9eecf945b4d3f991d969b5f53857693a5c8c0b3f 100644
--- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc
@@ -1029,6 +1029,7 @@ static const double kFastReturnValueDouble = 2.7;
// variable return values
static bool fast_return_value_bool = false;
static bool fast_return_value_void_is_null = false;
+static bool fast_return_value_object_is_empty = false;
template<>
void FastReturnValueCallback<int32_t>(
@@ -1072,7 +1073,9 @@ void FastReturnValueCallback<void>(
template<>
void FastReturnValueCallback<Object>(
const v8::FunctionCallbackInfo<v8::Value>& info) {
- info.GetReturnValue().Set(Object::New());
+ v8::Handle<v8::Object> object;
+ if (!fast_return_value_object_is_empty) object = Object::New();
+ info.GetReturnValue().Set(object);
}
template<typename T>
@@ -1119,8 +1122,13 @@ THREADED_TEST(FastReturnValues) {
CHECK(value->IsUndefined());
}
}
+ // check handles
+ fast_return_value_object_is_empty = false;
value = TestFastReturnValues<Object>();
CHECK(value->IsObject());
+ fast_return_value_object_is_empty = true;
+ value = TestFastReturnValues<Object>();
+ CHECK(value->IsUndefined());
}
« no previous file with comments | « include/v8.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698