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

Side by Side Diff: Source/devtools/front_end/sdk/Linkifier.js

Issue 448743002: DevTools: Linkify console stacks with blackboxing consideration. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 * @return {!Element} 151 * @return {!Element}
152 */ 152 */
153 linkifyScriptLocation: function(target, scriptId, sourceURL, lineNumber, col umnNumber, classes) 153 linkifyScriptLocation: function(target, scriptId, sourceURL, lineNumber, col umnNumber, classes)
154 { 154 {
155 var rawLocation = target && !target.isDetached() ? target.debuggerModel. createRawLocationByScriptId(scriptId, sourceURL, lineNumber, columnNumber || 0) : null; 155 var rawLocation = target && !target.isDetached() ? target.debuggerModel. createRawLocationByScriptId(scriptId, sourceURL, lineNumber, columnNumber || 0) : null;
156 var fallbackAnchor = WebInspector.linkifyResourceAsNode(sourceURL, lineN umber, classes); 156 var fallbackAnchor = WebInspector.linkifyResourceAsNode(sourceURL, lineN umber, classes);
157 if (!rawLocation) 157 if (!rawLocation)
158 return fallbackAnchor; 158 return fallbackAnchor;
159 159
160 var anchor = this._createAnchor(classes); 160 var anchor = this._createAnchor(classes);
161 if (WebInspector.experimentsSettings.frameworksDebuggingSupport.isEnable d() && WebInspector.BlackboxSupport.isBlackboxedURL(sourceURL))
162 anchor.classList.add("webkit-html-blackbox-link");
vsevik 2014/08/07 09:11:58 Again, I don't think we should dim the link to the
aandrey 2014/08/07 10:24:59 Done.
161 var liveLocation = WebInspector.debuggerWorkspaceBinding.createLiveLocat ion(rawLocation, this._updateAnchor.bind(this, anchor)); 163 var liveLocation = WebInspector.debuggerWorkspaceBinding.createLiveLocat ion(rawLocation, this._updateAnchor.bind(this, anchor));
162 this._liveLocationsByTarget.get(rawLocation.target()).push({anchor: anch or, location: liveLocation}); 164 this._liveLocationsByTarget.get(rawLocation.target()).push({ anchor: anc hor, location: liveLocation });
163 anchor.__fallbackAnchor = fallbackAnchor; 165 anchor.__fallbackAnchor = fallbackAnchor;
164 return anchor; 166 return anchor;
165 }, 167 },
166 168
167 /** 169 /**
168 * @param {!WebInspector.DebuggerModel.Location} rawLocation 170 * @param {!WebInspector.DebuggerModel.Location} rawLocation
169 * @param {string} fallbackUrl 171 * @param {string} fallbackUrl
170 * @param {string=} classes 172 * @param {string=} classes
171 * @return {!Element} 173 * @return {!Element}
172 */ 174 */
(...skipping 10 matching lines...) Expand all
183 */ 185 */
184 linkifyConsoleCallFrame: function(target, callFrame, classes) 186 linkifyConsoleCallFrame: function(target, callFrame, classes)
185 { 187 {
186 // FIXME(62725): console stack trace line/column numbers are one-based. 188 // FIXME(62725): console stack trace line/column numbers are one-based.
187 var lineNumber = callFrame.lineNumber ? callFrame.lineNumber - 1 : 0; 189 var lineNumber = callFrame.lineNumber ? callFrame.lineNumber - 1 : 0;
188 var columnNumber = callFrame.columnNumber ? callFrame.columnNumber - 1 : 0; 190 var columnNumber = callFrame.columnNumber ? callFrame.columnNumber - 1 : 0;
189 return this.linkifyScriptLocation(target, callFrame.scriptId, callFrame. url, lineNumber, columnNumber, classes); 191 return this.linkifyScriptLocation(target, callFrame.scriptId, callFrame. url, lineNumber, columnNumber, classes);
190 }, 192 },
191 193
192 /** 194 /**
195 * @param {?WebInspector.Target} target
196 * @param {?Array.<!ConsoleAgent.CallFrame>} stackTrace
197 * @param {string=} classes
198 * @param {boolean=} disallowUnknownSource
199 * @return {?Element}
200 */
201 linkifyTopUnblackboxedConsoleCallFrame: function(target, stackTrace, classes , disallowUnknownSource)
202 {
203 if (!stackTrace || !stackTrace.length)
204 return null;
205 var index = 0;
206 if (WebInspector.experimentsSettings.frameworksDebuggingSupport.isEnable d()) {
207 while (index < stackTrace.length && WebInspector.BlackboxSupport.isB lackboxedURL(stackTrace[index].url))
208 ++index;
209 if (index >= stackTrace.length)
210 index = 0;
211 }
212 var callFrame = stackTrace[index];
213 if (disallowUnknownSource && !callFrame.scriptId)
214 return null;
215 return this.linkifyConsoleCallFrame(target, callFrame, classes);
216 },
217
218 /**
193 * @param {!WebInspector.CSSLocation} rawLocation 219 * @param {!WebInspector.CSSLocation} rawLocation
194 * @param {string=} classes 220 * @param {string=} classes
195 * @return {?Element} 221 * @return {?Element}
196 */ 222 */
197 linkifyCSSLocation: function(rawLocation, classes) 223 linkifyCSSLocation: function(rawLocation, classes)
198 { 224 {
199 var anchor = this._createAnchor(classes); 225 var anchor = this._createAnchor(classes);
200 var liveLocation = WebInspector.cssWorkspaceBinding.createLiveLocation(r awLocation, this._updateAnchor.bind(this, anchor)); 226 var liveLocation = WebInspector.cssWorkspaceBinding.createLiveLocation(r awLocation, this._updateAnchor.bind(this, anchor));
201 if (!liveLocation) 227 if (!liveLocation)
202 return null; 228 return null;
203 this._liveLocationsByTarget.get(rawLocation.target()).push({anchor: anch or, location: liveLocation}); 229 this._liveLocationsByTarget.get(rawLocation.target()).push({ anchor: anc hor, location: liveLocation });
204 return anchor; 230 return anchor;
205 }, 231 },
206 232
207 /** 233 /**
208 * @param {!WebInspector.CSSMedia} media 234 * @param {!WebInspector.CSSMedia} media
209 * @return {?Element} 235 * @return {?Element}
210 */ 236 */
211 linkifyMedia: function(media) 237 linkifyMedia: function(media)
212 { 238 {
213 var location = media.rawLocation(); 239 var location = media.rawLocation();
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 */ 378 */
353 WebInspector.Linkifier.liveLocationText = function(target, scriptId, lineNumber, columnNumber) 379 WebInspector.Linkifier.liveLocationText = function(target, scriptId, lineNumber, columnNumber)
354 { 380 {
355 var script = target.debuggerModel.scriptForId(scriptId); 381 var script = target.debuggerModel.scriptForId(scriptId);
356 if (!script) 382 if (!script)
357 return ""; 383 return "";
358 var location = /** @type {!WebInspector.DebuggerModel.Location} */ (target.d ebuggerModel.createRawLocation(script, lineNumber, columnNumber || 0)); 384 var location = /** @type {!WebInspector.DebuggerModel.Location} */ (target.d ebuggerModel.createRawLocation(script, lineNumber, columnNumber || 0));
359 var uiLocation = /** @type {!WebInspector.UILocation} */ (WebInspector.debug gerWorkspaceBinding.rawLocationToUILocation(location)); 385 var uiLocation = /** @type {!WebInspector.UILocation} */ (WebInspector.debug gerWorkspaceBinding.rawLocationToUILocation(location));
360 return uiLocation.linkText(); 386 return uiLocation.linkText();
361 } 387 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698