Ensure default isolate is present in Add/RemoveCallCompletedCallback.
authordanno@chromium.org <danno@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Wed, 4 Apr 2012 14:28:00 +0000 (14:28 +0000)
committerdanno@chromium.org <danno@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Wed, 4 Apr 2012 14:28:00 +0000 (14:28 +0000)
R=ulan@chromium.org,pliard@chromium.org
BUG=ui_tests don't crash in Chrome

Review URL: https://chromiumcodereview.appspot.com/9979003

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@11225 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/api.cc

index ee106a9..3c54b4b 100644 (file)
@@ -5279,6 +5279,7 @@ void V8::RemoveMemoryAllocationCallback(MemoryAllocationCallback callback) {
 
 void V8::AddCallCompletedCallback(CallCompletedCallback callback) {
   if (callback == NULL) return;
+  i::Isolate::EnsureDefaultIsolate();
   i::Isolate* isolate = i::Isolate::Current();
   if (IsDeadCheck(isolate, "v8::V8::AddLeaveScriptCallback()")) return;
   i::V8::AddCallCompletedCallback(callback);
@@ -5286,6 +5287,7 @@ void V8::AddCallCompletedCallback(CallCompletedCallback callback) {
 
 
 void V8::RemoveCallCompletedCallback(CallCompletedCallback callback) {
+  i::Isolate::EnsureDefaultIsolate();
   i::Isolate* isolate = i::Isolate::Current();
   if (IsDeadCheck(isolate, "v8::V8::RemoveLeaveScriptCallback()")) return;
   i::V8::RemoveCallCompletedCallback(callback);