Chromium Code Reviews| Index: third_party/WebKit/Source/devtools/front_end/console/ConsoleContextSelector.js |
| diff --git a/third_party/WebKit/Source/devtools/front_end/console/ConsoleContextSelector.js b/third_party/WebKit/Source/devtools/front_end/console/ConsoleContextSelector.js |
| index a7436d5c505ba9c66b9712175e72f9dd6e057f53..aebb00f4cc4785d4dcde21709cd03ab96ba6531f 100644 |
| --- a/third_party/WebKit/Source/devtools/front_end/console/ConsoleContextSelector.js |
| +++ b/third_party/WebKit/Source/devtools/front_end/console/ConsoleContextSelector.js |
| @@ -33,21 +33,32 @@ Console.ConsoleContextSelector = class { |
| * @return {string} |
| */ |
| _titleFor(executionContext) { |
| - var result; |
| - if (executionContext.isDefault) { |
| - if (executionContext.frameId) { |
| - var resourceTreeModel = SDK.ResourceTreeModel.fromTarget(executionContext.target()); |
| - var frame = resourceTreeModel && resourceTreeModel.frameForId(executionContext.frameId); |
| - result = frame ? frame.displayName() : executionContext.label(); |
| - } else { |
| - result = executionContext.target().decorateLabel(executionContext.label()); |
| + var target = executionContext.target(); |
|
pfeldman
2017/01/21 02:21:24
According to the new guidelines, you should use co
pfeldman
2017/01/21 02:22:49
My bad, it should be let.
|
| + var depth = 0; |
| + var label = executionContext.label() ? target.decorateLabel(executionContext.label()) : ''; |
| + if (!executionContext.isDefault) |
| + depth++; |
| + if (executionContext.frameId) { |
| + var resourceTreeModel = SDK.ResourceTreeModel.fromTarget(target); |
| + var frame = resourceTreeModel && resourceTreeModel.frameForId(executionContext.frameId); |
| + if (frame) { |
| + label = label || frame.displayName(); |
| + while (frame.parentFrame) { |
| + depth++; |
| + frame = frame.parentFrame; |
| + } |
| } |
| - } else { |
| - result = '\u00a0\u00a0\u00a0\u00a0' + (executionContext.label() || executionContext.origin); |
| + } |
| + label = label || executionContext.origin; |
| + while (target.parentTarget()) { |
| + if (target.parentTarget().hasJSCapability()) |
|
pfeldman
2017/01/21 02:27:31
Special case service workers?
dgozman
2017/01/23 19:20:35
Done.
|
| + depth++; |
| + target = target.parentTarget(); |
| } |
| + var prefix = new Array(4 * depth + 1).join('\u00a0'); |
| var maxLength = 50; |
| - return result.trimMiddle(maxLength); |
| + return (prefix + label).trimMiddle(maxLength); |
| } |
| /** |