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

Move descriptionForNode to Blink and fix case bug

This CL moves the logic for generation the description of Node objects to Blink.

Previous CLs: https://chromium-review.googlesource.com/c/v8/v8/+/2502342, https://chromium-review.googlesource.com/c/chromium/src/+/2502589

Fixed: chromium:1127115
Bug: chromium:1048143,chromium:1127115
Change-Id: Ie250cfff9eb45f5b755d7d13871d3039a8ac909b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2504259
Commit-Queue: Alfonso Castaño <alcastano@google.com>
Reviewed-by: default avatarSigurd Schneider <sigurds@chromium.org>
Reviewed-by: default avatarFredrik Söderquist <fs@opera.com>
Reviewed-by: default avatarYang Guo <yangguo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#828160}
parent 7c9835aa
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include "third_party/blink/renderer/bindings/core/v8/v8_trusted_html.h" #include "third_party/blink/renderer/bindings/core/v8/v8_trusted_html.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_trusted_script.h" #include "third_party/blink/renderer/bindings/core/v8/v8_trusted_script.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_trusted_script_url.h" #include "third_party/blink/renderer/bindings/core/v8/v8_trusted_script_url.h"
#include "third_party/blink/renderer/core/dom/element.h"
#include "third_party/blink/renderer/core/frame/local_dom_window.h" #include "third_party/blink/renderer/core/frame/local_dom_window.h"
#include "third_party/blink/renderer/core/inspector/console_message.h" #include "third_party/blink/renderer/core/inspector/console_message.h"
#include "third_party/blink/renderer/core/inspector/inspector_dom_debugger_agent.h" #include "third_party/blink/renderer/core/inspector/inspector_dom_debugger_agent.h"
...@@ -206,6 +207,43 @@ ThreadDebugger::descriptionForValueSubtype(v8::Local<v8::Context> context, ...@@ -206,6 +207,43 @@ ThreadDebugger::descriptionForValueSubtype(v8::Local<v8::Context> context,
TrustedScriptURL* trusted_script_url = TrustedScriptURL* trusted_script_url =
V8TrustedScriptURL::ToImplWithTypeCheck(isolate_, value); V8TrustedScriptURL::ToImplWithTypeCheck(isolate_, value);
return ToV8InspectorStringBuffer(trusted_script_url->toString()); return ToV8InspectorStringBuffer(trusted_script_url->toString());
} else if (V8Node::HasInstance(value, isolate_)) {
Node* node = V8Node::ToImplWithTypeCheck(isolate_, value);
StringBuilder description;
switch (node->getNodeType()) {
case Node::kElementNode: {
const auto* element = To<blink::Element>(node);
description.Append(element->TagQName().ToString());
const AtomicString& id = element->GetIdAttribute();
if (!id.IsEmpty()) {
description.Append('#');
description.Append(id);
}
if (element->HasClass()) {
auto element_class_names = element->ClassNames();
auto n_classes = element_class_names.size();
for (unsigned i = 0; i < n_classes; ++i) {
description.Append('.');
description.Append(element_class_names[i]);
}
}
break;
}
case Node::kDocumentTypeNode: {
description.Append("<!DOCTYPE ");
description.Append(node->nodeName());
description.Append('>');
break;
}
default: {
description.Append(node->nodeName());
break;
}
}
DCHECK(description.length());
return ToV8InspectorStringBuffer(description.ToString());
} }
return nullptr; return nullptr;
} }
......
...@@ -5980,10 +5980,6 @@ crbug.com/997202 [ Mac ] virtual/transform-interop/external/wpt/css/css-transfor ...@@ -5980,10 +5980,6 @@ crbug.com/997202 [ Mac ] virtual/transform-interop/external/wpt/css/css-transfor
crbug.com/1144273 http/tests/devtools/sources/debugger-ui/continue-to-location-markers-in-top-level-function.js [ Pass Failure Timeout ] crbug.com/1144273 http/tests/devtools/sources/debugger-ui/continue-to-location-markers-in-top-level-function.js [ Pass Failure Timeout ]
crbug.com/1145742 [ Fuchsia ] virtual/stable/http/tests/navigation/location-assign-adds-history-item.html [ Pass Crash Timeout ] crbug.com/1145742 [ Fuchsia ] virtual/stable/http/tests/navigation/location-assign-adds-history-item.html [ Pass Crash Timeout ]
# Disabled until CL with fix gets merged https://chromium-review.googlesource.com/c/chromium/src/+/2504259
crbug.com/1127115 inspector-protocol/runtime/runtime-console-log-node-letter-case.js [ Failure ]
crbug.com/1127115 inspector-protocol/runtime/runtime-console-log-node-document-type.js [ Failure ]
# Sheriff 2020-11-06 # Sheriff 2020-11-06
crbug.com/1146560 [ Win ] fast/canvas/color-space/canvas-createImageBitmap-e_srgb.html [ Failure Pass ] crbug.com/1146560 [ Win ] fast/canvas/color-space/canvas-createImageBitmap-e_srgb.html [ Failure Pass ]
......
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