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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 } else | 85 } else |
86 this.lastPathComponent = path; | 86 this.lastPathComponent = path; |
87 } | 87 } |
88 | 88 |
89 /** | 89 /** |
90 * @param {string} url | 90 * @param {string} url |
91 * @return {!Array.<string>} | 91 * @return {!Array.<string>} |
92 */ | 92 */ |
93 WebInspector.ParsedURL.splitURLIntoPathComponents = function(url) | 93 WebInspector.ParsedURL.splitURLIntoPathComponents = function(url) |
94 { | 94 { |
95 var parsedURL = new WebInspector.ParsedURL(decodeURI(url)); | 95 var decodedURL = url; |
| 96 try { |
| 97 decodedURL = decodeURI(url); |
| 98 } catch (e) { } |
| 99 var parsedURL = new WebInspector.ParsedURL(decodedURL); |
96 var origin; | 100 var origin; |
97 var folderPath; | 101 var folderPath; |
98 var name; | 102 var name; |
99 if (parsedURL.isValid) { | 103 if (parsedURL.isValid) { |
100 origin = parsedURL.scheme + "://" + parsedURL.host; | 104 origin = parsedURL.scheme + "://" + parsedURL.host; |
101 if (parsedURL.port) | 105 if (parsedURL.port) |
102 origin += ":" + parsedURL.port; | 106 origin += ":" + parsedURL.port; |
103 folderPath = parsedURL.folderPathComponents; | 107 folderPath = parsedURL.folderPathComponents; |
104 name = parsedURL.lastPathComponent; | 108 name = parsedURL.lastPathComponent; |
105 if (parsedURL.queryParams) | 109 if (parsedURL.queryParams) |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 /** | 242 /** |
239 * @return {?WebInspector.ParsedURL} | 243 * @return {?WebInspector.ParsedURL} |
240 */ | 244 */ |
241 String.prototype.asParsedURL = function() | 245 String.prototype.asParsedURL = function() |
242 { | 246 { |
243 var parsedURL = new WebInspector.ParsedURL(this.toString()); | 247 var parsedURL = new WebInspector.ParsedURL(this.toString()); |
244 if (parsedURL.isValid) | 248 if (parsedURL.isValid) |
245 return parsedURL; | 249 return parsedURL; |
246 return null; | 250 return null; |
247 } | 251 } |
OLD | NEW |