Commit 104337b9 authored by Joel Einbinder's avatar Joel Einbinder Committed by Commit Bot

DevTools: Don't write to disk when override files bind

When override files bind to network UISourceCodes, the content of the
file could be different so we add a commit to the network UISourceCode
with the new content. This was unintentionally being picked up by
persistence, and copied back to disk as if the user edited the network
UISourceCode.

Change-Id: Id1e832a658e85fae6965ad71a1a08552791f6328
Reviewed-on: https://chromium-review.googlesource.com/823229Reviewed-by: default avatarPavel Feldman <pfeldman@chromium.org>
Commit-Queue: Joel Einbinder <einbinder@chromium.org>
Cr-Commit-Position: refs/heads/master@{#523882}
parent d500724e
...@@ -310,7 +310,7 @@ Persistence.NetworkPersistenceManager = class extends Common.Object { ...@@ -310,7 +310,7 @@ Persistence.NetworkPersistenceManager = class extends Common.Object {
fileSystemUISourceCode[this._bindingSymbol] = binding; fileSystemUISourceCode[this._bindingSymbol] = binding;
Persistence.persistence.addBinding(binding); Persistence.persistence.addBinding(binding);
var content = await fileSystemUISourceCode.requestContent(); var content = await fileSystemUISourceCode.requestContent();
networkUISourceCode.addRevision(content); Persistence.persistence.syncContent(fileSystemUISourceCode, content);
} }
/** /**
......
...@@ -219,10 +219,18 @@ Persistence.Persistence = class extends Common.Object { ...@@ -219,10 +219,18 @@ Persistence.Persistence = class extends Common.Object {
*/ */
_onWorkingCopyCommitted(event) { _onWorkingCopyCommitted(event) {
var uiSourceCode = /** @type {!Workspace.UISourceCode} */ (event.data.uiSourceCode); var uiSourceCode = /** @type {!Workspace.UISourceCode} */ (event.data.uiSourceCode);
var newContent = /** @type {string} */ (event.data.content);
this.syncContent(uiSourceCode, newContent);
}
/**
* @param {!Workspace.UISourceCode} uiSourceCode
* @param {string} newContent
*/
syncContent(uiSourceCode, newContent) {
var binding = uiSourceCode[Persistence.Persistence._binding]; var binding = uiSourceCode[Persistence.Persistence._binding];
if (!binding || binding[Persistence.Persistence._muteCommit]) if (!binding || binding[Persistence.Persistence._muteCommit])
return; return;
var newContent = /** @type {string} */ (event.data.content);
var other = binding.network === uiSourceCode ? binding.fileSystem : binding.network; var other = binding.network === uiSourceCode ? binding.fileSystem : binding.network;
var target = Bindings.NetworkProject.targetForUISourceCode(binding.network); var target = Bindings.NetworkProject.targetForUISourceCode(binding.network);
if (target.isNodeJS()) { if (target.isNodeJS()) {
......
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