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

Unified Diff: extensions/renderer/app_runtime_custom_bindings.cc

Issue 1167423002: Use V8 Maybe APIs in extensions/renderer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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 | « extensions/renderer/api_activity_logger.cc ('k') | extensions/renderer/app_window_custom_bindings.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« no previous file with comments | « extensions/renderer/api_activity_logger.cc ('k') | extensions/renderer/app_window_custom_bindings.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698