Commit ce609dba authored by Alexey Kozyatinskiy's avatar Alexey Kozyatinskiy Committed by Commit Bot

[inspector] injected script source should call less user code

If user redefines some getter on node then it is too easy to detect our
nice tools. Let's make it a little harder.

R=dgozman@chromium.org

Bug: chromium:795547
Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel
Change-Id: Ibfee850949124d056a443d869ea67a71abd71d24
Reviewed-on: https://chromium-review.googlesource.com/845299Reviewed-by: 's avatarDmitry Gozman <dgozman@chromium.org>
Commit-Queue: Aleksey Kozyatinskiy <kozyatinskiy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#50314}
parent c0ba6d17
......@@ -586,15 +586,20 @@ InjectedScript.prototype = {
if (subtype === "node") {
var description = "";
if (obj.nodeName)
description = obj.nodeName.toLowerCase();
else if (obj.constructor)
description = obj.constructor.name.toLowerCase();
var nodeName = InjectedScriptHost.getProperty(obj, "nodeName");
if (nodeName) {
description = nodeName.toLowerCase();
} else {
var constructor = InjectedScriptHost.getProperty(obj, "constructor");
if (constructor)
description = (InjectedScriptHost.getProperty(constructor, "name") || "").toLowerCase();
}
switch (obj.nodeType) {
case 1 /* Node.ELEMENT_NODE */:
description += obj.id ? "#" + obj.id : "";
var className = obj.className;
var id = InjectedScriptHost.getProperty(obj, "id");
description += id ? "#" + id : "";
var className = InjectedScriptHost.getProperty(obj, "className");
description += (className && typeof className === "string") ? "." + className.trim().replace(/\s+/g, ".") : "";
break;
case 10 /*Node.DOCUMENT_TYPE_NODE */:
......
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