Commit f4006fba authored by Alfonso Castaño's avatar Alfonso Castaño Committed by Commit Bot

Custom stringification for Trusted Type objects in V8 (ValueMirror)

Since V8 and Renderer CL cannot be glued a separate CL includes the changes to ThreadDebugger:
https://chromium-review.googlesource.com/c/chromium/src/+/2494761

Screenshot: https://i.imgur.com/rTIchch.png, https://i.imgur.com/knMTmMm.png
Bug: chromium:1048143
Change-Id: I7551303f34f83fd4f8ccd134c87d34028a3f6c4d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2494706
Commit-Queue: Alfonso Castaño <alcastano@google.com>
Reviewed-by: 's avatarYang Guo <yangguo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#70791}
parent 44f46def
......@@ -1738,6 +1738,18 @@ String16 descriptionForNode(v8::Local<v8::Context> context,
return description;
}
String16 descriptionForTrustedType(v8::Local<v8::Context> context,
v8::Local<v8::Value> value) {
if (!value->IsObject()) return String16();
v8::Local<v8::Object> object = value.As<v8::Object>();
v8::Isolate* isolate = context->GetIsolate();
v8::TryCatch tryCatch(isolate);
v8::Local<v8::String> description;
if (!object->ToString(context).ToLocal(&description)) return String16();
return toProtocolString(isolate, description);
}
std::unique_ptr<ValueMirror> clientMirror(v8::Local<v8::Context> context,
v8::Local<v8::Value> value,
const String16& subtype) {
......@@ -1746,6 +1758,10 @@ std::unique_ptr<ValueMirror> clientMirror(v8::Local<v8::Context> context,
return std::make_unique<ObjectMirror>(value, subtype,
descriptionForNode(context, value));
}
if (subtype == "trustedtype") {
return std::make_unique<ObjectMirror>(
value, subtype, descriptionForTrustedType(context, value));
}
if (subtype == "error") {
return std::make_unique<ObjectMirror>(
value, RemoteObject::SubtypeEnum::Error,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment