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

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: fixed review comments 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
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/components/Linkifier.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 String.prototype.compareTo = function(other) 245 String.prototype.compareTo = function(other)
246 { 246 {
247 if (this > other) 247 if (this > other)
248 return 1; 248 return 1;
249 if (this < other) 249 if (this < other)
250 return -1; 250 return -1;
251 return 0; 251 return 0;
252 } 252 }
253 253
254 /** 254 /**
255 * @param {string} href
256 * @return {?string}
257 */
258 function sanitizeHref(href)
259 {
260 return href && href.trim().toLowerCase().startsWith("javascript:") ? null : href;
261 }
262
263 /**
264 * @return {string} 255 * @return {string}
265 */ 256 */
266 String.prototype.removeURLFragment = function() 257 String.prototype.removeURLFragment = function()
267 { 258 {
268 var fragmentIndex = this.indexOf("#"); 259 var fragmentIndex = this.indexOf("#");
269 if (fragmentIndex == -1) 260 if (fragmentIndex == -1)
270 fragmentIndex = this.length; 261 fragmentIndex = this.length;
271 return this.substring(0, fragmentIndex); 262 return this.substring(0, fragmentIndex);
272 } 263 }
273 264
(...skipping 1357 matching lines...) Expand 10 before | Expand all | Expand 10 after
1631 _tryMerge: function(first, second) 1622 _tryMerge: function(first, second)
1632 { 1623 {
1633 var merged = this._mergeCallback && this._mergeCallback(first, second); 1624 var merged = this._mergeCallback && this._mergeCallback(first, second);
1634 if (!merged) 1625 if (!merged)
1635 return null; 1626 return null;
1636 merged.begin = first.begin; 1627 merged.begin = first.begin;
1637 merged.end = Math.max(first.end, second.end); 1628 merged.end = Math.max(first.end, second.end);
1638 return merged; 1629 return merged;
1639 } 1630 }
1640 } 1631 }
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/components/Linkifier.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698