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

Unified Diff: Source/bindings/v8/custom/V8InspectorFrontendHostCustom.cpp

Issue 74133005: Remove several uses of toWebCoreStringWithNullCheck(v8::Handle<v8::Value>) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 1 month 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
Index: Source/bindings/v8/custom/V8InspectorFrontendHostCustom.cpp
diff --git a/Source/bindings/v8/custom/V8InspectorFrontendHostCustom.cpp b/Source/bindings/v8/custom/V8InspectorFrontendHostCustom.cpp
index 8e487b8433771bc4527ac707a5a88f903218c140..e5e123902b927951b6639641d1a7e8a10a6f3e35 100644
--- a/Source/bindings/v8/custom/V8InspectorFrontendHostCustom.cpp
+++ b/Source/bindings/v8/custom/V8InspectorFrontendHostCustom.cpp
@@ -56,7 +56,7 @@ void V8InspectorFrontendHost::portMethodCustom(const v8::FunctionCallbackInfo<v8
{
}
-static void populateContextMenuItems(v8::Local<v8::Array>& itemArray, ContextMenu& menu)
+static bool populateContextMenuItems(v8::Local<v8::Array>& itemArray, ContextMenu& menu)
{
for (size_t i = 0; i < itemArray->Length(); ++i) {
v8::Local<v8::Object> item = v8::Local<v8::Object>::Cast(itemArray->Get(i));
@@ -77,11 +77,13 @@ static void populateContextMenuItems(v8::Local<v8::Array>& itemArray, ContextMen
} else if (typeString == "subMenu" && subItems->IsArray()) {
ContextMenu subMenu;
v8::Local<v8::Array> subItemsArray = v8::Local<v8::Array>::Cast(subItems);
- populateContextMenuItems(subItemsArray, subMenu);
+ if (!populateContextMenuItems(subItemsArray, subMenu))
+ return false;
+ V8TRYCATCH_FOR_V8STRINGRESOURCE_RETURN(V8StringResource<WithNullCheck>, labelString, label, false);
ContextMenuItem item(SubmenuType,
- ContextMenuItemCustomTagNoAction,
- toWebCoreStringWithNullCheck(label),
- &subMenu);
+ ContextMenuItemCustomTagNoAction,
+ labelString,
+ &subMenu);
menu.appendItem(item);
} else {
ContextMenuAction typedId = static_cast<ContextMenuAction>(ContextMenuItemBaseCustomTag + id->ToInt32()->Value());
@@ -93,6 +95,7 @@ static void populateContextMenuItems(v8::Local<v8::Array>& itemArray, ContextMen
menu.appendItem(menuItem);
}
}
+ return true;
}
void V8InspectorFrontendHost::showContextMenuMethodCustom(const v8::FunctionCallbackInfo<v8::Value>& info)
@@ -110,7 +113,8 @@ void V8InspectorFrontendHost::showContextMenuMethodCustom(const v8::FunctionCall
v8::Local<v8::Array> array = v8::Local<v8::Array>::Cast(info[1]);
ContextMenu menu;
- populateContextMenuItems(array, menu);
+ if (!populateContextMenuItems(array, menu))
+ return;
InspectorFrontendHost* frontendHost = V8InspectorFrontendHost::toNative(info.Holder());
Vector<ContextMenuItem> items = menu.items();

Powered by Google App Engine
This is Rietveld 408576698