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

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

Issue 2546583003: DevTools: [Persistence] guard against multiple UISourceCodes with similar URL (Closed)
Patch Set: put check deep down Created 4 years 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 | « no previous file | third_party/WebKit/Source/devtools/front_end/persistence/DefaultMapping.js » ('j') | 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 Persistence.Automapping = class { 7 Persistence.Automapping = class {
8 /** 8 /**
9 * @param {!Workspace.Workspace} workspace 9 * @param {!Workspace.Workspace} workspace
10 * @param {function(!Persistence.PersistenceBinding)} onBindingCreated 10 * @param {function(!Persistence.PersistenceBinding)} onBindingCreated
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 * @this {Persistence.Automapping} 146 * @this {Persistence.Automapping}
147 */ 147 */
148 function onBinding(binding) { 148 function onBinding(binding) {
149 if (networkSourceCode[Persistence.Automapping._processingPromise] !== crea teBindingPromise) 149 if (networkSourceCode[Persistence.Automapping._processingPromise] !== crea teBindingPromise)
150 return; 150 return;
151 networkSourceCode[Persistence.Automapping._processingPromise] = null; 151 networkSourceCode[Persistence.Automapping._processingPromise] = null;
152 if (!binding) { 152 if (!binding) {
153 this._onBindingFailedForTest(); 153 this._onBindingFailedForTest();
154 return; 154 return;
155 } 155 }
156 // TODO(lushnikov): remove this check once there's a single uiSourceCode p er url. @see crbug.com/670180
157 if (binding.network[Persistence.Automapping._binding] || binding.fileSyste m[Persistence.Automapping._binding])
158 return;
156 159
157 this._bindings.add(binding); 160 this._bindings.add(binding);
158 binding.network[Persistence.Automapping._binding] = binding; 161 binding.network[Persistence.Automapping._binding] = binding;
159 binding.fileSystem[Persistence.Automapping._binding] = binding; 162 binding.fileSystem[Persistence.Automapping._binding] = binding;
160 if (binding.exactMatch) { 163 if (binding.exactMatch) {
161 var projectFolder = this._projectFoldersIndex.closestParentFolder(bindin g.fileSystem.url()); 164 var projectFolder = this._projectFoldersIndex.closestParentFolder(bindin g.fileSystem.url());
162 var newFolderAdded = projectFolder ? this._activeFoldersIndex.addFolder( projectFolder) : false; 165 var newFolderAdded = projectFolder ? this._activeFoldersIndex.addFolder( projectFolder) : false;
163 if (newFolderAdded) 166 if (newFolderAdded)
164 this._scheduleSweep(); 167 this._scheduleSweep();
165 } 168 }
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 /** 402 /**
400 * @param {string} path 403 * @param {string} path
401 * @return {string} 404 * @return {string}
402 */ 405 */
403 closestParentFolder(path) { 406 closestParentFolder(path) {
404 var encodedPath = this._encoder.encode(path); 407 var encodedPath = this._encoder.encode(path);
405 var commonPrefix = this._index.longestPrefix(encodedPath, true); 408 var commonPrefix = this._index.longestPrefix(encodedPath, true);
406 return this._encoder.decode(commonPrefix); 409 return this._encoder.decode(commonPrefix);
407 } 410 }
408 }; 411 };
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/persistence/DefaultMapping.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698