Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(100)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/persistence/Automapping.js

Issue 2484833003: DevTools: teach automapping to deal with network resources with file:// urls (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/http/tests/inspector/persistence/automapping-absolute-paths-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 /** 4 /**
5 * @unrestricted 5 * @unrestricted
6 */ 6 */
7 WebInspector.Automapping = class { 7 WebInspector.Automapping = class {
8 /** 8 /**
9 * @param {!WebInspector.Workspace} workspace 9 * @param {!WebInspector.Workspace} workspace
10 * @param {function(!WebInspector.PersistenceBinding)} onBindingCreated 10 * @param {function(!WebInspector.PersistenceBinding)} onBindingCreated
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 this._activeFoldersIndex.removeFolder(projectFolder); 191 this._activeFoldersIndex.removeFolder(projectFolder);
192 } 192 }
193 this._onBindingRemoved.call(null, binding); 193 this._onBindingRemoved.call(null, binding);
194 } 194 }
195 195
196 /** 196 /**
197 * @param {!WebInspector.UISourceCode} networkSourceCode 197 * @param {!WebInspector.UISourceCode} networkSourceCode
198 * @return {!Promise<?WebInspector.PersistenceBinding>} 198 * @return {!Promise<?WebInspector.PersistenceBinding>}
199 */ 199 */
200 _createBinding(networkSourceCode) { 200 _createBinding(networkSourceCode) {
201 if (networkSourceCode.url().startsWith('file://')) {
202 var fileSourceCode = this._fileSystemUISourceCodes.get(networkSourceCode.u rl());
203 var binding = fileSourceCode ? new WebInspector.PersistenceBinding(network SourceCode, fileSourceCode, false) : null;
204 return Promise.resolve(binding);
205 }
206
201 var networkPath = WebInspector.ParsedURL.extractPath(networkSourceCode.url() ); 207 var networkPath = WebInspector.ParsedURL.extractPath(networkSourceCode.url() );
202 if (networkPath === null) 208 if (networkPath === null)
203 return Promise.resolve(/** @type {?WebInspector.PersistenceBinding} */ (nu ll)); 209 return Promise.resolve(/** @type {?WebInspector.PersistenceBinding} */ (nu ll));
204 210
205 if (networkPath.endsWith('/')) 211 if (networkPath.endsWith('/'))
206 networkPath += 'index.html'; 212 networkPath += 'index.html';
207 var similarFiles = this._filesIndex.similarFiles(networkPath).map(path => th is._fileSystemUISourceCodes.get(path)); 213 var similarFiles = this._filesIndex.similarFiles(networkPath).map(path => th is._fileSystemUISourceCodes.get(path));
208 if (!similarFiles.length) 214 if (!similarFiles.length)
209 return Promise.resolve(/** @type {?WebInspector.PersistenceBinding} */ (nu ll)); 215 return Promise.resolve(/** @type {?WebInspector.PersistenceBinding} */ (nu ll));
210 216
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 /** 398 /**
393 * @param {string} path 399 * @param {string} path
394 * @return {string} 400 * @return {string}
395 */ 401 */
396 closestParentFolder(path) { 402 closestParentFolder(path) {
397 var encodedPath = this._encoder.encode(path); 403 var encodedPath = this._encoder.encode(path);
398 var commonPrefix = this._index.longestPrefix(encodedPath, true); 404 var commonPrefix = this._index.longestPrefix(encodedPath, true);
399 return this._encoder.decode(commonPrefix); 405 return this._encoder.decode(commonPrefix);
400 } 406 }
401 }; 407 };
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/http/tests/inspector/persistence/automapping-absolute-paths-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698