| Index: extensions/renderer/console.cc
|
| diff --git a/extensions/renderer/console.cc b/extensions/renderer/console.cc
|
| index 172c5915bd06430c3a63d8684f6beb2d98ada31d..110288e999293b0095e6ad967b692e105d6f9ded 100644
|
| --- a/extensions/renderer/console.cc
|
| +++ b/extensions/renderer/console.cc
|
| @@ -14,6 +14,7 @@
|
| #include "content/public/renderer/render_view_visitor.h"
|
| #include "extensions/renderer/dispatcher.h"
|
| #include "extensions/renderer/extension_helper.h"
|
| +#include "extensions/renderer/v8_maybe_helpers.h"
|
| #include "third_party/WebKit/public/web/WebConsoleMessage.h"
|
| #include "third_party/WebKit/public/web/WebFrame.h"
|
| #include "third_party/WebKit/public/web/WebView.h"
|
| @@ -82,12 +83,17 @@ void BindLogMethod(v8::Isolate* isolate,
|
| v8::Local<v8::Object> target,
|
| const std::string& name,
|
| LogMethod log_method) {
|
| + CHECK(name.size() < v8::String::kMaxLength);
|
| v8::Local<v8::FunctionTemplate> tmpl = v8::FunctionTemplate::New(
|
| isolate,
|
| &BoundLogMethodCallback,
|
| v8::External::New(isolate, reinterpret_cast<void*>(log_method)));
|
| - target->Set(v8::String::NewFromUtf8(isolate, name.c_str()),
|
| - tmpl->GetFunction());
|
| + v8::Local<v8::String> property = ToV8String(isolate, name.c_str());
|
| + v8::Local<v8::Context> context = isolate->GetCurrentContext();
|
| + v8::Local<v8::Function> function;
|
| + if (!tmpl->GetFunction(context).ToLocal(&function))
|
| + NOTREACHED();
|
| + SetProperty(context, target, property, function);
|
| }
|
|
|
| } // namespace
|
|
|