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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/common/ParsedURL.js

Issue 1805763002: [DevTools] Do not linkify relative urls. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: only scheme 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 | « no previous file | third_party/WebKit/Source/devtools/front_end/components/Linkifier.js » ('j') | 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) 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 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 10 *
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 } 296 }
297 if (typeof(lineColumnMatch[2]) === "string") { 297 if (typeof(lineColumnMatch[2]) === "string") {
298 columnNumber = parseInt(lineColumnMatch[2], 10); 298 columnNumber = parseInt(lineColumnMatch[2], 10);
299 columnNumber = isNaN(columnNumber) ? undefined : columnNumber - 1; 299 columnNumber = isNaN(columnNumber) ? undefined : columnNumber - 1;
300 } 300 }
301 301
302 return {url: string.substring(0, string.length - lineColumnMatch[0].length), lineNumber: lineNumber, columnNumber: columnNumber}; 302 return {url: string.substring(0, string.length - lineColumnMatch[0].length), lineNumber: lineNumber, columnNumber: columnNumber};
303 } 303 }
304 304
305 /** 305 /**
306 * @param {string} url
307 * @return {boolean}
308 */
309 WebInspector.ParsedURL.isRelativeURL = function(url)
310 {
311 return !(/^([A-Za-z][A-Za-z0-9+.-]*):\/\//.test(url));
caseq 2016/03/16 01:44:28 so javascript:alert('hello-world') is relative acc
dgozman 2016/03/16 01:55:17 Nope, we test for //.
312 }
313
314 /**
306 * @return {?WebInspector.ParsedURL} 315 * @return {?WebInspector.ParsedURL}
307 */ 316 */
308 String.prototype.asParsedURL = function() 317 String.prototype.asParsedURL = function()
309 { 318 {
310 var parsedURL = new WebInspector.ParsedURL(this.toString()); 319 var parsedURL = new WebInspector.ParsedURL(this.toString());
311 if (parsedURL.isValid) 320 if (parsedURL.isValid)
312 return parsedURL; 321 return parsedURL;
313 return null; 322 return null;
314 } 323 }
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/components/Linkifier.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698