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

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

Issue 2752403002: [DevTools] Migrate usages of Target to RuntimeModel where makes sense (Closed)
Patch Set: review comments addressed Created 3 years, 9 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
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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 * @param {number} lineNumber 146 * @param {number} lineNumber
147 * @param {number=} columnNumber 147 * @param {number=} columnNumber
148 * @param {string=} classes 148 * @param {string=} classes
149 * @return {?Element} 149 * @return {?Element}
150 */ 150 */
151 maybeLinkifyScriptLocation(target, scriptId, sourceURL, lineNumber, columnNumb er, classes) { 151 maybeLinkifyScriptLocation(target, scriptId, sourceURL, lineNumber, columnNumb er, classes) {
152 var fallbackAnchor = 152 var fallbackAnchor =
153 sourceURL ? Components.Linkifier.linkifyURL(sourceURL, undefined, classe s, lineNumber, columnNumber) : null; 153 sourceURL ? Components.Linkifier.linkifyURL(sourceURL, undefined, classe s, lineNumber, columnNumber) : null;
154 if (!target || target.isDisposed()) 154 if (!target || target.isDisposed())
155 return fallbackAnchor; 155 return fallbackAnchor;
156 var debuggerModel = SDK.DebuggerModel.fromTarget(target); 156 var debuggerModel = target.model(SDK.DebuggerModel);
157 if (!debuggerModel) 157 if (!debuggerModel)
158 return fallbackAnchor; 158 return fallbackAnchor;
159 159
160 var rawLocation = 160 var rawLocation =
161 (scriptId ? debuggerModel.createRawLocationByScriptId(scriptId, lineNumb er, columnNumber || 0) : null) || 161 (scriptId ? debuggerModel.createRawLocationByScriptId(scriptId, lineNumb er, columnNumber || 0) : null) ||
162 debuggerModel.createRawLocationByURL(sourceURL, lineNumber, columnNumber || 0); 162 debuggerModel.createRawLocationByURL(sourceURL, lineNumber, columnNumber || 0);
163 if (!rawLocation) 163 if (!rawLocation)
164 return fallbackAnchor; 164 return fallbackAnchor;
165 165
166 var anchor = Components.Linkifier._createLink('', classes || ''); 166 var anchor = Components.Linkifier._createLink('', classes || '');
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 */ 221 */
222 linkifyStackTraceTopFrame(target, stackTrace, classes) { 222 linkifyStackTraceTopFrame(target, stackTrace, classes) {
223 console.assert(stackTrace.callFrames && stackTrace.callFrames.length); 223 console.assert(stackTrace.callFrames && stackTrace.callFrames.length);
224 224
225 var topFrame = stackTrace.callFrames[0]; 225 var topFrame = stackTrace.callFrames[0];
226 var fallbackAnchor = 226 var fallbackAnchor =
227 Components.Linkifier.linkifyURL(topFrame.url, undefined, classes, topFra me.lineNumber, topFrame.columnNumber); 227 Components.Linkifier.linkifyURL(topFrame.url, undefined, classes, topFra me.lineNumber, topFrame.columnNumber);
228 if (target.isDisposed()) 228 if (target.isDisposed())
229 return fallbackAnchor; 229 return fallbackAnchor;
230 230
231 var debuggerModel = SDK.DebuggerModel.fromTarget(target); 231 var debuggerModel = target.model(SDK.DebuggerModel);
232 var rawLocations = debuggerModel.createRawLocationsByStackTrace(stackTrace); 232 var rawLocations = debuggerModel.createRawLocationsByStackTrace(stackTrace);
233 if (rawLocations.length === 0) 233 if (rawLocations.length === 0)
234 return fallbackAnchor; 234 return fallbackAnchor;
235 235
236 var anchor = Components.Linkifier._createLink('', classes || ''); 236 var anchor = Components.Linkifier._createLink('', classes || '');
237 var info = Components.Linkifier._linkInfo(anchor); 237 var info = Components.Linkifier._linkInfo(anchor);
238 info.enableDecorator = this._useLinkDecorator; 238 info.enableDecorator = this._useLinkDecorator;
239 info.fallback = fallbackAnchor; 239 info.fallback = fallbackAnchor;
240 info.liveLocation = Bindings.debuggerWorkspaceBinding.createStackTraceTopFra meLiveLocation( 240 info.liveLocation = Bindings.debuggerWorkspaceBinding.createStackTraceTopFra meLiveLocation(
241 rawLocations, this._updateAnchor.bind(this, anchor), 241 rawLocations, this._updateAnchor.bind(this, anchor),
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after
780 contextMenu.appendSeparator(); 780 contextMenu.appendSeparator();
781 contextMenu.appendItem(Common.UIString('Save'), save.bind(null, false)); 781 contextMenu.appendItem(Common.UIString('Save'), save.bind(null, false));
782 782
783 if (contentProvider instanceof Workspace.UISourceCode) { 783 if (contentProvider instanceof Workspace.UISourceCode) {
784 var uiSourceCode = /** @type {!Workspace.UISourceCode} */ (contentProvider ); 784 var uiSourceCode = /** @type {!Workspace.UISourceCode} */ (contentProvider );
785 if (!uiSourceCode.project().canSetFileContent()) 785 if (!uiSourceCode.project().canSetFileContent())
786 contextMenu.appendItem(Common.UIString.capitalize('Save ^as...'), save.b ind(null, true)); 786 contextMenu.appendItem(Common.UIString.capitalize('Save ^as...'), save.b ind(null, true));
787 } 787 }
788 } 788 }
789 }; 789 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698