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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/components/Linkifier.js

Issue 2441933002: [DevTools] Refactor connection-related classes. (Closed)
Patch Set: tests.js Created 4 years, 1 month 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
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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 * @param {?string} scriptId 158 * @param {?string} scriptId
159 * @param {string} sourceURL 159 * @param {string} sourceURL
160 * @param {number} lineNumber 160 * @param {number} lineNumber
161 * @param {number=} columnNumber 161 * @param {number=} columnNumber
162 * @param {string=} classes 162 * @param {string=} classes
163 * @return {?Element} 163 * @return {?Element}
164 */ 164 */
165 maybeLinkifyScriptLocation: function(target, scriptId, sourceURL, lineNumber , columnNumber, classes) 165 maybeLinkifyScriptLocation: function(target, scriptId, sourceURL, lineNumber , columnNumber, classes)
166 { 166 {
167 var fallbackAnchor = sourceURL ? WebInspector.linkifyResourceAsNode(sour ceURL, lineNumber, columnNumber, classes) : null; 167 var fallbackAnchor = sourceURL ? WebInspector.linkifyResourceAsNode(sour ceURL, lineNumber, columnNumber, classes) : null;
168 if (!target || target.isDetached()) 168 if (!target || target.isDisposed())
169 return fallbackAnchor; 169 return fallbackAnchor;
170 var debuggerModel = WebInspector.DebuggerModel.fromTarget(target); 170 var debuggerModel = WebInspector.DebuggerModel.fromTarget(target);
171 if (!debuggerModel) 171 if (!debuggerModel)
172 return fallbackAnchor; 172 return fallbackAnchor;
173 173
174 var rawLocation = 174 var rawLocation =
175 (scriptId ? debuggerModel.createRawLocationByScriptId(scriptId, line Number, columnNumber || 0) : null) || 175 (scriptId ? debuggerModel.createRawLocationByScriptId(scriptId, line Number, columnNumber || 0) : null) ||
176 debuggerModel.createRawLocationByURL(sourceURL, lineNumber, columnNu mber || 0); 176 debuggerModel.createRawLocationByURL(sourceURL, lineNumber, columnNu mber || 0);
177 if (!rawLocation) 177 if (!rawLocation)
178 return fallbackAnchor; 178 return fallbackAnchor;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 * @param {!RuntimeAgent.StackTrace} stackTrace 228 * @param {!RuntimeAgent.StackTrace} stackTrace
229 * @param {string=} classes 229 * @param {string=} classes
230 * @return {!Element} 230 * @return {!Element}
231 */ 231 */
232 linkifyStackTraceTopFrame: function(target, stackTrace, classes) 232 linkifyStackTraceTopFrame: function(target, stackTrace, classes)
233 { 233 {
234 console.assert(stackTrace.callFrames && stackTrace.callFrames.length); 234 console.assert(stackTrace.callFrames && stackTrace.callFrames.length);
235 235
236 var topFrame = stackTrace.callFrames[0]; 236 var topFrame = stackTrace.callFrames[0];
237 var fallbackAnchor = WebInspector.linkifyResourceAsNode(topFrame.url, to pFrame.lineNumber, topFrame.columnNumber, classes); 237 var fallbackAnchor = WebInspector.linkifyResourceAsNode(topFrame.url, to pFrame.lineNumber, topFrame.columnNumber, classes);
238 if (target.isDetached()) 238 if (target.isDisposed())
239 return fallbackAnchor; 239 return fallbackAnchor;
240 240
241 var debuggerModel = WebInspector.DebuggerModel.fromTarget(target); 241 var debuggerModel = WebInspector.DebuggerModel.fromTarget(target);
242 var rawLocations = debuggerModel.createRawLocationsByStackTrace(stackTra ce); 242 var rawLocations = debuggerModel.createRawLocationsByStackTrace(stackTra ce);
243 if (rawLocations.length === 0) 243 if (rawLocations.length === 0)
244 return fallbackAnchor; 244 return fallbackAnchor;
245 245
246 var anchor = this._createAnchor(classes); 246 var anchor = this._createAnchor(classes);
247 var liveLocation = WebInspector.debuggerWorkspaceBinding.createStackTrac eTopFrameLiveLocation(rawLocations, this._updateAnchor.bind(this, anchor), /** @ type {!WebInspector.LiveLocationPool} */(this._locationPoolByTarget.get(target)) ); 247 var liveLocation = WebInspector.debuggerWorkspaceBinding.createStackTrac eTopFrameLiveLocation(rawLocations, this._updateAnchor.bind(this, anchor), /** @ type {!WebInspector.LiveLocationPool} */(this._locationPoolByTarget.get(target)) );
248 var anchors = /** @type {!Array<!Element>} */(this._anchorsByTarget.get( target)); 248 var anchors = /** @type {!Array<!Element>} */(this._anchorsByTarget.get( target));
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 /** 555 /**
556 * @param {!WebInspector.NetworkRequest} request 556 * @param {!WebInspector.NetworkRequest} request
557 * @return {!Element} 557 * @return {!Element}
558 */ 558 */
559 WebInspector.linkifyRequestAsNode = function(request) 559 WebInspector.linkifyRequestAsNode = function(request)
560 { 560 {
561 var anchor = WebInspector.linkifyURLAsNode(request.url); 561 var anchor = WebInspector.linkifyURLAsNode(request.url);
562 anchor.requestId = request.requestId; 562 anchor.requestId = request.requestId;
563 return anchor; 563 return anchor;
564 }; 564 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698