Commit 9746319d authored by Joel Einbinder's avatar Joel Einbinder Committed by Commit Bot

DevTools: Don't label top level completions as from the first prototype

In an object like {abc: 123}, the property 'abc' was mistakenly labeled
as being from the Object prototype.

ScreenShot: https://i.imgur.com/bdIWNDt.png

Bug: none

Change-Id: I85aed6eaa6561afbc54f52115ec9bf539fd345eb
Reviewed-on: https://chromium-review.googlesource.com/c/1460180
Commit-Queue: Joel Einbinder <einbinder@chromium.org>
Reviewed-by: default avatarErik Luo <luoe@chromium.org>
Cr-Commit-Position: refs/heads/master@{#630533}
parent ffa9a586
......@@ -413,7 +413,8 @@ ObjectUI.JavaScriptAutocomplete = class {
const group = {items: [], __proto__: null};
try {
if (typeof o === 'object' && o.constructor && o.constructor.name)
if (typeof o === 'object' && Object.prototype.hasOwnProperty.call(o, 'constructor') && o.constructor &&
o.constructor.name)
group.title = o.constructor.name;
} catch (ee) {
// we could break upon cross origin check.
......
......@@ -3,7 +3,6 @@ Tests completions prototype chain and scope variables.
Completions for objectC.:
{
priority : 2
subtitle : "C"
text : "instanceMember"
}
{
......@@ -12,6 +11,7 @@ Completions for objectC.:
}
{
priority : 3
subtitle : "C"
text : "EPriorityMember"
}
{
......@@ -39,7 +39,6 @@ Completions for objectC.:
Completions for prefix:
{
priority : 4
subtitle : "Window"
text : "prefixA"
}
{
......
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