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 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 } |
| OLD | NEW |