- Revision
- 252704
- Author
- yu...@chromium.org
- Date
- 2019-11-20 13:23:36 -0800 (Wed, 20 Nov 2019)
Log Message
Web Inspector: REGRESSION(r250618): main resource view is empty when pausing on inline 'debugger' statement
https://bugs.webkit.org/show_bug.cgi?id=204086
Reviewed by Devin Rousso.
SourceCodeRevision.currentRevision doesn't create new revisions under the hood anymore.
This allows to avoid undesirable side effects when e.g. text editor tries to read current
content of the SourceCode which results in a new revision (with empty content).
New method editableRevision is introduced for applying changes to the resource while
keeping original content revision intact.
* UserInterface/Controllers/CSSManager.js:
(WI.CSSManager.prototype._resourceContentDidChange.applyStyleSheetChanges.styleSheetFound):
(WI.CSSManager.prototype._resourceContentDidChange.applyStyleSheetChanges):
(WI.CSSManager.prototype._resourceContentDidChange):
(WI.CSSManager.prototype._updateResourceContent.fetchedStyleSheetContent):
* UserInterface/Models/SourceCode.js:
(WI.SourceCode.prototype.get currentRevision):
(WI.SourceCode.prototype.get editableRevision):
(WI.SourceCode.prototype.get content):
(WI.SourceCode.prototype.revisionContentDidChange):
* UserInterface/Views/FontResourceContentView.js:
(WI.FontResourceContentView.prototype.dropZoneHandleDrop):
* UserInterface/Views/ImageResourceContentView.js:
(WI.ImageResourceContentView.prototype.dropZoneHandleDrop):
* UserInterface/Views/ResourceContentView.js:
(WI.ResourceContentView.prototype._contentAvailable):
(WI.ResourceContentView.prototype._handleImportLocalResourceOverride):
* UserInterface/Views/ScriptContentView.js:
(WI.ScriptContentView.prototype._handleTextEditorContentDidChange):
* UserInterface/Views/TextResourceContentView.js:
(WI.TextResourceContentView.prototype._textEditorContentDidChange):
Modified Paths
Diff
Modified: trunk/Source/WebInspectorUI/ChangeLog (252703 => 252704)
--- trunk/Source/WebInspectorUI/ChangeLog 2019-11-20 21:04:04 UTC (rev 252703)
+++ trunk/Source/WebInspectorUI/ChangeLog 2019-11-20 21:23:36 UTC (rev 252704)
@@ -1,3 +1,38 @@
+2019-11-20 Yury Semikhatsky <yu...@chromium.org>
+
+ Web Inspector: REGRESSION(r250618): main resource view is empty when pausing on inline 'debugger' statement
+ https://bugs.webkit.org/show_bug.cgi?id=204086
+
+ Reviewed by Devin Rousso.
+
+ SourceCodeRevision.currentRevision doesn't create new revisions under the hood anymore.
+ This allows to avoid undesirable side effects when e.g. text editor tries to read current
+ content of the SourceCode which results in a new revision (with empty content).
+ New method editableRevision is introduced for applying changes to the resource while
+ keeping original content revision intact.
+
+ * UserInterface/Controllers/CSSManager.js:
+ (WI.CSSManager.prototype._resourceContentDidChange.applyStyleSheetChanges.styleSheetFound):
+ (WI.CSSManager.prototype._resourceContentDidChange.applyStyleSheetChanges):
+ (WI.CSSManager.prototype._resourceContentDidChange):
+ (WI.CSSManager.prototype._updateResourceContent.fetchedStyleSheetContent):
+ * UserInterface/Models/SourceCode.js:
+ (WI.SourceCode.prototype.get currentRevision):
+ (WI.SourceCode.prototype.get editableRevision):
+ (WI.SourceCode.prototype.get content):
+ (WI.SourceCode.prototype.revisionContentDidChange):
+ * UserInterface/Views/FontResourceContentView.js:
+ (WI.FontResourceContentView.prototype.dropZoneHandleDrop):
+ * UserInterface/Views/ImageResourceContentView.js:
+ (WI.ImageResourceContentView.prototype.dropZoneHandleDrop):
+ * UserInterface/Views/ResourceContentView.js:
+ (WI.ResourceContentView.prototype._contentAvailable):
+ (WI.ResourceContentView.prototype._handleImportLocalResourceOverride):
+ * UserInterface/Views/ScriptContentView.js:
+ (WI.ScriptContentView.prototype._handleTextEditorContentDidChange):
+ * UserInterface/Views/TextResourceContentView.js:
+ (WI.TextResourceContentView.prototype._textEditorContentDidChange):
+
2019-11-19 Devin Rousso <drou...@apple.com>
Web Inspector: Local Overrides: the placeholder for the MIME type, status code, and status text is the same as the placeholder URL
Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/CSSManager.js (252703 => 252704)
--- trunk/Source/WebInspectorUI/UserInterface/Controllers/CSSManager.js 2019-11-20 21:04:04 UTC (rev 252703)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/CSSManager.js 2019-11-20 21:23:36 UTC (rev 252704)
@@ -660,7 +660,7 @@
// ignore the next _updateResourceContent call.
resource.__ignoreNextUpdateResourceContent = true;
- let revision = styleSheet.currentRevision;
+ let revision = styleSheet.editableRevision;
revision.updateRevisionContent(resource.content);
}
@@ -704,7 +704,7 @@
this._ignoreResourceContentDidChangeEventForResource = representedObject;
- let revision = representedObject.currentRevision;
+ let revision = representedObject.editableRevision;
if (styleSheet.isInspectorStyleSheet()) {
revision.updateRevisionContent(representedObject.content);
styleSheet.dispatchEventToListeners(WI.SourceCode.Event.ContentDidChange);
Modified: trunk/Source/WebInspectorUI/UserInterface/Models/SourceCode.js (252703 => 252704)
--- trunk/Source/WebInspectorUI/UserInterface/Models/SourceCode.js 2019-11-20 21:04:04 UTC (rev 252703)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/SourceCode.js 2019-11-20 21:23:36 UTC (rev 252704)
@@ -66,7 +66,6 @@
get currentRevision()
{
- this._initializeCurrentRevisionIfNeeded();
return this._currentRevision;
}
@@ -85,9 +84,16 @@
this.dispatchEventToListeners(WI.SourceCode.Event.ContentDidChange);
}
+ get editableRevision()
+ {
+ if (this._currentRevision === this._originalRevision)
+ this._currentRevision = this._originalRevision.copy();
+ return this._currentRevision;
+ }
+
get content()
{
- return this.currentRevision.content;
+ return this._currentRevision.content;
}
get url()
@@ -178,13 +184,11 @@
revisionContentDidChange(revision)
{
- if (revision === this._originalRevision)
- this._initializeCurrentRevisionIfNeeded();
-
if (this._ignoreRevisionContentDidChangeEvent)
return;
- if (revision !== this.currentRevision)
+ console.assert(revision === this._currentRevision);
+ if (revision !== this._currentRevision)
return;
this.handleCurrentRevisionContentChange();
@@ -224,12 +228,6 @@
// Private
- _initializeCurrentRevisionIfNeeded()
- {
- if (this._currentRevision === this._originalRevision)
- this._currentRevision = this._originalRevision.copy();
- }
-
_processContent(parameters)
{
// Different backend APIs return one of `content, `body`, `text`, or `scriptSource`.
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/FontResourceContentView.js (252703 => 252704)
--- trunk/Source/WebInspectorUI/UserInterface/Views/FontResourceContentView.js 2019-11-20 21:04:04 UTC (rev 252703)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/FontResourceContentView.js 2019-11-20 21:23:36 UTC (rev 252704)
@@ -146,7 +146,7 @@
console.assert(localResourceOverride);
- let revision = localResourceOverride.localResource.currentRevision;
+ let revision = localResourceOverride.localResource.editableRevision;
revision.updateRevisionContent(content, {base64Encoded, mimeType});
if (!this.showingLocalResourceOverride)
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ImageResourceContentView.js (252703 => 252704)
--- trunk/Source/WebInspectorUI/UserInterface/Views/ImageResourceContentView.js 2019-11-20 21:04:04 UTC (rev 252703)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ImageResourceContentView.js 2019-11-20 21:23:36 UTC (rev 252704)
@@ -161,7 +161,7 @@
console.assert(localResourceOverride);
- let revision = localResourceOverride.localResource.currentRevision;
+ let revision = localResourceOverride.localResource.editableRevision;
revision.updateRevisionContent(content, {base64Encoded, mimeType});
if (!this.showingLocalResourceOverride)
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ResourceContentView.js (252703 => 252704)
--- trunk/Source/WebInspectorUI/UserInterface/Views/ResourceContentView.js 2019-11-20 21:04:04 UTC (rev 252703)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ResourceContentView.js 2019-11-20 21:23:36 UTC (rev 252704)
@@ -209,8 +209,12 @@
return;
}
+ // The view maybe populated with inline scripts content by the time resource
+ // content arrives. SourceCodeTextEditor will handle that.
+ if (this._hasContent())
+ return;
+
// Content is ready to show, call the public method now.
- console.assert(!this._hasContent());
console.assert(parameters.sourceCode === this._resource);
this.contentAvailable(parameters.sourceCode.content, parameters.base64Encoded);
@@ -290,8 +294,8 @@
let localResourceOverride = WI.networkManager.localResourceOverrideForURL(this.resource.url);
console.assert(localResourceOverride);
- let revision = localResourceOverride.localResource.currentRevision;
await this._getContentForLocalResourceOverrideFromFile(fileList[0], ({mimeType, base64Encoded, content}) => {
+ let revision = localResourceOverride.localResource.editableRevision;
revision.updateRevisionContent(content, {base64Encoded, mimeType});
});
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ScriptContentView.js (252703 => 252704)
--- trunk/Source/WebInspectorUI/UserInterface/Views/ScriptContentView.js 2019-11-20 21:04:04 UTC (rev 252703)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ScriptContentView.js 2019-11-20 21:23:36 UTC (rev 252704)
@@ -236,7 +236,7 @@
_handleTextEditorContentDidChange(event)
{
- this._script.currentRevision.updateRevisionContent(this._textEditor.string);
+ this._script.editableRevision.updateRevisionContent(this._textEditor.string);
}
_togglePrettyPrint(event)
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TextResourceContentView.js (252703 => 252704)
--- trunk/Source/WebInspectorUI/UserInterface/Views/TextResourceContentView.js 2019-11-20 21:04:04 UTC (rev 252703)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TextResourceContentView.js 2019-11-20 21:23:36 UTC (rev 252704)
@@ -289,7 +289,7 @@
_textEditorContentDidChange(event)
{
this._ignoreSourceCodeContentDidChangeEvent = true;
- this.resource.currentRevision.updateRevisionContent(this._textEditor.string);
+ this.resource.editableRevision.updateRevisionContent(this._textEditor.string);
this._ignoreSourceCodeContentDidChangeEvent = false;
}