Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(40)

Unified Diff: third_party/WebKit/Source/devtools/front_end/components/ObjectPropertiesSection.js

Issue 2112673003: [DevTools] Move suspended generator location to internal properties (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed comments Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/devtools/front_end/components/ObjectPropertiesSection.js
diff --git a/third_party/WebKit/Source/devtools/front_end/components/ObjectPropertiesSection.js b/third_party/WebKit/Source/devtools/front_end/components/ObjectPropertiesSection.js
index 5f9d406b81aa8eec22eed1aa4f21b687c513ea82..8a90167861e000ce05cd0598db3064392ac35312 100644
--- a/third_party/WebKit/Source/devtools/front_end/components/ObjectPropertiesSection.js
+++ b/third_party/WebKit/Source/devtools/front_end/components/ObjectPropertiesSection.js
@@ -29,18 +29,19 @@
* @extends {TreeOutlineInShadow}
* @param {!WebInspector.RemoteObject} object
* @param {?string|!Element=} title
+ * @param {!WebInspector.Linkifier=} linkifier
* @param {?string=} emptyPlaceholder
* @param {boolean=} ignoreHasOwnProperty
* @param {!Array.<!WebInspector.RemoteObjectProperty>=} extraProperties
*/
-WebInspector.ObjectPropertiesSection = function(object, title, emptyPlaceholder, ignoreHasOwnProperty, extraProperties)
+WebInspector.ObjectPropertiesSection = function(object, title, linkifier, emptyPlaceholder, ignoreHasOwnProperty, extraProperties)
{
this._object = object;
this._editable = true;
TreeOutlineInShadow.call(this);
this.hideOverflow();
this.setFocusable(false);
- this._objectTreeElement = new WebInspector.ObjectPropertiesSection.RootElement(object, emptyPlaceholder, ignoreHasOwnProperty, extraProperties);
+ this._objectTreeElement = new WebInspector.ObjectPropertiesSection.RootElement(object, linkifier, emptyPlaceholder, ignoreHasOwnProperty, extraProperties);
this.appendChild(this._objectTreeElement);
if (typeof title === "string" || !title)
this.element.createChild("span").textContent = title || "";
@@ -58,10 +59,11 @@ WebInspector.ObjectPropertiesSection._arrayLoadThreshold = 100;
/**
* @param {!WebInspector.RemoteObject} object
+ * @param {!WebInspector.Linkifier=} linkifier
* @param {boolean=} skipProto
* @return {!Element}
*/
-WebInspector.ObjectPropertiesSection.defaultObjectPresentation = function(object, skipProto)
+WebInspector.ObjectPropertiesSection.defaultObjectPresentation = function(object, linkifier, skipProto)
{
var componentRoot = createElementWithClass("span", "source-code");
var shadowRoot = WebInspector.createShadowRootWithCoreStyles(componentRoot, "components/objectValue.css");
@@ -69,7 +71,7 @@ WebInspector.ObjectPropertiesSection.defaultObjectPresentation = function(object
if (!object.hasChildren)
return componentRoot;
- var objectPropertiesSection = new WebInspector.ObjectPropertiesSection(object, componentRoot);
+ var objectPropertiesSection = new WebInspector.ObjectPropertiesSection(object, componentRoot, linkifier);
objectPropertiesSection.editable = false;
if (skipProto)
objectPropertiesSection.skipProto();
@@ -150,11 +152,12 @@ WebInspector.ObjectPropertiesSection.CompareProperties = function(propertyA, pro
* @constructor
* @extends {TreeElement}
* @param {!WebInspector.RemoteObject} object
+ * @param {!WebInspector.Linkifier=} linkifier
* @param {?string=} emptyPlaceholder
* @param {boolean=} ignoreHasOwnProperty
* @param {!Array.<!WebInspector.RemoteObjectProperty>=} extraProperties
*/
-WebInspector.ObjectPropertiesSection.RootElement = function(object, emptyPlaceholder, ignoreHasOwnProperty, extraProperties)
+WebInspector.ObjectPropertiesSection.RootElement = function(object, linkifier, emptyPlaceholder, ignoreHasOwnProperty, extraProperties)
{
this._object = object;
this._extraProperties = extraProperties || [];
@@ -166,6 +169,7 @@ WebInspector.ObjectPropertiesSection.RootElement = function(object, emptyPlaceho
this.selectable = false;
this.toggleOnClick = true;
this.listItemElement.classList.add("object-properties-section-root-element");
+ this._linkifier = linkifier;
}
WebInspector.ObjectPropertiesSection.RootElement.prototype = {
@@ -194,7 +198,7 @@ WebInspector.ObjectPropertiesSection.RootElement.prototype = {
onpopulate: function()
{
- WebInspector.ObjectPropertyTreeElement._populate(this, this._object, !!this.treeOutline._skipProto, this._emptyPlaceholder, this._ignoreHasOwnProperty, this._extraProperties);
+ WebInspector.ObjectPropertyTreeElement._populate(this, this._object, !!this.treeOutline._skipProto, this._linkifier, this._emptyPlaceholder, this._ignoreHasOwnProperty, this._extraProperties);
},
__proto__: TreeElement.prototype
@@ -204,8 +208,9 @@ WebInspector.ObjectPropertiesSection.RootElement.prototype = {
* @constructor
* @extends {TreeElement}
* @param {!WebInspector.RemoteObjectProperty} property
+ * @param {!WebInspector.Linkifier=} linkifier
*/
-WebInspector.ObjectPropertyTreeElement = function(property)
+WebInspector.ObjectPropertyTreeElement = function(property, linkifier)
{
this.property = property;
@@ -215,6 +220,7 @@ WebInspector.ObjectPropertyTreeElement = function(property)
this.selectable = false;
/** @type {!Array.<!Object>} */
this._highlightChanges = [];
+ this._linkifier = linkifier;
}
WebInspector.ObjectPropertyTreeElement.prototype = {
@@ -268,7 +274,7 @@ WebInspector.ObjectPropertyTreeElement.prototype = {
console.assert(propertyValue);
var skipProto = this.treeOutline ? this.treeOutline._skipProto : true;
var targetValue = this.property.name !== "__proto__" ? propertyValue : this.property.parentObject;
- WebInspector.ObjectPropertyTreeElement._populate(this, propertyValue, skipProto, undefined, undefined, undefined, targetValue);
+ WebInspector.ObjectPropertyTreeElement._populate(this, propertyValue, skipProto, this._linkifier, undefined, undefined, undefined, targetValue);
},
/**
@@ -309,7 +315,7 @@ WebInspector.ObjectPropertyTreeElement.prototype = {
separatorElement.textContent = ": ";
if (this.property.value) {
- this.valueElement = WebInspector.ObjectPropertiesSection.createValueElementWithCustomSupport(this.property.value, this.property.wasThrown, this.listItemElement);
+ this.valueElement = WebInspector.ObjectPropertiesSection.createValueElementWithCustomSupport(this.property.value, this.property.wasThrown, this.listItemElement, this._linkifier);
this.valueElement.addEventListener("contextmenu", this._contextMenuFired.bind(this, this.property), false);
} else if (this.property.getter) {
this.valueElement = WebInspector.ObjectPropertyTreeElement.createRemoteObjectAccessorPropertySpan(this.property.parentObject, [this.property.name], this._onInvokeGetterClick.bind(this));
@@ -498,16 +504,17 @@ WebInspector.ObjectPropertyTreeElement.prototype = {
* @param {!TreeElement} treeElement
* @param {!WebInspector.RemoteObject} value
* @param {boolean} skipProto
+ * @param {!WebInspector.Linkifier=} linkifier
* @param {?string=} emptyPlaceholder
* @param {boolean=} flattenProtoChain
* @param {!Array.<!WebInspector.RemoteObjectProperty>=} extraProperties
* @param {!WebInspector.RemoteObject=} targetValue
*/
-WebInspector.ObjectPropertyTreeElement._populate = function(treeElement, value, skipProto, emptyPlaceholder, flattenProtoChain, extraProperties, targetValue)
+WebInspector.ObjectPropertyTreeElement._populate = function(treeElement, value, skipProto, linkifier, emptyPlaceholder, flattenProtoChain, extraProperties, targetValue)
{
if (value.arrayLength() > WebInspector.ObjectPropertiesSection._arrayLoadThreshold) {
treeElement.removeChildren();
- WebInspector.ArrayGroupingTreeElement._populateArray(treeElement, value, 0, value.arrayLength() - 1);
+ WebInspector.ArrayGroupingTreeElement._populateArray(treeElement, value, 0, value.arrayLength() - 1, linkifier);
return;
}
@@ -526,7 +533,7 @@ WebInspector.ObjectPropertyTreeElement._populate = function(treeElement, value,
properties.push(extraProperties[i]);
WebInspector.ObjectPropertyTreeElement.populateWithProperties(treeElement, properties, internalProperties,
- skipProto, targetValue || value, emptyPlaceholder);
+ skipProto, targetValue || value, linkifier, emptyPlaceholder);
}
if (flattenProtoChain)
@@ -541,9 +548,10 @@ WebInspector.ObjectPropertyTreeElement._populate = function(treeElement, value,
* @param {?Array.<!WebInspector.RemoteObjectProperty>} internalProperties
* @param {boolean} skipProto
* @param {?WebInspector.RemoteObject} value
+ * @param {!WebInspector.Linkifier=} linkifier
* @param {?string=} emptyPlaceholder
*/
-WebInspector.ObjectPropertyTreeElement.populateWithProperties = function(treeNode, properties, internalProperties, skipProto, value, emptyPlaceholder) {
+WebInspector.ObjectPropertyTreeElement.populateWithProperties = function(treeNode, properties, internalProperties, skipProto, value, linkifier, emptyPlaceholder) {
properties.sort(WebInspector.ObjectPropertiesSection.CompareProperties);
for (var i = 0; i < properties.length; ++i) {
@@ -553,29 +561,29 @@ WebInspector.ObjectPropertyTreeElement.populateWithProperties = function(treeNod
if (property.isAccessorProperty()) {
if (property.name !== "__proto__" && property.getter) {
property.parentObject = value;
- treeNode.appendChild(new WebInspector.ObjectPropertyTreeElement(property));
+ treeNode.appendChild(new WebInspector.ObjectPropertyTreeElement(property, linkifier));
}
if (property.isOwn) {
if (property.getter) {
var getterProperty = new WebInspector.RemoteObjectProperty("get " + property.name, property.getter);
getterProperty.parentObject = value;
- treeNode.appendChild(new WebInspector.ObjectPropertyTreeElement(getterProperty));
+ treeNode.appendChild(new WebInspector.ObjectPropertyTreeElement(getterProperty, linkifier));
}
if (property.setter) {
var setterProperty = new WebInspector.RemoteObjectProperty("set " + property.name, property.setter);
setterProperty.parentObject = value;
- treeNode.appendChild(new WebInspector.ObjectPropertyTreeElement(setterProperty));
+ treeNode.appendChild(new WebInspector.ObjectPropertyTreeElement(setterProperty, linkifier));
}
}
} else {
property.parentObject = value;
- treeNode.appendChild(new WebInspector.ObjectPropertyTreeElement(property));
+ treeNode.appendChild(new WebInspector.ObjectPropertyTreeElement(property, linkifier));
}
}
if (internalProperties) {
for (var i = 0; i < internalProperties.length; i++) {
internalProperties[i].parentObject = value;
- var treeElement = new WebInspector.ObjectPropertyTreeElement(internalProperties[i]);
+ var treeElement = new WebInspector.ObjectPropertyTreeElement(internalProperties[i], linkifier);
if (internalProperties[i].name === "[[Entries]]") {
treeElement.setExpandable(true);
treeElement.expand();
@@ -598,7 +606,7 @@ WebInspector.ObjectPropertyTreeElement.populateWithProperties = function(treeNod
}
}
if (!hasTargetFunction)
- treeNode.appendChild(new WebInspector.FunctionScopeMainTreeElement(value));
+ treeNode.appendChild(new WebInspector.FunctionScopeMainTreeElement(value, linkifier));
}
WebInspector.ObjectPropertyTreeElement._appendEmptyPlaceholderIfNeeded(treeNode, emptyPlaceholder);
}
@@ -647,13 +655,15 @@ WebInspector.ObjectPropertyTreeElement.createRemoteObjectAccessorPropertySpan =
* @constructor
* @extends {TreeElement}
* @param {!WebInspector.RemoteObject} remoteObject
+ * @param {!WebInspector.Linkifier=} linkifier
*/
-WebInspector.FunctionScopeMainTreeElement = function(remoteObject)
+WebInspector.FunctionScopeMainTreeElement = function(remoteObject, linkifier)
{
TreeElement.call(this, "<function scope>", true);
this.toggleOnClick = true;
this.selectable = false;
this._remoteObject = remoteObject;
+ this._linkifier = linkifier;
}
WebInspector.FunctionScopeMainTreeElement.prototype = {
@@ -711,7 +721,7 @@ WebInspector.FunctionScopeMainTreeElement.prototype = {
var property = new WebInspector.RemoteObjectProperty(title, remoteObject);
property.writable = false;
property.parentObject = null;
- this.appendChild(new WebInspector.ObjectPropertyTreeElement(property));
+ this.appendChild(new WebInspector.ObjectPropertyTreeElement(property, this._linkifier));
} else {
var scopeRef = new WebInspector.ScopeRef(i, undefined);
var remoteObject = runtimeModel.createScopeRemoteObject(scope.object, scopeRef);
@@ -759,8 +769,9 @@ WebInspector.ScopeTreeElement.prototype = {
* @param {number} fromIndex
* @param {number} toIndex
* @param {number} propertyCount
+ * @param {!WebInspector.Linkifier=} linkifier
*/
-WebInspector.ArrayGroupingTreeElement = function(object, fromIndex, toIndex, propertyCount)
+WebInspector.ArrayGroupingTreeElement = function(object, fromIndex, toIndex, propertyCount, linkifier)
{
TreeElement.call(this, String.sprintf("[%d \u2026 %d]", fromIndex, toIndex), true);
this.toggleOnClick = true;
@@ -770,6 +781,7 @@ WebInspector.ArrayGroupingTreeElement = function(object, fromIndex, toIndex, pro
this._object = object;
this._readOnly = true;
this._propertyCount = propertyCount;
+ this._linkifier = linkifier;
}
WebInspector.ArrayGroupingTreeElement._bucketThreshold = 100;
@@ -781,10 +793,11 @@ WebInspector.ArrayGroupingTreeElement._getOwnPropertyNamesThreshold = 500000;
* @param {!WebInspector.RemoteObject} object
* @param {number} fromIndex
* @param {number} toIndex
+ * @param {!WebInspector.Linkifier=} linkifier
*/
-WebInspector.ArrayGroupingTreeElement._populateArray = function(treeNode, object, fromIndex, toIndex)
+WebInspector.ArrayGroupingTreeElement._populateArray = function(treeNode, object, fromIndex, toIndex, linkifier)
{
- WebInspector.ArrayGroupingTreeElement._populateRanges(treeNode, object, fromIndex, toIndex, true);
+ WebInspector.ArrayGroupingTreeElement._populateRanges(treeNode, object, fromIndex, toIndex, true, linkifier);
}
/**
@@ -793,9 +806,10 @@ WebInspector.ArrayGroupingTreeElement._populateArray = function(treeNode, object
* @param {number} fromIndex
* @param {number} toIndex
* @param {boolean} topLevel
+ * @param {!WebInspector.Linkifier=} linkifier
* @this {WebInspector.ArrayGroupingTreeElement}
*/
-WebInspector.ArrayGroupingTreeElement._populateRanges = function(treeNode, object, fromIndex, toIndex, topLevel)
+WebInspector.ArrayGroupingTreeElement._populateRanges = function(treeNode, object, fromIndex, toIndex, topLevel, linkifier)
{
object.callFunctionJSON(packRanges, [
{ value: fromIndex },
@@ -889,20 +903,20 @@ WebInspector.ArrayGroupingTreeElement._populateRanges = function(treeNode, objec
return;
var ranges = /** @type {!Array.<!Array.<number>>} */ (result.ranges);
if (ranges.length === 1) {
- WebInspector.ArrayGroupingTreeElement._populateAsFragment(treeNode, object, ranges[0][0], ranges[0][1]);
+ WebInspector.ArrayGroupingTreeElement._populateAsFragment(treeNode, object, ranges[0][0], ranges[0][1], linkifier);
} else {
for (var i = 0; i < ranges.length; ++i) {
var fromIndex = ranges[i][0];
var toIndex = ranges[i][1];
var count = ranges[i][2];
if (fromIndex === toIndex)
- WebInspector.ArrayGroupingTreeElement._populateAsFragment(treeNode, object, fromIndex, toIndex);
+ WebInspector.ArrayGroupingTreeElement._populateAsFragment(treeNode, object, fromIndex, toIndex, linkifier);
else
- treeNode.appendChild(new WebInspector.ArrayGroupingTreeElement(object, fromIndex, toIndex, count));
+ treeNode.appendChild(new WebInspector.ArrayGroupingTreeElement(object, fromIndex, toIndex, count, linkifier));
}
}
if (topLevel)
- WebInspector.ArrayGroupingTreeElement._populateNonIndexProperties(treeNode, object, result.skipGetOwnPropertyNames);
+ WebInspector.ArrayGroupingTreeElement._populateNonIndexProperties(treeNode, object, result.skipGetOwnPropertyNames, linkifier);
}
}
@@ -911,9 +925,10 @@ WebInspector.ArrayGroupingTreeElement._populateRanges = function(treeNode, objec
* @param {!WebInspector.RemoteObject} object
* @param {number} fromIndex
* @param {number} toIndex
+ * @param {!WebInspector.Linkifier=} linkifier
* @this {WebInspector.ArrayGroupingTreeElement}
*/
-WebInspector.ArrayGroupingTreeElement._populateAsFragment = function(treeNode, object, fromIndex, toIndex)
+WebInspector.ArrayGroupingTreeElement._populateAsFragment = function(treeNode, object, fromIndex, toIndex, linkifier)
{
object.callFunction(buildArrayFragment, [{value: fromIndex}, {value: toIndex}, {value: WebInspector.ArrayGroupingTreeElement._sparseIterationThreshold}], processArrayFragment.bind(this));
@@ -965,7 +980,7 @@ WebInspector.ArrayGroupingTreeElement._populateAsFragment = function(treeNode, o
properties.sort(WebInspector.ObjectPropertiesSection.CompareProperties);
for (var i = 0; i < properties.length; ++i) {
properties[i].parentObject = this._object;
- var childTreeElement = new WebInspector.ObjectPropertyTreeElement(properties[i]);
+ var childTreeElement = new WebInspector.ObjectPropertyTreeElement(properties[i], linkifier);
childTreeElement._readOnly = true;
treeNode.appendChild(childTreeElement);
}
@@ -976,9 +991,10 @@ WebInspector.ArrayGroupingTreeElement._populateAsFragment = function(treeNode, o
* @param {!TreeElement} treeNode
* @param {!WebInspector.RemoteObject} object
* @param {boolean} skipGetOwnPropertyNames
+ * @param {!WebInspector.Linkifier=} linkifier
* @this {WebInspector.ArrayGroupingTreeElement}
*/
-WebInspector.ArrayGroupingTreeElement._populateNonIndexProperties = function(treeNode, object, skipGetOwnPropertyNames)
+WebInspector.ArrayGroupingTreeElement._populateNonIndexProperties = function(treeNode, object, skipGetOwnPropertyNames, linkifier)
{
object.callFunction(buildObjectFragment, [{value: skipGetOwnPropertyNames}], processObjectFragment.bind(this));
@@ -1029,7 +1045,7 @@ WebInspector.ArrayGroupingTreeElement._populateNonIndexProperties = function(tre
properties.sort(WebInspector.ObjectPropertiesSection.CompareProperties);
for (var i = 0; i < properties.length; ++i) {
properties[i].parentObject = this._object;
- var childTreeElement = new WebInspector.ObjectPropertyTreeElement(properties[i]);
+ var childTreeElement = new WebInspector.ObjectPropertyTreeElement(properties[i], linkifier);
childTreeElement._readOnly = true;
treeNode.appendChild(childTreeElement);
}
@@ -1040,10 +1056,10 @@ WebInspector.ArrayGroupingTreeElement.prototype = {
onpopulate: function()
{
if (this._propertyCount >= WebInspector.ArrayGroupingTreeElement._bucketThreshold) {
- WebInspector.ArrayGroupingTreeElement._populateRanges(this, this._object, this._fromIndex, this._toIndex, false);
+ WebInspector.ArrayGroupingTreeElement._populateRanges(this, this._object, this._fromIndex, this._toIndex, false, this._linkifier);
return;
}
- WebInspector.ArrayGroupingTreeElement._populateAsFragment(this, this._object, this._fromIndex, this._toIndex);
+ WebInspector.ArrayGroupingTreeElement._populateAsFragment(this, this._object, this._fromIndex, this._toIndex, this._linkifier);
},
onattach: function()
@@ -1102,25 +1118,27 @@ WebInspector.ObjectPropertiesSection.valueTextForFunctionDescription = function(
* @param {!WebInspector.RemoteObject} value
* @param {boolean} wasThrown
* @param {!Element=} parentElement
+ * @param {!WebInspector.Linkifier=} linkifier
* @return {!Element}
*/
-WebInspector.ObjectPropertiesSection.createValueElementWithCustomSupport = function(value, wasThrown, parentElement)
+WebInspector.ObjectPropertiesSection.createValueElementWithCustomSupport = function(value, wasThrown, parentElement, linkifier)
{
if (value.customPreview()) {
var result = (new WebInspector.CustomPreviewComponent(value)).element;
result.classList.add("object-properties-section-custom-section");
return result
}
- return WebInspector.ObjectPropertiesSection.createValueElement(value, wasThrown, parentElement);
+ return WebInspector.ObjectPropertiesSection.createValueElement(value, wasThrown, parentElement, linkifier);
}
/**
* @param {!WebInspector.RemoteObject} value
* @param {boolean} wasThrown
* @param {!Element=} parentElement
+ * @param {!WebInspector.Linkifier=} linkifier
* @return {!Element}
*/
-WebInspector.ObjectPropertiesSection.createValueElement = function(value, wasThrown, parentElement)
+WebInspector.ObjectPropertiesSection.createValueElement = function(value, wasThrown, parentElement, linkifier)
{
var valueElement = createElementWithClass("span", "value");
var type = value.type;
@@ -1174,6 +1192,9 @@ WebInspector.ObjectPropertiesSection.createValueElement = function(value, wasThr
valueElement.title = description || "";
}
+ if (type === "object" && subtype === "internal#location" && linkifier)
+ return linkifier.linkifyScriptLocation(value.target(), value.value.scriptId, "", value.value.lineNumber, value.value.columnNumber);
+
function mouseMove()
{
WebInspector.DOMModel.highlightObjectAsDOMNode(value);

Powered by Google App Engine
This is Rietveld 408576698