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

Unified Diff: Source/bindings/core/v8/custom/V8DevToolsHostCustom.cpp

Issue 1067203002: bindings: Use Maybe APIs in V8DevToolsHostCustom (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 8 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/core/v8/custom/V8DevToolsHostCustom.cpp
diff --git a/Source/bindings/core/v8/custom/V8DevToolsHostCustom.cpp b/Source/bindings/core/v8/custom/V8DevToolsHostCustom.cpp
index 39798a18e30305a50e51b253fe24d00f010955ba..fa8fb13ab2e81b44d235d5167d7b43d21aacf8d7 100644
--- a/Source/bindings/core/v8/custom/V8DevToolsHostCustom.cpp
+++ b/Source/bindings/core/v8/custom/V8DevToolsHostCustom.cpp
@@ -58,14 +58,22 @@ void V8DevToolsHost::platformMethodCustom(const v8::FunctionCallbackInfo<v8::Val
static bool populateContextMenuItems(const v8::Local<v8::Array>& itemArray, ContextMenu& menu, v8::Isolate* isolate)
{
+ v8::Local<v8::Context> context = isolate->GetCurrentContext();
for (size_t i = 0; i < itemArray->Length(); ++i) {
- v8::Local<v8::Object> item = v8::Local<v8::Object>::Cast(itemArray->Get(i));
- v8::Local<v8::Value> type = item->Get(v8AtomicString(isolate, "type"));
- v8::Local<v8::Value> id = item->Get(v8AtomicString(isolate, "id"));
- v8::Local<v8::Value> label = item->Get(v8AtomicString(isolate, "label"));
- v8::Local<v8::Value> enabled = item->Get(v8AtomicString(isolate, "enabled"));
- v8::Local<v8::Value> checked = item->Get(v8AtomicString(isolate, "checked"));
- v8::Local<v8::Value> subItems = item->Get(v8AtomicString(isolate, "subItems"));
+ v8::Local<v8::Object> item = itemArray->Get(context, i).ToLocalChecked().As<v8::Object>();
+ v8::Local<v8::Value> type;
+ v8::Local<v8::Value> id;
+ v8::Local<v8::Value> label;
+ v8::Local<v8::Value> enabled;
+ v8::Local<v8::Value> checked;
+ v8::Local<v8::Value> subItems;
+ if (!item->Get(context, v8AtomicString(isolate, "type")).ToLocal(&type)
+ || !item->Get(context, v8AtomicString(isolate, "id")).ToLocal(&id)
+ || !item->Get(context, v8AtomicString(isolate, "label")).ToLocal(&label)
+ || !item->Get(context, v8AtomicString(isolate, "enabled")).ToLocal(&enabled)
+ || !item->Get(context, v8AtomicString(isolate, "checked")).ToLocal(&checked)
+ || !item->Get(context, v8AtomicString(isolate, "subItems")).ToLocal(&subItems))
+ return false;
if (!type->IsString())
continue;
String typeString = toCoreStringWithNullCheck(type.As<v8::String>());
@@ -88,7 +96,10 @@ static bool populateContextMenuItems(const v8::Local<v8::Array>& itemArray, Cont
&subMenu);
menu.appendItem(item);
} else {
- ContextMenuAction typedId = static_cast<ContextMenuAction>(ContextMenuItemBaseCustomTag + id->ToInt32(isolate)->Value());
+ int32_t int32Id;
+ if (!v8Call(id->Int32Value(context), int32Id))
+ return false;
+ ContextMenuAction typedId = static_cast<ContextMenuAction>(ContextMenuItemBaseCustomTag + int32Id);
TOSTRING_DEFAULT(V8StringResource<TreatNullAsNullString>, labelString, label, false);
ContextMenuItem menuItem((typeString == "checkbox" ? CheckableActionType : ActionType), typedId, labelString, String());
if (checked->IsBoolean())
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698