Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 var hasScheme = /^([A-Za-z][A-Za-z0-9+.-]*):\/\//.test(url); | |
| 312 if (hasScheme) | |
| 313 return false; | |
| 314 var hasPort = /^[^:^\/]*:/.test(url); | |
|
caseq
2016/03/16 00:50:32
I think this is wrong both on part of URL grammar.
| |
| 315 if (hasPort) | |
| 316 return false; | |
| 317 var hasDomain = /^[^.^\/]*\.[^\/]*\//.test(url); | |
|
caseq
2016/03/16 00:50:33
... and regexp syntax.
| |
| 318 if (hasDomain) | |
| 319 return false; | |
| 320 return true; | |
| 321 } | |
| 322 | |
| 323 /** | |
| 306 * @return {?WebInspector.ParsedURL} | 324 * @return {?WebInspector.ParsedURL} |
| 307 */ | 325 */ |
| 308 String.prototype.asParsedURL = function() | 326 String.prototype.asParsedURL = function() |
| 309 { | 327 { |
| 310 var parsedURL = new WebInspector.ParsedURL(this.toString()); | 328 var parsedURL = new WebInspector.ParsedURL(this.toString()); |
| 311 if (parsedURL.isValid) | 329 if (parsedURL.isValid) |
| 312 return parsedURL; | 330 return parsedURL; |
| 313 return null; | 331 return null; |
| 314 } | 332 } |
| OLD | NEW |