| 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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 for (var i = 1; i < splittedPath.length; ++i) { | 128 for (var i = 1; i < splittedPath.length; ++i) { |
| 129 if (!splittedPath[i]) | 129 if (!splittedPath[i]) |
| 130 continue; | 130 continue; |
| 131 result.push(splittedPath[i]); | 131 result.push(splittedPath[i]); |
| 132 } | 132 } |
| 133 result.push(name); | 133 result.push(name); |
| 134 return result; | 134 return result; |
| 135 } | 135 } |
| 136 | 136 |
| 137 /** | 137 /** |
| 138 * @param {string} url |
| 139 * @return {string} |
| 140 */ |
| 141 WebInspector.ParsedURL.extractOrigin = function(url) |
| 142 { |
| 143 var decodedURL = WebInspector.ParsedURL._decodeIfPossible(url); |
| 144 var parsedURL = new WebInspector.ParsedURL(decodedURL); |
| 145 if (!parsedURL.isValid) |
| 146 return ""; |
| 147 |
| 148 var origin = parsedURL.scheme + "://" + parsedURL.host; |
| 149 if (parsedURL.port) |
| 150 origin += ":" + parsedURL.port; |
| 151 return origin; |
| 152 } |
| 153 |
| 154 /** |
| 138 * @param {string} baseURL | 155 * @param {string} baseURL |
| 139 * @param {string} href | 156 * @param {string} href |
| 140 * @return {?string} | 157 * @return {?string} |
| 141 */ | 158 */ |
| 142 WebInspector.ParsedURL.completeURL = function(baseURL, href) | 159 WebInspector.ParsedURL.completeURL = function(baseURL, href) |
| 143 { | 160 { |
| 144 if (href) { | 161 if (href) { |
| 145 // Return special URLs as-is. | 162 // Return special URLs as-is. |
| 146 var trimmedHref = href.trim(); | 163 var trimmedHref = href.trim(); |
| 147 if (trimmedHref.startsWith("data:") || trimmedHref.startsWith("blob:") |
| trimmedHref.startsWith("javascript:")) | 164 if (trimmedHref.startsWith("data:") || trimmedHref.startsWith("blob:") |
| trimmedHref.startsWith("javascript:")) |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 /** | 320 /** |
| 304 * @return {?WebInspector.ParsedURL} | 321 * @return {?WebInspector.ParsedURL} |
| 305 */ | 322 */ |
| 306 String.prototype.asParsedURL = function() | 323 String.prototype.asParsedURL = function() |
| 307 { | 324 { |
| 308 var parsedURL = new WebInspector.ParsedURL(this.toString()); | 325 var parsedURL = new WebInspector.ParsedURL(this.toString()); |
| 309 if (parsedURL.isValid) | 326 if (parsedURL.isValid) |
| 310 return parsedURL; | 327 return parsedURL; |
| 311 return null; | 328 return null; |
| 312 } | 329 } |
| OLD | NEW |