Commit ee3f3ecc authored by lushnikov's avatar lushnikov Committed by Commit bot

DevTools: fix tabbed editor to not open all bound files

The crrev.com/2384783003 introduced a regression where tabbedEditorContainer
starts opening file for every created persistence binding.

This patch fixes the issue.

BUG=none
R=pfeldman, dgozman

Review-Url: https://codereview.chromium.org/2390333002
Cr-Commit-Position: refs/heads/master@{#422881}
parent e47ceb37
......@@ -4,7 +4,8 @@ Binding created: {
network: http://127.0.0.1:8000/inspector/persistence/resources/foo.js
fileSystem: file:///var/www/inspector/persistence/resources/foo.js
}
Opened tabs before opening any UISourceCodes:
request open uiSourceCode: file:///var/www/inspector/persistence/resources/foo.js
Opened tabs:
Opened tabs after opening UISourceCode:
http://127.0.0.1:8000/inspector/persistence/resources/foo.js
......@@ -19,18 +19,19 @@ function test()
function onBindingCreated(binding)
{
InspectorTest.addResult("Binding created: " + binding);
dumpEditorTabs("Opened tabs before opening any UISourceCodes:");
InspectorTest.addResult("request open uiSourceCode: " + binding.fileSystem.url());
WebInspector.panels.sources.showUISourceCode(binding.fileSystem, 0, 0);
dumpEditorTabs();
dumpEditorTabs("Opened tabs after opening UISourceCode:");
InspectorTest.completeTest();
}
function dumpEditorTabs()
function dumpEditorTabs(title)
{
var editorContainer = WebInspector.panels.sources._sourcesView._editorContainer;
var openedUISourceCodes = editorContainer._tabIds.keysArray();
openedUISourceCodes.sort((a, b) => a.url().compareTo(b.url()));
InspectorTest.addResult("Opened tabs: ");
InspectorTest.addResult(title);
for (code of openedUISourceCodes)
InspectorTest.addResult(" " + code.url());
}
......
......@@ -90,23 +90,18 @@ WebInspector.TabbedEditorContainer.prototype = {
var binding = /** @type {!WebInspector.PersistenceBinding} */(event.data);
var networkTabId = this._tabIds.get(binding.network);
var fileSystemTabId = this._tabIds.get(binding.fileSystem);
var wasSelectedInFileSystem = this._currentFile === binding.fileSystem;
if (fileSystemTabId) {
if (networkTabId)
this._tabbedPane.changeTabTitle(networkTabId, this._titleForFile(binding.fileSystem), this._tooltipForFile(binding.fileSystem));
if (!fileSystemTabId)
return;
var wasSelectedInFileSystem = this._currentFile === binding.fileSystem;
var tabIndex = this._tabbedPane.tabIndex(fileSystemTabId);
this._closeTabs([fileSystemTabId]);
}
if (networkTabId) {
if (!networkTabId)
networkTabId = this._appendFileTab(binding.network, false, tabIndex);
if (wasSelectedInFileSystem)
this._tabbedPane.selectTab(networkTabId, false);
this._tabbedPane.changeTabTitle(networkTabId, this._titleForFile(binding.fileSystem), this._tooltipForFile(binding.fileSystem));
return;
}
var tabId = this._appendFileTab(binding.network, false, tabIndex);
if (wasSelectedInFileSystem)
this._tabbedPane.selectTab(tabId, false);
},
/**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment