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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/workspace/FileSystemMapping.js

Issue 1813943003: DevTools: automatic mapping detection is broken for cases with specific file paths. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: added expectations Created 4 years, 9 months 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/inspector/file-system-mapping-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 /* 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 * * 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 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 { 304 {
305 var commonPathSuffixLength = 0; 305 var commonPathSuffixLength = 0;
306 for (var i = 0; i < filePath.length; ++i) { 306 for (var i = 0; i < filePath.length; ++i) {
307 var filePathCharacter = filePath[filePath.length - 1 - i]; 307 var filePathCharacter = filePath[filePath.length - 1 - i];
308 var urlCharacter = url[url.length - 1 - i]; 308 var urlCharacter = url[url.length - 1 - i];
309 if (filePathCharacter !== urlCharacter) 309 if (filePathCharacter !== urlCharacter)
310 break; 310 break;
311 if (filePathCharacter === "/") 311 if (filePathCharacter === "/")
312 commonPathSuffixLength = i; 312 commonPathSuffixLength = i;
313 } 313 }
314 var pathPrefix = filePath.substring(fileSystemPath.length, filePath.leng th - commonPathSuffixLength); 314 var from = fileSystemPath.length;
315 var to = filePath.length - commonPathSuffixLength;
316 var pathPrefix = filePath.substring(from, to);
315 var urlPrefix = url.substr(0, url.length - commonPathSuffixLength); 317 var urlPrefix = url.substr(0, url.length - commonPathSuffixLength);
316 this.addFileMapping(fileSystemPath, urlPrefix, pathPrefix); 318 if (to >= from)
319 this.addFileMapping(fileSystemPath, urlPrefix, pathPrefix);
320 else
321 this.addFileMapping(fileSystemPath, urlPrefix + pathPrefix, "/");
317 }, 322 },
318 323
319 resetForTesting: function() 324 resetForTesting: function()
320 { 325 {
321 this._fileSystemMappings = {}; 326 this._fileSystemMappings = {};
322 }, 327 },
323 328
324 __proto__: WebInspector.Object.prototype 329 __proto__: WebInspector.Object.prototype
325 } 330 }
326 331
327 /** 332 /**
328 * @constructor 333 * @constructor
329 * @param {string} fileSystemPath 334 * @param {string} fileSystemPath
330 * @param {string} urlPrefix 335 * @param {string} urlPrefix
331 * @param {string} pathPrefix 336 * @param {string} pathPrefix
332 * @param {boolean} configurable 337 * @param {boolean} configurable
333 */ 338 */
334 WebInspector.FileSystemMapping.Entry = function(fileSystemPath, urlPrefix, pathP refix, configurable) 339 WebInspector.FileSystemMapping.Entry = function(fileSystemPath, urlPrefix, pathP refix, configurable)
335 { 340 {
336 this.fileSystemPath = fileSystemPath; 341 this.fileSystemPath = fileSystemPath;
337 this.urlPrefix = urlPrefix; 342 this.urlPrefix = urlPrefix;
338 this.pathPrefix = pathPrefix; 343 this.pathPrefix = pathPrefix;
339 this.configurable = configurable; 344 this.configurable = configurable;
340 } 345 }
341 346
342 /** 347 /**
343 * @type {!WebInspector.FileSystemMapping} 348 * @type {!WebInspector.FileSystemMapping}
344 */ 349 */
345 WebInspector.fileSystemMapping; 350 WebInspector.fileSystemMapping;
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/inspector/file-system-mapping-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698