Commit 1e760fbe authored by Joel Einbinder's avatar Joel Einbinder Committed by Commit Bot

DevTools: Remove SourceFrame onTextEditorContentSet

onTextEditorContentSet is a legacy method from when SourceFrame had
many subclasses. Overriding setContent instead is simpler and makes
for a cleaner plugin story around dispose/ensure plugins.

As a drive-by, the currentSearchResultIndex getter was removed.

Change-Id: I7f467da9297288b9f654eaf1cdd73b8be281cbaa
Reviewed-on: https://chromium-review.googlesource.com/1020812
Commit-Queue: Andrey Lushnikov <lushnikov@chromium.org>
Reviewed-by: default avatarAndrey Lushnikov <lushnikov@chromium.org>
Cr-Commit-Position: refs/heads/master@{#553320}
parent 4648e7b6
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
if (!compontentView.loaded) { if (!compontentView.loaded) {
// try again when content is loaded. // try again when content is loaded.
TestRunner.addSniffer( TestRunner.addSniffer(
compontentView, 'onTextEditorContentSet', previewViewHandled.bind(this, searches, callback, view)); compontentView, 'setContent', previewViewHandled.bind(this, searches, callback, view));
return; return;
} }
} else if (compontentView instanceof SourceFrame.XMLView) { } else if (compontentView instanceof SourceFrame.XMLView) {
......
...@@ -79,7 +79,7 @@ ApplicationTestRunner.showResource = function(resourceURL, callback) { ...@@ -79,7 +79,7 @@ ApplicationTestRunner.showResource = function(resourceURL, callback) {
if (sourceFrame.loaded) if (sourceFrame.loaded)
callbackWrapper(sourceFrame); callbackWrapper(sourceFrame);
else else
TestRunner.addSniffer(sourceFrame, 'onTextEditorContentSet', callbackWrapper.bind(null, sourceFrame)); TestRunner.addSniffer(sourceFrame, 'setContent', callbackWrapper.bind(null, sourceFrame));
} }
ApplicationTestRunner.runAfterResourcesAreFinished([resourceURL], showResourceCallback); ApplicationTestRunner.runAfterResourcesAreFinished([resourceURL], showResourceCallback);
......
...@@ -379,10 +379,6 @@ SourceFrame.SourceFrame = class extends UI.SimpleView { ...@@ -379,10 +379,6 @@ SourceFrame.SourceFrame = class extends UI.SimpleView {
this._delayedFindSearchMatches = null; this._delayedFindSearchMatches = null;
} }
this._muteChangeEventsForSetContent = false; this._muteChangeEventsForSetContent = false;
this.onTextEditorContentSet();
}
onTextEditorContentSet() {
} }
/** /**
...@@ -512,10 +508,6 @@ SourceFrame.SourceFrame = class extends UI.SimpleView { ...@@ -512,10 +508,6 @@ SourceFrame.SourceFrame = class extends UI.SimpleView {
return true; return true;
} }
get currentSearchResultIndex() {
return this._currentSearchResultIndex;
}
jumpToSearchResult(index) { jumpToSearchResult(index) {
if (!this.loaded || !this._searchResults.length) if (!this.loaded || !this._searchResults.length)
return; return;
......
...@@ -232,13 +232,15 @@ Sources.UISourceCodeFrame = class extends SourceFrame.SourceFrame { ...@@ -232,13 +232,15 @@ Sources.UISourceCodeFrame = class extends SourceFrame.SourceFrame {
/** /**
* @override * @override
* @param {?string} content
*/ */
onTextEditorContentSet() { setContent(content) {
super.onTextEditorContentSet(); this._disposePlugins();
super.setContent(content);
for (const message of this._allMessages()) for (const message of this._allMessages())
this._addMessageToSource(message); this._addMessageToSource(message);
this._decorateAllTypes(); this._decorateAllTypes();
this._refreshPlugins(); this._ensurePluginsLoaded();
} }
/** /**
...@@ -291,11 +293,6 @@ Sources.UISourceCodeFrame = class extends SourceFrame.SourceFrame { ...@@ -291,11 +293,6 @@ Sources.UISourceCodeFrame = class extends SourceFrame.SourceFrame {
this._updateStyle(); this._updateStyle();
} }
_refreshPlugins() {
this._disposePlugins();
this._ensurePluginsLoaded();
}
_ensurePluginsLoaded() { _ensurePluginsLoaded() {
if (!this.loaded || this._plugins.length) if (!this.loaded || this._plugins.length)
return; return;
......
...@@ -399,7 +399,7 @@ SourcesTestRunner.showUISourceCode = function(uiSourceCode, callback) { ...@@ -399,7 +399,7 @@ SourcesTestRunner.showUISourceCode = function(uiSourceCode, callback) {
if (sourceFrame.loaded) if (sourceFrame.loaded)
callback(sourceFrame); callback(sourceFrame);
else else
TestRunner.addSniffer(sourceFrame, 'onTextEditorContentSet', callback && callback.bind(null, sourceFrame)); TestRunner.addSniffer(sourceFrame, 'setContent', callback && callback.bind(null, sourceFrame));
}; };
SourcesTestRunner.showUISourceCodePromise = function(uiSourceCode) { SourcesTestRunner.showUISourceCodePromise = function(uiSourceCode) {
...@@ -747,7 +747,7 @@ SourcesTestRunner.debuggerPlugin = function(sourceFrame) { ...@@ -747,7 +747,7 @@ SourcesTestRunner.debuggerPlugin = function(sourceFrame) {
SourcesTestRunner.waitUntilDebuggerPluginLoaded = async function(sourceFrame) { SourcesTestRunner.waitUntilDebuggerPluginLoaded = async function(sourceFrame) {
while (!SourcesTestRunner.debuggerPlugin(sourceFrame)) while (!SourcesTestRunner.debuggerPlugin(sourceFrame))
await TestRunner.addSnifferPromise(sourceFrame, '_refreshPlugins'); await TestRunner.addSnifferPromise(sourceFrame, '_ensurePluginsLoaded');
return SourcesTestRunner.debuggerPlugin(sourceFrame); return SourcesTestRunner.debuggerPlugin(sourceFrame);
}; };
......
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