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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/persistence/DefaultMapping.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 | « third_party/WebKit/Source/devtools/front_end/persistence/Automapping.js ('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 Persistence.DefaultMapping = class { 7 Persistence.DefaultMapping = class {
8 /** 8 /**
9 * @param {!Workspace.Workspace} workspace 9 * @param {!Workspace.Workspace} workspace
10 * @param {!Workspace.FileSystemMapping} fileSystemMapping 10 * @param {!Workspace.FileSystemMapping} fileSystemMapping
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 } 85 }
86 86
87 /** 87 /**
88 * @param {!Workspace.UISourceCode} uiSourceCode 88 * @param {!Workspace.UISourceCode} uiSourceCode
89 */ 89 */
90 _bind(uiSourceCode) { 90 _bind(uiSourceCode) {
91 console.assert(!uiSourceCode[Persistence.DefaultMapping._binding], 'Cannot b ind already bound UISourceCode!'); 91 console.assert(!uiSourceCode[Persistence.DefaultMapping._binding], 'Cannot b ind already bound UISourceCode!');
92 var binding = this._createBinding(uiSourceCode); 92 var binding = this._createBinding(uiSourceCode);
93 if (!binding) 93 if (!binding)
94 return; 94 return;
95 // TODO(lushnikov): remove this check once there's a single uiSourceCode per url. @see crbug.com/670180
96 if (binding.network[Persistence.DefaultMapping._binding] || binding.fileSyst em[Persistence.DefaultMapping._binding])
97 return;
98
95 this._bindings.add(binding); 99 this._bindings.add(binding);
96 binding.network[Persistence.DefaultMapping._binding] = binding; 100 binding.network[Persistence.DefaultMapping._binding] = binding;
97 binding.fileSystem[Persistence.DefaultMapping._binding] = binding; 101 binding.fileSystem[Persistence.DefaultMapping._binding] = binding;
98 102
99 binding.fileSystem.addEventListener( 103 binding.fileSystem.addEventListener(
100 Workspace.UISourceCode.Events.TitleChanged, this._onFileSystemUISourceCo deRenamed, this); 104 Workspace.UISourceCode.Events.TitleChanged, this._onFileSystemUISourceCo deRenamed, this);
101 105
102 this._onBindingCreated.call(null, binding); 106 this._onBindingCreated.call(null, binding);
103 } 107 }
104 108
(...skipping 23 matching lines...) Expand all
128 this._unbind(binding.network); 132 this._unbind(binding.network);
129 this._bind(binding.network); 133 this._bind(binding.network);
130 } 134 }
131 135
132 dispose() { 136 dispose() {
133 Common.EventTarget.removeEventListeners(this._eventListeners); 137 Common.EventTarget.removeEventListeners(this._eventListeners);
134 } 138 }
135 }; 139 };
136 140
137 Persistence.DefaultMapping._binding = Symbol('DefaultMapping.Binding'); 141 Persistence.DefaultMapping._binding = Symbol('DefaultMapping.Binding');
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/persistence/Automapping.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698