OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 this._remoteObjectFormatter = formatter; | 55 this._remoteObjectFormatter = formatter; |
56 }, | 56 }, |
57 | 57 |
58 /** | 58 /** |
59 * @param {!Element} element | 59 * @param {!Element} element |
60 * @param {!WebInspector.Popover} popover | 60 * @param {!WebInspector.Popover} popover |
61 */ | 61 */ |
62 _showObjectPopover: function(element, popover) | 62 _showObjectPopover: function(element, popover) |
63 { | 63 { |
64 /** | 64 /** |
| 65 * @param {!WebInspector.Target} target |
65 * @param {!Element} anchorElement | 66 * @param {!Element} anchorElement |
66 * @param {!Element} popoverContentElement | 67 * @param {!Element} popoverContentElement |
67 * @param {?Protocol.Error} error | 68 * @param {?DebuggerAgent.FunctionDetails} response |
68 * @param {!DebuggerAgent.FunctionDetails} response | |
69 * @this {WebInspector.ObjectPopoverHelper} | 69 * @this {WebInspector.ObjectPopoverHelper} |
70 */ | 70 */ |
71 function didGetDetails(anchorElement, popoverContentElement, error, resp
onse) | 71 function didGetDetails(target, anchorElement, popoverContentElement, res
ponse) |
72 { | 72 { |
73 if (error) { | 73 if (!response) |
74 console.error(error); | |
75 return; | 74 return; |
76 } | 75 |
77 var container = document.createElement("div"); | 76 var container = document.createElement("div"); |
78 container.className = "inline-block"; | 77 container.className = "inline-block"; |
79 | 78 |
80 var title = container.createChild("div", "function-popover-title sou
rce-code"); | 79 var title = container.createChild("div", "function-popover-title sou
rce-code"); |
81 var functionName = title.createChild("span", "function-name"); | 80 var functionName = title.createChild("span", "function-name"); |
82 functionName.textContent = response.functionName || WebInspector.UIS
tring("(anonymous function)"); | 81 functionName.textContent = response.functionName || WebInspector.UIS
tring("(anonymous function)"); |
83 | 82 |
84 this._linkifier = new WebInspector.Linkifier(); | 83 this._linkifier = new WebInspector.Linkifier(); |
85 var rawLocation = /** @type {!WebInspector.DebuggerModel.Location} *
/ (response.location); | 84 var rawLocation = WebInspector.DebuggerModel.Location.fromPayload(ta
rget, response.location); |
86 var link = this._linkifier.linkifyRawLocation(rawLocation, "function
-location-link"); | 85 var link = this._linkifier.linkifyRawLocation(rawLocation, "function
-location-link"); |
87 if (link) | 86 if (link) |
88 title.appendChild(link); | 87 title.appendChild(link); |
89 | 88 |
90 container.appendChild(popoverContentElement); | 89 container.appendChild(popoverContentElement); |
91 | 90 |
92 popover.show(container, anchorElement); | 91 popover.show(container, anchorElement); |
93 } | 92 } |
94 | 93 |
95 /** | 94 /** |
(...skipping 14 matching lines...) Expand all Loading... |
110 var anchorElement = anchorOverride || element; | 109 var anchorElement = anchorOverride || element; |
111 var description = (this._remoteObjectFormatter && this._remoteObject
Formatter(result)) || result.description; | 110 var description = (this._remoteObjectFormatter && this._remoteObject
Formatter(result)) || result.description; |
112 | 111 |
113 var popoverContentElement = null; | 112 var popoverContentElement = null; |
114 if (result.type !== "object") { | 113 if (result.type !== "object") { |
115 popoverContentElement = document.createElement("span"); | 114 popoverContentElement = document.createElement("span"); |
116 popoverContentElement.className = "monospace console-formatted-"
+ result.type; | 115 popoverContentElement.className = "monospace console-formatted-"
+ result.type; |
117 popoverContentElement.style.whiteSpace = "pre"; | 116 popoverContentElement.style.whiteSpace = "pre"; |
118 popoverContentElement.textContent = description; | 117 popoverContentElement.textContent = description; |
119 if (result.type === "function") { | 118 if (result.type === "function") { |
120 DebuggerAgent.getFunctionDetails(result.objectId, didGetDeta
ils.bind(this, anchorElement, popoverContentElement)); | 119 result.functionDetails(didGetDetails.bind(this, result.targe
t(), anchorElement, popoverContentElement)); |
121 return; | 120 return; |
122 } | 121 } |
123 if (result.type === "string") | 122 if (result.type === "string") |
124 popoverContentElement.textContent = "\"" + popoverContentEle
ment.textContent + "\""; | 123 popoverContentElement.textContent = "\"" + popoverContentEle
ment.textContent + "\""; |
125 popover.show(popoverContentElement, anchorElement); | 124 popover.show(popoverContentElement, anchorElement); |
126 } else { | 125 } else { |
127 if (result.subtype === "node") | 126 if (result.subtype === "node") |
128 result.highlightAsDOMNode(); | 127 result.highlightAsDOMNode(); |
129 popoverContentElement = document.createElement("div"); | 128 popoverContentElement = document.createElement("div"); |
130 this._titleElement = document.createElement("div"); | 129 this._titleElement = document.createElement("div"); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 if (properties[i].value.description) | 169 if (properties[i].value.description) |
171 this._titleElement.textContent += "#" + properties[i].value.
description; | 170 this._titleElement.textContent += "#" + properties[i].value.
description; |
172 break; | 171 break; |
173 } | 172 } |
174 } | 173 } |
175 this._sectionUpdateProperties(properties, rootTreeElementConstructor, ro
otPropertyComparer); | 174 this._sectionUpdateProperties(properties, rootTreeElementConstructor, ro
otPropertyComparer); |
176 }, | 175 }, |
177 | 176 |
178 __proto__: WebInspector.PopoverHelper.prototype | 177 __proto__: WebInspector.PopoverHelper.prototype |
179 } | 178 } |
OLD | NEW |