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..f0568cdea6f0680f07e7f071f5e9125ec5f6cf81 100644 |
--- a/Source/devtools/front_end/common/ParsedURL.js |
+++ b/Source/devtools/front_end/common/ParsedURL.js |
@@ -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() |