OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2014 Google Inc. All rights reserved. | 2 * Copyright (C) 2014 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 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 } | 73 } |
74 } | 74 } |
75 | 75 |
76 /** | 76 /** |
77 * http://tools.ietf.org/html/rfc3986#section-5.2.4 | 77 * http://tools.ietf.org/html/rfc3986#section-5.2.4 |
78 * @param {string} path | 78 * @param {string} path |
79 * @return {string} | 79 * @return {string} |
80 */ | 80 */ |
81 function normalizePath(path) | 81 function normalizePath(path) |
82 { | 82 { |
83 if (path.indexOf("..") === -1 && path.indexOf('.') === -1) | 83 if (path.indexOf("..") === -1 && path.indexOf(".") === -1) |
84 return path; | 84 return path; |
85 | 85 |
86 var normalizedSegments = []; | 86 var normalizedSegments = []; |
87 var segments = path.split("/"); | 87 var segments = path.split("/"); |
88 for (var i = 0; i < segments.length; i++) { | 88 for (var i = 0; i < segments.length; i++) { |
89 var segment = segments[i]; | 89 var segment = segments[i]; |
90 if (segment === ".") | 90 if (segment === ".") |
91 continue; | 91 continue; |
92 else if (segment === "..") | 92 else if (segment === "..") |
93 normalizedSegments.pop(); | 93 normalizedSegments.pop(); |
(...skipping 1013 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1107 { | 1107 { |
1108 var sourceURL = window.location.href; | 1108 var sourceURL = window.location.href; |
1109 if (window.location.search) | 1109 if (window.location.search) |
1110 sourceURL = sourceURL.replace(window.location.search, ""); | 1110 sourceURL = sourceURL.replace(window.location.search, ""); |
1111 sourceURL = sourceURL.substring(0, sourceURL.lastIndexOf("/") + 1) + path; | 1111 sourceURL = sourceURL.substring(0, sourceURL.lastIndexOf("/") + 1) + path; |
1112 return "\n/*# sourceURL=" + sourceURL + " */"; | 1112 return "\n/*# sourceURL=" + sourceURL + " */"; |
1113 } | 1113 } |
1114 | 1114 |
1115 /** @type {!Runtime} */ | 1115 /** @type {!Runtime} */ |
1116 var runtime; | 1116 var runtime; |
OLD | NEW |