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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/platform/utilities.js

Issue 1805763002: [DevTools] Do not linkify relative urls. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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) 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2007 Apple Inc. All rights reserved.
3 * Copyright (C) 2012 Google Inc. All rights reserved. 3 * Copyright (C) 2012 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 String.prototype.compareTo = function(other) 280 String.prototype.compareTo = function(other)
281 { 281 {
282 if (this > other) 282 if (this > other)
283 return 1; 283 return 1;
284 if (this < other) 284 if (this < other)
285 return -1; 285 return -1;
286 return 0; 286 return 0;
287 } 287 }
288 288
289 /** 289 /**
290 * @param {string} href
291 * @return {?string}
292 */
293 function sanitizeHref(href)
294 {
295 return href && href.trim().toLowerCase().startsWith("javascript:") ? null : href;
296 }
297
298 /**
299 * @return {string} 290 * @return {string}
300 */ 291 */
301 String.prototype.removeURLFragment = function() 292 String.prototype.removeURLFragment = function()
302 { 293 {
303 var fragmentIndex = this.indexOf("#"); 294 var fragmentIndex = this.indexOf("#");
304 if (fragmentIndex == -1) 295 if (fragmentIndex == -1)
305 fragmentIndex = this.length; 296 fragmentIndex = this.length;
306 return this.substring(0, fragmentIndex); 297 return this.substring(0, fragmentIndex);
307 } 298 }
308 299
(...skipping 1357 matching lines...) Expand 10 before | Expand all | Expand 10 after
1666 _tryMerge: function(first, second) 1657 _tryMerge: function(first, second)
1667 { 1658 {
1668 var merged = this._mergeCallback && this._mergeCallback(first, second); 1659 var merged = this._mergeCallback && this._mergeCallback(first, second);
1669 if (!merged) 1660 if (!merged)
1670 return null; 1661 return null;
1671 merged.begin = first.begin; 1662 merged.begin = first.begin;
1672 merged.end = Math.max(first.end, second.end); 1663 merged.end = Math.max(first.end, second.end);
1673 return merged; 1664 return merged;
1674 } 1665 }
1675 } 1666 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698