mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-19 13:04:39 +08:00
Only query coverage model if it is available
Drive-by: Also disable content script filter if no coverage data is available. Bug: chromium:1131420 Change-Id: Ia09ce872b95a7c91840319e0da3419a031ee5e4d Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2424195 Reviewed-by: Peter Marshall <petermarshall@chromium.org> Commit-Queue: Sigurd Schneider <sigurds@chromium.org>
This commit is contained in:
committed by
Commit Bot
parent
8e4f3c6c93
commit
61507f98a5
@@ -125,10 +125,11 @@ export class CoverageView extends UI.Widget.VBox {
|
||||
toolbar.appendSeparator();
|
||||
this._showContentScriptsSetting = Common.Settings.Settings.instance().createSetting('showContentScripts', false);
|
||||
this._showContentScriptsSetting.addChangeListener(this._onFilterChanged, this);
|
||||
const contentScriptsCheckbox = new UI.Toolbar.ToolbarSettingCheckbox(
|
||||
this._contentScriptsCheckbox = new UI.Toolbar.ToolbarSettingCheckbox(
|
||||
this._showContentScriptsSetting, Common.UIString.UIString('Include extension content scripts'),
|
||||
Common.UIString.UIString('Content scripts'));
|
||||
toolbar.appendToolbarItem(contentScriptsCheckbox);
|
||||
this._contentScriptsCheckbox.setEnabled(false);
|
||||
toolbar.appendToolbarItem(this._contentScriptsCheckbox);
|
||||
|
||||
this._coverageResultsElement = this.contentElement.createChild('div', 'coverage-results');
|
||||
this._landingPage = this._buildLandingPage();
|
||||
@@ -179,6 +180,7 @@ export class CoverageView extends UI.Widget.VBox {
|
||||
this._statusMessageElement.textContent = '';
|
||||
this._filterInput.setEnabled(false);
|
||||
this._filterByTypeComboBox.setEnabled(false);
|
||||
this._contentScriptsCheckbox.setEnabled(false);
|
||||
this._saveButton.setEnabled(false);
|
||||
}
|
||||
|
||||
@@ -280,6 +282,7 @@ export class CoverageView extends UI.Widget.VBox {
|
||||
this._coverageTypeComboBox.setEnabled(false);
|
||||
this._filterInput.setEnabled(true);
|
||||
this._filterByTypeComboBox.setEnabled(true);
|
||||
this._contentScriptsCheckbox.setEnabled(true);
|
||||
if (this._landingPage.isShowing()) {
|
||||
this._landingPage.detach();
|
||||
}
|
||||
@@ -350,14 +353,16 @@ export class CoverageView extends UI.Widget.VBox {
|
||||
const all = {total: 0, unused: 0};
|
||||
const filtered = {total: 0, unused: 0};
|
||||
let filterApplied = false;
|
||||
for (const info of this._model.entries()) {
|
||||
all.total += info.size();
|
||||
all.unused += info.unusedSize();
|
||||
if (this._isVisible(false, info)) {
|
||||
filtered.total += info.size();
|
||||
filtered.unused += info.unusedSize();
|
||||
} else {
|
||||
filterApplied = true;
|
||||
if (this._model) {
|
||||
for (const info of this._model.entries()) {
|
||||
all.total += info.size();
|
||||
all.unused += info.unusedSize();
|
||||
if (this._isVisible(false, info)) {
|
||||
filtered.total += info.size();
|
||||
filtered.unused += info.unusedSize();
|
||||
} else {
|
||||
filterApplied = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
this._statusMessageElement.textContent =
|
||||
|
||||
Reference in New Issue
Block a user