Reviewers: ulan,

Description:
Protect against API abuse.

This makes Chrome's --single-process work again, but the real solution
is to pass an Isolate explicitly and fixing things on the Chrome side
=> follow-up CLs.

Please review this at https://codereview.chromium.org/239513006/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files (+6, -0 lines):
  M src/api.cc


Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index fde3b5d05078a26a443d31ab13cf1c00cd9d283b..2d850f755af3afc3c7ca16f23d6bd64c3c7909ad 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -6291,12 +6291,16 @@ void V8::SetCaptureStackTraceForUncaughtExceptions(

 void V8::SetCounterFunction(CounterLookupCallback callback) {
   i::Isolate* isolate = i::Isolate::UncheckedCurrent();
+  // TODO(svenpanne) The Isolate should really be a parameter.
+  if (isolate == NULL) return;
   isolate->stats_table()->SetCounterFunction(callback);
 }


 void V8::SetCreateHistogramFunction(CreateHistogramCallback callback) {
   i::Isolate* isolate = i::Isolate::UncheckedCurrent();
+  // TODO(svenpanne) The Isolate should really be a parameter.
+  if (isolate == NULL) return;
   isolate->stats_table()->SetCreateHistogramFunction(callback);
   isolate->InitializeLoggingAndCounters();
   isolate->counters()->ResetHistograms();
@@ -6305,6 +6309,8 @@ void V8::SetCreateHistogramFunction(CreateHistogramCallback callback) {

void V8::SetAddHistogramSampleFunction(AddHistogramSampleCallback callback) {
   i::Isolate* isolate = i::Isolate::UncheckedCurrent();
+  // TODO(svenpanne) The Isolate should really be a parameter.
+  if (isolate == NULL) return;
   isolate->stats_table()->
       SetAddHistogramSampleFunction(callback);
 }


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to