| Index: Source/devtools/front_end/common/ParsedURL.js
|
| diff --git a/Source/devtools/front_end/common/ParsedURL.js b/Source/devtools/front_end/common/ParsedURL.js
|
| index 0f093e52ce94cf78a7b4a38f45d94b610f7db05a..aca073fb67eca39004ce7a2f95853ea7f05b6ca2 100644
|
| --- a/Source/devtools/front_end/common/ParsedURL.js
|
| +++ b/Source/devtools/front_end/common/ParsedURL.js
|
| @@ -49,7 +49,7 @@ WebInspector.ParsedURL = function(url)
|
| // 3 - ?port
|
| // 4 - ?path
|
| // 5 - ?fragment
|
| - var match = url.match(/^([A-Za-z][A-Za-z0-9+.-]*):\/\/([^\/:]*)(?::([\d]+))?(?:(\/[^#]*)(?:#(.*))?)?$/i);
|
| + var match = url.match(/^([A-Za-z][A-Za-z0-9+.-]*):\/\/([^\s\/:]*)(?::([\d]+))?(?:(\/[^\s<>#]*)(?:#(.*))?)?$/i);
|
| if (match) {
|
| this.isValid = true;
|
| this.scheme = match[1].toLowerCase();
|
| @@ -240,6 +240,30 @@ WebInspector.ParsedURL.prototype = {
|
| }
|
|
|
| /**
|
| + * @param {string} string
|
| + * @return {?{url: string, lineNumber: (number|undefined), columnNumber: (number|undefined)}}
|
| + */
|
| +WebInspector.ParsedURL.splitLineAndColumn = function(string)
|
| +{
|
| + var lineColumnRegEx = /:(\d+)(:(\d+))?$/;
|
| + var lineColumnMatch = lineColumnRegEx.exec(string);
|
| + var lineNumber;
|
| + var columnNumber;
|
| + if (!lineColumnMatch)
|
| + return null;
|
| +
|
| + lineNumber = parseInt(lineColumnMatch[1], 10);
|
| + // Immediately convert line and column to 0-based numbers.
|
| + lineNumber = isNaN(lineNumber) ? undefined : lineNumber - 1;
|
| + if (typeof(lineColumnMatch[3]) === "string") {
|
| + columnNumber = parseInt(lineColumnMatch[3], 10);
|
| + columnNumber = isNaN(columnNumber) ? undefined : columnNumber - 1;
|
| + }
|
| +
|
| + return { url: string.substring(0, string.length - lineColumnMatch[0].length), lineNumber: lineNumber, columnNumber: columnNumber};
|
| +}
|
| +
|
| +/**
|
| * @return {?WebInspector.ParsedURL}
|
| */
|
| String.prototype.asParsedURL = function()
|
|
|