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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 { | 114 { |
115 /** @type {!Array<!Promise<undefined>>} */ | 115 /** @type {!Array<!Promise<undefined>>} */ |
116 var promises = []; | 116 var promises = []; |
117 /** @type {!Array<string>} */ | 117 /** @type {!Array<string>} */ |
118 var urls = []; | 118 var urls = []; |
119 var sources = new Array(scriptNames.length); | 119 var sources = new Array(scriptNames.length); |
120 var scriptToEval = 0; | 120 var scriptToEval = 0; |
121 for (var i = 0; i < scriptNames.length; ++i) { | 121 for (var i = 0; i < scriptNames.length; ++i) { |
122 var scriptName = scriptNames[i]; | 122 var scriptName = scriptNames[i]; |
123 var sourceURL = (base || self._importScriptPathPrefix) + scriptName; | 123 var sourceURL = (base || self._importScriptPathPrefix) + scriptName; |
| 124 |
124 var schemaIndex = sourceURL.indexOf("://") + 3; | 125 var schemaIndex = sourceURL.indexOf("://") + 3; |
125 sourceURL = sourceURL.substring(0, schemaIndex) + normalizePath(sourceUR
L.substring(schemaIndex)); | 126 var pathIndex = sourceURL.indexOf("/", schemaIndex); |
| 127 if (pathIndex === -1) |
| 128 pathIndex = sourceURL.length; |
| 129 sourceURL = sourceURL.substring(0, pathIndex) + normalizePath(sourceURL.
substring(pathIndex)); |
| 130 |
126 if (_loadedScripts[sourceURL]) | 131 if (_loadedScripts[sourceURL]) |
127 continue; | 132 continue; |
128 urls.push(sourceURL); | 133 urls.push(sourceURL); |
129 promises.push(loadResourcePromise(sourceURL).then(scriptSourceLoaded.bin
d(null, i), scriptSourceLoaded.bind(null, i, undefined))); | 134 promises.push(loadResourcePromise(sourceURL).then(scriptSourceLoaded.bin
d(null, i), scriptSourceLoaded.bind(null, i, undefined))); |
130 } | 135 } |
131 return Promise.all(promises).then(undefined); | 136 return Promise.all(promises).then(undefined); |
132 | 137 |
133 /** | 138 /** |
134 * @param {number} scriptNumber | 139 * @param {number} scriptNumber |
135 * @param {string=} scriptSource | 140 * @param {string=} scriptSource |
(...skipping 1017 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1153 | 1158 |
1154 // This must be constructed after the query parameters have been parsed. | 1159 // This must be constructed after the query parameters have been parsed. |
1155 Runtime.experiments = new Runtime.ExperimentsSupport(); | 1160 Runtime.experiments = new Runtime.ExperimentsSupport(); |
1156 | 1161 |
1157 /** | 1162 /** |
1158 * @type {?string} | 1163 * @type {?string} |
1159 */ | 1164 */ |
1160 Runtime._remoteBase = Runtime.queryParam("remoteBase"); | 1165 Runtime._remoteBase = Runtime.queryParam("remoteBase"); |
1161 {(function validateRemoteBase() | 1166 {(function validateRemoteBase() |
1162 { | 1167 { |
1163 if (Runtime._remoteBase && !Runtime._remoteBase.startsWith("https://chrome-d
evtools-frontend.appspot.com/")) | 1168 var remoteBaseRegexp = /^https:\/\/chrome-devtools-frontend\.appspot\.com\/s
erve_file\/@[0-9a-zA-Z]+\/?$/; |
| 1169 if (Runtime._remoteBase && !remoteBaseRegexp.test(Runtime._remoteBase)) |
1164 Runtime._remoteBase = null; | 1170 Runtime._remoteBase = null; |
1165 })();} | 1171 })();} |
1166 | 1172 |
1167 /** | 1173 /** |
1168 * @param {string} path | 1174 * @param {string} path |
1169 * @return {string} | 1175 * @return {string} |
1170 */ | 1176 */ |
1171 Runtime.resolveSourceURL = function(path) | 1177 Runtime.resolveSourceURL = function(path) |
1172 { | 1178 { |
1173 var sourceURL = self.location.href; | 1179 var sourceURL = self.location.href; |
1174 if (self.location.search) | 1180 if (self.location.search) |
1175 sourceURL = sourceURL.replace(self.location.search, ""); | 1181 sourceURL = sourceURL.replace(self.location.search, ""); |
1176 sourceURL = sourceURL.substring(0, sourceURL.lastIndexOf("/") + 1) + path; | 1182 sourceURL = sourceURL.substring(0, sourceURL.lastIndexOf("/") + 1) + path; |
1177 return "\n/*# sourceURL=" + sourceURL + " */"; | 1183 return "\n/*# sourceURL=" + sourceURL + " */"; |
1178 } | 1184 } |
1179 | 1185 |
1180 /** @type {!Runtime} */ | 1186 /** @type {!Runtime} */ |
1181 var runtime; | 1187 var runtime; |
OLD | NEW |