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 @@
if (!compontentView.loaded) {
// try again when content is loaded.
TestRunner.addSniffer(
compontentView, 'onTextEditorContentSet', previewViewHandled.bind(this, searches, callback, view));
compontentView, 'setContent', previewViewHandled.bind(this, searches, callback, view));
return;
}
} else if (compontentView instanceof SourceFrame.XMLView) {
......
......@@ -79,7 +79,7 @@ ApplicationTestRunner.showResource = function(resourceURL, callback) {
if (sourceFrame.loaded)
callbackWrapper(sourceFrame);
else
TestRunner.addSniffer(sourceFrame, 'onTextEditorContentSet', callbackWrapper.bind(null, sourceFrame));
TestRunner.addSniffer(sourceFrame, 'setContent', callbackWrapper.bind(null, sourceFrame));
}
ApplicationTestRunner.runAfterResourcesAreFinished([resourceURL], showResourceCallback);
......
......@@ -379,10 +379,6 @@ SourceFrame.SourceFrame = class extends UI.SimpleView {
this._delayedFindSearchMatches = null;
}
this._muteChangeEventsForSetContent = false;
this.onTextEditorContentSet();
}
onTextEditorContentSet() {
}
/**
......@@ -512,10 +508,6 @@ SourceFrame.SourceFrame = class extends UI.SimpleView {
return true;
}
get currentSearchResultIndex() {
return this._currentSearchResultIndex;
}
jumpToSearchResult(index) {
if (!this.loaded || !this._searchResults.length)
return;
......
......@@ -232,13 +232,15 @@ Sources.UISourceCodeFrame = class extends SourceFrame.SourceFrame {
/**
* @override
* @param {?string} content
*/
onTextEditorContentSet() {
super.onTextEditorContentSet();
setContent(content) {
this._disposePlugins();
super.setContent(content);
for (const message of this._allMessages())
this._addMessageToSource(message);
this._decorateAllTypes();
this._refreshPlugins();
this._ensurePluginsLoaded();
}
/**
......@@ -291,11 +293,6 @@ Sources.UISourceCodeFrame = class extends SourceFrame.SourceFrame {
this._updateStyle();
}
_refreshPlugins() {
this._disposePlugins();
this._ensurePluginsLoaded();
}
_ensurePluginsLoaded() {
if (!this.loaded || this._plugins.length)
return;
......
......@@ -399,7 +399,7 @@ SourcesTestRunner.showUISourceCode = function(uiSourceCode, callback) {
if (sourceFrame.loaded)
callback(sourceFrame);
else
TestRunner.addSniffer(sourceFrame, 'onTextEditorContentSet', callback && callback.bind(null, sourceFrame));
TestRunner.addSniffer(sourceFrame, 'setContent', callback && callback.bind(null, sourceFrame));
};
SourcesTestRunner.showUISourceCodePromise = function(uiSourceCode) {
......@@ -747,7 +747,7 @@ SourcesTestRunner.debuggerPlugin = function(sourceFrame) {
SourcesTestRunner.waitUntilDebuggerPluginLoaded = async function(sourceFrame) {
while (!SourcesTestRunner.debuggerPlugin(sourceFrame))
await TestRunner.addSnifferPromise(sourceFrame, '_refreshPlugins');
await TestRunner.addSnifferPromise(sourceFrame, '_ensurePluginsLoaded');
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