Index: extensions/renderer/app_runtime_custom_bindings.cc |
diff --git a/extensions/renderer/app_runtime_custom_bindings.cc b/extensions/renderer/app_runtime_custom_bindings.cc |
index 4302590d0a2cffc770bcab352000bee5da98cb7f..34e4c175d16d93d0e8144c46c76fabb43158a0da 100644 |
--- a/extensions/renderer/app_runtime_custom_bindings.cc |
+++ b/extensions/renderer/app_runtime_custom_bindings.cc |
@@ -6,6 +6,7 @@ |
#include "base/bind.h" |
#include "base/strings/string_number_conversions.h" |
+#include "extensions/renderer/v8_maybe_helpers.h" |
#include "third_party/WebKit/public/platform/WebCString.h" |
#include "third_party/WebKit/public/platform/WebString.h" |
#include "third_party/WebKit/public/web/WebBlob.h" |
@@ -34,8 +35,10 @@ void SerializeToString(const v8::FunctionCallbackInfo<v8::Value>& args) { |
WebString data_webstring = data.toString(); |
std::string v = std::string(data_webstring.utf8()); |
- args.GetReturnValue().Set( |
- v8::String::NewFromUtf8(args.GetIsolate(), v.c_str())); |
+ if (v.size() >= v8::String::kMaxLength) |
+ return; |
+ args.GetReturnValue().Set(extensions::ToV8String(args.GetIsolate(), |
+ v.c_str())); |
} |
void CreateBlob(const v8::FunctionCallbackInfo<v8::Value>& args) { |