[Underscore Migration] Migrate panels/application
This patch is part of the underscore migration that adds the private
keyword to all properties that start with an underscore and removes the
underscore.
[email protected]
Bug:chromium:1207342
Change-Id: Ib0ba7b50bf3193a647a81c6c702b24bd4a59b05f
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3090585
Commit-Queue: Jan Scheffler <[email protected]>
Auto-Submit: Jan Scheffler <[email protected]>
Reviewed-by: Tim van der Lippe <[email protected]>
diff --git a/front_end/panels/application/AppManifestView.ts b/front_end/panels/application/AppManifestView.ts
index 80a9023..64e4c5d 100644
--- a/front_end/panels/application/AppManifestView.ts
+++ b/front_end/panels/application/AppManifestView.ts
@@ -353,29 +353,29 @@
};
export class AppManifestView extends UI.Widget.VBox implements SDK.TargetManager.Observer {
- _emptyView: UI.EmptyWidget.EmptyWidget;
- _reportView: UI.ReportView.ReportView;
- _errorsSection: UI.ReportView.Section;
- _installabilitySection: UI.ReportView.Section;
- _identitySection: UI.ReportView.Section;
- _presentationSection: UI.ReportView.Section;
- _iconsSection: UI.ReportView.Section;
- _shortcutSections: UI.ReportView.Section[];
- _screenshotsSections: UI.ReportView.Section[];
- _nameField: HTMLElement;
- _shortNameField: HTMLElement;
- _descriptionField: Element;
- _startURLField: HTMLElement;
- _themeColorSwatch: InlineEditor.ColorSwatch.ColorSwatch;
- _backgroundColorSwatch: InlineEditor.ColorSwatch.ColorSwatch;
- _orientationField: HTMLElement;
- _displayField: HTMLElement;
- _newNoteUrlField: HTMLElement;
- _throttler: Common.Throttler.Throttler;
- _registeredListeners: Common.EventTarget.EventDescriptor[];
- _target?: SDK.Target.Target;
- _resourceTreeModel?: SDK.ResourceTreeModel.ResourceTreeModel|null;
- _serviceWorkerManager?: SDK.ServiceWorkerManager.ServiceWorkerManager|null;
+ private readonly emptyView: UI.EmptyWidget.EmptyWidget;
+ private readonly reportView: UI.ReportView.ReportView;
+ private readonly errorsSection: UI.ReportView.Section;
+ private readonly installabilitySection: UI.ReportView.Section;
+ private readonly identitySection: UI.ReportView.Section;
+ private readonly presentationSection: UI.ReportView.Section;
+ private readonly iconsSection: UI.ReportView.Section;
+ private readonly shortcutSections: UI.ReportView.Section[];
+ private readonly screenshotsSections: UI.ReportView.Section[];
+ private nameField: HTMLElement;
+ private shortNameField: HTMLElement;
+ private descriptionField: Element;
+ private readonly startURLField: HTMLElement;
+ private readonly themeColorSwatch: InlineEditor.ColorSwatch.ColorSwatch;
+ private readonly backgroundColorSwatch: InlineEditor.ColorSwatch.ColorSwatch;
+ private orientationField: HTMLElement;
+ private displayField: HTMLElement;
+ private readonly newNoteUrlField: HTMLElement;
+ private readonly throttler: Common.Throttler.Throttler;
+ private registeredListeners: Common.EventTarget.EventDescriptor[];
+ private target?: SDK.Target.Target;
+ private resourceTreeModel?: SDK.ResourceTreeModel.ResourceTreeModel|null;
+ private serviceWorkerManager?: SDK.ServiceWorkerManager.ServiceWorkerManager|null;
constructor() {
super(true);
this.registerRequiredCSS('panels/application/appManifestView.css');
@@ -383,125 +383,125 @@
Common.Settings.Settings.instance()
.moduleSetting('colorFormat')
- .addChangeListener(this._updateManifest.bind(this, true));
+ .addChangeListener(this.updateManifest.bind(this, true));
- this._emptyView = new UI.EmptyWidget.EmptyWidget(i18nString(UIStrings.noManifestDetected));
- this._emptyView.appendLink('https://web.dev/add-manifest/');
+ this.emptyView = new UI.EmptyWidget.EmptyWidget(i18nString(UIStrings.noManifestDetected));
+ this.emptyView.appendLink('https://web.dev/add-manifest/');
- this._emptyView.show(this.contentElement);
- this._emptyView.hideWidget();
+ this.emptyView.show(this.contentElement);
+ this.emptyView.hideWidget();
// TODO(crbug.com/1156978): Replace UI.ReportView.ReportView with ReportView.ts web component.
- this._reportView = new UI.ReportView.ReportView(i18nString(UIStrings.appManifest));
- this._reportView.registerRequiredCSS('panels/application/appManifestView.css');
- this._reportView.element.classList.add('manifest-view-header');
- this._reportView.show(this.contentElement);
- this._reportView.hideWidget();
+ this.reportView = new UI.ReportView.ReportView(i18nString(UIStrings.appManifest));
+ this.reportView.registerRequiredCSS('panels/application/appManifestView.css');
+ this.reportView.element.classList.add('manifest-view-header');
+ this.reportView.show(this.contentElement);
+ this.reportView.hideWidget();
- this._errorsSection = this._reportView.appendSection(i18nString(UIStrings.errorsAndWarnings));
- this._installabilitySection = this._reportView.appendSection(i18nString(UIStrings.installability));
- this._identitySection = this._reportView.appendSection(i18nString(UIStrings.identity));
+ this.errorsSection = this.reportView.appendSection(i18nString(UIStrings.errorsAndWarnings));
+ this.installabilitySection = this.reportView.appendSection(i18nString(UIStrings.installability));
+ this.identitySection = this.reportView.appendSection(i18nString(UIStrings.identity));
- this._presentationSection = this._reportView.appendSection(i18nString(UIStrings.presentation));
- this._iconsSection = this._reportView.appendSection(i18nString(UIStrings.icons), 'report-section-icons');
- this._shortcutSections = [];
- this._screenshotsSections = [];
+ this.presentationSection = this.reportView.appendSection(i18nString(UIStrings.presentation));
+ this.iconsSection = this.reportView.appendSection(i18nString(UIStrings.icons), 'report-section-icons');
+ this.shortcutSections = [];
+ this.screenshotsSections = [];
- this._nameField = this._identitySection.appendField(i18nString(UIStrings.name));
- this._shortNameField = this._identitySection.appendField(i18nString(UIStrings.shortName));
- this._descriptionField = this._identitySection.appendFlexedField(i18nString(UIStrings.description));
+ this.nameField = this.identitySection.appendField(i18nString(UIStrings.name));
+ this.shortNameField = this.identitySection.appendField(i18nString(UIStrings.shortName));
+ this.descriptionField = this.identitySection.appendFlexedField(i18nString(UIStrings.description));
- this._startURLField = this._presentationSection.appendField(i18nString(UIStrings.startUrl));
+ this.startURLField = this.presentationSection.appendField(i18nString(UIStrings.startUrl));
- const themeColorField = this._presentationSection.appendField(i18nString(UIStrings.themeColor));
- this._themeColorSwatch = new InlineEditor.ColorSwatch.ColorSwatch();
- themeColorField.appendChild(this._themeColorSwatch);
+ const themeColorField = this.presentationSection.appendField(i18nString(UIStrings.themeColor));
+ this.themeColorSwatch = new InlineEditor.ColorSwatch.ColorSwatch();
+ themeColorField.appendChild(this.themeColorSwatch);
- const backgroundColorField = this._presentationSection.appendField(i18nString(UIStrings.backgroundColor));
- this._backgroundColorSwatch = new InlineEditor.ColorSwatch.ColorSwatch();
- backgroundColorField.appendChild(this._backgroundColorSwatch);
+ const backgroundColorField = this.presentationSection.appendField(i18nString(UIStrings.backgroundColor));
+ this.backgroundColorSwatch = new InlineEditor.ColorSwatch.ColorSwatch();
+ backgroundColorField.appendChild(this.backgroundColorSwatch);
- this._orientationField = this._presentationSection.appendField(i18nString(UIStrings.orientation));
- this._displayField = this._presentationSection.appendField(i18nString(UIStrings.display));
+ this.orientationField = this.presentationSection.appendField(i18nString(UIStrings.orientation));
+ this.displayField = this.presentationSection.appendField(i18nString(UIStrings.display));
- this._newNoteUrlField = this._presentationSection.appendField(i18nString(UIStrings.newNoteUrl));
+ this.newNoteUrlField = this.presentationSection.appendField(i18nString(UIStrings.newNoteUrl));
- this._throttler = new Common.Throttler.Throttler(1000);
+ this.throttler = new Common.Throttler.Throttler(1000);
SDK.TargetManager.TargetManager.instance().observeTargets(this);
- this._registeredListeners = [];
+ this.registeredListeners = [];
}
targetAdded(target: SDK.Target.Target): void {
- if (this._target) {
+ if (this.target) {
return;
}
- this._target = target;
- this._resourceTreeModel = target.model(SDK.ResourceTreeModel.ResourceTreeModel);
- this._serviceWorkerManager = target.model(SDK.ServiceWorkerManager.ServiceWorkerManager);
- if (!this._resourceTreeModel || !this._serviceWorkerManager) {
+ this.target = target;
+ this.resourceTreeModel = target.model(SDK.ResourceTreeModel.ResourceTreeModel);
+ this.serviceWorkerManager = target.model(SDK.ServiceWorkerManager.ServiceWorkerManager);
+ if (!this.resourceTreeModel || !this.serviceWorkerManager) {
return;
}
- this._updateManifest(true);
+ this.updateManifest(true);
- this._registeredListeners = [
- this._resourceTreeModel.addEventListener(
+ this.registeredListeners = [
+ this.resourceTreeModel.addEventListener(
SDK.ResourceTreeModel.Events.DOMContentLoaded,
() => {
- this._updateManifest(true);
+ this.updateManifest(true);
}),
- this._serviceWorkerManager.addEventListener(
+ this.serviceWorkerManager.addEventListener(
SDK.ServiceWorkerManager.Events.RegistrationUpdated,
() => {
- this._updateManifest(false);
+ this.updateManifest(false);
}),
];
}
targetRemoved(target: SDK.Target.Target): void {
- if (this._target !== target) {
+ if (this.target !== target) {
return;
}
- if (!this._resourceTreeModel || !this._serviceWorkerManager) {
+ if (!this.resourceTreeModel || !this.serviceWorkerManager) {
return;
}
- delete this._resourceTreeModel;
- delete this._serviceWorkerManager;
- Common.EventTarget.removeEventListeners(this._registeredListeners);
+ delete this.resourceTreeModel;
+ delete this.serviceWorkerManager;
+ Common.EventTarget.removeEventListeners(this.registeredListeners);
}
- async _updateManifest(immediately: boolean): Promise<void> {
- if (!this._resourceTreeModel) {
+ private async updateManifest(immediately: boolean): Promise<void> {
+ if (!this.resourceTreeModel) {
return;
}
- const {url, data, errors} = await this._resourceTreeModel.fetchAppManifest();
- const installabilityErrors = await this._resourceTreeModel.getInstallabilityErrors();
- const manifestIcons = await this._resourceTreeModel.getManifestIcons();
+ const {url, data, errors} = await this.resourceTreeModel.fetchAppManifest();
+ const installabilityErrors = await this.resourceTreeModel.getInstallabilityErrors();
+ const manifestIcons = await this.resourceTreeModel.getManifestIcons();
- this._throttler.schedule(
- () => this._renderManifest(url, data, errors, installabilityErrors, manifestIcons), immediately);
+ this.throttler.schedule(
+ () => this.renderManifest(url, data, errors, installabilityErrors, manifestIcons), immediately);
}
- async _renderManifest(
+ private async renderManifest(
url: string, data: string|null, errors: Protocol.Page.AppManifestError[],
installabilityErrors: Protocol.Page.InstallabilityError[], manifestIcons: {
primaryIcon: string|null,
}): Promise<void> {
if (!data && !errors.length) {
- this._emptyView.showWidget();
- this._reportView.hideWidget();
+ this.emptyView.showWidget();
+ this.reportView.hideWidget();
return;
}
- this._emptyView.hideWidget();
- this._reportView.showWidget();
+ this.emptyView.hideWidget();
+ this.reportView.showWidget();
const link = Components.Linkifier.Linkifier.linkifyURL(url);
link.tabIndex = 0;
- this._reportView.setURL(link);
- this._errorsSection.clearContent();
- this._errorsSection.element.classList.toggle('hidden', !errors.length);
+ this.reportView.setURL(link);
+ this.errorsSection.clearContent();
+ this.errorsSection.element.classList.toggle('hidden', !errors.length);
for (const error of errors) {
- this._errorsSection.appendRow().appendChild(
+ this.errorsSection.appendRow().appendChild(
UI.UIUtils.createIconLabel(error.message, error.critical ? 'smallicon-error' : 'smallicon-warning'));
}
@@ -514,67 +514,67 @@
} // Trim the BOM as per https://tools.ietf.org/html/rfc7159#section-8.1.
const parsedManifest = JSON.parse(data);
- this._nameField.textContent = stringProperty('name');
- this._shortNameField.textContent = stringProperty('short_name');
+ this.nameField.textContent = stringProperty('name');
+ this.shortNameField.textContent = stringProperty('short_name');
const warnings = [];
const description = stringProperty('description');
- this._descriptionField.textContent = description;
+ this.descriptionField.textContent = description;
if (description.length > 324) {
warnings.push(i18nString(UIStrings.descriptionMayBeTruncated));
}
- this._startURLField.removeChildren();
+ this.startURLField.removeChildren();
const startURL = stringProperty('start_url');
if (startURL) {
const completeURL = (Common.ParsedURL.ParsedURL.completeURL(url, startURL) as string);
const link = Components.Linkifier.Linkifier.linkifyURL(
completeURL, ({text: startURL} as Components.Linkifier.LinkifyURLOptions));
link.tabIndex = 0;
- this._startURLField.appendChild(link);
+ this.startURLField.appendChild(link);
}
- this._themeColorSwatch.classList.toggle('hidden', !stringProperty('theme_color'));
+ this.themeColorSwatch.classList.toggle('hidden', !stringProperty('theme_color'));
const themeColor =
Common.Color.Color.parse(stringProperty('theme_color') || 'white') || Common.Color.Color.parse('white');
if (themeColor) {
- this._themeColorSwatch.renderColor(themeColor, true);
+ this.themeColorSwatch.renderColor(themeColor, true);
}
- this._backgroundColorSwatch.classList.toggle('hidden', !stringProperty('background_color'));
+ this.backgroundColorSwatch.classList.toggle('hidden', !stringProperty('background_color'));
const backgroundColor =
Common.Color.Color.parse(stringProperty('background_color') || 'white') || Common.Color.Color.parse('white');
if (backgroundColor) {
- this._backgroundColorSwatch.renderColor(backgroundColor, true);
+ this.backgroundColorSwatch.renderColor(backgroundColor, true);
}
- this._orientationField.textContent = stringProperty('orientation');
+ this.orientationField.textContent = stringProperty('orientation');
const displayType = stringProperty('display');
- this._displayField.textContent = displayType;
+ this.displayField.textContent = displayType;
const noteTaking = parsedManifest['note_taking'] || {};
const newNoteUrl = noteTaking['new_note_url'];
const hasNewNoteUrl = typeof newNoteUrl === 'string';
- this._newNoteUrlField.parentElement?.classList.toggle('hidden', !hasNewNoteUrl);
- this._newNoteUrlField.removeChildren();
+ this.newNoteUrlField.parentElement?.classList.toggle('hidden', !hasNewNoteUrl);
+ this.newNoteUrlField.removeChildren();
if (hasNewNoteUrl) {
const completeURL = (Common.ParsedURL.ParsedURL.completeURL(url, newNoteUrl) as string);
const link = Components.Linkifier.Linkifier.linkifyURL(
completeURL, ({text: newNoteUrl} as Components.Linkifier.LinkifyURLOptions));
link.tabIndex = 0;
- this._newNoteUrlField.appendChild(link);
+ this.newNoteUrlField.appendChild(link);
}
const icons = parsedManifest['icons'] || [];
- this._iconsSection.clearContent();
+ this.iconsSection.clearContent();
const shortcuts = parsedManifest['shortcuts'] || [];
- for (const shortcutsSection of this._shortcutSections) {
+ for (const shortcutsSection of this.shortcutSections) {
shortcutsSection.detach(/** overrideHideOnDetach= */ true);
}
const screenshots = parsedManifest['screenshots'] || [];
- for (const screenshotSection of this._screenshotsSections) {
+ for (const screenshotSection of this.screenshotsSections) {
screenshotSection.detach(/** overrideHideOnDetach= */ true);
}
@@ -583,12 +583,12 @@
const setIconMaskedCheckbox = UI.UIUtils.CheckboxLabel.create(i18nString(UIStrings.showOnlyTheMinimumSafeAreaFor));
setIconMaskedCheckbox.classList.add('mask-checkbox');
setIconMaskedCheckbox.addEventListener('click', () => {
- this._iconsSection.setIconMasked(setIconMaskedCheckbox.checkboxElement.checked);
+ this.iconsSection.setIconMasked(setIconMaskedCheckbox.checkboxElement.checked);
});
- this._iconsSection.appendRow().appendChild(setIconMaskedCheckbox);
+ this.iconsSection.appendRow().appendChild(setIconMaskedCheckbox);
const documentationLink =
UI.XLink.XLink.create('https://web.dev/maskable-icon/', i18nString(UIStrings.documentationOnMaskableIcons));
- this._iconsSection.appendRow().appendChild(
+ this.iconsSection.appendRow().appendChild(
i18n.i18n.getFormatLocalizedString(str_, UIStrings.needHelpReadOurS, {PH1: documentationLink}));
if (manifestIcons && manifestIcons.primaryIcon) {
@@ -600,15 +600,14 @@
image.src = 'data:image/png;base64,' + manifestIcons.primaryIcon;
image.alt = i18nString(UIStrings.primaryManifestIconFromS, {PH1: url});
const title = i18nString(UIStrings.primaryIconasUsedByChrome);
- const field = this._iconsSection.appendFlexedField(title);
+ const field = this.iconsSection.appendFlexedField(title);
wrapper.appendChild(image);
field.appendChild(wrapper);
}
let squareSizedIconAvailable = false;
for (const icon of icons) {
- const result =
- await this._appendImageResourceToSection(url, icon, this._iconsSection, /** isScreenshot= */ false);
+ const result = await this.appendImageResourceToSection(url, icon, this.iconsSection, /** isScreenshot= */ false);
imageErrors.push(...result.imageResourceErrors);
squareSizedIconAvailable = result.squareSizedIconAvailable || squareSizedIconAvailable;
}
@@ -618,8 +617,8 @@
let shortcutIndex = 1;
for (const shortcut of shortcuts) {
- const shortcutSection = this._reportView.appendSection(i18nString(UIStrings.shortcutS, {PH1: shortcutIndex}));
- this._shortcutSections.push(shortcutSection);
+ const shortcutSection = this.reportView.appendSection(i18nString(UIStrings.shortcutS, {PH1: shortcutIndex}));
+ this.shortcutSections.push(shortcutSection);
shortcutSection.appendFlexedField('Name', shortcut.name);
if (shortcut.short_name) {
@@ -639,7 +638,7 @@
let hasShorcutIconLargeEnough = false;
for (const shortcutIcon of shortcutIcons) {
const {imageResourceErrors: shortcutIconErrors} =
- await this._appendImageResourceToSection(url, shortcutIcon, shortcutSection, /** isScreenshot= */ false);
+ await this.appendImageResourceToSection(url, shortcutIcon, shortcutSection, /** isScreenshot= */ false);
imageErrors.push(...shortcutIconErrors);
if (!hasShorcutIconLargeEnough && shortcutIcon.sizes) {
const shortcutIconSize = shortcutIcon.sizes.match(/^(\d+)x(\d+)$/);
@@ -657,27 +656,27 @@
let screenshotIndex = 1;
for (const screenshot of screenshots) {
const screenshotSection =
- this._reportView.appendSection(i18nString(UIStrings.screenshotS, {PH1: screenshotIndex}));
- this._screenshotsSections.push(screenshotSection);
+ this.reportView.appendSection(i18nString(UIStrings.screenshotS, {PH1: screenshotIndex}));
+ this.screenshotsSections.push(screenshotSection);
const {imageResourceErrors: screenshotErrors} =
- await this._appendImageResourceToSection(url, screenshot, screenshotSection, /** isScreenshot= */ true);
+ await this.appendImageResourceToSection(url, screenshot, screenshotSection, /** isScreenshot= */ true);
imageErrors.push(...screenshotErrors);
screenshotIndex++;
}
- this._installabilitySection.clearContent();
- this._installabilitySection.element.classList.toggle('hidden', !installabilityErrors.length);
+ this.installabilitySection.clearContent();
+ this.installabilitySection.element.classList.toggle('hidden', !installabilityErrors.length);
const errorMessages = this.getInstallabilityErrorMessages(installabilityErrors);
for (const error of errorMessages) {
- this._installabilitySection.appendRow().appendChild(UI.UIUtils.createIconLabel(error, 'smallicon-warning'));
+ this.installabilitySection.appendRow().appendChild(UI.UIUtils.createIconLabel(error, 'smallicon-warning'));
}
- this._errorsSection.element.classList.toggle('hidden', !errors.length && !imageErrors.length && !warnings.length);
+ this.errorsSection.element.classList.toggle('hidden', !errors.length && !imageErrors.length && !warnings.length);
for (const warning of warnings) {
- this._errorsSection.appendRow().appendChild(UI.UIUtils.createIconLabel(warning, 'smallicon-warning'));
+ this.errorsSection.appendRow().appendChild(UI.UIUtils.createIconLabel(warning, 'smallicon-warning'));
}
for (const error of imageErrors) {
- this._errorsSection.appendRow().appendChild(UI.UIUtils.createIconLabel(error, 'smallicon-warning'));
+ this.errorsSection.appendRow().appendChild(UI.UIUtils.createIconLabel(error, 'smallicon-warning'));
}
function stringProperty(name: string): string {
@@ -791,7 +790,7 @@
return errorMessages;
}
- async _loadImage(url: string): Promise<{
+ private async loadImage(url: string): Promise<{
image: HTMLImageElement,
wrapper: Element,
}|null> {
@@ -878,7 +877,7 @@
return {hasSquareSize};
}
- async _appendImageResourceToSection(
+ private async appendImageResourceToSection(
// TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration)
// eslint-disable-next-line @typescript-eslint/no-explicit-any
baseUrl: string, imageResource: any, section: UI.ReportView.Section, isScreenshot: boolean):
@@ -895,7 +894,7 @@
i18nString(UIStrings.sUrlSFailedToParse, {PH1: resourceName, PH2: imageResource['src']}));
return {imageResourceErrors};
}
- const result = await this._loadImage(imageUrl);
+ const result = await this.loadImage(imageUrl);
if (!result) {
imageResourceErrors.push(i18nString(UIStrings.sSFailedToLoad, {PH1: resourceName, PH2: imageUrl}));
return {imageResourceErrors};
diff --git a/front_end/panels/application/ApplicationCacheItemsView.ts b/front_end/panels/application/ApplicationCacheItemsView.ts
index 4d00f72a..dd2d9da 100644
--- a/front_end/panels/application/ApplicationCacheItemsView.ts
+++ b/front_end/panels/application/ApplicationCacheItemsView.ts
@@ -80,85 +80,86 @@
const str_ = i18n.i18n.registerUIStrings('panels/application/ApplicationCacheItemsView.ts', UIStrings);
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
export class ApplicationCacheItemsView extends UI.View.SimpleView {
- _model: ApplicationCacheModel;
- _deleteButton: UI.Toolbar.ToolbarButton;
- _connectivityIcon: UI.UIUtils.DevToolsIconLabel;
- _statusIcon: UI.UIUtils.DevToolsIconLabel;
- _frameId: Protocol.Page.FrameId;
- _emptyWidget: UI.EmptyWidget.EmptyWidget;
- _nodeResources: WeakMap<DataGrid.DataGrid.DataGridNode<unknown>, Protocol.ApplicationCache.ApplicationCacheResource>;
- _viewDirty?: boolean;
- _status?: number;
- _manifest?: string;
- _creationTime?: number;
- _updateTime?: number;
- _size?: number;
- _resources?: Protocol.ApplicationCache.ApplicationCacheResource[];
- _dataGrid?: DataGrid.DataGrid.DataGridImpl<unknown>;
+ private readonly model: ApplicationCacheModel;
+ private readonly deleteButton: UI.Toolbar.ToolbarButton;
+ private connectivityIcon: UI.UIUtils.DevToolsIconLabel;
+ private statusIcon: UI.UIUtils.DevToolsIconLabel;
+ private readonly frameId: Protocol.Page.FrameId;
+ private readonly emptyWidget: UI.EmptyWidget.EmptyWidget;
+ private readonly nodeResources:
+ WeakMap<DataGrid.DataGrid.DataGridNode<unknown>, Protocol.ApplicationCache.ApplicationCacheResource>;
+ private viewDirty?: boolean;
+ private status?: number;
+ private manifest?: string;
+ private creationTime?: number;
+ private updateTime?: number;
+ private size?: number;
+ private resources?: Protocol.ApplicationCache.ApplicationCacheResource[];
+ private dataGrid?: DataGrid.DataGrid.DataGridImpl<unknown>;
constructor(model: ApplicationCacheModel, frameId: Protocol.Page.FrameId) {
super(i18nString(UIStrings.appcache));
- this._model = model;
+ this.model = model;
this.element.classList.add('storage-view', 'table');
- this._deleteButton = new UI.Toolbar.ToolbarButton(i18nString(UIStrings.deleteString), 'largeicon-delete');
- this._deleteButton.setVisible(false);
- this._deleteButton.addEventListener(UI.Toolbar.ToolbarButton.Events.Click, this._deleteButtonClicked, this);
- this._connectivityIcon = (document.createElement('span', {is: 'dt-icon-label'}) as UI.UIUtils.DevToolsIconLabel);
- this._connectivityIcon.style.margin = '0 2px 0 5px';
- this._statusIcon = (document.createElement('span', {is: 'dt-icon-label'}) as UI.UIUtils.DevToolsIconLabel);
- this._statusIcon.style.margin = '0 2px 0 5px';
+ this.deleteButton = new UI.Toolbar.ToolbarButton(i18nString(UIStrings.deleteString), 'largeicon-delete');
+ this.deleteButton.setVisible(false);
+ this.deleteButton.addEventListener(UI.Toolbar.ToolbarButton.Events.Click, this.deleteButtonClicked, this);
+ this.connectivityIcon = (document.createElement('span', {is: 'dt-icon-label'}) as UI.UIUtils.DevToolsIconLabel);
+ this.connectivityIcon.style.margin = '0 2px 0 5px';
+ this.statusIcon = (document.createElement('span', {is: 'dt-icon-label'}) as UI.UIUtils.DevToolsIconLabel);
+ this.statusIcon.style.margin = '0 2px 0 5px';
- this._frameId = frameId;
+ this.frameId = frameId;
- this._emptyWidget = new UI.EmptyWidget.EmptyWidget(i18nString(UIStrings.noApplicationCacheInformation));
- this._emptyWidget.show(this.element);
+ this.emptyWidget = new UI.EmptyWidget.EmptyWidget(i18nString(UIStrings.noApplicationCacheInformation));
+ this.emptyWidget.show(this.element);
- this._markDirty();
+ this.markDirty();
- const status = this._model.frameManifestStatus(frameId);
+ const status = this.model.frameManifestStatus(frameId);
this.updateStatus(status);
- this.updateNetworkState(this._model.onLine);
- (this._deleteButton.element as HTMLElement).style.display = 'none';
+ this.updateNetworkState(this.model.onLine);
+ (this.deleteButton.element as HTMLElement).style.display = 'none';
- this._nodeResources = new WeakMap();
+ this.nodeResources = new WeakMap();
}
async toolbarItems(): Promise<UI.Toolbar.ToolbarItem[]> {
return [
- this._deleteButton,
- new UI.Toolbar.ToolbarItem(this._connectivityIcon),
+ this.deleteButton,
+ new UI.Toolbar.ToolbarItem(this.connectivityIcon),
new UI.Toolbar.ToolbarSeparator(),
- new UI.Toolbar.ToolbarItem(this._statusIcon),
+ new UI.Toolbar.ToolbarItem(this.statusIcon),
];
}
wasShown(): void {
- this._maybeUpdate();
+ this.maybeUpdate();
}
willHide(): void {
- this._deleteButton.setVisible(false);
+ this.deleteButton.setVisible(false);
}
- _maybeUpdate(): void {
- if (!this.isShowing() || !this._viewDirty) {
+ private maybeUpdate(): void {
+ if (!this.isShowing() || !this.viewDirty) {
return;
}
- this._update();
- this._viewDirty = false;
+ this.update();
+ this.viewDirty = false;
}
- _markDirty(): void {
- this._viewDirty = true;
+ private markDirty(): void {
+ this.viewDirty = true;
}
updateStatus(status: number): void {
- const oldStatus = this._status;
- this._status = status;
+ const oldStatus = this.status;
+ this.status = status;
const statusInformation = new Map([
// We should never have UNCACHED status, since we remove frames with UNCACHED application cache status from the tree.
@@ -171,68 +172,68 @@
]);
const info = statusInformation.get(status) || statusInformation.get(UNCACHED);
if (info) {
- this._statusIcon.type = info.type;
- this._statusIcon.textContent = info.text;
+ this.statusIcon.type = info.type;
+ this.statusIcon.textContent = info.text;
}
- if (this.isShowing() && this._status === IDLE && (oldStatus === UPDATEREADY || !this._resources)) {
- this._markDirty();
+ if (this.isShowing() && this.status === IDLE && (oldStatus === UPDATEREADY || !this.resources)) {
+ this.markDirty();
}
- this._maybeUpdate();
+ this.maybeUpdate();
}
updateNetworkState(isNowOnline: boolean): void {
if (isNowOnline) {
- this._connectivityIcon.type = 'smallicon-green-ball';
- this._connectivityIcon.textContent = i18nString(UIStrings.online);
+ this.connectivityIcon.type = 'smallicon-green-ball';
+ this.connectivityIcon.textContent = i18nString(UIStrings.online);
} else {
- this._connectivityIcon.type = 'smallicon-red-ball';
- this._connectivityIcon.textContent = i18nString(UIStrings.offline);
+ this.connectivityIcon.type = 'smallicon-red-ball';
+ this.connectivityIcon.textContent = i18nString(UIStrings.offline);
}
}
- async _update(): Promise<void> {
- const applicationCache = await this._model.requestApplicationCache(this._frameId);
+ private async update(): Promise<void> {
+ const applicationCache = await this.model.requestApplicationCache(this.frameId);
if (!applicationCache || !applicationCache.manifestURL) {
- delete this._manifest;
- delete this._creationTime;
- delete this._updateTime;
- delete this._size;
- delete this._resources;
+ delete this.manifest;
+ delete this.creationTime;
+ delete this.updateTime;
+ delete this.size;
+ delete this.resources;
- this._emptyWidget.show(this.element);
- this._deleteButton.setVisible(false);
- if (this._dataGrid) {
- this._dataGrid.element.classList.add('hidden');
+ this.emptyWidget.show(this.element);
+ this.deleteButton.setVisible(false);
+ if (this.dataGrid) {
+ this.dataGrid.element.classList.add('hidden');
}
return;
}
// FIXME: are these variables needed anywhere else?
- this._manifest = applicationCache.manifestURL;
- this._creationTime = applicationCache.creationTime;
- this._updateTime = applicationCache.updateTime;
- this._size = applicationCache.size;
- this._resources = applicationCache.resources;
+ this.manifest = applicationCache.manifestURL;
+ this.creationTime = applicationCache.creationTime;
+ this.updateTime = applicationCache.updateTime;
+ this.size = applicationCache.size;
+ this.resources = applicationCache.resources;
- if (!this._dataGrid) {
- this._createDataGrid();
+ if (!this.dataGrid) {
+ this.createDataGrid();
}
- this._populateDataGrid();
- if (this._dataGrid) {
- this._dataGrid.autoSizeColumns(20, 80);
- this._dataGrid.element.classList.remove('hidden');
+ this.populateDataGrid();
+ if (this.dataGrid) {
+ this.dataGrid.autoSizeColumns(20, 80);
+ this.dataGrid.element.classList.remove('hidden');
}
- this._emptyWidget.detach();
- this._deleteButton.setVisible(true);
+ this.emptyWidget.detach();
+ this.deleteButton.setVisible(true);
// FIXME: For Chrome, put creationTime and updateTime somewhere.
// NOTE: localizedString has not yet been added.
- // i18nString("(%s) Created: %s Updated: %s", this.size, this._creationTime, this._updateTime);
+ // i18nString("(%s) Created: %s Updated: %s", this.size, this.creationTime, this.updateTime);
}
- _createDataGrid(): void {
+ private createDataGrid(): void {
const columns = ([
{id: 'resource', title: i18nString(UIStrings.resource), sort: DataGrid.DataGrid.Order.Ascending, sortable: true},
{id: 'type', title: i18nString(UIStrings.typeString), sortable: true},
@@ -245,19 +246,19 @@
deleteCallback: undefined,
refreshCallback: undefined,
};
- this._dataGrid = new DataGrid.DataGrid.DataGridImpl(parameters);
- this._dataGrid.setStriped(true);
- this._dataGrid.asWidget().show(this.element);
- this._dataGrid.addEventListener(DataGrid.DataGrid.Events.SortingChanged, this._populateDataGrid, this);
+ this.dataGrid = new DataGrid.DataGrid.DataGridImpl(parameters);
+ this.dataGrid.setStriped(true);
+ this.dataGrid.asWidget().show(this.element);
+ this.dataGrid.addEventListener(DataGrid.DataGrid.Events.SortingChanged, this.populateDataGrid, this);
}
- _populateDataGrid(): void {
- if (!this._dataGrid) {
+ private populateDataGrid(): void {
+ if (!this.dataGrid) {
return;
}
const selectedResource: Protocol.ApplicationCache.ApplicationCacheResource|null =
- (this._dataGrid.selectedNode ? this._nodeResources.get(this._dataGrid.selectedNode) : null) || null;
- const sortDirection = this._dataGrid.isSortOrderAscending() ? 1 : -1;
+ (this.dataGrid.selectedNode ? this.nodeResources.get(this.dataGrid.selectedNode) : null) || null;
+ const sortDirection = this.dataGrid.isSortOrderAscending() ? 1 : -1;
function numberCompare(
field: keyof Platform.TypeScriptUtilities
@@ -276,7 +277,7 @@
}
let comparator = null;
- switch (this._dataGrid.sortColumnId()) {
+ switch (this.dataGrid.sortColumnId()) {
case 'resource':
comparator = localeCompare.bind(null, 'url');
break;
@@ -288,47 +289,47 @@
break;
}
- this._dataGrid.rootNode().removeChildren();
- if (!this._resources) {
+ this.dataGrid.rootNode().removeChildren();
+ if (!this.resources) {
return;
}
if (comparator) {
- this._resources.sort(comparator);
+ this.resources.sort(comparator);
}
let nodeToSelect;
- for (let i = 0; i < this._resources.length; ++i) {
- const resource = this._resources[i];
+ for (let i = 0; i < this.resources.length; ++i) {
+ const resource = this.resources[i];
const data = {
resource: resource.url,
type: resource.type,
size: Platform.NumberUtilities.bytesToString(resource.size),
};
const node = new DataGrid.DataGrid.DataGridNode(data);
- this._nodeResources.set(node, resource);
+ this.nodeResources.set(node, resource);
node.selectable = true;
- this._dataGrid.rootNode().appendChild(node);
+ this.dataGrid.rootNode().appendChild(node);
if (resource === selectedResource) {
nodeToSelect = node;
nodeToSelect.selected = true;
}
}
- if (!nodeToSelect && this._dataGrid.rootNode().children.length) {
- this._dataGrid.rootNode().children[0].selected = true;
+ if (!nodeToSelect && this.dataGrid.rootNode().children.length) {
+ this.dataGrid.rootNode().children[0].selected = true;
}
}
- _deleteButtonClicked(_event: Common.EventTarget.EventTargetEvent): void {
- if (!this._dataGrid || !this._dataGrid.selectedNode) {
+ private deleteButtonClicked(_event: Common.EventTarget.EventTargetEvent): void {
+ if (!this.dataGrid || !this.dataGrid.selectedNode) {
return;
}
// FIXME: Delete Button semantics are not yet defined. (Delete a single, or all?)
- this._deleteCallback(this._dataGrid.selectedNode);
+ this.deleteCallback(this.dataGrid.selectedNode);
}
- _deleteCallback(_node: DataGrid.DataGrid.DataGridNode<unknown>): void {
+ private deleteCallback(_node: DataGrid.DataGrid.DataGridNode<unknown>): void {
// FIXME: Should we delete a single (selected) resource or all resources?
// ProtocolClient.inspectorBackend.deleteCachedResource(...)
// this.update();
diff --git a/front_end/panels/application/ApplicationCacheModel.ts b/front_end/panels/application/ApplicationCacheModel.ts
index 9961f71..0c5e767 100644
--- a/front_end/panels/application/ApplicationCacheModel.ts
+++ b/front_end/panels/application/ApplicationCacheModel.ts
@@ -38,74 +38,76 @@
import type * as Protocol from '../../generated/protocol.js';
export class ApplicationCacheModel extends SDK.SDKModel.SDKModel {
- _agent: ProtocolProxyApi.ApplicationCacheApi;
- _statuses: Map<Protocol.Page.FrameId, number>;
- _manifestURLsByFrame: Map<Protocol.Page.FrameId, string>;
- _onLine: boolean;
+ private readonly agent: ProtocolProxyApi.ApplicationCacheApi;
+ private readonly statuses: Map<Protocol.Page.FrameId, number>;
+ private manifestURLsByFrame: Map<Protocol.Page.FrameId, string>;
+ private onLineInternal: boolean;
constructor(target: SDK.Target.Target) {
super(target);
target.registerApplicationCacheDispatcher(new ApplicationCacheDispatcher(this));
- this._agent = target.applicationCacheAgent();
- this._agent.invoke_enable();
+ this.agent = target.applicationCacheAgent();
+ this.agent.invoke_enable();
const resourceTreeModel = target.model(SDK.ResourceTreeModel.ResourceTreeModel);
if (!resourceTreeModel) {
throw new Error('Target must provide an ResourceTreeModel');
}
- resourceTreeModel.addEventListener(SDK.ResourceTreeModel.Events.FrameNavigated, this._frameNavigatedCallback, this);
- resourceTreeModel.addEventListener(SDK.ResourceTreeModel.Events.FrameDetached, this._frameDetached, this);
+ resourceTreeModel.addEventListener(SDK.ResourceTreeModel.Events.FrameNavigated, this.frameNavigatedCallback, this);
+ resourceTreeModel.addEventListener(SDK.ResourceTreeModel.Events.FrameDetached, this.frameDetached, this);
- this._statuses = new Map();
- this._manifestURLsByFrame = new Map();
+ this.statuses = new Map();
+ this.manifestURLsByFrame = new Map();
- this._mainFrameNavigated();
- this._onLine = true;
+ this.mainFrameNavigated();
+ this.onLineInternal = true;
}
- _frameNavigatedCallback(event: Common.EventTarget.EventTargetEvent<SDK.ResourceTreeModel.ResourceTreeFrame>): void {
- this._frameNavigated(event);
+ private frameNavigatedCallback(event: Common.EventTarget.EventTargetEvent<SDK.ResourceTreeModel.ResourceTreeFrame>):
+ void {
+ this.frameNavigated(event);
}
- async _frameNavigated(event: Common.EventTarget.EventTargetEvent<SDK.ResourceTreeModel.ResourceTreeFrame>):
+ private async frameNavigated(event: Common.EventTarget.EventTargetEvent<SDK.ResourceTreeModel.ResourceTreeFrame>):
Promise<void> {
const frame = event.data;
if (frame.isMainFrame()) {
- this._mainFrameNavigated();
+ this.mainFrameNavigated();
return;
}
const frameId = frame.id;
- const manifestURL = await this._agent.invoke_getManifestForFrame({frameId});
+ const manifestURL = await this.agent.invoke_getManifestForFrame({frameId});
if (manifestURL !== null && !manifestURL) {
- this._frameManifestRemoved(frameId);
+ this.frameManifestRemoved(frameId);
}
}
- _frameDetached(event: Common.EventTarget
- .EventTargetEvent<{frame: SDK.ResourceTreeModel.ResourceTreeFrame, isSwap: boolean}>): void {
- this._frameManifestRemoved(event.data.frame.id);
+ private frameDetached(
+ event: Common.EventTarget.EventTargetEvent<{frame: SDK.ResourceTreeModel.ResourceTreeFrame, isSwap: boolean}>):
+ void {
+ this.frameManifestRemoved(event.data.frame.id);
}
reset(): void {
- this._statuses.clear();
- this._manifestURLsByFrame.clear();
+ this.statuses.clear();
+ this.manifestURLsByFrame.clear();
this.dispatchEventToListeners(Events.FrameManifestsReset);
}
- async _mainFrameNavigated(): Promise<void> {
- const framesWithManifests = await this._agent.invoke_getFramesWithManifests();
+ private async mainFrameNavigated(): Promise<void> {
+ const framesWithManifests = await this.agent.invoke_getFramesWithManifests();
if (framesWithManifests.getError()) {
return;
}
for (const frame of framesWithManifests.frameIds) {
- this._frameManifestUpdated(frame.frameId, frame.manifestURL, frame.status);
+ this.frameManifestUpdated(frame.frameId, frame.manifestURL, frame.status);
}
}
- _frameManifestUpdated(frameId: Protocol.Page.FrameId, manifestURL: string, status: number): void {
+ private frameManifestUpdated(frameId: Protocol.Page.FrameId, manifestURL: string, status: number): void {
if (status === UNCACHED) {
- this._frameManifestRemoved(frameId);
+ this.frameManifestRemoved(frameId);
return;
}
@@ -113,16 +115,16 @@
return;
}
- const recordedManifestURL = this._manifestURLsByFrame.get(frameId);
+ const recordedManifestURL = this.manifestURLsByFrame.get(frameId);
if (recordedManifestURL && manifestURL !== recordedManifestURL) {
- this._frameManifestRemoved(frameId);
+ this.frameManifestRemoved(frameId);
}
- const statusChanged = this._statuses.get(frameId) !== status;
- this._statuses.set(frameId, status);
+ const statusChanged = this.statuses.get(frameId) !== status;
+ this.statuses.set(frameId, status);
- if (!this._manifestURLsByFrame.has(frameId)) {
- this._manifestURLsByFrame.set(frameId, manifestURL);
+ if (!this.manifestURLsByFrame.has(frameId)) {
+ this.manifestURLsByFrame.set(frameId, manifestURL);
this.dispatchEventToListeners(Events.FrameManifestAdded, frameId);
}
@@ -131,41 +133,41 @@
}
}
- _frameManifestRemoved(frameId: Protocol.Page.FrameId): void {
- const removed = this._manifestURLsByFrame.delete(frameId);
- this._statuses.delete(frameId);
+ private frameManifestRemoved(frameId: Protocol.Page.FrameId): void {
+ const removed = this.manifestURLsByFrame.delete(frameId);
+ this.statuses.delete(frameId);
if (removed) {
this.dispatchEventToListeners(Events.FrameManifestRemoved, frameId);
}
}
frameManifestURL(frameId: Protocol.Page.FrameId): string {
- return this._manifestURLsByFrame.get(frameId) || '';
+ return this.manifestURLsByFrame.get(frameId) || '';
}
frameManifestStatus(frameId: Protocol.Page.FrameId): number {
- return this._statuses.get(frameId) || UNCACHED;
+ return this.statuses.get(frameId) || UNCACHED;
}
get onLine(): boolean {
- return this._onLine;
+ return this.onLineInternal;
}
- _statusUpdated(frameId: Protocol.Page.FrameId, manifestURL: string, status: number): void {
- this._frameManifestUpdated(frameId, manifestURL, status);
+ statusUpdated(frameId: Protocol.Page.FrameId, manifestURL: string, status: number): void {
+ this.frameManifestUpdated(frameId, manifestURL, status);
}
async requestApplicationCache(frameId: Protocol.Page.FrameId):
Promise<Protocol.ApplicationCache.ApplicationCache|null> {
- const response = await this._agent.invoke_getApplicationCacheForFrame({frameId});
+ const response = await this.agent.invoke_getApplicationCacheForFrame({frameId});
if (response.getError()) {
return null;
}
return response.applicationCache;
}
- _networkStateUpdated(isNowOnline: boolean): void {
- this._onLine = isNowOnline;
+ networkStateUpdated(isNowOnline: boolean): void {
+ this.onLineInternal = isNowOnline;
this.dispatchEventToListeners(Events.NetworkStateChanged, isNowOnline);
}
}
@@ -183,18 +185,18 @@
}
export class ApplicationCacheDispatcher implements ProtocolProxyApi.ApplicationCacheDispatcher {
- _applicationCacheModel: ApplicationCacheModel;
+ private readonly applicationCacheModel: ApplicationCacheModel;
constructor(applicationCacheModel: ApplicationCacheModel) {
- this._applicationCacheModel = applicationCacheModel;
+ this.applicationCacheModel = applicationCacheModel;
}
applicationCacheStatusUpdated({frameId, manifestURL, status}:
Protocol.ApplicationCache.ApplicationCacheStatusUpdatedEvent): void {
- this._applicationCacheModel._statusUpdated(frameId, manifestURL, status);
+ this.applicationCacheModel.statusUpdated(frameId, manifestURL, status);
}
networkStateUpdated({isNowOnline}: Protocol.ApplicationCache.NetworkStateUpdatedEvent): void {
- this._applicationCacheModel._networkStateUpdated(isNowOnline);
+ this.applicationCacheModel.networkStateUpdated(isNowOnline);
}
}
diff --git a/front_end/panels/application/ApplicationPanelCacheSection.ts b/front_end/panels/application/ApplicationPanelCacheSection.ts
index e983b44..62577f1 100644
--- a/front_end/panels/application/ApplicationPanelCacheSection.ts
+++ b/front_end/panels/application/ApplicationPanelCacheSection.ts
@@ -203,7 +203,7 @@
readonly manifestURL: string;
constructor(sidebar: ApplicationPanelSidebar, frame: SDK.ResourceTreeModel.ResourceTreeFrame, manifestURL: string) {
- super(sidebar._panel, '', false);
+ super(sidebar.panel, '', false);
this.sidebar = sidebar;
this.frameId = frame.id;
this.manifestURL = manifestURL;
@@ -227,7 +227,7 @@
onselect(selectedByUser: boolean|undefined): boolean {
super.onselect(selectedByUser);
- this.sidebar._showApplicationCache(this.frameId);
+ this.sidebar.showApplicationCache(this.frameId);
return false;
}
}
diff --git a/front_end/panels/application/ApplicationPanelSidebar.ts b/front_end/panels/application/ApplicationPanelSidebar.ts
index f7adc6b..71a55e7 100644
--- a/front_end/panels/application/ApplicationPanelSidebar.ts
+++ b/front_end/panels/application/ApplicationPanelSidebar.ts
@@ -185,12 +185,12 @@
}
export class ApplicationPanelSidebar extends UI.Widget.VBox implements SDK.TargetManager.Observer {
- _panel: ResourcesPanel;
- _applicationCacheViews: Map<Protocol.Page.FrameId, ApplicationCacheItemsView>;
- _applicationCacheFrameElements: Map<string, ApplicationCacheFrameTreeElement>;
- _applicationCacheManifestElements: Map<string, ApplicationCacheManifestTreeElement>;
- _sidebarTree: UI.TreeOutline.TreeOutlineInShadow;
- _applicationTreeElement: UI.TreeOutline.TreeElement;
+ panel: ResourcesPanel;
+ private readonly applicationCacheViews: Map<Protocol.Page.FrameId, ApplicationCacheItemsView>;
+ private readonly applicationCacheFrameElements: Map<Protocol.Page.FrameId, ApplicationCacheFrameTreeElement>;
+ private readonly applicationCacheManifestElements: Map<string, ApplicationCacheManifestTreeElement>;
+ private readonly sidebarTree: UI.TreeOutline.TreeOutlineInShadow;
+ private readonly applicationTreeElement: UI.TreeOutline.TreeElement;
serviceWorkersTreeElement: ServiceWorkersTreeElement;
localStorageListTreeElement: ExpandableApplicationPanelTreeElement;
sessionStorageListTreeElement: ExpandableApplicationPanelTreeElement;
@@ -207,50 +207,50 @@
paymentHandlerTreeElement: BackgroundServiceTreeElement|undefined;
periodicBackgroundSyncTreeElement: BackgroundServiceTreeElement|undefined;
pushMessagingTreeElement: BackgroundServiceTreeElement|undefined;
- _resourcesSection: ResourcesSection;
- _databaseTableViews: Map<DatabaseModelDatabase, {
+ private readonly resourcesSection: ResourcesSection;
+ private readonly databaseTableViews: Map<DatabaseModelDatabase, {
[x: string]: DatabaseTableView,
}>;
- _databaseQueryViews: Map<DatabaseModelDatabase, DatabaseQueryView>;
- _databaseTreeElements: Map<DatabaseModelDatabase, DatabaseTreeElement>;
- _domStorageTreeElements: Map<DOMStorage, DOMStorageTreeElement>;
- _domains: {
+ private databaseQueryViews: Map<DatabaseModelDatabase, DatabaseQueryView>;
+ private readonly databaseTreeElements: Map<DatabaseModelDatabase, DatabaseTreeElement>;
+ private domStorageTreeElements: Map<DOMStorage, DOMStorageTreeElement>;
+ private domains: {
[x: string]: boolean,
};
- _target?: SDK.Target.Target;
- _databaseModel?: DatabaseModel|null;
- _applicationCacheModel?: ApplicationCacheModel|null;
- _previousHoveredElement?: FrameTreeElement;
+ private target?: SDK.Target.Target;
+ private databaseModel?: DatabaseModel|null;
+ private applicationCacheModel?: ApplicationCacheModel|null;
+ private previousHoveredElement?: FrameTreeElement;
constructor(panel: ResourcesPanel) {
super();
- this._panel = panel;
+ this.panel = panel;
- this._applicationCacheViews = new Map();
- this._applicationCacheFrameElements = new Map();
- this._applicationCacheManifestElements = new Map();
+ this.applicationCacheViews = new Map();
+ this.applicationCacheFrameElements = new Map();
+ this.applicationCacheManifestElements = new Map();
- this._sidebarTree = new UI.TreeOutline.TreeOutlineInShadow();
- this._sidebarTree.element.classList.add('resources-sidebar');
- this._sidebarTree.registerRequiredCSS('panels/application/resourcesSidebar.css');
- this._sidebarTree.element.classList.add('filter-all');
+ this.sidebarTree = new UI.TreeOutline.TreeOutlineInShadow();
+ this.sidebarTree.element.classList.add('resources-sidebar');
+ this.sidebarTree.registerRequiredCSS('panels/application/resourcesSidebar.css');
+ this.sidebarTree.element.classList.add('filter-all');
// Listener needs to have been set up before the elements are added
- this._sidebarTree.addEventListener(UI.TreeOutline.Events.ElementAttached, this._treeElementAdded, this);
+ this.sidebarTree.addEventListener(UI.TreeOutline.Events.ElementAttached, this.treeElementAdded, this);
- this.contentElement.appendChild(this._sidebarTree.element);
+ this.contentElement.appendChild(this.sidebarTree.element);
const applicationSectionTitle = i18nString(UIStrings.application);
- this._applicationTreeElement = this._addSidebarSection(applicationSectionTitle);
+ this.applicationTreeElement = this.addSidebarSection(applicationSectionTitle);
const manifestTreeElement = new AppManifestTreeElement(panel);
- this._applicationTreeElement.appendChild(manifestTreeElement);
+ this.applicationTreeElement.appendChild(manifestTreeElement);
this.serviceWorkersTreeElement = new ServiceWorkersTreeElement(panel);
- this._applicationTreeElement.appendChild(this.serviceWorkersTreeElement);
+ this.applicationTreeElement.appendChild(this.serviceWorkersTreeElement);
const clearStorageTreeElement = new ClearStorageTreeElement(panel);
- this._applicationTreeElement.appendChild(clearStorageTreeElement);
+ this.applicationTreeElement.appendChild(clearStorageTreeElement);
const storageSectionTitle = i18nString(UIStrings.storage);
- const storageTreeElement = this._addSidebarSection(storageSectionTitle);
+ const storageTreeElement = this.addSidebarSection(storageSectionTitle);
this.localStorageListTreeElement =
new ExpandableApplicationPanelTreeElement(panel, i18nString(UIStrings.localStorage), 'LocalStorage');
this.localStorageListTreeElement.setLink(
@@ -291,7 +291,7 @@
storageTreeElement.appendChild(this.trustTokensTreeElement);
const cacheSectionTitle = i18nString(UIStrings.cache);
- const cacheTreeElement = this._addSidebarSection(cacheSectionTitle);
+ const cacheTreeElement = this.addSidebarSection(cacheSectionTitle);
this.cacheStorageListTreeElement = new ServiceWorkerCacheTreeElement(panel);
cacheTreeElement.appendChild(this.cacheStorageListTreeElement);
this.applicationCacheListTreeElement =
@@ -309,7 +309,7 @@
if (Root.Runtime.experiments.isEnabled('backgroundServices')) {
const backgroundServiceSectionTitle = i18nString(UIStrings.backgroundServices);
- const backgroundServiceTreeElement = this._addSidebarSection(backgroundServiceSectionTitle);
+ const backgroundServiceTreeElement = this.addSidebarSection(backgroundServiceSectionTitle);
this.backgroundFetchTreeElement =
new BackgroundServiceTreeElement(panel, Protocol.BackgroundService.ServiceName.BackgroundFetch);
@@ -338,31 +338,31 @@
}
}
const resourcesSectionTitle = i18nString(UIStrings.frames);
- const resourcesTreeElement = this._addSidebarSection(resourcesSectionTitle);
- this._resourcesSection = new ResourcesSection(panel, resourcesTreeElement);
+ const resourcesTreeElement = this.addSidebarSection(resourcesSectionTitle);
+ this.resourcesSection = new ResourcesSection(panel, resourcesTreeElement);
- this._databaseTableViews = new Map();
- this._databaseQueryViews = new Map();
- this._databaseTreeElements = new Map();
- this._domStorageTreeElements = new Map();
- this._domains = {};
+ this.databaseTableViews = new Map();
+ this.databaseQueryViews = new Map();
+ this.databaseTreeElements = new Map();
+ this.domStorageTreeElements = new Map();
+ this.domains = {};
- this._sidebarTree.contentElement.addEventListener('mousemove', this._onmousemove.bind(this), false);
- this._sidebarTree.contentElement.addEventListener('mouseleave', this._onmouseleave.bind(this), false);
+ this.sidebarTree.contentElement.addEventListener('mousemove', this.onmousemove.bind(this), false);
+ this.sidebarTree.contentElement.addEventListener('mouseleave', this.onmouseleave.bind(this), false);
SDK.TargetManager.TargetManager.instance().observeTargets(this);
SDK.TargetManager.TargetManager.instance().addModelListener(
- SDK.ResourceTreeModel.ResourceTreeModel, SDK.ResourceTreeModel.Events.FrameNavigated, this._frameNavigated,
+ SDK.ResourceTreeModel.ResourceTreeModel, SDK.ResourceTreeModel.Events.FrameNavigated, this.frameNavigated,
this);
- const selection = this._panel.lastSelectedItemPath();
+ const selection = this.panel.lastSelectedItemPath();
if (!selection.length) {
manifestTreeElement.select();
}
SDK.TargetManager.TargetManager.instance().observeModels(DOMStorageModel, {
- modelAdded: (model: DOMStorageModel): void => this._domStorageModelAdded(model),
- modelRemoved: (model: DOMStorageModel): void => this._domStorageModelRemoved(model),
+ modelAdded: (model: DOMStorageModel): void => this.domStorageModelAdded(model),
+ modelRemoved: (model: DOMStorageModel): void => this.domStorageModelRemoved(model),
});
SDK.TargetManager.TargetManager.instance().observeModels(IndexedDBModel, {
modelAdded: (model: IndexedDBModel): void => model.enable(),
@@ -374,25 +374,25 @@
this.contentElement.style.contain = 'layout style';
}
- _addSidebarSection(title: string): UI.TreeOutline.TreeElement {
+ private addSidebarSection(title: string): UI.TreeOutline.TreeElement {
const treeElement = new UI.TreeOutline.TreeElement(title, true);
treeElement.listItemElement.classList.add('storage-group-list-item');
treeElement.setCollapsible(false);
treeElement.selectable = false;
- this._sidebarTree.appendChild(treeElement);
+ this.sidebarTree.appendChild(treeElement);
UI.ARIAUtils.setAccessibleName(treeElement.childrenListElement, title);
return treeElement;
}
targetAdded(target: SDK.Target.Target): void {
- if (this._target) {
+ if (this.target) {
return;
}
- this._target = target;
- this._databaseModel = target.model(DatabaseModel);
- if (this._databaseModel) {
- this._databaseModel.addEventListener(DatabaseModelEvents.DatabaseAdded, this._databaseAdded, this);
- this._databaseModel.addEventListener(DatabaseModelEvents.DatabasesRemoved, this._resetWebSQL, this);
+ this.target = target;
+ this.databaseModel = target.model(DatabaseModel);
+ if (this.databaseModel) {
+ this.databaseModel.addEventListener(DatabaseModelEvents.DatabaseAdded, this.databaseAdded, this);
+ this.databaseModel.addEventListener(DatabaseModelEvents.DatabasesRemoved, this.resetWebSQL, this);
}
const resourceTreeModel = target.model(SDK.ResourceTreeModel.ResourceTreeModel);
@@ -401,121 +401,121 @@
}
if (resourceTreeModel.cachedResourcesLoaded()) {
- this._initialize();
+ this.initialize();
}
- resourceTreeModel.addEventListener(SDK.ResourceTreeModel.Events.CachedResourcesLoaded, this._initialize, this);
+ resourceTreeModel.addEventListener(SDK.ResourceTreeModel.Events.CachedResourcesLoaded, this.initialize, this);
resourceTreeModel.addEventListener(
- SDK.ResourceTreeModel.Events.WillLoadCachedResources, this._resetWithFrames, this);
+ SDK.ResourceTreeModel.Events.WillLoadCachedResources, this.resetWithFrames, this);
}
targetRemoved(target: SDK.Target.Target): void {
- if (target !== this._target) {
+ if (target !== this.target) {
return;
}
- delete this._target;
+ delete this.target;
const resourceTreeModel = target.model(SDK.ResourceTreeModel.ResourceTreeModel);
if (resourceTreeModel) {
- resourceTreeModel.removeEventListener(SDK.ResourceTreeModel.Events.CachedResourcesLoaded, this._initialize, this);
+ resourceTreeModel.removeEventListener(SDK.ResourceTreeModel.Events.CachedResourcesLoaded, this.initialize, this);
resourceTreeModel.removeEventListener(
- SDK.ResourceTreeModel.Events.WillLoadCachedResources, this._resetWithFrames, this);
+ SDK.ResourceTreeModel.Events.WillLoadCachedResources, this.resetWithFrames, this);
}
- if (this._databaseModel) {
- this._databaseModel.removeEventListener(DatabaseModelEvents.DatabaseAdded, this._databaseAdded, this);
- this._databaseModel.removeEventListener(DatabaseModelEvents.DatabasesRemoved, this._resetWebSQL, this);
- this._databaseModel = null;
+ if (this.databaseModel) {
+ this.databaseModel.removeEventListener(DatabaseModelEvents.DatabaseAdded, this.databaseAdded, this);
+ this.databaseModel.removeEventListener(DatabaseModelEvents.DatabasesRemoved, this.resetWebSQL, this);
+ this.databaseModel = null;
}
- this._resetWithFrames();
+ this.resetWithFrames();
}
focus(): void {
- this._sidebarTree.focus();
+ this.sidebarTree.focus();
}
- _initialize(): void {
+ private initialize(): void {
for (const frame of SDK.ResourceTreeModel.ResourceTreeModel.frames()) {
- this._addCookieDocument(frame);
+ this.addCookieDocument(frame);
}
- if (this._databaseModel) {
- this._databaseModel.enable();
+ if (this.databaseModel) {
+ this.databaseModel.enable();
}
- const cacheStorageModel = this._target && this._target.model(SDK.ServiceWorkerCacheModel.ServiceWorkerCacheModel);
+ const cacheStorageModel = this.target && this.target.model(SDK.ServiceWorkerCacheModel.ServiceWorkerCacheModel);
if (cacheStorageModel) {
cacheStorageModel.enable();
}
- const resourceTreeModel = this._target && this._target.model(SDK.ResourceTreeModel.ResourceTreeModel);
+ const resourceTreeModel = this.target && this.target.model(SDK.ResourceTreeModel.ResourceTreeModel);
if (resourceTreeModel) {
- this._populateApplicationCacheTree(resourceTreeModel);
+ this.populateApplicationCacheTree(resourceTreeModel);
}
const serviceWorkerCacheModel =
- this._target && this._target.model(SDK.ServiceWorkerCacheModel.ServiceWorkerCacheModel) || null;
+ this.target && this.target.model(SDK.ServiceWorkerCacheModel.ServiceWorkerCacheModel) || null;
this.cacheStorageListTreeElement.initialize(serviceWorkerCacheModel);
- const backgroundServiceModel = this._target && this._target.model(BackgroundServiceModel) || null;
+ const backgroundServiceModel = this.target && this.target.model(BackgroundServiceModel) || null;
if (Root.Runtime.experiments.isEnabled('backgroundServices')) {
- this.backgroundFetchTreeElement && this.backgroundFetchTreeElement._initialize(backgroundServiceModel);
- this.backgroundSyncTreeElement && this.backgroundSyncTreeElement._initialize(backgroundServiceModel);
+ this.backgroundFetchTreeElement && this.backgroundFetchTreeElement.initialize(backgroundServiceModel);
+ this.backgroundSyncTreeElement && this.backgroundSyncTreeElement.initialize(backgroundServiceModel);
if (Root.Runtime.experiments.isEnabled('backgroundServicesNotifications') && this.notificationsTreeElement) {
- this.notificationsTreeElement._initialize(backgroundServiceModel);
+ this.notificationsTreeElement.initialize(backgroundServiceModel);
}
if (Root.Runtime.experiments.isEnabled('backgroundServicesPaymentHandler') && this.paymentHandlerTreeElement) {
- this.paymentHandlerTreeElement._initialize(backgroundServiceModel);
+ this.paymentHandlerTreeElement.initialize(backgroundServiceModel);
}
this.periodicBackgroundSyncTreeElement &&
- this.periodicBackgroundSyncTreeElement._initialize(backgroundServiceModel);
+ this.periodicBackgroundSyncTreeElement.initialize(backgroundServiceModel);
if (Root.Runtime.experiments.isEnabled('backgroundServicesPushMessaging') && this.pushMessagingTreeElement) {
- this.pushMessagingTreeElement._initialize(backgroundServiceModel);
+ this.pushMessagingTreeElement.initialize(backgroundServiceModel);
}
}
}
- _domStorageModelAdded(model: DOMStorageModel): void {
+ private domStorageModelAdded(model: DOMStorageModel): void {
model.enable();
- model.storages().forEach(this._addDOMStorage.bind(this));
- model.addEventListener(DOMStorageModelEvents.DOMStorageAdded, this._domStorageAdded, this);
- model.addEventListener(DOMStorageModelEvents.DOMStorageRemoved, this._domStorageRemoved, this);
+ model.storages().forEach(this.addDOMStorage.bind(this));
+ model.addEventListener(DOMStorageModelEvents.DOMStorageAdded, this.domStorageAdded, this);
+ model.addEventListener(DOMStorageModelEvents.DOMStorageRemoved, this.domStorageRemoved, this);
}
- _domStorageModelRemoved(model: DOMStorageModel): void {
- model.storages().forEach(this._removeDOMStorage.bind(this));
- model.removeEventListener(DOMStorageModelEvents.DOMStorageAdded, this._domStorageAdded, this);
- model.removeEventListener(DOMStorageModelEvents.DOMStorageRemoved, this._domStorageRemoved, this);
+ private domStorageModelRemoved(model: DOMStorageModel): void {
+ model.storages().forEach(this.removeDOMStorage.bind(this));
+ model.removeEventListener(DOMStorageModelEvents.DOMStorageAdded, this.domStorageAdded, this);
+ model.removeEventListener(DOMStorageModelEvents.DOMStorageRemoved, this.domStorageRemoved, this);
}
- _resetWithFrames(): void {
- this._resourcesSection.reset();
- this._reset();
+ private resetWithFrames(): void {
+ this.resourcesSection.reset();
+ this.reset();
}
- _resetWebSQL(): void {
- for (const queryView of this._databaseQueryViews.values()) {
+ private resetWebSQL(): void {
+ for (const queryView of this.databaseQueryViews.values()) {
queryView.removeEventListener(DatabaseQueryViewEvents.SchemaUpdated, event => {
- this._updateDatabaseTables(event);
+ this.updateDatabaseTables(event);
}, this);
}
- this._databaseTableViews.clear();
- this._databaseQueryViews.clear();
- this._databaseTreeElements.clear();
+ this.databaseTableViews.clear();
+ this.databaseQueryViews.clear();
+ this.databaseTreeElements.clear();
this.databasesListTreeElement.removeChildren();
this.databasesListTreeElement.setExpandable(false);
}
- _resetAppCache(): void {
- for (const frameId of this._applicationCacheFrameElements.keys()) {
- this._applicationCacheFrameManifestRemoved({data: frameId});
+ private resetAppCache(): void {
+ for (const frameId of this.applicationCacheFrameElements.keys()) {
+ this.applicationCacheFrameManifestRemoved({data: frameId});
}
this.applicationCacheListTreeElement.setExpandable(false);
}
- _treeElementAdded(event: Common.EventTarget.EventTargetEvent): void {
+ private treeElementAdded(event: Common.EventTarget.EventTargetEvent): void {
// On tree item selection its itemURL and those of its parents are persisted.
// On reload/navigation we check for matches starting from the root on the
// path to the current element. Matching nodes are expanded until we hit a
// mismatch. This way we ensure that the longest matching path starting from
// the root is expanded, even if we cannot match the whole path.
- const selection = this._panel.lastSelectedItemPath();
+ const selection = this.panel.lastSelectedItemPath();
if (!selection.length) {
return;
}
@@ -541,34 +541,34 @@
}
}
- _reset(): void {
- this._domains = {};
- this._resetWebSQL();
+ private reset(): void {
+ this.domains = {};
+ this.resetWebSQL();
this.cookieListTreeElement.removeChildren();
}
- _frameNavigated(event: Common.EventTarget.EventTargetEvent<SDK.ResourceTreeModel.ResourceTreeFrame>): void {
+ private frameNavigated(event: Common.EventTarget.EventTargetEvent<SDK.ResourceTreeModel.ResourceTreeFrame>): void {
const frame = event.data;
if (frame.isTopFrame()) {
- this._reset();
+ this.reset();
}
- const applicationCacheFrameTreeElement = this._applicationCacheFrameElements.get(frame.id);
+ const applicationCacheFrameTreeElement = this.applicationCacheFrameElements.get(frame.id);
if (applicationCacheFrameTreeElement) {
applicationCacheFrameTreeElement.frameNavigated(frame);
}
- this._addCookieDocument(frame);
+ this.addCookieDocument(frame);
}
- _databaseAdded(event: Common.EventTarget.EventTargetEvent): void {
+ private databaseAdded(event: Common.EventTarget.EventTargetEvent): void {
const database = (event.data as DatabaseModelDatabase);
const databaseTreeElement = new DatabaseTreeElement(this, database);
- this._databaseTreeElements.set(database, databaseTreeElement);
+ this.databaseTreeElements.set(database, databaseTreeElement);
this.databasesListTreeElement.appendChild(databaseTreeElement);
}
- _addCookieDocument(frame: SDK.ResourceTreeModel.ResourceTreeFrame): void {
+ private addCookieDocument(frame: SDK.ResourceTreeModel.ResourceTreeFrame): void {
// In case the current frame was unreachable, show it's cookies
// instead of the error interstitials because they might help to
// debug why the frame was unreachable.
@@ -579,23 +579,23 @@
}
const domain = parsedURL.securityOrigin();
- if (!this._domains[domain]) {
- this._domains[domain] = true;
- const cookieDomainTreeElement = new CookieTreeElement(this._panel, frame, domain);
+ if (!this.domains[domain]) {
+ this.domains[domain] = true;
+ const cookieDomainTreeElement = new CookieTreeElement(this.panel, frame, domain);
this.cookieListTreeElement.appendChild(cookieDomainTreeElement);
}
}
- _domStorageAdded(event: Common.EventTarget.EventTargetEvent): void {
+ private domStorageAdded(event: Common.EventTarget.EventTargetEvent): void {
const domStorage = (event.data as DOMStorage);
- this._addDOMStorage(domStorage);
+ this.addDOMStorage(domStorage);
}
- _addDOMStorage(domStorage: DOMStorage): void {
- console.assert(!this._domStorageTreeElements.get(domStorage));
+ private addDOMStorage(domStorage: DOMStorage): void {
+ console.assert(!this.domStorageTreeElements.get(domStorage));
- const domStorageTreeElement = new DOMStorageTreeElement(this._panel, domStorage);
- this._domStorageTreeElements.set(domStorage, domStorageTreeElement);
+ const domStorageTreeElement = new DOMStorageTreeElement(this.panel, domStorage);
+ this.domStorageTreeElements.set(domStorage, domStorageTreeElement);
if (domStorage.isLocalStorage) {
this.localStorageListTreeElement.appendChild(domStorageTreeElement);
} else {
@@ -603,13 +603,13 @@
}
}
- _domStorageRemoved(event: Common.EventTarget.EventTargetEvent): void {
+ private domStorageRemoved(event: Common.EventTarget.EventTargetEvent): void {
const domStorage = (event.data as DOMStorage);
- this._removeDOMStorage(domStorage);
+ this.removeDOMStorage(domStorage);
}
- _removeDOMStorage(domStorage: DOMStorage): void {
- const treeElement = this._domStorageTreeElements.get(domStorage);
+ private removeDOMStorage(domStorage: DOMStorage): void {
+ const treeElement = this.domStorageTreeElements.get(domStorage);
if (!treeElement) {
return;
}
@@ -621,38 +621,38 @@
parentListTreeElement.select();
}
}
- this._domStorageTreeElements.delete(domStorage);
+ this.domStorageTreeElements.delete(domStorage);
}
selectDatabase(database: DatabaseModelDatabase): void {
if (database) {
- this._showDatabase(database);
- const treeElement = this._databaseTreeElements.get(database);
+ this.showDatabase(database);
+ const treeElement = this.databaseTreeElements.get(database);
treeElement && treeElement.select();
}
}
async showResource(resource: SDK.Resource.Resource, line?: number, column?: number): Promise<void> {
- await this._resourcesSection.revealResource(resource, line, column);
+ await this.resourcesSection.revealResource(resource, line, column);
}
showFrame(frame: SDK.ResourceTreeModel.ResourceTreeFrame): void {
- this._resourcesSection.revealAndSelectFrame(frame);
+ this.resourcesSection.revealAndSelectFrame(frame);
}
- _showDatabase(database: DatabaseModelDatabase, tableName?: string): void {
+ showDatabase(database: DatabaseModelDatabase, tableName?: string): void {
if (!database) {
return;
}
let view;
if (tableName) {
- let tableViews = this._databaseTableViews.get(database);
+ let tableViews = this.databaseTableViews.get(database);
if (!tableViews) {
tableViews = ({} as {
[x: string]: DatabaseTableView,
});
- this._databaseTableViews.set(database, tableViews);
+ this.databaseTableViews.set(database, tableViews);
}
view = tableViews[tableName];
if (!view) {
@@ -660,60 +660,60 @@
tableViews[tableName] = view;
}
} else {
- view = this._databaseQueryViews.get(database);
+ view = this.databaseQueryViews.get(database);
if (!view) {
view = new DatabaseQueryView(database);
- this._databaseQueryViews.set(database, view);
+ this.databaseQueryViews.set(database, view);
view.addEventListener(DatabaseQueryViewEvents.SchemaUpdated, event => {
- this._updateDatabaseTables(event);
+ this.updateDatabaseTables(event);
}, this);
}
}
- this._innerShowView(view);
+ this.innerShowView(view);
}
- _showApplicationCache(frameId: Protocol.Page.FrameId): void {
- if (!this._applicationCacheModel) {
+ showApplicationCache(frameId: Protocol.Page.FrameId): void {
+ if (!this.applicationCacheModel) {
return;
}
- let view = this._applicationCacheViews.get(frameId);
+ let view = this.applicationCacheViews.get(frameId);
if (!view) {
- view = new ApplicationCacheItemsView(this._applicationCacheModel, frameId);
- this._applicationCacheViews.set(frameId, view);
+ view = new ApplicationCacheItemsView(this.applicationCacheModel, frameId);
+ this.applicationCacheViews.set(frameId, view);
}
- this._innerShowView(view);
+ this.innerShowView(view);
}
showFileSystem(view: UI.Widget.Widget): void {
- this._innerShowView(view);
+ this.innerShowView(view);
}
- _innerShowView(view: UI.Widget.Widget): void {
- this._panel.showView(view);
+ private innerShowView(view: UI.Widget.Widget): void {
+ this.panel.showView(view);
}
- async _updateDatabaseTables(event: Common.EventTarget.EventTargetEvent): Promise<void> {
+ private async updateDatabaseTables(event: Common.EventTarget.EventTargetEvent): Promise<void> {
const database = (event.data as DatabaseModelDatabase);
if (!database) {
return;
}
- const databasesTreeElement = this._databaseTreeElements.get(database);
+ const databasesTreeElement = this.databaseTreeElements.get(database);
if (!databasesTreeElement) {
return;
}
databasesTreeElement.invalidateChildren();
- const tableViews = this._databaseTableViews.get(database);
+ const tableViews = this.databaseTableViews.get(database);
if (!tableViews) {
return;
}
const tableNamesHash = new Set<string>();
- const panel = this._panel;
+ const panel = this.panel;
const tableNames = await database.tableNames();
for (const tableName of tableNames) {
@@ -732,94 +732,96 @@
await databasesTreeElement.updateChildren();
}
- _populateApplicationCacheTree(_resourceTreeModel: SDK.ResourceTreeModel.ResourceTreeModel): void {
- if (!this._target) {
+ private populateApplicationCacheTree(_resourceTreeModel: SDK.ResourceTreeModel.ResourceTreeModel): void {
+ if (!this.target) {
return;
}
- this._applicationCacheModel = this._target.model(ApplicationCacheModel);
- if (!this._applicationCacheModel) {
+ this.applicationCacheModel = this.target.model(ApplicationCacheModel);
+ if (!this.applicationCacheModel) {
return;
}
- this._applicationCacheModel.addEventListener(
- ApplicationCacheModelEvents.FrameManifestAdded, this._applicationCacheFrameManifestAdded, this);
- this._applicationCacheModel.addEventListener(
- ApplicationCacheModelEvents.FrameManifestRemoved, this._applicationCacheFrameManifestRemoved, this);
- this._applicationCacheModel.addEventListener(
- ApplicationCacheModelEvents.FrameManifestsReset, this._resetAppCache, this);
+ this.applicationCacheModel.addEventListener(
+ ApplicationCacheModelEvents.FrameManifestAdded, this.applicationCacheFrameManifestAdded, this);
+ this.applicationCacheModel.addEventListener(
+ ApplicationCacheModelEvents.FrameManifestRemoved, this.applicationCacheFrameManifestRemoved, this);
+ this.applicationCacheModel.addEventListener(
+ ApplicationCacheModelEvents.FrameManifestsReset, this.resetAppCache, this);
- this._applicationCacheModel.addEventListener(
- ApplicationCacheModelEvents.FrameManifestStatusUpdated, this._applicationCacheFrameManifestStatusChanged, this);
- this._applicationCacheModel.addEventListener(
- ApplicationCacheModelEvents.NetworkStateChanged, this._applicationCacheNetworkStateChanged, this);
+ this.applicationCacheModel.addEventListener(
+ ApplicationCacheModelEvents.FrameManifestStatusUpdated, this.applicationCacheFrameManifestStatusChanged, this);
+ this.applicationCacheModel.addEventListener(
+ ApplicationCacheModelEvents.NetworkStateChanged, this.applicationCacheNetworkStateChanged, this);
}
- _applicationCacheFrameManifestAdded(event: Common.EventTarget.EventTargetEvent): void {
+ private applicationCacheFrameManifestAdded(event: Common.EventTarget.EventTargetEvent): void {
const frameId = event.data;
- if (!this._applicationCacheModel || !this._target || frameId !== 'string') {
+ if (!this.applicationCacheModel || !this.target || frameId !== 'string') {
return;
}
- const manifestURL = this._applicationCacheModel.frameManifestURL(frameId);
+ const manifestURL = this.applicationCacheModel.frameManifestURL(frameId);
- let manifestTreeElement = this._applicationCacheManifestElements.get(manifestURL);
+ let manifestTreeElement = this.applicationCacheManifestElements.get(manifestURL);
if (!manifestTreeElement) {
- manifestTreeElement = new ApplicationCacheManifestTreeElement(this._panel, manifestURL);
+ manifestTreeElement = new ApplicationCacheManifestTreeElement(this.panel, manifestURL);
this.applicationCacheListTreeElement.appendChild(manifestTreeElement);
- this._applicationCacheManifestElements.set(manifestURL, manifestTreeElement);
+ this.applicationCacheManifestElements.set(manifestURL, manifestTreeElement);
}
- const model = this._target.model(SDK.ResourceTreeModel.ResourceTreeModel);
+ const model = this.target.model(SDK.ResourceTreeModel.ResourceTreeModel);
const frame = model && model.frameForId(frameId);
if (model && frame) {
const frameTreeElement = new ApplicationCacheFrameTreeElement(this, frame, manifestURL);
manifestTreeElement.appendChild(frameTreeElement);
manifestTreeElement.expand();
- this._applicationCacheFrameElements.set(frameId, frameTreeElement);
+ this.applicationCacheFrameElements.set(frameId, frameTreeElement);
}
}
- _applicationCacheFrameManifestRemoved(event: Common.EventTarget.EventTargetEvent): void {
- const frameId = (event.data as Protocol.Page.FrameId);
- const frameTreeElement = this._applicationCacheFrameElements.get(frameId);
+ private applicationCacheFrameManifestRemoved(event: Common.EventTarget.EventTargetEvent<Protocol.Page.FrameId>):
+ void {
+ const frameId = event.data;
+ const frameTreeElement = this.applicationCacheFrameElements.get(frameId);
if (!frameTreeElement) {
return;
}
const manifestURL = frameTreeElement.manifestURL;
- this._applicationCacheFrameElements.delete(frameId);
- this._applicationCacheViews.delete(frameId);
+ this.applicationCacheFrameElements.delete(frameId);
+ this.applicationCacheViews.delete(frameId);
frameTreeElement.parent && frameTreeElement.parent.removeChild(frameTreeElement);
- const manifestTreeElement = this._applicationCacheManifestElements.get(manifestURL);
+ const manifestTreeElement = this.applicationCacheManifestElements.get(manifestURL);
if (!manifestTreeElement || manifestTreeElement.childCount()) {
return;
}
- this._applicationCacheManifestElements.delete(manifestURL);
+ this.applicationCacheManifestElements.delete(manifestURL);
manifestTreeElement.parent && manifestTreeElement.parent.removeChild(manifestTreeElement);
}
- _applicationCacheFrameManifestStatusChanged(event: Common.EventTarget.EventTargetEvent): void {
- if (!this._applicationCacheModel) {
+ private applicationCacheFrameManifestStatusChanged(event: Common.EventTarget.EventTargetEvent<Protocol.Page.FrameId>):
+ void {
+ if (!this.applicationCacheModel) {
return;
}
- const frameId = (event.data as Protocol.Page.FrameId);
- const status = this._applicationCacheModel.frameManifestStatus(frameId);
+ const frameId = event.data;
+ const status = this.applicationCacheModel.frameManifestStatus(frameId);
- const view = this._applicationCacheViews.get(frameId);
+ const view = this.applicationCacheViews.get(frameId);
if (view) {
view.updateStatus(status);
}
}
- _applicationCacheNetworkStateChanged(event: Common.EventTarget.EventTargetEvent): void {
+ private applicationCacheNetworkStateChanged(event: Common.EventTarget.EventTargetEvent): void {
const isNowOnline = (event.data as boolean);
- for (const view of this._applicationCacheViews.values()) {
+ for (const view of this.applicationCacheViews.values()) {
view.updateNetworkState(isNowOnline);
}
}
- _onmousemove(event: MouseEvent): void {
+ private onmousemove(event: MouseEvent): void {
const nodeUnderMouse = (event.target as Node);
if (!nodeUnderMouse) {
return;
@@ -831,53 +833,52 @@
}
const element = UI.TreeOutline.TreeElement.getTreeElementBylistItemNode(listNode);
- if (this._previousHoveredElement === element) {
+ if (this.previousHoveredElement === element) {
return;
}
- if (this._previousHoveredElement) {
- this._previousHoveredElement.hovered = false;
- delete this._previousHoveredElement;
+ if (this.previousHoveredElement) {
+ this.previousHoveredElement.hovered = false;
+ delete this.previousHoveredElement;
}
if (element instanceof FrameTreeElement) {
- this._previousHoveredElement = element;
+ this.previousHoveredElement = element;
element.hovered = true;
}
}
- _onmouseleave(_event: MouseEvent): void {
- if (this._previousHoveredElement) {
- this._previousHoveredElement.hovered = false;
- delete this._previousHoveredElement;
+ private onmouseleave(_event: MouseEvent): void {
+ if (this.previousHoveredElement) {
+ this.previousHoveredElement.hovered = false;
+ delete this.previousHoveredElement;
}
}
}
export class BackgroundServiceTreeElement extends ApplicationPanelTreeElement {
- _serviceName: Protocol.BackgroundService.ServiceName;
- _selected: boolean;
- _view: BackgroundServiceView|null;
- _model: BackgroundServiceModel|null;
+ private serviceName: Protocol.BackgroundService.ServiceName;
+ private view: BackgroundServiceView|null;
+ private model: BackgroundServiceModel|null;
constructor(storagePanel: ResourcesPanel, serviceName: Protocol.BackgroundService.ServiceName) {
super(storagePanel, BackgroundServiceView.getUIString(serviceName), false);
- this._serviceName = serviceName;
+ this.serviceName = serviceName;
/* Whether the element has been selected. */
- this._selected = false;
+ this.selected = false;
- this._view = null;
+ this.view = null;
- this._model = null;
+ this.model = null;
- const backgroundServiceIcon = UI.Icon.Icon.create(this._getIconType(), 'resource-tree-item');
+ const backgroundServiceIcon = UI.Icon.Icon.create(this.getIconType(), 'resource-tree-item');
this.setLeadingIcons([backgroundServiceIcon]);
}
- _getIconType(): string {
- switch (this._serviceName) {
+ private getIconType(): string {
+ switch (this.serviceName) {
case Protocol.BackgroundService.ServiceName.BackgroundFetch:
return 'mediumicon-fetch';
case Protocol.BackgroundService.ServiceName.BackgroundSync:
@@ -891,59 +892,59 @@
case Protocol.BackgroundService.ServiceName.PeriodicBackgroundSync:
return 'mediumicon-schedule';
default:
- console.error(`Service ${this._serviceName} does not have a dedicated icon`);
+ console.error(`Service ${this.serviceName} does not have a dedicated icon`);
return 'mediumicon-table';
}
}
- _initialize(model: BackgroundServiceModel|null): void {
- this._model = model;
+ initialize(model: BackgroundServiceModel|null): void {
+ this.model = model;
// Show the view if the model was initialized after selection.
- if (this._selected && !this._view) {
+ if (this.selected && !this.view) {
this.onselect(false);
}
}
get itemURL(): string {
- return `background-service://${this._serviceName}`;
+ return `background-service://${this.serviceName}`;
}
onselect(selectedByUser?: boolean): boolean {
super.onselect(selectedByUser);
- this._selected = true;
+ this.selected = true;
- if (!this._model) {
+ if (!this.model) {
return false;
}
- if (!this._view) {
- this._view = new BackgroundServiceView(this._serviceName, this._model);
+ if (!this.view) {
+ this.view = new BackgroundServiceView(this.serviceName, this.model);
}
- this.showView(this._view);
- UI.Context.Context.instance().setFlavor(BackgroundServiceView, this._view);
+ this.showView(this.view);
+ UI.Context.Context.instance().setFlavor(BackgroundServiceView, this.view);
return false;
}
}
export class DatabaseTreeElement extends ApplicationPanelTreeElement {
- _sidebar: ApplicationPanelSidebar;
- _database: DatabaseModelDatabase;
+ private readonly sidebar: ApplicationPanelSidebar;
+ private readonly database: DatabaseModelDatabase;
constructor(sidebar: ApplicationPanelSidebar, database: DatabaseModelDatabase) {
- super(sidebar._panel, database.name, true);
- this._sidebar = sidebar;
- this._database = database;
+ super(sidebar.panel, database.name, true);
+ this.sidebar = sidebar;
+ this.database = database;
const icon = UI.Icon.Icon.create('mediumicon-database', 'resource-tree-item');
this.setLeadingIcons([icon]);
}
get itemURL(): string {
- return 'database://' + encodeURI(this._database.name);
+ return 'database://' + encodeURI(this.database.name);
}
onselect(selectedByUser?: boolean): boolean {
super.onselect(selectedByUser);
- this._sidebar._showDatabase(this._database);
+ this.sidebar.showDatabase(this.database);
return false;
}
@@ -953,40 +954,40 @@
async updateChildren(): Promise<void> {
this.removeChildren();
- const tableNames = await this._database.tableNames();
+ const tableNames = await this.database.tableNames();
for (const tableName of tableNames) {
- this.appendChild(new DatabaseTableTreeElement(this._sidebar, this._database, tableName));
+ this.appendChild(new DatabaseTableTreeElement(this.sidebar, this.database, tableName));
}
}
}
export class DatabaseTableTreeElement extends ApplicationPanelTreeElement {
- _sidebar: ApplicationPanelSidebar;
- _database: DatabaseModelDatabase;
- _tableName: string;
+ private readonly sidebar: ApplicationPanelSidebar;
+ private readonly database: DatabaseModelDatabase;
+ private readonly tableName: string;
constructor(sidebar: ApplicationPanelSidebar, database: DatabaseModelDatabase, tableName: string) {
- super(sidebar._panel, tableName, false);
- this._sidebar = sidebar;
- this._database = database;
- this._tableName = tableName;
+ super(sidebar.panel, tableName, false);
+ this.sidebar = sidebar;
+ this.database = database;
+ this.tableName = tableName;
const icon = UI.Icon.Icon.create('mediumicon-table', 'resource-tree-item');
this.setLeadingIcons([icon]);
}
get itemURL(): string {
- return 'database://' + encodeURI(this._database.name) + '/' + encodeURI(this._tableName);
+ return 'database://' + encodeURI(this.database.name) + '/' + encodeURI(this.tableName);
}
onselect(selectedByUser?: boolean): boolean {
super.onselect(selectedByUser);
- this._sidebar._showDatabase(this._database, this._tableName);
+ this.sidebar.showDatabase(this.database, this.tableName);
return false;
}
}
export class ServiceWorkersTreeElement extends ApplicationPanelTreeElement {
- _view?: ServiceWorkersView;
+ private view?: ServiceWorkersView;
constructor(storagePanel: ResourcesPanel) {
super(storagePanel, i18n.i18n.lockedString('Service Workers'), false);
@@ -1000,16 +1001,16 @@
onselect(selectedByUser?: boolean): boolean {
super.onselect(selectedByUser);
- if (!this._view) {
- this._view = new ServiceWorkersView();
+ if (!this.view) {
+ this.view = new ServiceWorkersView();
}
- this.showView(this._view);
+ this.showView(this.view);
return false;
}
}
export class AppManifestTreeElement extends ApplicationPanelTreeElement {
- _view?: AppManifestView;
+ private view?: AppManifestView;
constructor(storagePanel: ResourcesPanel) {
super(storagePanel, i18nString(UIStrings.manifest), false);
const icon = UI.Icon.Icon.create('mediumicon-manifest', 'resource-tree-item');
@@ -1022,16 +1023,16 @@
onselect(selectedByUser?: boolean): boolean {
super.onselect(selectedByUser);
- if (!this._view) {
- this._view = new AppManifestView();
+ if (!this.view) {
+ this.view = new AppManifestView();
}
- this.showView(this._view);
+ this.showView(this.view);
return false;
}
}
export class ClearStorageTreeElement extends ApplicationPanelTreeElement {
- _view?: StorageView;
+ private view?: StorageView;
constructor(storagePanel: ResourcesPanel) {
super(storagePanel, i18nString(UIStrings.storage), false);
const icon = UI.Icon.Icon.create('mediumicon-database', 'resource-tree-item');
@@ -1044,58 +1045,58 @@
onselect(selectedByUser?: boolean): boolean {
super.onselect(selectedByUser);
- if (!this._view) {
- this._view = new StorageView();
+ if (!this.view) {
+ this.view = new StorageView();
}
- this.showView(this._view);
+ this.showView(this.view);
return false;
}
}
export class IndexedDBTreeElement extends ExpandableApplicationPanelTreeElement {
- _idbDatabaseTreeElements: IDBDatabaseTreeElement[];
+ private idbDatabaseTreeElements: IDBDatabaseTreeElement[];
constructor(storagePanel: ResourcesPanel) {
super(storagePanel, i18nString(UIStrings.indexeddb), 'IndexedDB');
const icon = UI.Icon.Icon.create('mediumicon-database', 'resource-tree-item');
this.setLeadingIcons([icon]);
- this._idbDatabaseTreeElements = [];
+ this.idbDatabaseTreeElements = [];
this.initialize();
}
private initialize(): void {
SDK.TargetManager.TargetManager.instance().addModelListener(
- IndexedDBModel, IndexedDBModelEvents.DatabaseAdded, this._indexedDBAdded, this);
+ IndexedDBModel, IndexedDBModelEvents.DatabaseAdded, this.indexedDBAdded, this);
SDK.TargetManager.TargetManager.instance().addModelListener(
- IndexedDBModel, IndexedDBModelEvents.DatabaseRemoved, this._indexedDBRemoved, this);
+ IndexedDBModel, IndexedDBModelEvents.DatabaseRemoved, this.indexedDBRemoved, this);
SDK.TargetManager.TargetManager.instance().addModelListener(
- IndexedDBModel, IndexedDBModelEvents.DatabaseLoaded, this._indexedDBLoaded, this);
+ IndexedDBModel, IndexedDBModelEvents.DatabaseLoaded, this.indexedDBLoaded, this);
SDK.TargetManager.TargetManager.instance().addModelListener(
- IndexedDBModel, IndexedDBModelEvents.IndexedDBContentUpdated, this._indexedDBContentUpdated, this);
+ IndexedDBModel, IndexedDBModelEvents.IndexedDBContentUpdated, this.indexedDBContentUpdated, this);
// TODO(szuend): Replace with a Set once two web tests no longer directly access this private
// variable (indexeddb/live-update-indexeddb-content.js, indexeddb/delete-entry.js).
- this._idbDatabaseTreeElements = [];
+ this.idbDatabaseTreeElements = [];
for (const indexedDBModel of SDK.TargetManager.TargetManager.instance().models(IndexedDBModel)) {
const databases = indexedDBModel.databases();
for (let j = 0; j < databases.length; ++j) {
- this._addIndexedDB(indexedDBModel, databases[j]);
+ this.addIndexedDB(indexedDBModel, databases[j]);
}
}
}
removeIndexedDBForModel(model: IndexedDBModel): void {
- const idbDatabaseTreeElements = this._idbDatabaseTreeElements.filter(element => element._model === model);
+ const idbDatabaseTreeElements = this.idbDatabaseTreeElements.filter(element => element.model === model);
for (const idbDatabaseTreeElement of idbDatabaseTreeElements) {
- this._removeIDBDatabaseTreeElement(idbDatabaseTreeElement);
+ this.removeIDBDatabaseTreeElement(idbDatabaseTreeElement);
}
}
onattach(): void {
super.onattach();
- this.listItemElement.addEventListener('contextmenu', this._handleContextMenuEvent.bind(this), true);
+ this.listItemElement.addEventListener('contextmenu', this.handleContextMenuEvent.bind(this), true);
}
- _handleContextMenuEvent(event: MouseEvent): void {
+ private handleContextMenuEvent(event: MouseEvent): void {
const contextMenu = new UI.ContextMenu.ContextMenu(event);
contextMenu.defaultSection().appendItem(i18nString(UIStrings.refreshIndexeddb), this.refreshIndexedDB.bind(this));
contextMenu.show();
@@ -1107,147 +1108,147 @@
}
}
- _indexedDBAdded(event: Common.EventTarget.EventTargetEvent): void {
+ private indexedDBAdded(event: Common.EventTarget.EventTargetEvent): void {
const databaseId = (event.data.databaseId as DatabaseId);
const model = (event.data.model as IndexedDBModel);
- this._addIndexedDB(model, databaseId);
+ this.addIndexedDB(model, databaseId);
}
- _addIndexedDB(model: IndexedDBModel, databaseId: DatabaseId): void {
+ private addIndexedDB(model: IndexedDBModel, databaseId: DatabaseId): void {
const idbDatabaseTreeElement = new IDBDatabaseTreeElement(this.resourcesPanel, model, databaseId);
- this._idbDatabaseTreeElements.push(idbDatabaseTreeElement);
+ this.idbDatabaseTreeElements.push(idbDatabaseTreeElement);
this.appendChild(idbDatabaseTreeElement);
model.refreshDatabase(databaseId);
}
- _indexedDBRemoved(event: Common.EventTarget.EventTargetEvent): void {
+ private indexedDBRemoved(event: Common.EventTarget.EventTargetEvent): void {
const databaseId = (event.data.databaseId as DatabaseId);
const model = (event.data.model as IndexedDBModel);
- const idbDatabaseTreeElement = this._idbDatabaseTreeElement(model, databaseId);
+ const idbDatabaseTreeElement = this.idbDatabaseTreeElement(model, databaseId);
if (!idbDatabaseTreeElement) {
return;
}
- this._removeIDBDatabaseTreeElement(idbDatabaseTreeElement);
+ this.removeIDBDatabaseTreeElement(idbDatabaseTreeElement);
}
- _removeIDBDatabaseTreeElement(idbDatabaseTreeElement: IDBDatabaseTreeElement): void {
+ private removeIDBDatabaseTreeElement(idbDatabaseTreeElement: IDBDatabaseTreeElement): void {
idbDatabaseTreeElement.clear();
this.removeChild(idbDatabaseTreeElement);
- Platform.ArrayUtilities.removeElement(this._idbDatabaseTreeElements, idbDatabaseTreeElement);
+ Platform.ArrayUtilities.removeElement(this.idbDatabaseTreeElements, idbDatabaseTreeElement);
this.setExpandable(this.childCount() > 0);
}
- _indexedDBLoaded(event: Common.EventTarget.EventTargetEvent): void {
+ private indexedDBLoaded(event: Common.EventTarget.EventTargetEvent): void {
const database = (event.data.database as IndexedDBModelDatabase);
const model = (event.data.model as IndexedDBModel);
const entriesUpdated = (event.data.entriesUpdated as boolean);
- const idbDatabaseTreeElement = this._idbDatabaseTreeElement(model, database.databaseId);
+ const idbDatabaseTreeElement = this.idbDatabaseTreeElement(model, database.databaseId);
if (!idbDatabaseTreeElement) {
return;
}
idbDatabaseTreeElement.update(database, entriesUpdated);
- this._indexedDBLoadedForTest();
+ this.indexedDBLoadedForTest();
}
- _indexedDBLoadedForTest(): void {
+ private indexedDBLoadedForTest(): void {
// For sniffing in tests.
}
- _indexedDBContentUpdated(event: Common.EventTarget.EventTargetEvent): void {
+ private indexedDBContentUpdated(event: Common.EventTarget.EventTargetEvent): void {
const databaseId = (event.data.databaseId as DatabaseId);
const objectStoreName = (event.data.objectStoreName as string);
const model = (event.data.model as IndexedDBModel);
- const idbDatabaseTreeElement = this._idbDatabaseTreeElement(model, databaseId);
+ const idbDatabaseTreeElement = this.idbDatabaseTreeElement(model, databaseId);
if (!idbDatabaseTreeElement) {
return;
}
idbDatabaseTreeElement.indexedDBContentUpdated(objectStoreName);
}
- _idbDatabaseTreeElement(model: IndexedDBModel, databaseId: DatabaseId): IDBDatabaseTreeElement|null {
- return this._idbDatabaseTreeElements.find(x => x._databaseId.equals(databaseId) && x._model === model) || null;
+ private idbDatabaseTreeElement(model: IndexedDBModel, databaseId: DatabaseId): IDBDatabaseTreeElement|null {
+ return this.idbDatabaseTreeElements.find(x => x.databaseId.equals(databaseId) && x.model === model) || null;
}
}
export class IDBDatabaseTreeElement extends ApplicationPanelTreeElement {
- _model: IndexedDBModel;
- _databaseId: DatabaseId;
- _idbObjectStoreTreeElements: Map<string, IDBObjectStoreTreeElement>;
- _database?: IndexedDBModelDatabase;
- _view?: IDBDatabaseView;
+ model: IndexedDBModel;
+ databaseId: DatabaseId;
+ private readonly idbObjectStoreTreeElements: Map<string, IDBObjectStoreTreeElement>;
+ private database?: IndexedDBModelDatabase;
+ private view?: IDBDatabaseView;
constructor(storagePanel: ResourcesPanel, model: IndexedDBModel, databaseId: DatabaseId) {
super(storagePanel, databaseId.name + ' - ' + databaseId.securityOrigin, false);
- this._model = model;
- this._databaseId = databaseId;
- this._idbObjectStoreTreeElements = new Map();
+ this.model = model;
+ this.databaseId = databaseId;
+ this.idbObjectStoreTreeElements = new Map();
const icon = UI.Icon.Icon.create('mediumicon-database', 'resource-tree-item');
this.setLeadingIcons([icon]);
- this._model.addEventListener(IndexedDBModelEvents.DatabaseNamesRefreshed, this._refreshIndexedDB, this);
+ this.model.addEventListener(IndexedDBModelEvents.DatabaseNamesRefreshed, this.refreshIndexedDB, this);
}
get itemURL(): string {
- return 'indexedDB://' + this._databaseId.securityOrigin + '/' + this._databaseId.name;
+ return 'indexedDB://' + this.databaseId.securityOrigin + '/' + this.databaseId.name;
}
onattach(): void {
super.onattach();
- this.listItemElement.addEventListener('contextmenu', this._handleContextMenuEvent.bind(this), true);
+ this.listItemElement.addEventListener('contextmenu', this.handleContextMenuEvent.bind(this), true);
}
- _handleContextMenuEvent(event: MouseEvent): void {
+ private handleContextMenuEvent(event: MouseEvent): void {
const contextMenu = new UI.ContextMenu.ContextMenu(event);
- contextMenu.defaultSection().appendItem(i18nString(UIStrings.refreshIndexeddb), this._refreshIndexedDB.bind(this));
+ contextMenu.defaultSection().appendItem(i18nString(UIStrings.refreshIndexeddb), this.refreshIndexedDB.bind(this));
contextMenu.show();
}
- _refreshIndexedDB(): void {
- this._model.refreshDatabase(this._databaseId);
+ private refreshIndexedDB(): void {
+ this.model.refreshDatabase(this.databaseId);
}
indexedDBContentUpdated(objectStoreName: string): void {
- const treeElement = this._idbObjectStoreTreeElements.get(objectStoreName);
+ const treeElement = this.idbObjectStoreTreeElements.get(objectStoreName);
if (treeElement) {
treeElement.markNeedsRefresh();
}
}
update(database: IndexedDBModelDatabase, entriesUpdated: boolean): void {
- this._database = database;
+ this.database = database;
const objectStoreNames = new Set<string>();
- for (const objectStoreName of [...this._database.objectStores.keys()].sort()) {
- const objectStore = this._database.objectStores.get(objectStoreName);
+ for (const objectStoreName of [...this.database.objectStores.keys()].sort()) {
+ const objectStore = this.database.objectStores.get(objectStoreName);
if (!objectStore) {
continue;
}
objectStoreNames.add(objectStore.name);
- let treeElement = this._idbObjectStoreTreeElements.get(objectStore.name);
+ let treeElement = this.idbObjectStoreTreeElements.get(objectStore.name);
if (!treeElement) {
- treeElement = new IDBObjectStoreTreeElement(this.resourcesPanel, this._model, this._databaseId, objectStore);
- this._idbObjectStoreTreeElements.set(objectStore.name, treeElement);
+ treeElement = new IDBObjectStoreTreeElement(this.resourcesPanel, this.model, this.databaseId, objectStore);
+ this.idbObjectStoreTreeElements.set(objectStore.name, treeElement);
this.appendChild(treeElement);
}
treeElement.update(objectStore, entriesUpdated);
}
- for (const objectStoreName of this._idbObjectStoreTreeElements.keys()) {
+ for (const objectStoreName of this.idbObjectStoreTreeElements.keys()) {
if (!objectStoreNames.has(objectStoreName)) {
- this._objectStoreRemoved(objectStoreName);
+ this.objectStoreRemoved(objectStoreName);
}
}
- if (this._view) {
- this._view.update(database);
+ if (this.view) {
+ this.view.update(database);
}
- this._updateTooltip();
+ this.updateTooltip();
}
- _updateTooltip(): void {
- const version = this._database ? this._database.version : '-';
- if (Object.keys(this._idbObjectStoreTreeElements).length === 0) {
+ private updateTooltip(): void {
+ const version = this.database ? this.database.version : '-';
+ if (Object.keys(this.idbObjectStoreTreeElements).length === 0) {
this.tooltip = i18nString(UIStrings.versionSEmpty, {PH1: version});
} else {
this.tooltip = i18nString(UIStrings.versionS, {PH1: version});
@@ -1256,116 +1257,115 @@
onselect(selectedByUser?: boolean): boolean {
super.onselect(selectedByUser);
- if (!this._database) {
+ if (!this.database) {
return false;
}
- if (!this._view) {
- this._view = new IDBDatabaseView(this._model, this._database);
+ if (!this.view) {
+ this.view = new IDBDatabaseView(this.model, this.database);
}
- this.showView(this._view);
+ this.showView(this.view);
return false;
}
- _objectStoreRemoved(objectStoreName: string): void {
- const objectStoreTreeElement = this._idbObjectStoreTreeElements.get(objectStoreName);
+ private objectStoreRemoved(objectStoreName: string): void {
+ const objectStoreTreeElement = this.idbObjectStoreTreeElements.get(objectStoreName);
if (objectStoreTreeElement) {
objectStoreTreeElement.clear();
this.removeChild(objectStoreTreeElement);
}
- this._idbObjectStoreTreeElements.delete(objectStoreName);
- this._updateTooltip();
+ this.idbObjectStoreTreeElements.delete(objectStoreName);
+ this.updateTooltip();
}
clear(): void {
- for (const objectStoreName of this._idbObjectStoreTreeElements.keys()) {
- this._objectStoreRemoved(objectStoreName);
+ for (const objectStoreName of this.idbObjectStoreTreeElements.keys()) {
+ this.objectStoreRemoved(objectStoreName);
}
}
}
export class IDBObjectStoreTreeElement extends ApplicationPanelTreeElement {
- _model: IndexedDBModel;
- _databaseId: DatabaseId;
- _idbIndexTreeElements: Map<string, IDBIndexTreeElement>;
- _objectStore: ObjectStore;
- _view: IDBDataView|null;
+ private model: IndexedDBModel;
+ private databaseId: DatabaseId;
+ private readonly idbIndexTreeElements: Map<string, IDBIndexTreeElement>;
+ private objectStore: ObjectStore;
+ private view: IDBDataView|null;
constructor(storagePanel: ResourcesPanel, model: IndexedDBModel, databaseId: DatabaseId, objectStore: ObjectStore) {
super(storagePanel, objectStore.name, false);
- this._model = model;
- this._databaseId = databaseId;
- this._idbIndexTreeElements = new Map();
- this._objectStore = objectStore;
- this._view = null;
+ this.model = model;
+ this.databaseId = databaseId;
+ this.idbIndexTreeElements = new Map();
+ this.objectStore = objectStore;
+ this.view = null;
const icon = UI.Icon.Icon.create('mediumicon-table', 'resource-tree-item');
this.setLeadingIcons([icon]);
}
get itemURL(): string {
- return 'indexedDB://' + this._databaseId.securityOrigin + '/' + this._databaseId.name + '/' +
- this._objectStore.name;
+ return 'indexedDB://' + this.databaseId.securityOrigin + '/' + this.databaseId.name + '/' + this.objectStore.name;
}
onattach(): void {
super.onattach();
- this.listItemElement.addEventListener('contextmenu', this._handleContextMenuEvent.bind(this), true);
+ this.listItemElement.addEventListener('contextmenu', this.handleContextMenuEvent.bind(this), true);
}
markNeedsRefresh(): void {
- if (this._view) {
- this._view.markNeedsRefresh();
+ if (this.view) {
+ this.view.markNeedsRefresh();
}
- for (const treeElement of this._idbIndexTreeElements.values()) {
+ for (const treeElement of this.idbIndexTreeElements.values()) {
treeElement.markNeedsRefresh();
}
}
- _handleContextMenuEvent(event: MouseEvent): void {
+ private handleContextMenuEvent(event: MouseEvent): void {
const contextMenu = new UI.ContextMenu.ContextMenu(event);
- contextMenu.defaultSection().appendItem(i18nString(UIStrings.clear), this._clearObjectStore.bind(this));
+ contextMenu.defaultSection().appendItem(i18nString(UIStrings.clear), this.clearObjectStore.bind(this));
contextMenu.show();
}
- _refreshObjectStore(): void {
- if (this._view) {
- this._view.refreshData();
+ private refreshObjectStore(): void {
+ if (this.view) {
+ this.view.refreshData();
}
- for (const treeElement of this._idbIndexTreeElements.values()) {
+ for (const treeElement of this.idbIndexTreeElements.values()) {
treeElement.refreshIndex();
}
}
- async _clearObjectStore(): Promise<void> {
- await this._model.clearObjectStore(this._databaseId, this._objectStore.name);
- this.update(this._objectStore, true);
+ private async clearObjectStore(): Promise<void> {
+ await this.model.clearObjectStore(this.databaseId, this.objectStore.name);
+ this.update(this.objectStore, true);
}
update(objectStore: ObjectStore, entriesUpdated: boolean): void {
- this._objectStore = objectStore;
+ this.objectStore = objectStore;
const indexNames = new Set<string>();
- for (const index of this._objectStore.indexes.values()) {
+ for (const index of this.objectStore.indexes.values()) {
indexNames.add(index.name);
- let treeElement = this._idbIndexTreeElements.get(index.name);
+ let treeElement = this.idbIndexTreeElements.get(index.name);
if (!treeElement) {
treeElement = new IDBIndexTreeElement(
- this.resourcesPanel, this._model, this._databaseId, this._objectStore, index,
- this._refreshObjectStore.bind(this));
- this._idbIndexTreeElements.set(index.name, treeElement);
+ this.resourcesPanel, this.model, this.databaseId, this.objectStore, index,
+ this.refreshObjectStore.bind(this));
+ this.idbIndexTreeElements.set(index.name, treeElement);
this.appendChild(treeElement);
}
- treeElement.update(this._objectStore, index, entriesUpdated);
+ treeElement.update(this.objectStore, index, entriesUpdated);
}
- for (const indexName of this._idbIndexTreeElements.keys()) {
+ for (const indexName of this.idbIndexTreeElements.keys()) {
if (!indexNames.has(indexName)) {
- this._indexRemoved(indexName);
+ this.indexRemoved(indexName);
}
}
- for (const [indexName, treeElement] of this._idbIndexTreeElements.entries()) {
+ for (const [indexName, treeElement] of this.idbIndexTreeElements.entries()) {
if (!indexNames.has(indexName)) {
this.removeChild((treeElement as IDBIndexTreeElement));
- this._idbIndexTreeElements.delete((indexName as string));
+ this.idbIndexTreeElements.delete((indexName as string));
}
}
@@ -1373,17 +1373,17 @@
this.expand();
}
- if (this._view && entriesUpdated) {
- this._view.update(this._objectStore, null);
+ if (this.view && entriesUpdated) {
+ this.view.update(this.objectStore, null);
}
- this._updateTooltip();
+ this.updateTooltip();
}
- _updateTooltip(): void {
- const keyPathString = this._objectStore.keyPathString;
+ private updateTooltip(): void {
+ const keyPathString = this.objectStore.keyPathString;
let tooltipString = keyPathString !== null ? i18nString(UIStrings.keyPathS, {PH1: keyPathString}) : '';
- if (this._objectStore.autoIncrement) {
+ if (this.objectStore.autoIncrement) {
tooltipString += '\n' + i18n.i18n.lockedString('autoIncrement');
}
this.tooltip = tooltipString;
@@ -1391,89 +1391,89 @@
onselect(selectedByUser?: boolean): boolean {
super.onselect(selectedByUser);
- if (!this._view) {
- this._view =
- new IDBDataView(this._model, this._databaseId, this._objectStore, null, this._refreshObjectStore.bind(this));
+ if (!this.view) {
+ this.view =
+ new IDBDataView(this.model, this.databaseId, this.objectStore, null, this.refreshObjectStore.bind(this));
}
- this.showView(this._view);
+ this.showView(this.view);
return false;
}
- _indexRemoved(indexName: string): void {
- const indexTreeElement = this._idbIndexTreeElements.get(indexName);
+ private indexRemoved(indexName: string): void {
+ const indexTreeElement = this.idbIndexTreeElements.get(indexName);
if (indexTreeElement) {
indexTreeElement.clear();
this.removeChild(indexTreeElement);
}
- this._idbIndexTreeElements.delete(indexName);
+ this.idbIndexTreeElements.delete(indexName);
}
clear(): void {
- for (const indexName of this._idbIndexTreeElements.keys()) {
- this._indexRemoved(indexName);
+ for (const indexName of this.idbIndexTreeElements.keys()) {
+ this.indexRemoved(indexName);
}
- if (this._view) {
- this._view.clear();
+ if (this.view) {
+ this.view.clear();
}
}
}
export class IDBIndexTreeElement extends ApplicationPanelTreeElement {
- _model: IndexedDBModel;
- _databaseId: DatabaseId;
- _objectStore: ObjectStore;
- _index: Index;
- _refreshObjectStore: () => void;
- _view?: IDBDataView;
+ private model: IndexedDBModel;
+ private databaseId: DatabaseId;
+ private objectStore: ObjectStore;
+ private index: Index;
+ private refreshObjectStore: () => void;
+ private view?: IDBDataView;
constructor(
storagePanel: ResourcesPanel, model: IndexedDBModel, databaseId: DatabaseId, objectStore: ObjectStore,
index: Index, refreshObjectStore: () => void) {
super(storagePanel, index.name, false);
- this._model = model;
- this._databaseId = databaseId;
- this._objectStore = objectStore;
- this._index = index;
- this._refreshObjectStore = refreshObjectStore;
+ this.model = model;
+ this.databaseId = databaseId;
+ this.objectStore = objectStore;
+ this.index = index;
+ this.refreshObjectStore = refreshObjectStore;
}
get itemURL(): string {
- return 'indexedDB://' + this._databaseId.securityOrigin + '/' + this._databaseId.name + '/' +
- this._objectStore.name + '/' + this._index.name;
+ return 'indexedDB://' + this.databaseId.securityOrigin + '/' + this.databaseId.name + '/' + this.objectStore.name +
+ '/' + this.index.name;
}
markNeedsRefresh(): void {
- if (this._view) {
- this._view.markNeedsRefresh();
+ if (this.view) {
+ this.view.markNeedsRefresh();
}
}
refreshIndex(): void {
- if (this._view) {
- this._view.refreshData();
+ if (this.view) {
+ this.view.refreshData();
}
}
update(objectStore: ObjectStore, index: Index, entriesUpdated: boolean): void {
- this._objectStore = objectStore;
- this._index = index;
+ this.objectStore = objectStore;
+ this.index = index;
- if (this._view && entriesUpdated) {
- this._view.update(this._objectStore, this._index);
+ if (this.view && entriesUpdated) {
+ this.view.update(this.objectStore, this.index);
}
- this._updateTooltip();
+ this.updateTooltip();
}
- _updateTooltip(): void {
+ private updateTooltip(): void {
const tooltipLines = [];
- const keyPathString = this._index.keyPathString;
+ const keyPathString = this.index.keyPathString;
tooltipLines.push(i18nString(UIStrings.keyPathS, {PH1: keyPathString}));
- if (this._index.unique) {
+ if (this.index.unique) {
tooltipLines.push(i18n.i18n.lockedString('unique'));
}
- if (this._index.multiEntry) {
+ if (this.index.multiEntry) {
tooltipLines.push(i18n.i18n.lockedString('multiEntry'));
}
this.tooltip = tooltipLines.join('\n');
@@ -1481,169 +1481,167 @@
onselect(selectedByUser?: boolean): boolean {
super.onselect(selectedByUser);
- if (!this._view) {
- this._view =
- new IDBDataView(this._model, this._databaseId, this._objectStore, this._index, this._refreshObjectStore);
+ if (!this.view) {
+ this.view = new IDBDataView(this.model, this.databaseId, this.objectStore, this.index, this.refreshObjectStore);
}
- this.showView(this._view);
+ this.showView(this.view);
return false;
}
clear(): void {
- if (this._view) {
- this._view.clear();
+ if (this.view) {
+ this.view.clear();
}
}
}
export class DOMStorageTreeElement extends ApplicationPanelTreeElement {
- _domStorage: DOMStorage;
+ private readonly domStorage: DOMStorage;
constructor(storagePanel: ResourcesPanel, domStorage: DOMStorage) {
super(
storagePanel, domStorage.securityOrigin ? domStorage.securityOrigin : i18nString(UIStrings.localFiles), false);
- this._domStorage = domStorage;
+ this.domStorage = domStorage;
const icon = UI.Icon.Icon.create('mediumicon-table', 'resource-tree-item');
this.setLeadingIcons([icon]);
}
get itemURL(): string {
- return 'storage://' + this._domStorage.securityOrigin + '/' +
- (this._domStorage.isLocalStorage ? 'local' : 'session');
+ return 'storage://' + this.domStorage.securityOrigin + '/' + (this.domStorage.isLocalStorage ? 'local' : 'session');
}
onselect(selectedByUser?: boolean): boolean {
super.onselect(selectedByUser);
- this.resourcesPanel.showDOMStorage(this._domStorage);
+ this.resourcesPanel.showDOMStorage(this.domStorage);
return false;
}
onattach(): void {
super.onattach();
- this.listItemElement.addEventListener('contextmenu', this._handleContextMenuEvent.bind(this), true);
+ this.listItemElement.addEventListener('contextmenu', this.handleContextMenuEvent.bind(this), true);
}
- _handleContextMenuEvent(event: MouseEvent): void {
+ private handleContextMenuEvent(event: MouseEvent): void {
const contextMenu = new UI.ContextMenu.ContextMenu(event);
- contextMenu.defaultSection().appendItem(i18nString(UIStrings.clear), () => this._domStorage.clear());
+ contextMenu.defaultSection().appendItem(i18nString(UIStrings.clear), () => this.domStorage.clear());
contextMenu.show();
}
}
export class CookieTreeElement extends ApplicationPanelTreeElement {
- _target: SDK.Target.Target;
- _cookieDomain: string;
+ private readonly target: SDK.Target.Target;
+ private readonly cookieDomainInternal: string;
constructor(storagePanel: ResourcesPanel, frame: SDK.ResourceTreeModel.ResourceTreeFrame, cookieDomain: string) {
super(storagePanel, cookieDomain ? cookieDomain : i18nString(UIStrings.localFiles), false);
- this._target = frame.resourceTreeModel().target();
- this._cookieDomain = cookieDomain;
+ this.target = frame.resourceTreeModel().target();
+ this.cookieDomainInternal = cookieDomain;
this.tooltip = i18nString(UIStrings.cookiesUsedByFramesFromS, {PH1: cookieDomain});
const icon = UI.Icon.Icon.create('mediumicon-cookie', 'resource-tree-item');
this.setLeadingIcons([icon]);
}
get itemURL(): string {
- return 'cookies://' + this._cookieDomain;
+ return 'cookies://' + this.cookieDomainInternal;
}
cookieDomain(): string {
- return this._cookieDomain;
+ return this.cookieDomainInternal;
}
onattach(): void {
super.onattach();
- this.listItemElement.addEventListener('contextmenu', this._handleContextMenuEvent.bind(this), true);
+ this.listItemElement.addEventListener('contextmenu', this.handleContextMenuEvent.bind(this), true);
}
- _handleContextMenuEvent(event: Event): void {
+ private handleContextMenuEvent(event: Event): void {
const contextMenu = new UI.ContextMenu.ContextMenu(event);
contextMenu.defaultSection().appendItem(
- i18nString(UIStrings.clear), () => this.resourcesPanel.clearCookies(this._target, this._cookieDomain));
+ i18nString(UIStrings.clear), () => this.resourcesPanel.clearCookies(this.target, this.cookieDomainInternal));
contextMenu.show();
}
onselect(selectedByUser?: boolean): boolean {
super.onselect(selectedByUser);
- this.resourcesPanel.showCookies(this._target, this._cookieDomain);
+ this.resourcesPanel.showCookies(this.target, this.cookieDomainInternal);
return false;
}
}
export class StorageCategoryView extends UI.Widget.VBox {
- _emptyWidget: UI.EmptyWidget.EmptyWidget;
- _linkElement: HTMLElement|null;
+ private emptyWidget: UI.EmptyWidget.EmptyWidget;
+ private linkElement: HTMLElement|null;
constructor() {
super();
this.element.classList.add('storage-view');
- this._emptyWidget = new UI.EmptyWidget.EmptyWidget('');
- this._linkElement = null;
- this._emptyWidget.show(this.element);
+ this.emptyWidget = new UI.EmptyWidget.EmptyWidget('');
+ this.linkElement = null;
+ this.emptyWidget.show(this.element);
}
setText(text: string): void {
- this._emptyWidget.text = text;
+ this.emptyWidget.text = text;
}
setLink(link: string|null): void {
- if (link && !this._linkElement) {
- this._linkElement = this._emptyWidget.appendLink(link);
+ if (link && !this.linkElement) {
+ this.linkElement = this.emptyWidget.appendLink(link);
}
- if (!link && this._linkElement) {
- this._linkElement.classList.add('hidden');
+ if (!link && this.linkElement) {
+ this.linkElement.classList.add('hidden');
}
- if (link && this._linkElement) {
- this._linkElement.setAttribute('href', link);
- this._linkElement.classList.remove('hidden');
+ if (link && this.linkElement) {
+ this.linkElement.setAttribute('href', link);
+ this.linkElement.classList.remove('hidden');
}
}
}
export class ResourcesSection implements SDK.TargetManager.Observer {
- _panel: ResourcesPanel;
- _treeElement: UI.TreeOutline.TreeElement;
- _treeElementForFrameId: Map<string, FrameTreeElement>;
- _treeElementForTargetId: Map<string, FrameTreeElement>;
+ panel: ResourcesPanel;
+ private readonly treeElement: UI.TreeOutline.TreeElement;
+ private treeElementForFrameId: Map<string, FrameTreeElement>;
+ private treeElementForTargetId: Map<string, FrameTreeElement>;
constructor(storagePanel: ResourcesPanel, treeElement: UI.TreeOutline.TreeElement) {
- this._panel = storagePanel;
- this._treeElement = treeElement;
- UI.ARIAUtils.setAccessibleName(this._treeElement._listItemNode, 'Resources Section');
- this._treeElementForFrameId = new Map();
- this._treeElementForTargetId = new Map();
+ this.panel = storagePanel;
+ this.treeElement = treeElement;
+ UI.ARIAUtils.setAccessibleName(this.treeElement._listItemNode, 'Resources Section');
+ this.treeElementForFrameId = new Map();
+ this.treeElementForTargetId = new Map();
const frameManager = SDK.FrameManager.FrameManager.instance();
frameManager.addEventListener(
- SDK.FrameManager.Events.FrameAddedToTarget, event => this._frameAdded(event.data.frame), this);
+ SDK.FrameManager.Events.FrameAddedToTarget, event => this.frameAdded(event.data.frame), this);
frameManager.addEventListener(
- SDK.FrameManager.Events.FrameRemoved, event => this._frameDetached(event.data.frameId), this);
+ SDK.FrameManager.Events.FrameRemoved, event => this.frameDetached(event.data.frameId), this);
frameManager.addEventListener(
- SDK.FrameManager.Events.FrameNavigated, event => this._frameNavigated(event.data.frame), this);
+ SDK.FrameManager.Events.FrameNavigated, event => this.frameNavigated(event.data.frame), this);
frameManager.addEventListener(
- SDK.FrameManager.Events.ResourceAdded, event => this._resourceAdded(event.data.resource), this);
+ SDK.FrameManager.Events.ResourceAdded, event => this.resourceAdded(event.data.resource), this);
SDK.TargetManager.TargetManager.instance().addModelListener(
- SDK.ChildTargetManager.ChildTargetManager, SDK.ChildTargetManager.Events.TargetCreated, this._windowOpened,
+ SDK.ChildTargetManager.ChildTargetManager, SDK.ChildTargetManager.Events.TargetCreated, this.windowOpened,
this);
SDK.TargetManager.TargetManager.instance().addModelListener(
- SDK.ChildTargetManager.ChildTargetManager, SDK.ChildTargetManager.Events.TargetInfoChanged, this._windowChanged,
+ SDK.ChildTargetManager.ChildTargetManager, SDK.ChildTargetManager.Events.TargetInfoChanged, this.windowChanged,
this);
SDK.TargetManager.TargetManager.instance().addModelListener(
- SDK.ChildTargetManager.ChildTargetManager, SDK.ChildTargetManager.Events.TargetDestroyed, this._windowDestroyed,
+ SDK.ChildTargetManager.ChildTargetManager, SDK.ChildTargetManager.Events.TargetDestroyed, this.windowDestroyed,
this);
SDK.TargetManager.TargetManager.instance().observeTargets(this);
for (const frame of frameManager.getAllFrames()) {
- if (!this._treeElementForFrameId.get(frame.id)) {
- this._addFrameAndParents(frame);
+ if (!this.treeElementForFrameId.get(frame.id)) {
+ this.addFrameAndParents(frame);
}
const childTargetManager = frame.resourceTreeModel().target().model(SDK.ChildTargetManager.ChildTargetManager);
if (childTargetManager) {
for (const targetInfo of childTargetManager.targetInfos()) {
- this._windowOpened({data: targetInfo});
+ this.windowOpened({data: targetInfo});
}
}
}
@@ -1651,17 +1649,17 @@
targetAdded(target: SDK.Target.Target): void {
if (target.type() === SDK.Target.Type.Worker || target.type() === SDK.Target.Type.ServiceWorker) {
- this._workerAdded(target);
+ this.workerAdded(target);
}
}
- async _workerAdded(target: SDK.Target.Target): Promise<void> {
+ private async workerAdded(target: SDK.Target.Target): Promise<void> {
const parentTarget = target.parentTarget();
if (!parentTarget) {
return;
}
const parentTargetId = parentTarget.id();
- const frameTreeElement = this._treeElementForTargetId.get(parentTargetId);
+ const frameTreeElement = this.treeElementForTargetId.get(parentTargetId);
const targetId = target.id();
assertNotMainTarget(targetId);
const {targetInfo} = await parentTarget.targetAgent().invoke_getTargetInfo({targetId});
@@ -1673,23 +1671,23 @@
targetRemoved(_target: SDK.Target.Target): void {
}
- _addFrameAndParents(frame: SDK.ResourceTreeModel.ResourceTreeFrame): void {
+ private addFrameAndParents(frame: SDK.ResourceTreeModel.ResourceTreeFrame): void {
const parentFrame = frame.parentFrame();
- if (parentFrame && !this._treeElementForFrameId.get(parentFrame.id)) {
- this._addFrameAndParents(parentFrame);
+ if (parentFrame && !this.treeElementForFrameId.get(parentFrame.id)) {
+ this.addFrameAndParents(parentFrame);
}
- this._frameAdded(frame);
+ this.frameAdded(frame);
}
- _expandFrame(frame: SDK.ResourceTreeModel.ResourceTreeFrame|null): boolean {
+ private expandFrame(frame: SDK.ResourceTreeModel.ResourceTreeFrame|null): boolean {
if (!frame) {
return false;
}
- let treeElement = this._treeElementForFrameId.get(frame.id);
- if (!treeElement && !this._expandFrame(frame.parentFrame())) {
+ let treeElement = this.treeElementForFrameId.get(frame.id);
+ if (!treeElement && !this.expandFrame(frame.parentFrame())) {
return false;
}
- treeElement = this._treeElementForFrameId.get(frame.id);
+ treeElement = this.treeElementForFrameId.get(frame.id);
if (!treeElement) {
return false;
}
@@ -1698,7 +1696,7 @@
}
async revealResource(resource: SDK.Resource.Resource, line?: number, column?: number): Promise<void> {
- if (!this._expandFrame(resource.frame())) {
+ if (!this.expandFrame(resource.frame())) {
return;
}
const resourceTreeElement = FrameResourceTreeElement.forResource(resource);
@@ -1708,63 +1706,63 @@
}
revealAndSelectFrame(frame: SDK.ResourceTreeModel.ResourceTreeFrame): void {
- const frameTreeElement = this._treeElementForFrameId.get(frame.id);
+ const frameTreeElement = this.treeElementForFrameId.get(frame.id);
frameTreeElement?.reveal();
frameTreeElement?.select();
}
- _frameAdded(frame: SDK.ResourceTreeModel.ResourceTreeFrame): void {
+ private frameAdded(frame: SDK.ResourceTreeModel.ResourceTreeFrame): void {
const parentFrame = frame.parentFrame();
- const parentTreeElement = parentFrame ? this._treeElementForFrameId.get(parentFrame.id) : this._treeElement;
+ const parentTreeElement = parentFrame ? this.treeElementForFrameId.get(parentFrame.id) : this.treeElement;
if (!parentTreeElement) {
return;
}
- const existingElement = this._treeElementForFrameId.get(frame.id);
+ const existingElement = this.treeElementForFrameId.get(frame.id);
if (existingElement) {
- this._treeElementForFrameId.delete(frame.id);
+ this.treeElementForFrameId.delete(frame.id);
if (existingElement.parent) {
existingElement.parent.removeChild(existingElement);
}
}
const frameTreeElement = new FrameTreeElement(this, frame);
- this._treeElementForFrameId.set(frame.id, frameTreeElement);
+ this.treeElementForFrameId.set(frame.id, frameTreeElement);
const targetId = frame.resourceTreeModel().target().id();
- if (!this._treeElementForTargetId.get(targetId)) {
- this._treeElementForTargetId.set(targetId, frameTreeElement);
+ if (!this.treeElementForTargetId.get(targetId)) {
+ this.treeElementForTargetId.set(targetId, frameTreeElement);
}
parentTreeElement.appendChild(frameTreeElement);
for (const resource of frame.resources()) {
- this._resourceAdded(resource);
+ this.resourceAdded(resource);
}
}
- _frameDetached(frameId: Protocol.Page.FrameId): void {
- const frameTreeElement = this._treeElementForFrameId.get(frameId);
+ private frameDetached(frameId: Protocol.Page.FrameId): void {
+ const frameTreeElement = this.treeElementForFrameId.get(frameId);
if (!frameTreeElement) {
return;
}
- this._treeElementForFrameId.delete(frameId);
+ this.treeElementForFrameId.delete(frameId);
if (frameTreeElement.parent) {
frameTreeElement.parent.removeChild(frameTreeElement);
}
}
- _frameNavigated(frame: SDK.ResourceTreeModel.ResourceTreeFrame): void {
- const frameTreeElement = this._treeElementForFrameId.get(frame.id);
+ private frameNavigated(frame: SDK.ResourceTreeModel.ResourceTreeFrame): void {
+ const frameTreeElement = this.treeElementForFrameId.get(frame.id);
if (frameTreeElement) {
frameTreeElement.frameNavigated(frame);
}
}
- _resourceAdded(resource: SDK.Resource.Resource): void {
+ private resourceAdded(resource: SDK.Resource.Resource): void {
if (!resource.frameId) {
return;
}
- const frameTreeElement = this._treeElementForFrameId.get(resource.frameId);
+ const frameTreeElement = this.treeElementForFrameId.get(resource.frameId);
if (!frameTreeElement) {
// This is a frame's main resource, it will be retained
// and re-added by the resource manager;
@@ -1773,32 +1771,32 @@
frameTreeElement.appendResource(resource);
}
- _windowOpened(event: Common.EventTarget.EventTargetEvent<Protocol.Target.TargetInfo>): void {
+ private windowOpened(event: Common.EventTarget.EventTargetEvent<Protocol.Target.TargetInfo>): void {
const targetInfo = event.data;
// Events for DevTools windows are ignored because they do not have an openerId
if (targetInfo.openerId && targetInfo.type === 'page') {
- const frameTreeElement = this._treeElementForFrameId.get(targetInfo.openerId);
+ const frameTreeElement = this.treeElementForFrameId.get(targetInfo.openerId);
if (frameTreeElement) {
- this._treeElementForTargetId.set(targetInfo.targetId, frameTreeElement);
+ this.treeElementForTargetId.set(targetInfo.targetId, frameTreeElement);
frameTreeElement.windowOpened(targetInfo);
}
}
}
- _windowDestroyed(event: Common.EventTarget.EventTargetEvent<Protocol.Target.TargetID>): void {
+ private windowDestroyed(event: Common.EventTarget.EventTargetEvent<Protocol.Target.TargetID>): void {
const targetId = event.data;
- const frameTreeElement = this._treeElementForTargetId.get(targetId);
+ const frameTreeElement = this.treeElementForTargetId.get(targetId);
if (frameTreeElement) {
frameTreeElement.windowDestroyed(targetId);
- this._treeElementForTargetId.delete(targetId);
+ this.treeElementForTargetId.delete(targetId);
}
}
- _windowChanged(event: Common.EventTarget.EventTargetEvent<Protocol.Target.TargetInfo>): void {
+ private windowChanged(event: Common.EventTarget.EventTargetEvent<Protocol.Target.TargetInfo>): void {
const targetInfo = event.data;
// Events for DevTools windows are ignored because they do not have an openerId
if (targetInfo.openerId && targetInfo.type === 'page') {
- const frameTreeElement = this._treeElementForFrameId.get(targetInfo.openerId);
+ const frameTreeElement = this.treeElementForFrameId.get(targetInfo.openerId);
if (frameTreeElement) {
frameTreeElement.windowChanged(targetInfo);
}
@@ -1806,33 +1804,33 @@
}
reset(): void {
- this._treeElement.removeChildren();
- this._treeElementForFrameId.clear();
- this._treeElementForTargetId.clear();
+ this.treeElement.removeChildren();
+ this.treeElementForFrameId.clear();
+ this.treeElementForTargetId.clear();
}
}
export class FrameTreeElement extends ApplicationPanelTreeElement {
- _section: ResourcesSection;
- _frame: SDK.ResourceTreeModel.ResourceTreeFrame;
- _frameId: string;
- _categoryElements: Map<string, ExpandableApplicationPanelTreeElement>;
- _treeElementForResource: Map<string, FrameResourceTreeElement>;
- _treeElementForWindow: Map<string, FrameWindowTreeElement>;
- _treeElementForWorker: Map<string, WorkerTreeElement>;
- _view: ApplicationComponents.FrameDetailsView.FrameDetailsView|null;
+ private section: ResourcesSection;
+ private frame: SDK.ResourceTreeModel.ResourceTreeFrame;
+ private frameId: string;
+ private readonly categoryElements: Map<string, ExpandableApplicationPanelTreeElement>;
+ private readonly treeElementForResource: Map<string, FrameResourceTreeElement>;
+ private treeElementForWindow: Map<string, FrameWindowTreeElement>;
+ private treeElementForWorker: Map<string, WorkerTreeElement>;
+ private view: ApplicationComponents.FrameDetailsView.FrameDetailsView|null;
constructor(section: ResourcesSection, frame: SDK.ResourceTreeModel.ResourceTreeFrame) {
- super(section._panel, '', false);
- this._section = section;
- this._frame = frame;
- this._frameId = frame.id;
- this._categoryElements = new Map();
- this._treeElementForResource = new Map();
- this._treeElementForWindow = new Map();
- this._treeElementForWorker = new Map();
+ super(section.panel, '', false);
+ this.section = section;
+ this.frame = frame;
+ this.frameId = frame.id;
+ this.categoryElements = new Map();
+ this.treeElementForResource = new Map();
+ this.treeElementForWindow = new Map();
+ this.treeElementForWorker = new Map();
this.frameNavigated(frame);
- this._view = null;
+ this.view = null;
}
getIconTypeForFrame(frame: SDK.ResourceTreeModel.ResourceTreeFrame): 'mediumicon-frame-blocked'|'mediumicon-frame'|
@@ -1851,7 +1849,7 @@
this.setLeadingIcons([icon]);
this.invalidateChildren();
- this._frameId = frame.id;
+ this.frameId = frame.id;
if (this.title !== frame.displayName()) {
this.title = frame.displayName();
UI.ARIAUtils.setAccessibleName(this.listItemElement, this.title);
@@ -1862,15 +1860,15 @@
parent.appendChild(this);
}
}
- this._categoryElements.clear();
- this._treeElementForResource.clear();
- this._treeElementForWorker.clear();
+ this.categoryElements.clear();
+ this.treeElementForResource.clear();
+ this.treeElementForWorker.clear();
if (this.selected) {
- this._view = new ApplicationComponents.FrameDetailsView.FrameDetailsView(this._frame);
- this.showView(this._view);
+ this.view = new ApplicationComponents.FrameDetailsView.FrameDetailsView(this.frame);
+ this.showView(this.view);
} else {
- this._view = null;
+ this.view = null;
}
// Service Workers' parent is always the top frame. We need to reconstruct
@@ -1894,20 +1892,20 @@
// This is used to persist over reloads/navigation which frame was selected.
// A frame's title can change on DevTools refresh, so we resort to using
// the URL instead (even though it is not guaranteed to be unique).
- if (this._frame.isTopFrame()) {
+ if (this.frame.isTopFrame()) {
return 'frame://';
}
- return 'frame://' + encodeURI(this._frame.url);
+ return 'frame://' + encodeURI(this.frame.url);
}
onselect(selectedByUser?: boolean): boolean {
super.onselect(selectedByUser);
- if (!this._view) {
- this._view = new ApplicationComponents.FrameDetailsView.FrameDetailsView(this._frame);
+ if (!this.view) {
+ this.view = new ApplicationComponents.FrameDetailsView.FrameDetailsView(this.frame);
} else {
- this._view.update();
+ this.view.update();
}
- this.showView(this._view);
+ this.showView(this.view);
this.listItemElement.classList.remove('hovered');
SDK.OverlayModel.OverlayModel.hideDOMNodeHighlight();
@@ -1917,7 +1915,7 @@
set hovered(hovered: boolean) {
if (hovered) {
this.listItemElement.classList.add('hovered');
- this._frame.highlight();
+ this.frame.highlight();
} else {
this.listItemElement.classList.remove('hovered');
SDK.OverlayModel.OverlayModel.hideDOMNodeHighlight();
@@ -1933,35 +1931,35 @@
const resourceType = resource.resourceType();
const categoryName = resourceType.name();
let categoryElement =
- resourceType === Common.ResourceType.resourceTypes.Document ? this : this._categoryElements.get(categoryName);
+ resourceType === Common.ResourceType.resourceTypes.Document ? this : this.categoryElements.get(categoryName);
if (!categoryElement) {
categoryElement = new ExpandableApplicationPanelTreeElement(
- this._section._panel, resource.resourceType().category().title(), categoryName, categoryName === 'Frames');
- this._categoryElements.set(resourceType.name(), categoryElement);
- this.appendChild(categoryElement, FrameTreeElement._presentationOrderCompare);
+ this.section.panel, resource.resourceType().category().title(), categoryName, categoryName === 'Frames');
+ this.categoryElements.set(resourceType.name(), categoryElement);
+ this.appendChild(categoryElement, FrameTreeElement.presentationOrderCompare);
}
- const resourceTreeElement = new FrameResourceTreeElement(this._section._panel, resource);
- categoryElement.appendChild(resourceTreeElement, FrameTreeElement._presentationOrderCompare);
- this._treeElementForResource.set(resource.url, resourceTreeElement);
+ const resourceTreeElement = new FrameResourceTreeElement(this.section.panel, resource);
+ categoryElement.appendChild(resourceTreeElement, FrameTreeElement.presentationOrderCompare);
+ this.treeElementForResource.set(resource.url, resourceTreeElement);
- if (this._view) {
- this._view.update();
+ if (this.view) {
+ this.view.update();
}
}
windowOpened(targetInfo: Protocol.Target.TargetInfo): void {
const categoryKey = 'OpenedWindows';
- let categoryElement = this._categoryElements.get(categoryKey);
+ let categoryElement = this.categoryElements.get(categoryKey);
if (!categoryElement) {
categoryElement = new ExpandableApplicationPanelTreeElement(
- this._section._panel, i18nString(UIStrings.openedWindows), categoryKey);
- this._categoryElements.set(categoryKey, categoryElement);
- this.appendChild(categoryElement, FrameTreeElement._presentationOrderCompare);
+ this.section.panel, i18nString(UIStrings.openedWindows), categoryKey);
+ this.categoryElements.set(categoryKey, categoryElement);
+ this.appendChild(categoryElement, FrameTreeElement.presentationOrderCompare);
}
- if (!this._treeElementForWindow.get(targetInfo.targetId)) {
- const windowTreeElement = new FrameWindowTreeElement(this._section._panel, targetInfo);
+ if (!this.treeElementForWindow.get(targetInfo.targetId)) {
+ const windowTreeElement = new FrameWindowTreeElement(this.section.panel, targetInfo);
categoryElement.appendChild(windowTreeElement);
- this._treeElementForWindow.set(targetInfo.targetId, windowTreeElement);
+ this.treeElementForWindow.set(targetInfo.targetId, windowTreeElement);
}
}
@@ -1969,21 +1967,21 @@
const categoryKey = targetInfo.type === 'service_worker' ? 'Service Workers' : 'Web Workers';
const categoryName = targetInfo.type === 'service_worker' ? i18n.i18n.lockedString('Service Workers') :
i18nString(UIStrings.webWorkers);
- let categoryElement = this._categoryElements.get(categoryKey);
+ let categoryElement = this.categoryElements.get(categoryKey);
if (!categoryElement) {
- categoryElement = new ExpandableApplicationPanelTreeElement(this._section._panel, categoryName, categoryKey);
- this._categoryElements.set(categoryKey, categoryElement);
- this.appendChild(categoryElement, FrameTreeElement._presentationOrderCompare);
+ categoryElement = new ExpandableApplicationPanelTreeElement(this.section.panel, categoryName, categoryKey);
+ this.categoryElements.set(categoryKey, categoryElement);
+ this.appendChild(categoryElement, FrameTreeElement.presentationOrderCompare);
}
- if (!this._treeElementForWorker.get(targetInfo.targetId)) {
- const workerTreeElement = new WorkerTreeElement(this._section._panel, targetInfo);
+ if (!this.treeElementForWorker.get(targetInfo.targetId)) {
+ const workerTreeElement = new WorkerTreeElement(this.section.panel, targetInfo);
categoryElement.appendChild(workerTreeElement);
- this._treeElementForWorker.set(targetInfo.targetId, workerTreeElement);
+ this.treeElementForWorker.set(targetInfo.targetId, workerTreeElement);
}
}
windowChanged(targetInfo: Protocol.Target.TargetInfo): void {
- const windowTreeElement = this._treeElementForWindow.get(targetInfo.targetId);
+ const windowTreeElement = this.treeElementForWindow.get(targetInfo.targetId);
if (!windowTreeElement) {
return;
}
@@ -1994,7 +1992,7 @@
}
windowDestroyed(targetId: string): void {
- const windowTreeElement = this._treeElementForWindow.get(targetId);
+ const windowTreeElement = this.treeElementForWindow.get(targetId);
if (windowTreeElement) {
windowTreeElement.windowClosed();
}
@@ -2003,7 +2001,7 @@
appendChild(
treeElement: UI.TreeOutline.TreeElement,
comparator: ((arg0: UI.TreeOutline.TreeElement, arg1: UI.TreeOutline.TreeElement) => number)|
- undefined = FrameTreeElement._presentationOrderCompare): void {
+ undefined = FrameTreeElement.presentationOrderCompare): void {
super.appendChild(treeElement, comparator);
}
@@ -2011,8 +2009,8 @@
* Order elements by type (first frames, then resources, last Document resources)
* and then each of these groups in the alphabetical order.
*/
- static _presentationOrderCompare(treeElement1: UI.TreeOutline.TreeElement, treeElement2: UI.TreeOutline.TreeElement):
- number {
+ private static presentationOrderCompare(
+ treeElement1: UI.TreeOutline.TreeElement, treeElement2: UI.TreeOutline.TreeElement): number {
function typeWeight(treeElement: UI.TreeOutline.TreeElement): number {
if (treeElement instanceof ExpandableApplicationPanelTreeElement) {
return 2;
@@ -2032,18 +2030,18 @@
const resourceToFrameResourceTreeElement = new WeakMap<SDK.Resource.Resource, FrameResourceTreeElement>();
export class FrameResourceTreeElement extends ApplicationPanelTreeElement {
- _panel: ResourcesPanel;
- _resource: SDK.Resource.Resource;
- _previewPromise: Promise<UI.Widget.Widget>|null;
+ private readonly panel: ResourcesPanel;
+ private resource: SDK.Resource.Resource;
+ private previewPromise: Promise<UI.Widget.Widget>|null;
constructor(storagePanel: ResourcesPanel, resource: SDK.Resource.Resource) {
super(
storagePanel, resource.isGenerated ? i18nString(UIStrings.documentNotAvailable) : resource.displayName, false);
- this._panel = storagePanel;
- this._resource = resource;
- this._previewPromise = null;
+ this.panel = storagePanel;
+ this.resource = resource;
+ this.previewPromise = null;
this.tooltip = resource.url;
- resourceToFrameResourceTreeElement.set(this._resource, this);
+ resourceToFrameResourceTreeElement.set(this.resource, this);
const icon = UI.Icon.Icon.create('mediumicon-manifest', 'navigator-file-tree-item');
icon.classList.add('navigator-' + resource.resourceType().name() + '-tree-item');
@@ -2055,64 +2053,63 @@
}
get itemURL(): string {
- return this._resource.url;
+ return this.resource.url;
}
- _preparePreview(): Promise<UI.Widget.Widget> {
- if (this._previewPromise) {
- return this._previewPromise;
+ private preparePreview(): Promise<UI.Widget.Widget> {
+ if (this.previewPromise) {
+ return this.previewPromise;
}
- const viewPromise =
- SourceFrame.PreviewFactory.PreviewFactory.createPreview(this._resource, this._resource.mimeType);
- this._previewPromise = viewPromise.then(view => {
+ const viewPromise = SourceFrame.PreviewFactory.PreviewFactory.createPreview(this.resource, this.resource.mimeType);
+ this.previewPromise = viewPromise.then(view => {
if (view) {
return view;
}
- return new UI.EmptyWidget.EmptyWidget(this._resource.url);
+ return new UI.EmptyWidget.EmptyWidget(this.resource.url);
});
- return this._previewPromise;
+ return this.previewPromise;
}
onselect(selectedByUser?: boolean): boolean {
super.onselect(selectedByUser);
- if (this._resource.isGenerated) {
- this._panel.showCategoryView(i18nString(UIStrings.theContentOfThisDocumentHasBeen), null);
+ if (this.resource.isGenerated) {
+ this.panel.showCategoryView(i18nString(UIStrings.theContentOfThisDocumentHasBeen), null);
} else {
- this._panel.scheduleShowView(this._preparePreview());
+ this.panel.scheduleShowView(this.preparePreview());
}
return false;
}
ondblclick(_event: Event): boolean {
- Host.InspectorFrontendHost.InspectorFrontendHostInstance.openInNewTab(this._resource.url);
+ Host.InspectorFrontendHost.InspectorFrontendHostInstance.openInNewTab(this.resource.url);
return false;
}
onattach(): void {
super.onattach();
this.listItemElement.draggable = true;
- this.listItemElement.addEventListener('dragstart', this._ondragstart.bind(this), false);
- this.listItemElement.addEventListener('contextmenu', this._handleContextMenuEvent.bind(this), true);
+ this.listItemElement.addEventListener('dragstart', this.ondragstart.bind(this), false);
+ this.listItemElement.addEventListener('contextmenu', this.handleContextMenuEvent.bind(this), true);
}
- _ondragstart(event: DragEvent): boolean {
+ private ondragstart(event: DragEvent): boolean {
if (!event.dataTransfer) {
return false;
}
- event.dataTransfer.setData('text/plain', this._resource.content || '');
+ event.dataTransfer.setData('text/plain', this.resource.content || '');
event.dataTransfer.effectAllowed = 'copy';
return true;
}
- _handleContextMenuEvent(event: MouseEvent): void {
+ private handleContextMenuEvent(event: MouseEvent): void {
const contextMenu = new UI.ContextMenu.ContextMenu(event);
- contextMenu.appendApplicableItems(this._resource);
+ contextMenu.appendApplicableItems(this.resource);
contextMenu.show();
}
async revealResource(line?: number, column?: number): Promise<void> {
this.revealAndSelect(true);
- const view = await this._panel.scheduleShowView(this._preparePreview());
+ const view = await this.panel.scheduleShowView(this.preparePreview());
if (!(view instanceof SourceFrame.ResourceSourceFrame.ResourceSourceFrame) || typeof line !== 'number') {
return;
}
@@ -2121,15 +2118,15 @@
}
class FrameWindowTreeElement extends ApplicationPanelTreeElement {
- _targetInfo: Protocol.Target.TargetInfo;
- _isWindowClosed: boolean;
- _view: OpenedWindowDetailsView|null;
+ private targetInfo: Protocol.Target.TargetInfo;
+ private isWindowClosed: boolean;
+ private view: OpenedWindowDetailsView|null;
constructor(storagePanel: ResourcesPanel, targetInfo: Protocol.Target.TargetInfo) {
super(storagePanel, targetInfo.title || i18nString(UIStrings.windowWithoutTitle), false);
- this._targetInfo = targetInfo;
- this._isWindowClosed = false;
- this._view = null;
+ this.targetInfo = targetInfo;
+ this.isWindowClosed = false;
+ this.view = null;
this.updateIcon(targetInfo.canAccessOpener);
}
@@ -2140,65 +2137,65 @@
}
update(targetInfo: Protocol.Target.TargetInfo): void {
- if (targetInfo.canAccessOpener !== this._targetInfo.canAccessOpener) {
+ if (targetInfo.canAccessOpener !== this.targetInfo.canAccessOpener) {
this.updateIcon(targetInfo.canAccessOpener);
}
- this._targetInfo = targetInfo;
- if (this._view) {
- this._view.setTargetInfo(targetInfo);
- this._view.update();
+ this.targetInfo = targetInfo;
+ if (this.view) {
+ this.view.setTargetInfo(targetInfo);
+ this.view.update();
}
}
windowClosed(): void {
this.listItemElement.classList.add('window-closed');
- this._isWindowClosed = true;
- if (this._view) {
- this._view.setIsWindowClosed(true);
- this._view.update();
+ this.isWindowClosed = true;
+ if (this.view) {
+ this.view.setIsWindowClosed(true);
+ this.view.update();
}
}
onselect(selectedByUser?: boolean): boolean {
super.onselect(selectedByUser);
- if (!this._view) {
- this._view = new OpenedWindowDetailsView(this._targetInfo, this._isWindowClosed);
+ if (!this.view) {
+ this.view = new OpenedWindowDetailsView(this.targetInfo, this.isWindowClosed);
} else {
- this._view.update();
+ this.view.update();
}
- this.showView(this._view);
+ this.showView(this.view);
return false;
}
get itemURL(): string {
- return this._targetInfo.url;
+ return this.targetInfo.url;
}
}
class WorkerTreeElement extends ApplicationPanelTreeElement {
- _targetInfo: Protocol.Target.TargetInfo;
- _view: WorkerDetailsView|null;
+ private targetInfo: Protocol.Target.TargetInfo;
+ private view: WorkerDetailsView|null;
constructor(storagePanel: ResourcesPanel, targetInfo: Protocol.Target.TargetInfo) {
super(storagePanel, targetInfo.title || targetInfo.url || i18nString(UIStrings.worker), false);
- this._targetInfo = targetInfo;
- this._view = null;
+ this.targetInfo = targetInfo;
+ this.view = null;
const icon = UI.Icon.Icon.create('mediumicon-service-worker', 'navigator-file-tree-item');
this.setLeadingIcons([icon]);
}
onselect(selectedByUser?: boolean): boolean {
super.onselect(selectedByUser);
- if (!this._view) {
- this._view = new WorkerDetailsView(this._targetInfo);
+ if (!this.view) {
+ this.view = new WorkerDetailsView(this.targetInfo);
} else {
- this._view.update();
+ this.view.update();
}
- this.showView(this._view);
+ this.showView(this.view);
return false;
}
get itemURL(): string {
- return this._targetInfo.url;
+ return this.targetInfo.url;
}
}
diff --git a/front_end/panels/application/BackgroundServiceModel.ts b/front_end/panels/application/BackgroundServiceModel.ts
index 778d2df..e162916 100644
--- a/front_end/panels/application/BackgroundServiceModel.ts
+++ b/front_end/panels/application/BackgroundServiceModel.ts
@@ -10,33 +10,34 @@
export class BackgroundServiceModel extends SDK.SDKModel.SDKModel implements
ProtocolProxyApi.BackgroundServiceDispatcher {
- _backgroundServiceAgent: ProtocolProxyApi.BackgroundServiceApi;
- _events: Map<Protocol.BackgroundService.ServiceName, Protocol.BackgroundService.BackgroundServiceEvent[]>;
+ private readonly backgroundServiceAgent: ProtocolProxyApi.BackgroundServiceApi;
+ private readonly events:
+ Map<Protocol.BackgroundService.ServiceName, Protocol.BackgroundService.BackgroundServiceEvent[]>;
constructor(target: SDK.Target.Target) {
super(target);
- this._backgroundServiceAgent = target.backgroundServiceAgent();
+ this.backgroundServiceAgent = target.backgroundServiceAgent();
target.registerBackgroundServiceDispatcher(this);
- this._events = new Map();
+ this.events = new Map();
}
enable(service: Protocol.BackgroundService.ServiceName): void {
- this._events.set(service, []);
- this._backgroundServiceAgent.invoke_startObserving({service});
+ this.events.set(service, []);
+ this.backgroundServiceAgent.invoke_startObserving({service});
}
setRecording(shouldRecord: boolean, service: Protocol.BackgroundService.ServiceName): void {
- this._backgroundServiceAgent.invoke_setRecording({shouldRecord, service});
+ this.backgroundServiceAgent.invoke_setRecording({shouldRecord, service});
}
clearEvents(service: Protocol.BackgroundService.ServiceName): void {
- this._events.set(service, []);
- this._backgroundServiceAgent.invoke_clearEvents({service});
+ this.events.set(service, []);
+ this.backgroundServiceAgent.invoke_clearEvents({service});
}
getEvents(service: Protocol.BackgroundService.ServiceName): Protocol.BackgroundService.BackgroundServiceEvent[] {
- return this._events.get(service) || [];
+ return this.events.get(service) || [];
}
recordingStateChanged({isRecording, service}: Protocol.BackgroundService.RecordingStateChangedEvent): void {
@@ -47,7 +48,7 @@
Protocol.BackgroundService.BackgroundServiceEventReceivedEvent): void {
// TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration)
// @ts-expect-error
- this._events.get(backgroundServiceEvent.service).push(backgroundServiceEvent);
+ this.events.get(backgroundServiceEvent.service).push(backgroundServiceEvent);
this.dispatchEventToListeners(Events.BackgroundServiceEventReceived, backgroundServiceEvent);
}
}
diff --git a/front_end/panels/application/BackgroundServiceView.ts b/front_end/panels/application/BackgroundServiceView.ts
index 88b12c8..ddd7745 100644
--- a/front_end/panels/application/BackgroundServiceView.ts
+++ b/front_end/panels/application/BackgroundServiceView.ts
@@ -121,20 +121,20 @@
const str_ = i18n.i18n.registerUIStrings('panels/application/BackgroundServiceView.ts', UIStrings);
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
export class BackgroundServiceView extends UI.Widget.VBox {
- _serviceName: Protocol.BackgroundService.ServiceName;
- _model: BackgroundServiceModel;
- _serviceWorkerManager: SDK.ServiceWorkerManager.ServiceWorkerManager|null;
- _securityOriginManager: SDK.SecurityOriginManager.SecurityOriginManager;
- _recordAction: UI.ActionRegistration.Action;
- _recordButton!: UI.Toolbar.ToolbarToggle;
- _originCheckbox!: UI.Toolbar.ToolbarCheckbox;
- _saveButton!: UI.Toolbar.ToolbarButton;
- _toolbar: UI.Toolbar.Toolbar;
- _splitWidget: UI.SplitWidget.SplitWidget;
- _dataGrid: DataGrid.DataGrid.DataGridImpl<EventData>;
- _previewPanel: UI.Widget.VBox;
- _selectedEventNode: EventDataNode|null;
- _preview: UI.Widget.Widget|null;
+ private readonly serviceName: Protocol.BackgroundService.ServiceName;
+ private readonly model: BackgroundServiceModel;
+ private readonly serviceWorkerManager: SDK.ServiceWorkerManager.ServiceWorkerManager|null;
+ private readonly securityOriginManager: SDK.SecurityOriginManager.SecurityOriginManager;
+ private recordAction: UI.ActionRegistration.Action;
+ private recordButton!: UI.Toolbar.ToolbarToggle;
+ private originCheckbox!: UI.Toolbar.ToolbarCheckbox;
+ private saveButton!: UI.Toolbar.ToolbarButton;
+ private readonly toolbar: UI.Toolbar.Toolbar;
+ private readonly splitWidget: UI.SplitWidget.SplitWidget;
+ private readonly dataGrid: DataGrid.DataGrid.DataGridImpl<EventData>;
+ private readonly previewPanel: UI.Widget.VBox;
+ private selectedEventNode: EventDataNode|null;
+ private preview: UI.Widget.Widget|null;
static getUIString(serviceName: string): string {
switch (serviceName) {
@@ -160,163 +160,163 @@
this.registerRequiredCSS('panels/application/backgroundServiceView.css');
this.registerRequiredCSS('ui/legacy/emptyWidget.css');
- this._serviceName = serviceName;
+ this.serviceName = serviceName;
- this._model = model;
- this._model.addEventListener(Events.RecordingStateChanged, this._onRecordingStateChanged, this);
- this._model.addEventListener(Events.BackgroundServiceEventReceived, this._onEventReceived, this);
- this._model.enable(this._serviceName);
+ this.model = model;
+ this.model.addEventListener(Events.RecordingStateChanged, this.onRecordingStateChanged, this);
+ this.model.addEventListener(Events.BackgroundServiceEventReceived, this.onEventReceived, this);
+ this.model.enable(this.serviceName);
- this._serviceWorkerManager = this._model.target().model(SDK.ServiceWorkerManager.ServiceWorkerManager);
+ this.serviceWorkerManager = this.model.target().model(SDK.ServiceWorkerManager.ServiceWorkerManager);
- this._securityOriginManager = this._model.target().model(SDK.SecurityOriginManager.SecurityOriginManager) as
+ this.securityOriginManager = this.model.target().model(SDK.SecurityOriginManager.SecurityOriginManager) as
SDK.SecurityOriginManager.SecurityOriginManager;
- if (!this._securityOriginManager) {
+ if (!this.securityOriginManager) {
throw new Error('SecurityOriginManager instance is missing');
}
- this._securityOriginManager.addEventListener(
- SDK.SecurityOriginManager.Events.MainSecurityOriginChanged, () => this._onOriginChanged());
- this._recordAction =
+ this.securityOriginManager.addEventListener(
+ SDK.SecurityOriginManager.Events.MainSecurityOriginChanged, () => this.onOriginChanged());
+ this.recordAction =
(UI.ActionRegistry.ActionRegistry.instance().action('background-service.toggle-recording') as
UI.ActionRegistration.Action);
- this._toolbar = new UI.Toolbar.Toolbar('background-service-toolbar', this.contentElement);
- this._setupToolbar();
+ this.toolbar = new UI.Toolbar.Toolbar('background-service-toolbar', this.contentElement);
+ this.setupToolbar();
/**
* This will contain the DataGrid for displaying events, and a panel at the bottom for showing
* extra metadata related to the selected event.
*/
- this._splitWidget = new UI.SplitWidget.SplitWidget(/* isVertical= */ false, /* secondIsSidebar= */ true);
- this._splitWidget.show(this.contentElement);
+ this.splitWidget = new UI.SplitWidget.SplitWidget(/* isVertical= */ false, /* secondIsSidebar= */ true);
+ this.splitWidget.show(this.contentElement);
- this._dataGrid = this._createDataGrid();
+ this.dataGrid = this.createDataGrid();
- this._previewPanel = new UI.Widget.VBox();
+ this.previewPanel = new UI.Widget.VBox();
- this._selectedEventNode = null;
+ this.selectedEventNode = null;
- this._preview = null;
+ this.preview = null;
- this._splitWidget.setMainWidget(this._dataGrid.asWidget());
- this._splitWidget.setSidebarWidget(this._previewPanel);
+ this.splitWidget.setMainWidget(this.dataGrid.asWidget());
+ this.splitWidget.setSidebarWidget(this.previewPanel);
- this._showPreview(null);
+ this.showPreview(null);
}
/**
* Creates the toolbar UI element.
*/
- async _setupToolbar(): Promise<void> {
- this._recordButton = (UI.Toolbar.Toolbar.createActionButton(this._recordAction) as UI.Toolbar.ToolbarToggle);
- this._toolbar.appendToolbarItem(this._recordButton);
+ private async setupToolbar(): Promise<void> {
+ this.recordButton = (UI.Toolbar.Toolbar.createActionButton(this.recordAction) as UI.Toolbar.ToolbarToggle);
+ this.toolbar.appendToolbarItem(this.recordButton);
const clearButton = new UI.Toolbar.ToolbarButton(i18nString(UIStrings.clear), 'largeicon-clear');
- clearButton.addEventListener(UI.Toolbar.ToolbarButton.Events.Click, () => this._clearEvents());
- this._toolbar.appendToolbarItem(clearButton);
+ clearButton.addEventListener(UI.Toolbar.ToolbarButton.Events.Click, () => this.clearEvents());
+ this.toolbar.appendToolbarItem(clearButton);
- this._toolbar.appendSeparator();
+ this.toolbar.appendSeparator();
- this._saveButton = new UI.Toolbar.ToolbarButton(i18nString(UIStrings.saveEvents), 'largeicon-download');
- this._saveButton.addEventListener(UI.Toolbar.ToolbarButton.Events.Click, _event => {
- this._saveToFile();
+ this.saveButton = new UI.Toolbar.ToolbarButton(i18nString(UIStrings.saveEvents), 'largeicon-download');
+ this.saveButton.addEventListener(UI.Toolbar.ToolbarButton.Events.Click, _event => {
+ this.saveToFile();
});
- this._saveButton.setEnabled(false);
- this._toolbar.appendToolbarItem(this._saveButton);
+ this.saveButton.setEnabled(false);
+ this.toolbar.appendToolbarItem(this.saveButton);
- this._toolbar.appendSeparator();
+ this.toolbar.appendSeparator();
- this._originCheckbox = new UI.Toolbar.ToolbarCheckbox(
+ this.originCheckbox = new UI.Toolbar.ToolbarCheckbox(
i18nString(UIStrings.showEventsFromOtherDomains), i18nString(UIStrings.showEventsFromOtherDomains),
- () => this._refreshView());
- this._toolbar.appendToolbarItem(this._originCheckbox);
+ () => this.refreshView());
+ this.toolbar.appendToolbarItem(this.originCheckbox);
}
/**
* Displays all available events in the grid.
*/
- _refreshView(): void {
- this._clearView();
- const events = this._model.getEvents(this._serviceName).filter(event => this._acceptEvent(event));
+ private refreshView(): void {
+ this.clearView();
+ const events = this.model.getEvents(this.serviceName).filter(event => this.acceptEvent(event));
for (const event of events) {
- this._addEvent(event);
+ this.addEvent(event);
}
}
/**
* Clears the grid and panel.
*/
- _clearView(): void {
- this._selectedEventNode = null;
- this._dataGrid.rootNode().removeChildren();
- this._saveButton.setEnabled(false);
- this._showPreview(null);
+ private clearView(): void {
+ this.selectedEventNode = null;
+ this.dataGrid.rootNode().removeChildren();
+ this.saveButton.setEnabled(false);
+ this.showPreview(null);
}
/**
* Called when the `Toggle Record` button is clicked.
*/
- _toggleRecording(): void {
- this._model.setRecording(!this._recordButton.toggled(), this._serviceName);
+ toggleRecording(): void {
+ this.model.setRecording(!this.recordButton.toggled(), this.serviceName);
}
/**
* Called when the `Clear` button is clicked.
*/
- _clearEvents(): void {
- this._model.clearEvents(this._serviceName);
- this._clearView();
+ private clearEvents(): void {
+ this.model.clearEvents(this.serviceName);
+ this.clearView();
}
- _onRecordingStateChanged(event: Common.EventTarget.EventTargetEvent): void {
+ private onRecordingStateChanged(event: Common.EventTarget.EventTargetEvent): void {
const state = (event.data as RecordingState);
- if (state.serviceName !== this._serviceName) {
+ if (state.serviceName !== this.serviceName) {
return;
}
- if (state.isRecording === this._recordButton.toggled()) {
+ if (state.isRecording === this.recordButton.toggled()) {
return;
}
- this._recordButton.setToggled(state.isRecording);
- this._updateRecordButtonTooltip();
- this._showPreview(this._selectedEventNode);
+ this.recordButton.setToggled(state.isRecording);
+ this.updateRecordButtonTooltip();
+ this.showPreview(this.selectedEventNode);
}
- _updateRecordButtonTooltip(): void {
- const buttonTooltip = this._recordButton.toggled() ? i18nString(UIStrings.stopRecordingEvents) :
- i18nString(UIStrings.startRecordingEvents);
- this._recordButton.setTitle(buttonTooltip, 'background-service.toggle-recording');
+ private updateRecordButtonTooltip(): void {
+ const buttonTooltip = this.recordButton.toggled() ? i18nString(UIStrings.stopRecordingEvents) :
+ i18nString(UIStrings.startRecordingEvents);
+ this.recordButton.setTitle(buttonTooltip, 'background-service.toggle-recording');
}
- _onEventReceived(event: Common.EventTarget.EventTargetEvent): void {
+ private onEventReceived(event: Common.EventTarget.EventTargetEvent): void {
const serviceEvent = (event.data as Protocol.BackgroundService.BackgroundServiceEvent);
- if (!this._acceptEvent(serviceEvent)) {
+ if (!this.acceptEvent(serviceEvent)) {
return;
}
- this._addEvent(serviceEvent);
+ this.addEvent(serviceEvent);
}
- _onOriginChanged(): void {
+ private onOriginChanged(): void {
// No need to refresh the view if we are already showing all events.
- if (this._originCheckbox.checked()) {
+ if (this.originCheckbox.checked()) {
return;
}
- this._refreshView();
+ this.refreshView();
}
- _addEvent(serviceEvent: Protocol.BackgroundService.BackgroundServiceEvent): void {
- const data = this._createEventData(serviceEvent);
+ private addEvent(serviceEvent: Protocol.BackgroundService.BackgroundServiceEvent): void {
+ const data = this.createEventData(serviceEvent);
const dataNode = new EventDataNode(data, serviceEvent.eventMetadata);
- this._dataGrid.rootNode().appendChild(dataNode);
+ this.dataGrid.rootNode().appendChild(dataNode);
- if (this._dataGrid.rootNode().children.length === 1) {
- this._saveButton.setEnabled(true);
- this._showPreview(this._selectedEventNode);
+ if (this.dataGrid.rootNode().children.length === 1) {
+ this.saveButton.setEnabled(true);
+ this.showPreview(this.selectedEventNode);
}
}
- _createDataGrid(): DataGrid.DataGrid.DataGridImpl<EventData> {
+ private createDataGrid(): DataGrid.DataGrid.DataGridImpl<EventData> {
const columns = ([
{id: 'id', title: '#', weight: 1},
{id: 'timestamp', title: i18nString(UIStrings.timestamp), weight: 8},
@@ -335,7 +335,7 @@
dataGrid.setStriped(true);
dataGrid.addEventListener(
- DataGrid.DataGrid.Events.SelectedNode, event => this._showPreview((event.data as EventDataNode)));
+ DataGrid.DataGrid.Events.SelectedNode, event => this.showPreview((event.data as EventDataNode)));
return dataGrid;
}
@@ -343,19 +343,19 @@
/**
* Creates the data object to pass to the DataGrid Node.
*/
- _createEventData(serviceEvent: Protocol.BackgroundService.BackgroundServiceEvent): EventData {
+ private createEventData(serviceEvent: Protocol.BackgroundService.BackgroundServiceEvent): EventData {
let swScope = '';
// Try to get the scope of the Service Worker registration to be more user-friendly.
- const registration = this._serviceWorkerManager ?
- this._serviceWorkerManager.registrations().get(serviceEvent.serviceWorkerRegistrationId) :
+ const registration = this.serviceWorkerManager ?
+ this.serviceWorkerManager.registrations().get(serviceEvent.serviceWorkerRegistrationId) :
undefined;
if (registration) {
swScope = registration.scopeURL.substr(registration.securityOrigin.length);
}
return {
- id: this._dataGrid.rootNode().children.length + 1,
+ id: this.dataGrid.rootNode().children.length + 1,
timestamp: UI.UIUtils.formatTimestamp(serviceEvent.timestamp * 1000, /* full= */ true),
origin: serviceEvent.origin,
swScope,
@@ -367,25 +367,25 @@
/**
* Filtration function to know whether event should be shown or not.
*/
- _acceptEvent(event: Protocol.BackgroundService.BackgroundServiceEvent): boolean {
- if (event.service !== this._serviceName) {
+ private acceptEvent(event: Protocol.BackgroundService.BackgroundServiceEvent): boolean {
+ if (event.service !== this.serviceName) {
return false;
}
- if (this._originCheckbox.checked()) {
+ if (this.originCheckbox.checked()) {
return true;
}
// Trim the trailing '/'.
const origin = event.origin.substr(0, event.origin.length - 1);
- return this._securityOriginManager.securityOrigins().includes(origin);
+ return this.securityOriginManager.securityOrigins().includes(origin);
}
- _createLearnMoreLink(): Element {
+ private createLearnMoreLink(): Element {
let url = 'https://developer.chrome.com/docs/devtools/javascript/background-services/?utm_source=devtools';
- switch (this._serviceName) {
+ switch (this.serviceName) {
case Protocol.BackgroundService.ServiceName.BackgroundFetch:
url += '#fetch';
break;
@@ -405,37 +405,37 @@
return UI.XLink.XLink.create(url, i18nString(UIStrings.learnMore));
}
- _showPreview(dataNode: EventDataNode|null): void {
- if (this._selectedEventNode && this._selectedEventNode === dataNode) {
+ private showPreview(dataNode: EventDataNode|null): void {
+ if (this.selectedEventNode && this.selectedEventNode === dataNode) {
return;
}
- this._selectedEventNode = dataNode;
+ this.selectedEventNode = dataNode;
- if (this._preview) {
- this._preview.detach();
+ if (this.preview) {
+ this.preview.detach();
}
- if (this._selectedEventNode) {
- this._preview = this._selectedEventNode.createPreview();
- this._preview.show(this._previewPanel.contentElement);
+ if (this.selectedEventNode) {
+ this.preview = this.selectedEventNode.createPreview();
+ this.preview.show(this.previewPanel.contentElement);
return;
}
- this._preview = new UI.Widget.VBox();
- this._preview.contentElement.classList.add('background-service-preview', 'fill');
- const centered = this._preview.contentElement.createChild('div');
+ this.preview = new UI.Widget.VBox();
+ this.preview.contentElement.classList.add('background-service-preview', 'fill');
+ const centered = this.preview.contentElement.createChild('div');
- if (this._dataGrid.rootNode().children.length) {
+ if (this.dataGrid.rootNode().children.length) {
// Inform users that grid entries are clickable.
centered.createChild('p').textContent = i18nString(UIStrings.selectAnEntryToViewMetadata);
- } else if (this._recordButton.toggled()) {
+ } else if (this.recordButton.toggled()) {
// Inform users that we are recording/waiting for events.
- const featureName = BackgroundServiceView.getUIString(this._serviceName);
+ const featureName = BackgroundServiceView.getUIString(this.serviceName);
centered.createChild('p').textContent = i18nString(UIStrings.recordingSActivity, {PH1: featureName});
centered.createChild('p').textContent = i18nString(UIStrings.devtoolsWillRecordAllSActivity, {PH1: featureName});
} else {
- const landingRecordButton = UI.Toolbar.Toolbar.createActionButton(this._recordAction);
+ const landingRecordButton = UI.Toolbar.Toolbar.createActionButton(this.recordAction);
const recordKey = document.createElement('b');
recordKey.classList.add('background-service-shortcut');
@@ -448,17 +448,17 @@
centered.createChild('p').appendChild(i18n.i18n.getFormatLocalizedString(
str_, UIStrings.clickTheRecordButtonSOrHitSTo, {PH1: inlineButton, PH2: recordKey}));
- centered.appendChild(this._createLearnMoreLink());
+ centered.appendChild(this.createLearnMoreLink());
}
- this._preview.show(this._previewPanel.contentElement);
+ this.preview.show(this.previewPanel.contentElement);
}
/**
* Saves all currently displayed events in a file (JSON format).
*/
- async _saveToFile(): Promise<void> {
- const fileName = `${this._serviceName}-${Platform.DateUtilities.toISO8601Compact(new Date())}.json`;
+ private async saveToFile(): Promise<void> {
+ const fileName = `${this.serviceName}-${Platform.DateUtilities.toISO8601Compact(new Date())}.json`;
const stream = new Bindings.FileUtils.FileOutputStream();
const accepted = await stream.open(fileName);
@@ -466,26 +466,26 @@
return;
}
- const events = this._model.getEvents(this._serviceName).filter(event => this._acceptEvent(event));
+ const events = this.model.getEvents(this.serviceName).filter(event => this.acceptEvent(event));
await stream.write(JSON.stringify(events, undefined, 2));
stream.close();
}
}
export class EventDataNode extends DataGrid.DataGrid.DataGridNode<EventData> {
- _eventMetadata: Protocol.BackgroundService.EventMetadata[];
+ private readonly eventMetadata: Protocol.BackgroundService.EventMetadata[];
constructor(data: EventData, eventMetadata: Protocol.BackgroundService.EventMetadata[]) {
super(data);
- this._eventMetadata = eventMetadata.sort((m1, m2) => Platform.StringUtilities.compare(m1.key, m2.key));
+ this.eventMetadata = eventMetadata.sort((m1, m2) => Platform.StringUtilities.compare(m1.key, m2.key));
}
createPreview(): UI.Widget.VBox {
const preview = new UI.Widget.VBox();
preview.element.classList.add('background-service-metadata');
- for (const entry of this._eventMetadata) {
+ for (const entry of this.eventMetadata) {
const div = document.createElement('div');
div.classList.add('background-service-metadata-entry');
div.createChild('div', 'background-service-metadata-name').textContent = entry.key + ': ';
@@ -531,7 +531,7 @@
if (!view) {
throw new Error('BackgroundServiceView instance is missing');
}
- view._toggleRecording();
+ view.toggleRecording();
return true;
}
}
diff --git a/front_end/panels/application/CookieItemsView.ts b/front_end/panels/application/CookieItemsView.ts
index 425f91a..1be6238 100644
--- a/front_end/panels/application/CookieItemsView.ts
+++ b/front_end/panels/application/CookieItemsView.ts
@@ -80,16 +80,16 @@
const str_ = i18n.i18n.registerUIStrings('panels/application/CookieItemsView.ts', UIStrings);
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
class CookiePreviewWidget extends UI.Widget.VBox {
- _cookie: SDK.Cookie.Cookie|null;
- _showDecodedSetting: Common.Settings.Setting<boolean>;
- _toggle: UI.UIUtils.CheckboxLabel;
- _value: HTMLDivElement;
+ private cookie: SDK.Cookie.Cookie|null;
+ private showDecodedSetting: Common.Settings.Setting<boolean>;
+ private toggle: UI.UIUtils.CheckboxLabel;
+ private value: HTMLDivElement;
constructor() {
super();
this.setMinimumSize(230, 45);
- this._cookie = null;
- this._showDecodedSetting = Common.Settings.Settings.instance().createSetting('cookieViewShowDecoded', false);
+ this.cookie = null;
+ this.showDecodedSetting = Common.Settings.Settings.instance().createSetting('cookieViewShowDecoded', false);
const header = document.createElement('div');
header.classList.add('cookie-preview-widget-header');
@@ -99,44 +99,43 @@
header.appendChild(span);
this.contentElement.appendChild(header);
- const toggle =
- UI.UIUtils.CheckboxLabel.create(i18nString(UIStrings.showUrlDecoded), this._showDecodedSetting.get());
+ const toggle = UI.UIUtils.CheckboxLabel.create(i18nString(UIStrings.showUrlDecoded), this.showDecodedSetting.get());
toggle.classList.add('cookie-preview-widget-toggle');
- toggle.checkboxElement.addEventListener('click', () => this.showDecoded(!this._showDecodedSetting.get()));
+ toggle.checkboxElement.addEventListener('click', () => this.showDecoded(!this.showDecodedSetting.get()));
header.appendChild(toggle);
- this._toggle = toggle;
+ this.toggle = toggle;
const value = document.createElement('div');
value.classList.add('cookie-preview-widget-cookie-value');
value.textContent = '';
value.addEventListener('dblclick', this.handleDblClickOnCookieValue.bind(this));
- this._value = value;
+ this.value = value;
this.contentElement.classList.add('cookie-preview-widget');
this.contentElement.appendChild(value);
}
showDecoded(decoded: boolean): void {
- if (!this._cookie) {
+ if (!this.cookie) {
return;
}
- this._showDecodedSetting.set(decoded);
- this._toggle.checkboxElement.checked = decoded;
- this._updatePreview();
+ this.showDecodedSetting.set(decoded);
+ this.toggle.checkboxElement.checked = decoded;
+ this.updatePreview();
}
- _updatePreview(): void {
- if (this._cookie) {
- this._value.textContent =
- this._showDecodedSetting.get() ? decodeURIComponent(this._cookie.value()) : this._cookie.value();
+ private updatePreview(): void {
+ if (this.cookie) {
+ this.value.textContent =
+ this.showDecodedSetting.get() ? decodeURIComponent(this.cookie.value()) : this.cookie.value();
} else {
- this._value.textContent = '';
+ this.value.textContent = '';
}
}
setCookie(cookie: SDK.Cookie.Cookie): void {
- this._cookie = cookie;
- this._updatePreview();
+ this.cookie = cookie;
+ this.updatePreview();
}
/**
@@ -145,7 +144,7 @@
handleDblClickOnCookieValue(event: Event): void {
event.preventDefault();
const range = document.createRange();
- range.selectNode(this._value);
+ range.selectNode(this.value);
const selection = window.getSelection();
if (!selection) {
return;
@@ -156,124 +155,124 @@
}
export class CookieItemsView extends StorageItemsView {
- _model: SDK.CookieModel.CookieModel;
- _cookieDomain: string;
- _totalSize: number;
- _cookiesTable: CookieTable.CookiesTable.CookiesTable;
- _splitWidget: UI.SplitWidget.SplitWidget;
- _previewPanel: UI.Widget.VBox;
- _previewWidget: CookiePreviewWidget;
- _emptyWidget: UI.EmptyWidget.EmptyWidget;
- _onlyIssuesFilterUI: UI.Toolbar.ToolbarCheckbox;
- _refreshThrottler: Common.Throttler.Throttler;
- _eventDescriptors: Common.EventTarget.EventDescriptor[];
- _allCookies: SDK.Cookie.Cookie[];
- _shownCookies: SDK.Cookie.Cookie[];
- _selectedCookie: SDK.Cookie.Cookie|null;
+ private model: SDK.CookieModel.CookieModel;
+ private cookieDomain: string;
+ private totalSize: number;
+ private cookiesTable: CookieTable.CookiesTable.CookiesTable;
+ private readonly splitWidget: UI.SplitWidget.SplitWidget;
+ private readonly previewPanel: UI.Widget.VBox;
+ private readonly previewWidget: CookiePreviewWidget;
+ private readonly emptyWidget: UI.EmptyWidget.EmptyWidget;
+ private onlyIssuesFilterUI: UI.Toolbar.ToolbarCheckbox;
+ private readonly refreshThrottler: Common.Throttler.Throttler;
+ private eventDescriptors: Common.EventTarget.EventDescriptor[];
+ private allCookies: SDK.Cookie.Cookie[];
+ private shownCookies: SDK.Cookie.Cookie[];
+ private selectedCookie: SDK.Cookie.Cookie|null;
constructor(model: SDK.CookieModel.CookieModel, cookieDomain: string) {
super(i18nString(UIStrings.cookies), 'cookiesPanel');
this.registerRequiredCSS('panels/application/cookieItemsView.css');
this.element.classList.add('storage-view');
- this._model = model;
- this._cookieDomain = cookieDomain;
+ this.model = model;
+ this.cookieDomain = cookieDomain;
- this._totalSize = 0;
- this._cookiesTable = new CookieTable.CookiesTable.CookiesTable(
- /* renderInline */ false, this._saveCookie.bind(this), this.refreshItems.bind(this),
- this._handleCookieSelected.bind(this), this._deleteCookie.bind(this));
+ this.totalSize = 0;
+ this.cookiesTable = new CookieTable.CookiesTable.CookiesTable(
+ /* renderInline */ false, this.saveCookie.bind(this), this.refreshItems.bind(this),
+ this.handleCookieSelected.bind(this), this.deleteCookie.bind(this));
- this._cookiesTable.setMinimumSize(0, 50);
+ this.cookiesTable.setMinimumSize(0, 50);
- this._splitWidget = new UI.SplitWidget.SplitWidget(
+ this.splitWidget = new UI.SplitWidget.SplitWidget(
/* isVertical: */ false, /* secondIsSidebar: */ true, 'cookieItemsSplitViewState');
- this._splitWidget.show(this.element);
+ this.splitWidget.show(this.element);
- this._previewPanel = new UI.Widget.VBox();
- const resizer = this._previewPanel.element.createChild('div', 'preview-panel-resizer');
+ this.previewPanel = new UI.Widget.VBox();
+ const resizer = this.previewPanel.element.createChild('div', 'preview-panel-resizer');
- this._splitWidget.setMainWidget(this._cookiesTable);
- this._splitWidget.setSidebarWidget(this._previewPanel);
- this._splitWidget.installResizer(resizer);
+ this.splitWidget.setMainWidget(this.cookiesTable);
+ this.splitWidget.setSidebarWidget(this.previewPanel);
+ this.splitWidget.installResizer(resizer);
- this._previewWidget = new CookiePreviewWidget();
- this._emptyWidget = new UI.EmptyWidget.EmptyWidget(i18nString(UIStrings.selectACookieToPreviewItsValue));
- this._emptyWidget.show(this._previewPanel.contentElement);
+ this.previewWidget = new CookiePreviewWidget();
+ this.emptyWidget = new UI.EmptyWidget.EmptyWidget(i18nString(UIStrings.selectACookieToPreviewItsValue));
+ this.emptyWidget.show(this.previewPanel.contentElement);
- this._onlyIssuesFilterUI = new UI.Toolbar.ToolbarCheckbox(
+ this.onlyIssuesFilterUI = new UI.Toolbar.ToolbarCheckbox(
i18nString(UIStrings.onlyShowCookiesWithAnIssue), i18nString(UIStrings.onlyShowCookiesWhichHaveAn), () => {
- this._updateWithCookies(this._allCookies);
+ this.updateWithCookies(this.allCookies);
});
- this.appendToolbarItem(this._onlyIssuesFilterUI);
+ this.appendToolbarItem(this.onlyIssuesFilterUI);
- this._refreshThrottler = new Common.Throttler.Throttler(300);
- this._eventDescriptors = [];
+ this.refreshThrottler = new Common.Throttler.Throttler(300);
+ this.eventDescriptors = [];
- this._allCookies = [];
- this._shownCookies = [];
- this._selectedCookie = null;
+ this.allCookies = [];
+ this.shownCookies = [];
+ this.selectedCookie = null;
this.setCookiesDomain(model, cookieDomain);
}
setCookiesDomain(model: SDK.CookieModel.CookieModel, domain: string): void {
- this._model = model;
- this._cookieDomain = domain;
+ this.model = model;
+ this.cookieDomain = domain;
this.refreshItems();
- Common.EventTarget.removeEventListeners(this._eventDescriptors);
+ Common.EventTarget.removeEventListeners(this.eventDescriptors);
const networkManager = model.target().model(SDK.NetworkManager.NetworkManager);
if (networkManager) {
- this._eventDescriptors = [
- networkManager.addEventListener(SDK.NetworkManager.Events.ResponseReceived, this._onResponseReceived, this),
- networkManager.addEventListener(SDK.NetworkManager.Events.LoadingFinished, this._onLoadingFinished, this),
+ this.eventDescriptors = [
+ networkManager.addEventListener(SDK.NetworkManager.Events.ResponseReceived, this.onResponseReceived, this),
+ networkManager.addEventListener(SDK.NetworkManager.Events.LoadingFinished, this.onLoadingFinished, this),
];
}
}
- _showPreview(cookie: SDK.Cookie.Cookie|null): void {
- if (cookie === this._selectedCookie) {
+ private showPreview(cookie: SDK.Cookie.Cookie|null): void {
+ if (cookie === this.selectedCookie) {
return;
}
- this._selectedCookie = cookie;
+ this.selectedCookie = cookie;
if (!cookie) {
- this._previewWidget.detach();
- this._emptyWidget.show(this._previewPanel.contentElement);
+ this.previewWidget.detach();
+ this.emptyWidget.show(this.previewPanel.contentElement);
} else {
- this._emptyWidget.detach();
- this._previewWidget.setCookie(cookie);
- this._previewWidget.show(this._previewPanel.contentElement);
+ this.emptyWidget.detach();
+ this.previewWidget.setCookie(cookie);
+ this.previewWidget.show(this.previewPanel.contentElement);
}
}
- _handleCookieSelected(): void {
- const cookie = this._cookiesTable.selectedCookie();
+ private handleCookieSelected(): void {
+ const cookie = this.cookiesTable.selectedCookie();
this.setCanDeleteSelected(Boolean(cookie));
- this._showPreview(cookie);
+ this.showPreview(cookie);
}
- async _saveCookie(newCookie: SDK.Cookie.Cookie, oldCookie: SDK.Cookie.Cookie|null): Promise<boolean> {
+ private async saveCookie(newCookie: SDK.Cookie.Cookie, oldCookie: SDK.Cookie.Cookie|null): Promise<boolean> {
if (oldCookie && newCookie.key() !== oldCookie.key()) {
- await this._model.deleteCookie(oldCookie);
+ await this.model.deleteCookie(oldCookie);
}
- return this._model.saveCookie(newCookie);
+ return this.model.saveCookie(newCookie);
}
- _deleteCookie(cookie: SDK.Cookie.Cookie, callback: () => void): void {
- this._model.deleteCookie(cookie).then(callback);
+ private deleteCookie(cookie: SDK.Cookie.Cookie, callback: () => void): void {
+ this.model.deleteCookie(cookie).then(callback);
}
- _updateWithCookies(allCookies: SDK.Cookie.Cookie[]): void {
- this._allCookies = allCookies;
- this._totalSize = allCookies.reduce((size, cookie) => size + cookie.size(), 0);
+ private updateWithCookies(allCookies: SDK.Cookie.Cookie[]): void {
+ this.allCookies = allCookies;
+ this.totalSize = allCookies.reduce((size, cookie) => size + cookie.size(), 0);
- const parsedURL = Common.ParsedURL.ParsedURL.fromString(this._cookieDomain);
+ const parsedURL = Common.ParsedURL.ParsedURL.fromString(this.cookieDomain);
const host = parsedURL ? parsedURL.host : '';
- this._cookiesTable.setCookieDomain(host);
+ this.cookiesTable.setCookieDomain(host);
- this._shownCookies = this.filter(allCookies, cookie => `${cookie.name()} ${cookie.value()} ${cookie.domain()}`);
+ this.shownCookies = this.filter(allCookies, cookie => `${cookie.name()} ${cookie.value()} ${cookie.domain()}`);
if (this.hasFilter()) {
this.setDeleteAllTitle(i18nString(UIStrings.clearFilteredCookies));
this.setDeleteAllGlyph('largeicon-delete-filter');
@@ -281,20 +280,20 @@
this.setDeleteAllTitle(i18nString(UIStrings.clearAllCookies));
this.setDeleteAllGlyph('largeicon-delete-list');
}
- this._cookiesTable.setCookies(this._shownCookies, this._model.getCookieToBlockedReasonsMap());
- UI.ARIAUtils.alert(i18nString(UIStrings.numberOfCookiesShownInTableS, {PH1: this._shownCookies.length}));
+ this.cookiesTable.setCookies(this.shownCookies, this.model.getCookieToBlockedReasonsMap());
+ UI.ARIAUtils.alert(i18nString(UIStrings.numberOfCookiesShownInTableS, {PH1: this.shownCookies.length}));
this.setCanFilter(true);
- this.setCanDeleteAll(this._shownCookies.length > 0);
- this.setCanDeleteSelected(Boolean(this._cookiesTable.selectedCookie()));
+ this.setCanDeleteAll(this.shownCookies.length > 0);
+ this.setCanDeleteSelected(Boolean(this.cookiesTable.selectedCookie()));
- if (!this._cookiesTable.selectedCookie()) {
- this._showPreview(null);
+ if (!this.cookiesTable.selectedCookie()) {
+ this.showPreview(null);
}
}
filter<T>(items: T[], keyFunction: (arg0: T) => string): T[] {
const predicate = (object: T|null): boolean => {
- if (!this._onlyIssuesFilterUI.checked()) {
+ if (!this.onlyIssuesFilterUI.checked()) {
return true;
}
if (object instanceof SDK.Cookie.Cookie) {
@@ -309,31 +308,31 @@
* This will only delete the currently visible cookies.
*/
deleteAllItems(): void {
- this._showPreview(null);
- this._model.deleteCookies(this._shownCookies).then(() => this.refreshItems());
+ this.showPreview(null);
+ this.model.deleteCookies(this.shownCookies).then(() => this.refreshItems());
}
deleteSelectedItem(): void {
- const selectedCookie = this._cookiesTable.selectedCookie();
+ const selectedCookie = this.cookiesTable.selectedCookie();
if (selectedCookie) {
- this._showPreview(null);
- this._model.deleteCookie(selectedCookie).then(() => this.refreshItems());
+ this.showPreview(null);
+ this.model.deleteCookie(selectedCookie).then(() => this.refreshItems());
}
}
refreshItems(): void {
- this._model.getCookiesForDomain(this._cookieDomain).then(this._updateWithCookies.bind(this));
+ this.model.getCookiesForDomain(this.cookieDomain).then(this.updateWithCookies.bind(this));
}
refreshItemsThrottled(): void {
- this._refreshThrottler.schedule(() => Promise.resolve(this.refreshItems()));
+ this.refreshThrottler.schedule(() => Promise.resolve(this.refreshItems()));
}
- _onResponseReceived(): void {
+ private onResponseReceived(): void {
this.refreshItemsThrottled();
}
- _onLoadingFinished(): void {
+ private onLoadingFinished(): void {
this.refreshItemsThrottled();
}
}
diff --git a/front_end/panels/application/DOMStorageItemsView.ts b/front_end/panels/application/DOMStorageItemsView.ts
index 32cdf97..d7a776d 100644
--- a/front_end/panels/application/DOMStorageItemsView.ts
+++ b/front_end/panels/application/DOMStorageItemsView.ts
@@ -74,18 +74,18 @@
const str_ = i18n.i18n.registerUIStrings('panels/application/DOMStorageItemsView.ts', UIStrings);
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
export class DOMStorageItemsView extends StorageItemsView {
- _domStorage: DOMStorage;
- _dataGrid: DataGrid.DataGrid.DataGridImpl<unknown>;
- _splitWidget: UI.SplitWidget.SplitWidget;
- _previewPanel: UI.Widget.VBox;
- _preview: UI.Widget.Widget|null;
- _previewValue: string|null;
- _eventListeners: Common.EventTarget.EventDescriptor[];
+ private domStorage: DOMStorage;
+ private dataGrid: DataGrid.DataGrid.DataGridImpl<unknown>;
+ private readonly splitWidget: UI.SplitWidget.SplitWidget;
+ private readonly previewPanel: UI.Widget.VBox;
+ private preview: UI.Widget.Widget|null;
+ private previewValue: string|null;
+ private eventListeners: Common.EventTarget.EventDescriptor[];
constructor(domStorage: DOMStorage) {
super(i18nString(UIStrings.domStorage), 'domStoragePanel');
- this._domStorage = domStorage;
+ this.domStorage = domStorage;
this.element.classList.add('storage-view', 'table');
@@ -93,73 +93,73 @@
{id: 'key', title: i18nString(UIStrings.key), sortable: false, editable: true, longText: true, weight: 50},
{id: 'value', title: i18nString(UIStrings.value), sortable: false, editable: true, longText: true, weight: 50},
] as DataGrid.DataGrid.ColumnDescriptor[]);
- this._dataGrid = new DataGrid.DataGrid.DataGridImpl({
+ this.dataGrid = new DataGrid.DataGrid.DataGridImpl({
displayName: i18nString(UIStrings.domStorageItems),
columns,
- editCallback: this._editingCallback.bind(this),
- deleteCallback: this._deleteCallback.bind(this),
+ editCallback: this.editingCallback.bind(this),
+ deleteCallback: this.deleteCallback.bind(this),
refreshCallback: this.refreshItems.bind(this),
});
- this._dataGrid.addEventListener(DataGrid.DataGrid.Events.SelectedNode, event => {
- this._previewEntry((event.data as DataGrid.DataGrid.DataGridNode<unknown>));
+ this.dataGrid.addEventListener(DataGrid.DataGrid.Events.SelectedNode, event => {
+ this.previewEntry((event.data as DataGrid.DataGrid.DataGridNode<unknown>));
});
- this._dataGrid.addEventListener(DataGrid.DataGrid.Events.DeselectedNode, _event => {
- this._previewEntry(null);
+ this.dataGrid.addEventListener(DataGrid.DataGrid.Events.DeselectedNode, _event => {
+ this.previewEntry(null);
});
- this._dataGrid.setStriped(true);
- this._dataGrid.setName('DOMStorageItemsView');
+ this.dataGrid.setStriped(true);
+ this.dataGrid.setName('DOMStorageItemsView');
- this._splitWidget = new UI.SplitWidget.SplitWidget(
+ this.splitWidget = new UI.SplitWidget.SplitWidget(
/* isVertical: */ false, /* secondIsSidebar: */ true, 'domStorageSplitViewState');
- this._splitWidget.show(this.element);
+ this.splitWidget.show(this.element);
- this._previewPanel = new UI.Widget.VBox();
- this._previewPanel.setMinimumSize(0, 50);
- const resizer = this._previewPanel.element.createChild('div', 'preview-panel-resizer');
- const dataGridWidget = this._dataGrid.asWidget();
+ this.previewPanel = new UI.Widget.VBox();
+ this.previewPanel.setMinimumSize(0, 50);
+ const resizer = this.previewPanel.element.createChild('div', 'preview-panel-resizer');
+ const dataGridWidget = this.dataGrid.asWidget();
dataGridWidget.setMinimumSize(0, 50);
- this._splitWidget.setMainWidget(dataGridWidget);
- this._splitWidget.setSidebarWidget(this._previewPanel);
- this._splitWidget.installResizer(resizer);
+ this.splitWidget.setMainWidget(dataGridWidget);
+ this.splitWidget.setSidebarWidget(this.previewPanel);
+ this.splitWidget.installResizer(resizer);
- this._preview = null;
- this._previewValue = null;
+ this.preview = null;
+ this.previewValue = null;
- this._showPreview(null, null);
+ this.showPreview(null, null);
- this._eventListeners = [];
+ this.eventListeners = [];
this.setStorage(domStorage);
}
setStorage(domStorage: DOMStorage): void {
- Common.EventTarget.removeEventListeners(this._eventListeners);
- this._domStorage = domStorage;
- this._eventListeners = [
- this._domStorage.addEventListener(DOMStorage.Events.DOMStorageItemsCleared, this._domStorageItemsCleared, this),
- this._domStorage.addEventListener(DOMStorage.Events.DOMStorageItemRemoved, this._domStorageItemRemoved, this),
- this._domStorage.addEventListener(DOMStorage.Events.DOMStorageItemAdded, this._domStorageItemAdded, this),
- this._domStorage.addEventListener(DOMStorage.Events.DOMStorageItemUpdated, this._domStorageItemUpdated, this),
+ Common.EventTarget.removeEventListeners(this.eventListeners);
+ this.domStorage = domStorage;
+ this.eventListeners = [
+ this.domStorage.addEventListener(DOMStorage.Events.DOMStorageItemsCleared, this.domStorageItemsCleared, this),
+ this.domStorage.addEventListener(DOMStorage.Events.DOMStorageItemRemoved, this.domStorageItemRemoved, this),
+ this.domStorage.addEventListener(DOMStorage.Events.DOMStorageItemAdded, this.domStorageItemAdded, this),
+ this.domStorage.addEventListener(DOMStorage.Events.DOMStorageItemUpdated, this.domStorageItemUpdated, this),
];
this.refreshItems();
}
- _domStorageItemsCleared(): void {
- if (!this.isShowing() || !this._dataGrid) {
+ private domStorageItemsCleared(): void {
+ if (!this.isShowing() || !this.dataGrid) {
return;
}
- this._dataGrid.rootNode().removeChildren();
- this._dataGrid.addCreationNode(false);
+ this.dataGrid.rootNode().removeChildren();
+ this.dataGrid.addCreationNode(false);
this.setCanDeleteSelected(false);
}
- _domStorageItemRemoved(event: Common.EventTarget.EventTargetEvent): void {
- if (!this.isShowing() || !this._dataGrid) {
+ private domStorageItemRemoved(event: Common.EventTarget.EventTargetEvent): void {
+ if (!this.isShowing() || !this.dataGrid) {
return;
}
const storageData = event.data;
- const rootNode = this._dataGrid.rootNode();
+ const rootNode = this.dataGrid.rootNode();
const children = rootNode.children;
for (let i = 0; i < children.length; ++i) {
@@ -172,13 +172,13 @@
}
}
- _domStorageItemAdded(event: Common.EventTarget.EventTargetEvent): void {
- if (!this.isShowing() || !this._dataGrid) {
+ private domStorageItemAdded(event: Common.EventTarget.EventTargetEvent): void {
+ if (!this.isShowing() || !this.dataGrid) {
return;
}
const storageData = event.data;
- const rootNode = this._dataGrid.rootNode();
+ const rootNode = this.dataGrid.rootNode();
const children = rootNode.children;
for (let i = 0; i < children.length; ++i) {
@@ -191,13 +191,13 @@
rootNode.insertChild(childNode, children.length - 1);
}
- _domStorageItemUpdated(event: Common.EventTarget.EventTargetEvent): void {
- if (!this.isShowing() || !this._dataGrid) {
+ private domStorageItemUpdated(event: Common.EventTarget.EventTargetEvent): void {
+ if (!this.isShowing() || !this.dataGrid) {
return;
}
const storageData = event.data;
- const childNode = this._dataGrid.rootNode().children.find(
+ const childNode = this.dataGrid.rootNode().children.find(
(child: DataGrid.DataGrid.DataGridNode<unknown>) => child.data.key === storageData.key);
if (!childNode || childNode.data.value === storageData.value) {
return;
@@ -208,12 +208,12 @@
if (!childNode.selected) {
return;
}
- this._previewEntry(childNode);
+ this.previewEntry(childNode);
this.setCanDeleteSelected(true);
}
- _showDOMStorageItems(items: string[][]): void {
- const rootNode = this._dataGrid.rootNode();
+ private showDOMStorageItems(items: string[][]): void {
+ const rootNode = this.dataGrid.rootNode();
let selectedKey: null = null;
for (const node of rootNode.children) {
if (!node.selected) {
@@ -239,46 +239,46 @@
if (selectedNode) {
selectedNode.selected = true;
}
- this._dataGrid.addCreationNode(false);
+ this.dataGrid.addCreationNode(false);
this.setCanDeleteSelected(Boolean(selectedNode));
UI.ARIAUtils.alert(i18nString(UIStrings.domStorageNumberEntries, {PH1: filteredList.length}));
}
deleteSelectedItem(): void {
- if (!this._dataGrid || !this._dataGrid.selectedNode) {
+ if (!this.dataGrid || !this.dataGrid.selectedNode) {
return;
}
- this._deleteCallback(this._dataGrid.selectedNode);
+ this.deleteCallback(this.dataGrid.selectedNode);
}
refreshItems(): void {
- this._domStorage.getItems().then(items => items && this._showDOMStorageItems(items));
+ this.domStorage.getItems().then(items => items && this.showDOMStorageItems(items));
}
deleteAllItems(): void {
- this._domStorage.clear();
+ this.domStorage.clear();
// explicitly clear the view because the event won't be fired when it has no items
- this._domStorageItemsCleared();
+ this.domStorageItemsCleared();
}
- _editingCallback(
+ private editingCallback(
editingNode: DataGrid.DataGrid.DataGridNode<unknown>, columnIdentifier: string, oldText: string,
newText: string): void {
- const domStorage = this._domStorage;
+ const domStorage = this.domStorage;
if (columnIdentifier === 'key') {
if (typeof oldText === 'string') {
domStorage.removeItem(oldText);
}
domStorage.setItem(newText, editingNode.data.value || '');
- this._removeDupes(editingNode);
+ this.removeDupes(editingNode);
} else {
domStorage.setItem(editingNode.data.key || '', newText);
}
}
- _removeDupes(masterNode: DataGrid.DataGrid.DataGridNode<unknown>): void {
- const rootNode = this._dataGrid.rootNode();
+ private removeDupes(masterNode: DataGrid.DataGrid.DataGridNode<unknown>): void {
+ const rootNode = this.dataGrid.rootNode();
const children = rootNode.children;
for (let i = children.length - 1; i >= 0; --i) {
const childNode = children[i];
@@ -288,47 +288,47 @@
}
}
- _deleteCallback(node: DataGrid.DataGrid.DataGridNode<unknown>): void {
+ private deleteCallback(node: DataGrid.DataGrid.DataGridNode<unknown>): void {
if (!node || node.isCreationNode) {
return;
}
- if (this._domStorage) {
- this._domStorage.removeItem(node.data.key);
+ if (this.domStorage) {
+ this.domStorage.removeItem(node.data.key);
}
UI.ARIAUtils.alert(i18nString(UIStrings.domStorageItemDeleted));
}
- _showPreview(preview: UI.Widget.Widget|null, value: string|null): void {
- if (this._preview && this._previewValue === value) {
+ private showPreview(preview: UI.Widget.Widget|null, value: string|null): void {
+ if (this.preview && this.previewValue === value) {
return;
}
- if (this._preview) {
- this._preview.detach();
+ if (this.preview) {
+ this.preview.detach();
}
if (!preview) {
preview = new UI.EmptyWidget.EmptyWidget(i18nString(UIStrings.selectAValueToPreview));
}
- this._previewValue = value;
- this._preview = preview;
- preview.show(this._previewPanel.contentElement);
+ this.previewValue = value;
+ this.preview = preview;
+ preview.show(this.previewPanel.contentElement);
}
- async _previewEntry(entry: DataGrid.DataGrid.DataGridNode<unknown>|null): Promise<void> {
+ private async previewEntry(entry: DataGrid.DataGrid.DataGridNode<unknown>|null): Promise<void> {
const value = entry && entry.data && entry.data.value;
if (entry && entry.data && entry.data.value) {
- const protocol = this._domStorage.isLocalStorage ? 'localstorage' : 'sessionstorage';
+ const protocol = this.domStorage.isLocalStorage ? 'localstorage' : 'sessionstorage';
const url = `${protocol}://${entry.key}`;
const provider = TextUtils.StaticContentProvider.StaticContentProvider.fromString(
url, Common.ResourceType.resourceTypes.XHR, (value as string));
const preview = await SourceFrame.PreviewFactory.PreviewFactory.createPreview(provider, 'text/plain');
// Selection could've changed while the preview was loaded
if (entry.selected) {
- this._showPreview(preview, value);
+ this.showPreview(preview, value);
}
} else {
- this._showPreview(null, value);
+ this.showPreview(null, value);
}
}
}
diff --git a/front_end/panels/application/DOMStorageModel.ts b/front_end/panels/application/DOMStorageModel.ts
index 998faba..0852895 100644
--- a/front_end/panels/application/DOMStorageModel.ts
+++ b/front_end/panels/application/DOMStorageModel.ts
@@ -39,15 +39,15 @@
import type * as ProtocolProxyApi from '../../generated/protocol-proxy-api.js';
export class DOMStorage extends Common.ObjectWrapper.ObjectWrapper {
- _model: DOMStorageModel;
- _securityOrigin: string;
- _isLocalStorage: boolean;
+ private readonly model: DOMStorageModel;
+ private readonly securityOriginInternal: string;
+ private readonly isLocalStorageInternal: boolean;
constructor(model: DOMStorageModel, securityOrigin: string, isLocalStorage: boolean) {
super();
- this._model = model;
- this._securityOrigin = securityOrigin;
- this._isLocalStorage = isLocalStorage;
+ this.model = model;
+ this.securityOriginInternal = securityOrigin;
+ this.isLocalStorageInternal = isLocalStorage;
}
static storageId(securityOrigin: string, isLocalStorage: boolean): Protocol.DOMStorage.StorageId {
@@ -55,31 +55,31 @@
}
get id(): Protocol.DOMStorage.StorageId {
- return DOMStorage.storageId(this._securityOrigin, this._isLocalStorage);
+ return DOMStorage.storageId(this.securityOriginInternal, this.isLocalStorageInternal);
}
get securityOrigin(): string {
- return this._securityOrigin;
+ return this.securityOriginInternal;
}
get isLocalStorage(): boolean {
- return this._isLocalStorage;
+ return this.isLocalStorageInternal;
}
getItems(): Promise<Protocol.DOMStorage.Item[]|null> {
- return this._model._agent.invoke_getDOMStorageItems({storageId: this.id}).then(({entries}) => entries);
+ return this.model.agent.invoke_getDOMStorageItems({storageId: this.id}).then(({entries}) => entries);
}
setItem(key: string, value: string): void {
- this._model._agent.invoke_setDOMStorageItem({storageId: this.id, key, value});
+ this.model.agent.invoke_setDOMStorageItem({storageId: this.id, key, value});
}
removeItem(key: string): void {
- this._model._agent.invoke_removeDOMStorageItem({storageId: this.id, key});
+ this.model.agent.invoke_removeDOMStorageItem({storageId: this.id, key});
}
clear(): void {
- this._model._agent.invoke_clear({storageId: this.id});
+ this.model.agent.invoke_clear({storageId: this.id});
}
}
export namespace DOMStorage {
@@ -95,63 +95,63 @@
}
export class DOMStorageModel extends SDK.SDKModel.SDKModel {
- _securityOriginManager: SDK.SecurityOriginManager.SecurityOriginManager|null;
- _storages: {
+ private readonly securityOriginManager: SDK.SecurityOriginManager.SecurityOriginManager|null;
+ private storagesInternal: {
[x: string]: DOMStorage,
};
- _agent: ProtocolProxyApi.DOMStorageApi;
- _enabled?: boolean;
+ readonly agent: ProtocolProxyApi.DOMStorageApi;
+ private enabled?: boolean;
constructor(target: SDK.Target.Target) {
super(target);
- this._securityOriginManager = target.model(SDK.SecurityOriginManager.SecurityOriginManager);
- this._storages = {};
- this._agent = target.domstorageAgent();
+ this.securityOriginManager = target.model(SDK.SecurityOriginManager.SecurityOriginManager);
+ this.storagesInternal = {};
+ this.agent = target.domstorageAgent();
}
enable(): void {
- if (this._enabled) {
+ if (this.enabled) {
return;
}
this.target().registerDOMStorageDispatcher(new DOMStorageDispatcher(this));
- if (this._securityOriginManager) {
- this._securityOriginManager.addEventListener(
- SDK.SecurityOriginManager.Events.SecurityOriginAdded, this._securityOriginAdded, this);
- this._securityOriginManager.addEventListener(
- SDK.SecurityOriginManager.Events.SecurityOriginRemoved, this._securityOriginRemoved, this);
+ if (this.securityOriginManager) {
+ this.securityOriginManager.addEventListener(
+ SDK.SecurityOriginManager.Events.SecurityOriginAdded, this.securityOriginAdded, this);
+ this.securityOriginManager.addEventListener(
+ SDK.SecurityOriginManager.Events.SecurityOriginRemoved, this.securityOriginRemoved, this);
- for (const securityOrigin of this._securityOriginManager.securityOrigins()) {
- this._addOrigin(securityOrigin);
+ for (const securityOrigin of this.securityOriginManager.securityOrigins()) {
+ this.addOrigin(securityOrigin);
}
}
- this._agent.invoke_enable();
+ this.agent.invoke_enable();
- this._enabled = true;
+ this.enabled = true;
}
clearForOrigin(origin: string): void {
- if (!this._enabled) {
+ if (!this.enabled) {
return;
}
for (const isLocal of [true, false]) {
- const key = this._storageKey(origin, isLocal);
- const storage = this._storages[key];
+ const key = this.storageKey(origin, isLocal);
+ const storage = this.storagesInternal[key];
if (!storage) {
return;
}
storage.clear();
}
- this._removeOrigin(origin);
- this._addOrigin(origin);
+ this.removeOrigin(origin);
+ this.addOrigin(origin);
}
- _securityOriginAdded(event: Common.EventTarget.EventTargetEvent<string>): void {
- this._addOrigin(event.data);
+ private securityOriginAdded(event: Common.EventTarget.EventTargetEvent<string>): void {
+ this.addOrigin(event.data);
}
- _addOrigin(securityOrigin: string): void {
+ private addOrigin(securityOrigin: string): void {
const parsed = new Common.ParsedURL.ParsedURL(securityOrigin);
// These are "opaque" origins which are not supposed to support DOM storage.
if (!parsed.isValid || parsed.scheme === 'data' || parsed.scheme === 'about' || parsed.scheme === 'javascript') {
@@ -159,35 +159,35 @@
}
for (const isLocal of [true, false]) {
- const key = this._storageKey(securityOrigin, isLocal);
- console.assert(!this._storages[key]);
+ const key = this.storageKey(securityOrigin, isLocal);
+ console.assert(!this.storagesInternal[key]);
const storage = new DOMStorage(this, securityOrigin, isLocal);
- this._storages[key] = storage;
+ this.storagesInternal[key] = storage;
this.dispatchEventToListeners(Events.DOMStorageAdded, storage);
}
}
- _securityOriginRemoved(event: Common.EventTarget.EventTargetEvent<string>): void {
- this._removeOrigin(event.data);
+ private securityOriginRemoved(event: Common.EventTarget.EventTargetEvent<string>): void {
+ this.removeOrigin(event.data);
}
- _removeOrigin(securityOrigin: string): void {
+ private removeOrigin(securityOrigin: string): void {
for (const isLocal of [true, false]) {
- const key = this._storageKey(securityOrigin, isLocal);
- const storage = this._storages[key];
+ const key = this.storageKey(securityOrigin, isLocal);
+ const storage = this.storagesInternal[key];
if (!storage) {
continue;
}
- delete this._storages[key];
+ delete this.storagesInternal[key];
this.dispatchEventToListeners(Events.DOMStorageRemoved, storage);
}
}
- _storageKey(securityOrigin: string, isLocalStorage: boolean): string {
+ private storageKey(securityOrigin: string, isLocalStorage: boolean): string {
return JSON.stringify(DOMStorage.storageId(securityOrigin, isLocalStorage));
}
- _domStorageItemsCleared(storageId: Protocol.DOMStorage.StorageId): void {
+ domStorageItemsCleared(storageId: Protocol.DOMStorage.StorageId): void {
const domStorage = this.storageForId(storageId);
if (!domStorage) {
return;
@@ -197,7 +197,7 @@
domStorage.dispatchEventToListeners(DOMStorage.Events.DOMStorageItemsCleared, eventData);
}
- _domStorageItemRemoved(storageId: Protocol.DOMStorage.StorageId, key: string): void {
+ domStorageItemRemoved(storageId: Protocol.DOMStorage.StorageId, key: string): void {
const domStorage = this.storageForId(storageId);
if (!domStorage) {
return;
@@ -207,7 +207,7 @@
domStorage.dispatchEventToListeners(DOMStorage.Events.DOMStorageItemRemoved, eventData);
}
- _domStorageItemAdded(storageId: Protocol.DOMStorage.StorageId, key: string, value: string): void {
+ domStorageItemAdded(storageId: Protocol.DOMStorage.StorageId, key: string, value: string): void {
const domStorage = this.storageForId(storageId);
if (!domStorage) {
return;
@@ -217,7 +217,7 @@
domStorage.dispatchEventToListeners(DOMStorage.Events.DOMStorageItemAdded, eventData);
}
- _domStorageItemUpdated(storageId: Protocol.DOMStorage.StorageId, key: string, oldValue: string, value: string): void {
+ domStorageItemUpdated(storageId: Protocol.DOMStorage.StorageId, key: string, oldValue: string, value: string): void {
const domStorage = this.storageForId(storageId);
if (!domStorage) {
return;
@@ -228,13 +228,13 @@
}
storageForId(storageId: Protocol.DOMStorage.StorageId): DOMStorage {
- return this._storages[JSON.stringify(storageId)];
+ return this.storagesInternal[JSON.stringify(storageId)];
}
storages(): DOMStorage[] {
const result = [];
- for (const id in this._storages) {
- result.push(this._storages[id]);
+ for (const id in this.storagesInternal) {
+ result.push(this.storagesInternal[id]);
}
return result;
}
@@ -250,24 +250,24 @@
}
export class DOMStorageDispatcher implements ProtocolProxyApi.DOMStorageDispatcher {
- _model: DOMStorageModel;
+ private readonly model: DOMStorageModel;
constructor(model: DOMStorageModel) {
- this._model = model;
+ this.model = model;
}
domStorageItemsCleared({storageId}: Protocol.DOMStorage.DomStorageItemsClearedEvent): void {
- this._model._domStorageItemsCleared(storageId);
+ this.model.domStorageItemsCleared(storageId);
}
domStorageItemRemoved({storageId, key}: Protocol.DOMStorage.DomStorageItemRemovedEvent): void {
- this._model._domStorageItemRemoved(storageId, key);
+ this.model.domStorageItemRemoved(storageId, key);
}
domStorageItemAdded({storageId, key, newValue}: Protocol.DOMStorage.DomStorageItemAddedEvent): void {
- this._model._domStorageItemAdded(storageId, key, newValue);
+ this.model.domStorageItemAdded(storageId, key, newValue);
}
domStorageItemUpdated({storageId, key, oldValue, newValue}: Protocol.DOMStorage.DomStorageItemUpdatedEvent): void {
- this._model._domStorageItemUpdated(storageId, key, oldValue, newValue);
+ this.model.domStorageItemUpdated(storageId, key, oldValue, newValue);
}
}
diff --git a/front_end/panels/application/DatabaseModel.ts b/front_end/panels/application/DatabaseModel.ts
index b01e9d5e..b7bbd7b 100644
--- a/front_end/panels/application/DatabaseModel.ts
+++ b/front_end/panels/application/DatabaseModel.ts
@@ -51,49 +51,49 @@
const str_ = i18n.i18n.registerUIStrings('panels/application/DatabaseModel.ts', UIStrings);
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
export class Database {
- _model: DatabaseModel;
- _id: string;
- _domain: string;
- _name: string;
- _version: string;
+ private readonly model: DatabaseModel;
+ private readonly idInternal: string;
+ private domainInternal: string;
+ private nameInternal: string;
+ private versionInternal: string;
constructor(model: DatabaseModel, id: string, domain: string, name: string, version: string) {
- this._model = model;
- this._id = id;
- this._domain = domain;
- this._name = name;
- this._version = version;
+ this.model = model;
+ this.idInternal = id;
+ this.domainInternal = domain;
+ this.nameInternal = name;
+ this.versionInternal = version;
}
get id(): string {
- return this._id;
+ return this.idInternal;
}
get name(): string {
- return this._name;
+ return this.nameInternal;
}
set name(x: string) {
- this._name = x;
+ this.nameInternal = x;
}
get version(): string {
- return this._version;
+ return this.versionInternal;
}
set version(x: string) {
- this._version = x;
+ this.versionInternal = x;
}
get domain(): string {
- return this._domain;
+ return this.domainInternal;
}
set domain(x: string) {
- this._domain = x;
+ this.domainInternal = x;
}
async tableNames(): Promise<string[]> {
- const {tableNames} = await this._model._agent.invoke_getDatabaseTableNames({databaseId: this._id}) || [];
+ const {tableNames} = await this.model.agent.invoke_getDatabaseTableNames({databaseId: this.idInternal}) || [];
return tableNames.sort();
}
@@ -102,7 +102,7 @@
// eslint-disable-next-line @typescript-eslint/no-explicit-any
query: string, onSuccess: (arg0: Array<string>, arg1: Array<any>) => void,
onError: (arg0: string) => void): Promise<void> {
- const response = await this._model._agent.invoke_executeSQL({'databaseId': this._id, 'query': query});
+ const response = await this.model.agent.invoke_executeSQL({'databaseId': this.idInternal, 'query': query});
const error = response.getError() || null;
if (error) {
onError(error);
@@ -127,45 +127,45 @@
}
export class DatabaseModel extends SDK.SDKModel.SDKModel {
- _databases: Database[];
- _agent: ProtocolProxyApi.DatabaseApi;
- _enabled?: boolean;
+ private databasesInternal: Database[];
+ readonly agent: ProtocolProxyApi.DatabaseApi;
+ private enabled?: boolean;
constructor(target: SDK.Target.Target) {
super(target);
- this._databases = [];
- this._agent = target.databaseAgent();
+ this.databasesInternal = [];
+ this.agent = target.databaseAgent();
this.target().registerDatabaseDispatcher(new DatabaseDispatcher(this));
}
enable(): void {
- if (this._enabled) {
+ if (this.enabled) {
return;
}
- this._agent.invoke_enable();
- this._enabled = true;
+ this.agent.invoke_enable();
+ this.enabled = true;
}
disable(): void {
- if (!this._enabled) {
+ if (!this.enabled) {
return;
}
- this._enabled = false;
- this._databases = [];
- this._agent.invoke_disable();
+ this.enabled = false;
+ this.databasesInternal = [];
+ this.agent.invoke_disable();
this.dispatchEventToListeners(Events.DatabasesRemoved);
}
databases(): Database[] {
const result = [];
- for (const database of this._databases) {
+ for (const database of this.databasesInternal) {
result.push(database);
}
return result;
}
- _addDatabase(database: Database): void {
- this._databases.push(database);
+ addDatabase(database: Database): void {
+ this.databasesInternal.push(database);
this.dispatchEventToListeners(Events.DatabaseAdded, database);
}
}
@@ -180,12 +180,12 @@
}
export class DatabaseDispatcher implements ProtocolProxyApi.DatabaseDispatcher {
- _model: DatabaseModel;
+ private readonly model: DatabaseModel;
constructor(model: DatabaseModel) {
- this._model = model;
+ this.model = model;
}
addDatabase({database}: Protocol.Database.AddDatabaseEvent): void {
- this._model._addDatabase(new Database(this._model, database.id, database.domain, database.name, database.version));
+ this.model.addDatabase(new Database(this.model, database.id, database.domain, database.name, database.version));
}
}
diff --git a/front_end/panels/application/DatabaseQueryView.ts b/front_end/panels/application/DatabaseQueryView.ts
index 31cbe69..4364220 100644
--- a/front_end/panels/application/DatabaseQueryView.ts
+++ b/front_end/panels/application/DatabaseQueryView.ts
@@ -50,116 +50,116 @@
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
export class DatabaseQueryView extends UI.Widget.VBox {
database: Database;
- _queryWrapper: HTMLElement;
- _promptContainer: HTMLElement;
- _promptElement: HTMLElement;
- _prompt: UI.TextPrompt.TextPrompt;
- _proxyElement: Element;
- _queryResults: HTMLElement[];
- _virtualSelectedIndex: number;
- _lastSelectedElement!: Element|null;
- _selectionTimeout: number;
+ private queryWrapper: HTMLElement;
+ private readonly promptContainer: HTMLElement;
+ private readonly promptElement: HTMLElement;
+ private prompt: UI.TextPrompt.TextPrompt;
+ private readonly proxyElement: Element;
+ private queryResults: HTMLElement[];
+ private virtualSelectedIndex: number;
+ private lastSelectedElement!: Element|null;
+ private selectionTimeout: number;
constructor(database: Database) {
super();
this.database = database;
this.element.classList.add('storage-view', 'query', 'monospace');
- this.element.addEventListener('selectstart', this._selectStart.bind(this), false);
+ this.element.addEventListener('selectstart', this.selectStart.bind(this), false);
- this._queryWrapper = this.element.createChild('div', 'database-query-group-messages');
- this._queryWrapper.addEventListener('focusin', (this._onFocusIn.bind(this) as EventListener));
- this._queryWrapper.addEventListener('focusout', (this._onFocusOut.bind(this) as EventListener));
- this._queryWrapper.addEventListener('keydown', (this._onKeyDown.bind(this) as EventListener));
- this._queryWrapper.tabIndex = -1;
+ this.queryWrapper = this.element.createChild('div', 'database-query-group-messages');
+ this.queryWrapper.addEventListener('focusin', (this.onFocusIn.bind(this) as EventListener));
+ this.queryWrapper.addEventListener('focusout', (this.onFocusOut.bind(this) as EventListener));
+ this.queryWrapper.addEventListener('keydown', (this.onKeyDown.bind(this) as EventListener));
+ this.queryWrapper.tabIndex = -1;
- this._promptContainer = this.element.createChild('div', 'database-query-prompt-container');
- this._promptContainer.appendChild(UI.Icon.Icon.create('smallicon-text-prompt', 'prompt-icon'));
- this._promptElement = this._promptContainer.createChild('div');
- this._promptElement.className = 'database-query-prompt';
- this._promptElement.addEventListener('keydown', (this._promptKeyDown.bind(this) as EventListener));
+ this.promptContainer = this.element.createChild('div', 'database-query-prompt-container');
+ this.promptContainer.appendChild(UI.Icon.Icon.create('smallicon-text-prompt', 'prompt-icon'));
+ this.promptElement = this.promptContainer.createChild('div');
+ this.promptElement.className = 'database-query-prompt';
+ this.promptElement.addEventListener('keydown', (this.promptKeyDown.bind(this) as EventListener));
- this._prompt = new UI.TextPrompt.TextPrompt();
- this._prompt.initialize(this.completions.bind(this), ' ');
- this._proxyElement = this._prompt.attach(this._promptElement);
+ this.prompt = new UI.TextPrompt.TextPrompt();
+ this.prompt.initialize(this.completions.bind(this), ' ');
+ this.proxyElement = this.prompt.attach(this.promptElement);
- this.element.addEventListener('click', this._messagesClicked.bind(this), true);
+ this.element.addEventListener('click', this.messagesClicked.bind(this), true);
- this._queryResults = [];
- this._virtualSelectedIndex = -1;
- this._selectionTimeout = 0;
+ this.queryResults = [];
+ this.virtualSelectedIndex = -1;
+ this.selectionTimeout = 0;
}
- _messagesClicked(): void {
- this._prompt.focus();
- if (!this._prompt.isCaretInsidePrompt() && !this.element.hasSelection()) {
- this._prompt.moveCaretToEndOfPrompt();
+ private messagesClicked(): void {
+ this.prompt.focus();
+ if (!this.prompt.isCaretInsidePrompt() && !this.element.hasSelection()) {
+ this.prompt.moveCaretToEndOfPrompt();
}
}
- _onKeyDown(event: KeyboardEvent): void {
- if (UI.UIUtils.isEditing() || !this._queryResults.length || event.shiftKey) {
+ private onKeyDown(event: KeyboardEvent): void {
+ if (UI.UIUtils.isEditing() || !this.queryResults.length || event.shiftKey) {
return;
}
switch (event.key) {
case 'ArrowUp':
- if (this._virtualSelectedIndex > 0) {
- this._virtualSelectedIndex--;
+ if (this.virtualSelectedIndex > 0) {
+ this.virtualSelectedIndex--;
} else {
return;
}
break;
case 'ArrowDown':
- if (this._virtualSelectedIndex < this._queryResults.length - 1) {
- this._virtualSelectedIndex++;
+ if (this.virtualSelectedIndex < this.queryResults.length - 1) {
+ this.virtualSelectedIndex++;
} else {
return;
}
break;
case 'Home':
- this._virtualSelectedIndex = 0;
+ this.virtualSelectedIndex = 0;
break;
case 'End':
- this._virtualSelectedIndex = this._queryResults.length - 1;
+ this.virtualSelectedIndex = this.queryResults.length - 1;
break;
default:
return;
}
event.consume(true);
- this._updateFocusedItem();
+ this.updateFocusedItem();
}
- _onFocusIn(event: FocusEvent): void {
+ private onFocusIn(event: FocusEvent): void {
// Make default selection when moving from external (e.g. prompt) to the container.
- if (this._virtualSelectedIndex === -1 && this._isOutsideViewport((event.relatedTarget as Element | null)) &&
- event.target === this._queryWrapper && this._queryResults.length) {
- this._virtualSelectedIndex = this._queryResults.length - 1;
+ if (this.virtualSelectedIndex === -1 && this.isOutsideViewport((event.relatedTarget as Element | null)) &&
+ event.target === this.queryWrapper && this.queryResults.length) {
+ this.virtualSelectedIndex = this.queryResults.length - 1;
}
- this._updateFocusedItem();
+ this.updateFocusedItem();
}
- _onFocusOut(event: FocusEvent): void {
- if (this._isOutsideViewport((event.relatedTarget as Element | null))) {
- this._virtualSelectedIndex = -1;
+ private onFocusOut(event: FocusEvent): void {
+ if (this.isOutsideViewport((event.relatedTarget as Element | null))) {
+ this.virtualSelectedIndex = -1;
}
- this._updateFocusedItem();
+ this.updateFocusedItem();
- this._queryWrapper.scrollTop = 10000000;
+ this.queryWrapper.scrollTop = 10000000;
}
- _isOutsideViewport(element: Element|null): boolean {
- return element !== null && !element.isSelfOrDescendant(this._queryWrapper);
+ private isOutsideViewport(element: Element|null): boolean {
+ return element !== null && !element.isSelfOrDescendant(this.queryWrapper);
}
- _updateFocusedItem(): void {
- let index: number = this._virtualSelectedIndex;
- if (this._queryResults.length && this._virtualSelectedIndex < 0) {
- index = this._queryResults.length - 1;
+ private updateFocusedItem(): void {
+ let index: number = this.virtualSelectedIndex;
+ if (this.queryResults.length && this.virtualSelectedIndex < 0) {
+ index = this.queryResults.length - 1;
}
- const selectedElement = index >= 0 ? this._queryResults[index] : null;
- const changed = this._lastSelectedElement !== selectedElement;
- const containerHasFocus = this._queryWrapper === this.element.ownerDocument.deepActiveElement();
+ const selectedElement = index >= 0 ? this.queryResults[index] : null;
+ const changed = this.lastSelectedElement !== selectedElement;
+ const containerHasFocus = this.queryWrapper === this.element.ownerDocument.deepActiveElement();
if (selectedElement && (changed || containerHasFocus) && this.element.hasFocus()) {
if (!selectedElement.hasFocus()) {
@@ -167,12 +167,12 @@
}
}
- if (this._queryResults.length && !this._queryWrapper.hasFocus()) {
- this._queryWrapper.tabIndex = 0;
+ if (this.queryResults.length && !this.queryWrapper.hasFocus()) {
+ this.queryWrapper.tabIndex = 0;
} else {
- this._queryWrapper.tabIndex = -1;
+ this.queryWrapper.tabIndex = -1;
}
- this._lastSelectedElement = selectedElement;
+ this.lastSelectedElement = selectedElement;
}
async completions(_expression: string, prefix: string, _force?: boolean): Promise<UI.SuggestBox.Suggestions> {
@@ -188,42 +188,42 @@
.map(completion => ({text: completion} as UI.SuggestBox.Suggestion));
}
- _selectStart(_event: Event): void {
- if (this._selectionTimeout) {
- clearTimeout(this._selectionTimeout);
+ private selectStart(_event: Event): void {
+ if (this.selectionTimeout) {
+ clearTimeout(this.selectionTimeout);
}
- this._prompt.clearAutocomplete();
+ this.prompt.clearAutocomplete();
function moveBackIfOutside(this: DatabaseQueryView): void {
- this._selectionTimeout = 0;
- if (!this._prompt.isCaretInsidePrompt() && !this.element.hasSelection()) {
- this._prompt.moveCaretToEndOfPrompt();
+ this.selectionTimeout = 0;
+ if (!this.prompt.isCaretInsidePrompt() && !this.element.hasSelection()) {
+ this.prompt.moveCaretToEndOfPrompt();
}
- this._prompt.autoCompleteSoon();
+ this.prompt.autoCompleteSoon();
}
- this._selectionTimeout = window.setTimeout(moveBackIfOutside.bind(this), 100);
+ this.selectionTimeout = window.setTimeout(moveBackIfOutside.bind(this), 100);
}
- _promptKeyDown(event: KeyboardEvent): void {
+ private promptKeyDown(event: KeyboardEvent): void {
if (event.key === 'Enter') {
- this._enterKeyPressed(event);
+ this.enterKeyPressed(event);
return;
}
}
- async _enterKeyPressed(event: KeyboardEvent): Promise<void> {
+ private async enterKeyPressed(event: KeyboardEvent): Promise<void> {
event.consume(true);
- const query = this._prompt.textWithCurrentSuggestion();
- this._prompt.clearAutocomplete();
+ const query = this.prompt.textWithCurrentSuggestion();
+ this.prompt.clearAutocomplete();
if (!query.length) {
return;
}
- this._prompt.setEnabled(false);
+ this.prompt.setEnabled(false);
try {
// TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration)
// eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -231,18 +231,18 @@
this.database.executeSql(
query, (columnNames, values) => resolve({columnNames, values}), errorText => reject(errorText));
});
- this._queryFinished(query, result.columnNames, result.values);
+ this.queryFinished(query, result.columnNames, result.values);
} catch (e) {
- this._appendErrorQueryResult(query, e);
+ this.appendErrorQueryResult(query, e);
}
- this._prompt.setEnabled(true);
- this._prompt.setText('');
- this._prompt.focus();
+ this.prompt.setEnabled(true);
+ this.prompt.setText('');
+ this.prompt.focus();
}
// TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration)
// eslint-disable-next-line @typescript-eslint/no-explicit-any
- _queryFinished(query: string, columnNames: string[], values: any[]): void {
+ private queryFinished(query: string, columnNames: string[], values: any[]): void {
const dataGrid =
DataGrid.SortableDataGrid.SortableDataGrid.create(columnNames, values, i18nString(UIStrings.databaseQuery));
const trimmedQuery = query.trim();
@@ -255,46 +255,46 @@
view = dataGrid.asWidget();
dataGrid.setFocusable(false);
}
- this._appendViewQueryResult(trimmedQuery, view);
+ this.appendViewQueryResult(trimmedQuery, view);
if (trimmedQuery.match(/^create /i) || trimmedQuery.match(/^drop table /i)) {
this.dispatchEventToListeners(Events.SchemaUpdated, this.database);
}
}
- _appendViewQueryResult(query: string, view: UI.Widget.Widget|null): void {
- const resultElement = this._appendQueryResult(query);
+ private appendViewQueryResult(query: string, view: UI.Widget.Widget|null): void {
+ const resultElement = this.appendQueryResult(query);
if (view) {
view.show(resultElement);
} else {
resultElement.remove();
}
- this._scrollResultIntoView();
+ this.scrollResultIntoView();
}
- _appendErrorQueryResult(query: string, errorText: string): void {
- const resultElement = this._appendQueryResult(query);
+ private appendErrorQueryResult(query: string, errorText: string): void {
+ const resultElement = this.appendQueryResult(query);
resultElement.classList.add('error');
resultElement.appendChild(UI.Icon.Icon.create('smallicon-error', 'prompt-icon'));
UI.UIUtils.createTextChild(resultElement, errorText);
- this._scrollResultIntoView();
+ this.scrollResultIntoView();
}
- _scrollResultIntoView(): void {
- this._queryResults[this._queryResults.length - 1].scrollIntoView(false);
- this._promptElement.scrollIntoView(false);
+ private scrollResultIntoView(): void {
+ this.queryResults[this.queryResults.length - 1].scrollIntoView(false);
+ this.promptElement.scrollIntoView(false);
}
- _appendQueryResult(query: string): HTMLDivElement {
+ private appendQueryResult(query: string): HTMLDivElement {
const element = document.createElement('div');
element.className = 'database-user-query';
element.tabIndex = -1;
UI.ARIAUtils.setAccessibleName(element, i18nString(UIStrings.queryS, {PH1: query}));
- this._queryResults.push(element);
- this._updateFocusedItem();
+ this.queryResults.push(element);
+ this.updateFocusedItem();
element.appendChild(UI.Icon.Icon.create('smallicon-user-command', 'prompt-icon'));
@@ -307,7 +307,7 @@
resultElement.className = 'database-query-result';
element.appendChild(resultElement);
- this._queryWrapper.appendChild(element);
+ this.queryWrapper.appendChild(element);
return resultElement;
}
}
diff --git a/front_end/panels/application/DatabaseTableView.ts b/front_end/panels/application/DatabaseTableView.ts
index e549eb1..b3d4ead 100644
--- a/front_end/panels/application/DatabaseTableView.ts
+++ b/front_end/panels/application/DatabaseTableView.ts
@@ -69,34 +69,35 @@
export class DatabaseTableView extends UI.View.SimpleView {
database: Database;
tableName: string;
- _lastVisibleColumns: string;
- _columnsMap: Map<string, string>;
- _visibleColumnsSetting: Common.Settings.Setting<VisibleColumnsSetting>;
+ private lastVisibleColumns: string;
+ private readonly columnsMap: Map<string, string>;
+ private readonly visibleColumnsSetting: Common.Settings.Setting<VisibleColumnsSetting>;
refreshButton: UI.Toolbar.ToolbarButton;
- _visibleColumnsInput: UI.Toolbar.ToolbarInput;
- _dataGrid: DataGrid.SortableDataGrid.SortableDataGrid<DataGrid.SortableDataGrid.SortableDataGridNode<unknown>>|null;
- _emptyWidget?: UI.EmptyWidget.EmptyWidget;
+ private readonly visibleColumnsInput: UI.Toolbar.ToolbarInput;
+ private dataGrid: DataGrid.SortableDataGrid.SortableDataGrid<DataGrid.SortableDataGrid.SortableDataGridNode<unknown>>|
+ null;
+ private emptyWidget?: UI.EmptyWidget.EmptyWidget;
constructor(database: Database, tableName: string) {
super(i18nString(UIStrings.database));
this.database = database;
this.tableName = tableName;
- this._lastVisibleColumns = '';
- this._columnsMap = new Map();
+ this.lastVisibleColumns = '';
+ this.columnsMap = new Map();
this.element.classList.add('storage-view', 'table');
- this._visibleColumnsSetting =
+ this.visibleColumnsSetting =
Common.Settings.Settings.instance().createSetting('databaseTableViewVisibleColumns', {});
this.refreshButton = new UI.Toolbar.ToolbarButton(i18nString(UIStrings.refresh), 'largeicon-refresh');
- this.refreshButton.addEventListener(UI.Toolbar.ToolbarButton.Events.Click, this._refreshButtonClicked, this);
- this._visibleColumnsInput = new UI.Toolbar.ToolbarInput(i18nString(UIStrings.visibleColumns), '', 1);
- this._visibleColumnsInput.addEventListener(
- UI.Toolbar.ToolbarInput.Event.TextChanged, this._onVisibleColumnsChanged, this);
+ this.refreshButton.addEventListener(UI.Toolbar.ToolbarButton.Events.Click, this.refreshButtonClicked, this);
+ this.visibleColumnsInput = new UI.Toolbar.ToolbarInput(i18nString(UIStrings.visibleColumns), '', 1);
+ this.visibleColumnsInput.addEventListener(
+ UI.Toolbar.ToolbarInput.Event.TextChanged, this.onVisibleColumnsChanged, this);
- this._dataGrid = null;
+ this.dataGrid = null;
}
wasShown(): void {
@@ -104,58 +105,58 @@
}
async toolbarItems(): Promise<UI.Toolbar.ToolbarItem[]> {
- return [this.refreshButton, this._visibleColumnsInput];
+ return [this.refreshButton, this.visibleColumnsInput];
}
- _escapeTableName(tableName: string): string {
+ private escapeTableName(tableName: string): string {
return tableName.replace(/\"/g, '""');
}
update(): void {
this.database.executeSql(
- 'SELECT rowid, * FROM "' + this._escapeTableName(this.tableName) + '"', this._queryFinished.bind(this),
- this._queryError.bind(this));
+ 'SELECT rowid, * FROM "' + this.escapeTableName(this.tableName) + '"', this.queryFinished.bind(this),
+ this.queryError.bind(this));
}
// TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration)
// eslint-disable-next-line @typescript-eslint/no-explicit-any
- _queryFinished(columnNames: string[], values: any[]): void {
+ private queryFinished(columnNames: string[], values: any[]): void {
this.detachChildWidgets();
this.element.removeChildren();
- this._dataGrid =
+ this.dataGrid =
DataGrid.SortableDataGrid.SortableDataGrid.create(columnNames, values, i18nString(UIStrings.database));
- this._visibleColumnsInput.setVisible(Boolean(this._dataGrid));
- if (!this._dataGrid) {
- this._emptyWidget = new UI.EmptyWidget.EmptyWidget(i18nString(UIStrings.theStableIsEmpty, {PH1: this.tableName}));
- this._emptyWidget.show(this.element);
+ this.visibleColumnsInput.setVisible(Boolean(this.dataGrid));
+ if (!this.dataGrid) {
+ this.emptyWidget = new UI.EmptyWidget.EmptyWidget(i18nString(UIStrings.theStableIsEmpty, {PH1: this.tableName}));
+ this.emptyWidget.show(this.element);
return;
}
- this._dataGrid.setStriped(true);
- this._dataGrid.asWidget().show(this.element);
- this._dataGrid.autoSizeColumns(5);
+ this.dataGrid.setStriped(true);
+ this.dataGrid.asWidget().show(this.element);
+ this.dataGrid.autoSizeColumns(5);
- this._columnsMap.clear();
+ this.columnsMap.clear();
for (let i = 1; i < columnNames.length; ++i) {
- this._columnsMap.set(columnNames[i], String(i));
+ this.columnsMap.set(columnNames[i], String(i));
}
- this._lastVisibleColumns = '';
- const visibleColumnsText = this._visibleColumnsSetting.get()[this.tableName] || '';
- this._visibleColumnsInput.setValue(visibleColumnsText);
- this._onVisibleColumnsChanged();
+ this.lastVisibleColumns = '';
+ const visibleColumnsText = this.visibleColumnsSetting.get()[this.tableName] || '';
+ this.visibleColumnsInput.setValue(visibleColumnsText);
+ this.onVisibleColumnsChanged();
}
- _onVisibleColumnsChanged(): void {
- if (!this._dataGrid) {
+ private onVisibleColumnsChanged(): void {
+ if (!this.dataGrid) {
return;
}
- const text = this._visibleColumnsInput.value();
+ const text = this.visibleColumnsInput.value();
const parts = text.split(/[\s,]+/);
const matches = new Set<string>();
const columnsVisibility = new Set<string>();
columnsVisibility.add('0');
for (const part of parts) {
- const mappedColumn = this._columnsMap.get(part);
+ const mappedColumn = this.columnsMap.get(part);
if (mappedColumn !== undefined) {
matches.add(part);
columnsVisibility.add(mappedColumn);
@@ -163,21 +164,21 @@
}
const newVisibleColumns = [...matches].sort().join(', ');
if (newVisibleColumns.length === 0) {
- for (const v of this._columnsMap.values()) {
+ for (const v of this.columnsMap.values()) {
columnsVisibility.add(v);
}
}
- if (newVisibleColumns === this._lastVisibleColumns) {
+ if (newVisibleColumns === this.lastVisibleColumns) {
return;
}
- const visibleColumnsRegistry = this._visibleColumnsSetting.get();
+ const visibleColumnsRegistry = this.visibleColumnsSetting.get();
visibleColumnsRegistry[this.tableName] = text;
- this._visibleColumnsSetting.set(visibleColumnsRegistry);
- this._dataGrid.setColumnsVisiblity(columnsVisibility);
- this._lastVisibleColumns = newVisibleColumns;
+ this.visibleColumnsSetting.set(visibleColumnsRegistry);
+ this.dataGrid.setColumnsVisiblity(columnsVisibility);
+ this.lastVisibleColumns = newVisibleColumns;
}
- _queryError(): void {
+ private queryError(): void {
this.detachChildWidgets();
this.element.removeChildren();
@@ -187,7 +188,7 @@
this.element.appendChild(errorMsgElement);
}
- _refreshButtonClicked(_event: Common.EventTarget.EventTargetEvent): void {
+ private refreshButtonClicked(_event: Common.EventTarget.EventTargetEvent): void {
this.update();
}
}
diff --git a/front_end/panels/application/IndexedDBModel.ts b/front_end/panels/application/IndexedDBModel.ts
index 5659303..cc75709 100644
--- a/front_end/panels/application/IndexedDBModel.ts
+++ b/front_end/panels/application/IndexedDBModel.ts
@@ -36,29 +36,29 @@
import type * as ProtocolProxyApi from '../../generated/protocol-proxy-api.js';
export class IndexedDBModel extends SDK.SDKModel.SDKModel implements ProtocolProxyApi.StorageDispatcher {
- _securityOriginManager: SDK.SecurityOriginManager.SecurityOriginManager|null;
- _indexedDBAgent: ProtocolProxyApi.IndexedDBApi;
- _storageAgent: ProtocolProxyApi.StorageApi;
- _databases: Map<DatabaseId, Database>;
- _databaseNamesBySecurityOrigin: {
+ private readonly securityOriginManager: SDK.SecurityOriginManager.SecurityOriginManager|null;
+ private readonly indexedDBAgent: ProtocolProxyApi.IndexedDBApi;
+ private readonly storageAgent: ProtocolProxyApi.StorageApi;
+ private readonly databasesInternal: Map<DatabaseId, Database>;
+ private databaseNamesBySecurityOrigin: {
[x: string]: string[],
};
- _originsUpdated: Set<string>;
- _throttler: Common.Throttler.Throttler;
- _enabled?: boolean;
+ private readonly originsUpdated: Set<string>;
+ private readonly throttler: Common.Throttler.Throttler;
+ private enabled?: boolean;
constructor(target: SDK.Target.Target) {
super(target);
target.registerStorageDispatcher(this);
- this._securityOriginManager = target.model(SDK.SecurityOriginManager.SecurityOriginManager);
- this._indexedDBAgent = target.indexedDBAgent();
- this._storageAgent = target.storageAgent();
+ this.securityOriginManager = target.model(SDK.SecurityOriginManager.SecurityOriginManager);
+ this.indexedDBAgent = target.indexedDBAgent();
+ this.storageAgent = target.storageAgent();
- this._databases = new Map();
- this._databaseNamesBySecurityOrigin = {};
+ this.databasesInternal = new Map();
+ this.databaseNamesBySecurityOrigin = {};
- this._originsUpdated = new Set();
- this._throttler = new Common.Throttler.Throttler(1000);
+ this.originsUpdated = new Set();
+ this.throttler = new Common.Throttler.Throttler(1000);
}
// TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration)
@@ -110,7 +110,7 @@
return key;
}
- static _keyRangeFromIDBKeyRange(idbKeyRange: IDBKeyRange): Protocol.IndexedDB.KeyRange {
+ private static keyRangeFromIDBKeyRange(idbKeyRange: IDBKeyRange): Protocol.IndexedDB.KeyRange {
return {
lower: IndexedDBModel.keyFromIDBKey(idbKeyRange.lower),
upper: IndexedDBModel.keyFromIDBKey(idbKeyRange.upper),
@@ -146,120 +146,120 @@
}
enable(): void {
- if (this._enabled) {
+ if (this.enabled) {
return;
}
- this._indexedDBAgent.invoke_enable();
- if (this._securityOriginManager) {
- this._securityOriginManager.addEventListener(
- SDK.SecurityOriginManager.Events.SecurityOriginAdded, this._securityOriginAdded, this);
- this._securityOriginManager.addEventListener(
- SDK.SecurityOriginManager.Events.SecurityOriginRemoved, this._securityOriginRemoved, this);
+ this.indexedDBAgent.invoke_enable();
+ if (this.securityOriginManager) {
+ this.securityOriginManager.addEventListener(
+ SDK.SecurityOriginManager.Events.SecurityOriginAdded, this.securityOriginAdded, this);
+ this.securityOriginManager.addEventListener(
+ SDK.SecurityOriginManager.Events.SecurityOriginRemoved, this.securityOriginRemoved, this);
- for (const securityOrigin of this._securityOriginManager.securityOrigins()) {
- this._addOrigin(securityOrigin);
+ for (const securityOrigin of this.securityOriginManager.securityOrigins()) {
+ this.addOrigin(securityOrigin);
}
}
- this._enabled = true;
+ this.enabled = true;
}
clearForOrigin(origin: string): void {
- if (!this._enabled || !this._databaseNamesBySecurityOrigin[origin]) {
+ if (!this.enabled || !this.databaseNamesBySecurityOrigin[origin]) {
return;
}
- this._removeOrigin(origin);
- this._addOrigin(origin);
+ this.removeOrigin(origin);
+ this.addOrigin(origin);
}
async deleteDatabase(databaseId: DatabaseId): Promise<void> {
- if (!this._enabled) {
+ if (!this.enabled) {
return;
}
- await this._indexedDBAgent.invoke_deleteDatabase(
+ await this.indexedDBAgent.invoke_deleteDatabase(
{securityOrigin: databaseId.securityOrigin, databaseName: databaseId.name});
- this._loadDatabaseNames(databaseId.securityOrigin);
+ this.loadDatabaseNames(databaseId.securityOrigin);
}
async refreshDatabaseNames(): Promise<void> {
- for (const securityOrigin in this._databaseNamesBySecurityOrigin) {
- await this._loadDatabaseNames(securityOrigin);
+ for (const securityOrigin in this.databaseNamesBySecurityOrigin) {
+ await this.loadDatabaseNames(securityOrigin);
}
this.dispatchEventToListeners(Events.DatabaseNamesRefreshed);
}
refreshDatabase(databaseId: DatabaseId): void {
- this._loadDatabase(databaseId, true);
+ this.loadDatabase(databaseId, true);
}
async clearObjectStore(databaseId: DatabaseId, objectStoreName: string): Promise<void> {
- await this._indexedDBAgent.invoke_clearObjectStore(
+ await this.indexedDBAgent.invoke_clearObjectStore(
{securityOrigin: databaseId.securityOrigin, databaseName: databaseId.name, objectStoreName});
}
async deleteEntries(databaseId: DatabaseId, objectStoreName: string, idbKeyRange: IDBKeyRange): Promise<void> {
- const keyRange = IndexedDBModel._keyRangeFromIDBKeyRange(idbKeyRange);
- await this._indexedDBAgent.invoke_deleteObjectStoreEntries(
+ const keyRange = IndexedDBModel.keyRangeFromIDBKeyRange(idbKeyRange);
+ await this.indexedDBAgent.invoke_deleteObjectStoreEntries(
{securityOrigin: databaseId.securityOrigin, databaseName: databaseId.name, objectStoreName, keyRange});
}
- _securityOriginAdded(event: Common.EventTarget.EventTargetEvent<string>): void {
- this._addOrigin(event.data);
+ private securityOriginAdded(event: Common.EventTarget.EventTargetEvent<string>): void {
+ this.addOrigin(event.data);
}
- _securityOriginRemoved(event: Common.EventTarget.EventTargetEvent<string>): void {
- this._removeOrigin(event.data);
+ private securityOriginRemoved(event: Common.EventTarget.EventTargetEvent<string>): void {
+ this.removeOrigin(event.data);
}
- _addOrigin(securityOrigin: string): void {
- console.assert(!this._databaseNamesBySecurityOrigin[securityOrigin]);
- this._databaseNamesBySecurityOrigin[securityOrigin] = [];
- this._loadDatabaseNames(securityOrigin);
- if (this._isValidSecurityOrigin(securityOrigin)) {
- this._storageAgent.invoke_trackIndexedDBForOrigin({origin: securityOrigin});
+ private addOrigin(securityOrigin: string): void {
+ console.assert(!this.databaseNamesBySecurityOrigin[securityOrigin]);
+ this.databaseNamesBySecurityOrigin[securityOrigin] = [];
+ this.loadDatabaseNames(securityOrigin);
+ if (this.isValidSecurityOrigin(securityOrigin)) {
+ this.storageAgent.invoke_trackIndexedDBForOrigin({origin: securityOrigin});
}
}
- _removeOrigin(securityOrigin: string): void {
- console.assert(Boolean(this._databaseNamesBySecurityOrigin[securityOrigin]));
- for (let i = 0; i < this._databaseNamesBySecurityOrigin[securityOrigin].length; ++i) {
- this._databaseRemoved(securityOrigin, this._databaseNamesBySecurityOrigin[securityOrigin][i]);
+ private removeOrigin(securityOrigin: string): void {
+ console.assert(Boolean(this.databaseNamesBySecurityOrigin[securityOrigin]));
+ for (let i = 0; i < this.databaseNamesBySecurityOrigin[securityOrigin].length; ++i) {
+ this.databaseRemoved(securityOrigin, this.databaseNamesBySecurityOrigin[securityOrigin][i]);
}
- delete this._databaseNamesBySecurityOrigin[securityOrigin];
- if (this._isValidSecurityOrigin(securityOrigin)) {
- this._storageAgent.invoke_untrackIndexedDBForOrigin({origin: securityOrigin});
+ delete this.databaseNamesBySecurityOrigin[securityOrigin];
+ if (this.isValidSecurityOrigin(securityOrigin)) {
+ this.storageAgent.invoke_untrackIndexedDBForOrigin({origin: securityOrigin});
}
}
- _isValidSecurityOrigin(securityOrigin: string): boolean {
+ private isValidSecurityOrigin(securityOrigin: string): boolean {
const parsedURL = Common.ParsedURL.ParsedURL.fromString(securityOrigin);
return parsedURL !== null && parsedURL.scheme.startsWith('http');
}
- _updateOriginDatabaseNames(securityOrigin: string, databaseNames: string[]): void {
+ private updateOriginDatabaseNames(securityOrigin: string, databaseNames: string[]): void {
const newDatabaseNames = new Set<string>(databaseNames);
- const oldDatabaseNames = new Set<string>(this._databaseNamesBySecurityOrigin[securityOrigin]);
+ const oldDatabaseNames = new Set<string>(this.databaseNamesBySecurityOrigin[securityOrigin]);
- this._databaseNamesBySecurityOrigin[securityOrigin] = databaseNames;
+ this.databaseNamesBySecurityOrigin[securityOrigin] = databaseNames;
for (const databaseName of oldDatabaseNames) {
if (!newDatabaseNames.has(databaseName)) {
- this._databaseRemoved(securityOrigin, databaseName);
+ this.databaseRemoved(securityOrigin, databaseName);
}
}
for (const databaseName of newDatabaseNames) {
if (!oldDatabaseNames.has(databaseName)) {
- this._databaseAdded(securityOrigin, databaseName);
+ this.databaseAdded(securityOrigin, databaseName);
}
}
}
databases(): DatabaseId[] {
const result = [];
- for (const securityOrigin in this._databaseNamesBySecurityOrigin) {
- const databaseNames = this._databaseNamesBySecurityOrigin[securityOrigin];
+ for (const securityOrigin in this.databaseNamesBySecurityOrigin) {
+ const databaseNames = this.databaseNamesBySecurityOrigin[securityOrigin];
for (let i = 0; i < databaseNames.length; ++i) {
result.push(new DatabaseId(securityOrigin, databaseNames[i]));
}
@@ -267,41 +267,41 @@
return result;
}
- _databaseAdded(securityOrigin: string, databaseName: string): void {
+ private databaseAdded(securityOrigin: string, databaseName: string): void {
const databaseId = new DatabaseId(securityOrigin, databaseName);
this.dispatchEventToListeners(Events.DatabaseAdded, {model: this, databaseId: databaseId});
}
- _databaseRemoved(securityOrigin: string, databaseName: string): void {
+ private databaseRemoved(securityOrigin: string, databaseName: string): void {
const databaseId = new DatabaseId(securityOrigin, databaseName);
this.dispatchEventToListeners(Events.DatabaseRemoved, {model: this, databaseId: databaseId});
}
- async _loadDatabaseNames(securityOrigin: string): Promise<string[]> {
- const {databaseNames} = await this._indexedDBAgent.invoke_requestDatabaseNames({securityOrigin});
+ private async loadDatabaseNames(securityOrigin: string): Promise<string[]> {
+ const {databaseNames} = await this.indexedDBAgent.invoke_requestDatabaseNames({securityOrigin});
if (!databaseNames) {
return [];
}
- if (!this._databaseNamesBySecurityOrigin[securityOrigin]) {
+ if (!this.databaseNamesBySecurityOrigin[securityOrigin]) {
return [];
}
- this._updateOriginDatabaseNames(securityOrigin, databaseNames);
+ this.updateOriginDatabaseNames(securityOrigin, databaseNames);
return databaseNames;
}
- async _loadDatabase(databaseId: DatabaseId, entriesUpdated: boolean): Promise<void> {
- const {databaseWithObjectStores} = await this._indexedDBAgent.invoke_requestDatabase(
+ private async loadDatabase(databaseId: DatabaseId, entriesUpdated: boolean): Promise<void> {
+ const {databaseWithObjectStores} = await this.indexedDBAgent.invoke_requestDatabase(
{securityOrigin: databaseId.securityOrigin, databaseName: databaseId.name});
if (!databaseWithObjectStores) {
return;
}
- if (!this._databaseNamesBySecurityOrigin[databaseId.securityOrigin]) {
+ if (!this.databaseNamesBySecurityOrigin[databaseId.securityOrigin]) {
return;
}
const databaseModel = new Database(databaseId, databaseWithObjectStores.version);
- this._databases.set(databaseId, databaseModel);
+ this.databasesInternal.set(databaseId, databaseModel);
for (const objectStore of databaseWithObjectStores.objectStores) {
const objectStoreIDBKeyPath = IndexedDBModel.idbKeyPathFromKeyPath(objectStore.keyPath);
const objectStoreModel = new ObjectStore(objectStore.name, objectStoreIDBKeyPath, objectStore.autoIncrement);
@@ -321,23 +321,23 @@
loadObjectStoreData(
databaseId: DatabaseId, objectStoreName: string, idbKeyRange: IDBKeyRange|null, skipCount: number,
pageSize: number, callback: (arg0: Array<Entry>, arg1: boolean) => void): void {
- this._requestData(databaseId, databaseId.name, objectStoreName, '', idbKeyRange, skipCount, pageSize, callback);
+ this.requestData(databaseId, databaseId.name, objectStoreName, '', idbKeyRange, skipCount, pageSize, callback);
}
loadIndexData(
databaseId: DatabaseId, objectStoreName: string, indexName: string, idbKeyRange: IDBKeyRange|null,
skipCount: number, pageSize: number, callback: (arg0: Array<Entry>, arg1: boolean) => void): void {
- this._requestData(
+ this.requestData(
databaseId, databaseId.name, objectStoreName, indexName, idbKeyRange, skipCount, pageSize, callback);
}
- async _requestData(
+ private async requestData(
databaseId: DatabaseId, databaseName: string, objectStoreName: string, indexName: string,
idbKeyRange: IDBKeyRange|null, skipCount: number, pageSize: number,
callback: (arg0: Array<Entry>, arg1: boolean) => void): Promise<void> {
- const keyRange = idbKeyRange ? IndexedDBModel._keyRangeFromIDBKeyRange(idbKeyRange) : undefined;
+ const keyRange = idbKeyRange ? IndexedDBModel.keyRangeFromIDBKeyRange(idbKeyRange) : undefined;
- const response = await this._indexedDBAgent.invoke_requestData({
+ const response = await this.indexedDBAgent.invoke_requestData({
securityOrigin: databaseId.securityOrigin,
databaseName,
objectStoreName,
@@ -353,7 +353,7 @@
}
const runtimeModel = this.target().model(SDK.RuntimeModel.RuntimeModel);
- if (!runtimeModel || !this._databaseNamesBySecurityOrigin[databaseId.securityOrigin]) {
+ if (!runtimeModel || !this.databaseNamesBySecurityOrigin[databaseId.securityOrigin]) {
return;
}
const dataEntries = response.objectStoreDataEntries;
@@ -372,7 +372,7 @@
const databaseName = databaseId.name;
const objectStoreName = objectStore.name;
const response =
- await this._indexedDBAgent.invoke_getMetadata({securityOrigin: databaseOrigin, databaseName, objectStoreName});
+ await this.indexedDBAgent.invoke_getMetadata({securityOrigin: databaseOrigin, databaseName, objectStoreName});
if (response.getError()) {
console.error('IndexedDBAgent error: ' + response.getError());
@@ -381,21 +381,21 @@
return {entriesCount: response.entriesCount, keyGeneratorValue: response.keyGeneratorValue};
}
- async _refreshDatabaseList(securityOrigin: string): Promise<void> {
- const databaseNames = await this._loadDatabaseNames(securityOrigin);
+ private async refreshDatabaseList(securityOrigin: string): Promise<void> {
+ const databaseNames = await this.loadDatabaseNames(securityOrigin);
for (const databaseName of databaseNames) {
- this._loadDatabase(new DatabaseId(securityOrigin, databaseName), false);
+ this.loadDatabase(new DatabaseId(securityOrigin, databaseName), false);
}
}
indexedDBListUpdated({origin: securityOrigin}: Protocol.Storage.IndexedDBListUpdatedEvent): void {
- this._originsUpdated.add(securityOrigin);
+ this.originsUpdated.add(securityOrigin);
- this._throttler.schedule(() => {
- const promises = Array.from(this._originsUpdated, securityOrigin => {
- this._refreshDatabaseList(securityOrigin);
+ this.throttler.schedule(() => {
+ const promises = Array.from(this.originsUpdated, securityOrigin => {
+ this.refreshDatabaseList(securityOrigin);
});
- this._originsUpdated.clear();
+ this.originsUpdated.clear();
return Promise.all(promises);
});
}
diff --git a/front_end/panels/application/IndexedDBViews.ts b/front_end/panels/application/IndexedDBViews.ts
index 0edcb6a..9863578 100644
--- a/front_end/panels/application/IndexedDBViews.ts
+++ b/front_end/panels/application/IndexedDBViews.ts
@@ -147,107 +147,107 @@
const str_ = i18n.i18n.registerUIStrings('panels/application/IndexedDBViews.ts', UIStrings);
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
export class IDBDatabaseView extends UI.Widget.VBox {
- _model: IndexedDBModel;
- _database!: Database;
- _reportView: UI.ReportView.ReportView;
- _securityOriginElement: HTMLElement;
- _versionElement: HTMLElement;
- _objectStoreCountElement: HTMLElement;
- _clearButton: HTMLButtonElement;
- _refreshButton: HTMLButtonElement;
+ private readonly model: IndexedDBModel;
+ private database!: Database;
+ private readonly reportView: UI.ReportView.ReportView;
+ private securityOriginElement: HTMLElement;
+ private versionElement: HTMLElement;
+ private objectStoreCountElement: HTMLElement;
+ private readonly clearButton: HTMLButtonElement;
+ private readonly refreshButton: HTMLButtonElement;
constructor(model: IndexedDBModel, database: Database|null) {
super();
- this._model = model;
+ this.model = model;
const databaseName = database ? database.databaseId.name : i18nString(UIStrings.loading);
this.registerRequiredCSS('panels/application/indexedDBViews.css');
this.contentElement.classList.add('indexed-db-container');
// TODO(crbug.com/1156978): Replace UI.ReportView.ReportView with ReportView.ts web component.
- this._reportView = new UI.ReportView.ReportView(databaseName);
- this._reportView.show(this.contentElement);
- this._reportView.registerRequiredCSS('panels/application/indexedDBViews.css');
- this._reportView.element.classList.add('indexed-db-header');
+ this.reportView = new UI.ReportView.ReportView(databaseName);
+ this.reportView.show(this.contentElement);
+ this.reportView.registerRequiredCSS('panels/application/indexedDBViews.css');
+ this.reportView.element.classList.add('indexed-db-header');
- const bodySection = this._reportView.appendSection('');
- this._securityOriginElement = bodySection.appendField(i18nString(UIStrings.securityOrigin));
- this._versionElement = bodySection.appendField(i18nString(UIStrings.version));
- this._objectStoreCountElement = bodySection.appendField(i18nString(UIStrings.objectStores));
+ const bodySection = this.reportView.appendSection('');
+ this.securityOriginElement = bodySection.appendField(i18nString(UIStrings.securityOrigin));
+ this.versionElement = bodySection.appendField(i18nString(UIStrings.version));
+ this.objectStoreCountElement = bodySection.appendField(i18nString(UIStrings.objectStores));
- const footer = this._reportView.appendSection('').appendRow();
- this._clearButton = UI.UIUtils.createTextButton(
- i18nString(UIStrings.deleteDatabase), () => this._deleteDatabase(), i18nString(UIStrings.deleteDatabase));
- footer.appendChild(this._clearButton);
+ const footer = this.reportView.appendSection('').appendRow();
+ this.clearButton = UI.UIUtils.createTextButton(
+ i18nString(UIStrings.deleteDatabase), () => this.deleteDatabase(), i18nString(UIStrings.deleteDatabase));
+ footer.appendChild(this.clearButton);
- this._refreshButton = UI.UIUtils.createTextButton(
- i18nString(UIStrings.refreshDatabase), () => this._refreshDatabaseButtonClicked(),
+ this.refreshButton = UI.UIUtils.createTextButton(
+ i18nString(UIStrings.refreshDatabase), () => this.refreshDatabaseButtonClicked(),
i18nString(UIStrings.refreshDatabase));
- footer.appendChild(this._refreshButton);
+ footer.appendChild(this.refreshButton);
if (database) {
this.update(database);
}
}
- _refreshDatabase(): void {
- this._securityOriginElement.textContent = this._database.databaseId.securityOrigin;
- if (this._versionElement) {
- this._versionElement.textContent = this._database.version.toString();
+ private refreshDatabase(): void {
+ this.securityOriginElement.textContent = this.database.databaseId.securityOrigin;
+ if (this.versionElement) {
+ this.versionElement.textContent = this.database.version.toString();
}
- this._objectStoreCountElement.textContent = this._database.objectStores.size.toString();
+ this.objectStoreCountElement.textContent = this.database.objectStores.size.toString();
}
- _refreshDatabaseButtonClicked(): void {
- this._model.refreshDatabase(this._database.databaseId);
+ private refreshDatabaseButtonClicked(): void {
+ this.model.refreshDatabase(this.database.databaseId);
}
update(database: Database): void {
- this._database = database;
- this._reportView.setTitle(this._database.databaseId.name);
- this._refreshDatabase();
- this._updatedForTests();
+ this.database = database;
+ this.reportView.setTitle(this.database.databaseId.name);
+ this.refreshDatabase();
+ this.updatedForTests();
}
- _updatedForTests(): void {
+ private updatedForTests(): void {
// Sniffed in tests.
}
- async _deleteDatabase(): Promise<void> {
+ private async deleteDatabase(): Promise<void> {
const ok = await UI.UIUtils.ConfirmDialog.show(
- i18nString(UIStrings.pleaseConfirmDeleteOfSDatabase, {PH1: this._database.databaseId.name}), this.element);
+ i18nString(UIStrings.pleaseConfirmDeleteOfSDatabase, {PH1: this.database.databaseId.name}), this.element);
if (ok) {
- this._model.deleteDatabase(this._database.databaseId);
+ this.model.deleteDatabase(this.database.databaseId);
}
}
}
export class IDBDataView extends UI.View.SimpleView {
- _model: IndexedDBModel;
- _databaseId: DatabaseId;
- _isIndex: boolean;
- _refreshObjectStoreCallback: () => void;
- _refreshButton: UI.Toolbar.ToolbarButton;
- _deleteSelectedButton: UI.Toolbar.ToolbarButton;
- _clearButton: UI.Toolbar.ToolbarButton;
- _needsRefresh: UI.Toolbar.ToolbarItem;
- _clearingObjectStore: boolean;
- _pageSize: number;
- _skipCount: number;
- _entries: Entry[];
- _objectStore!: ObjectStore;
- _index!: Index|null;
- _keyInput!: UI.Toolbar.ToolbarInput;
- _dataGrid!: DataGrid.DataGrid.DataGridImpl<unknown>;
- _lastPageSize!: number;
- _lastSkipCount!: number;
- _pageBackButton!: UI.Toolbar.ToolbarButton;
- _pageForwardButton!: UI.Toolbar.ToolbarButton;
+ private readonly model: IndexedDBModel;
+ private readonly databaseId: DatabaseId;
+ private isIndex: boolean;
+ private readonly refreshObjectStoreCallback: () => void;
+ private readonly refreshButton: UI.Toolbar.ToolbarButton;
+ private readonly deleteSelectedButton: UI.Toolbar.ToolbarButton;
+ private readonly clearButton: UI.Toolbar.ToolbarButton;
+ private readonly needsRefresh: UI.Toolbar.ToolbarItem;
+ private clearingObjectStore: boolean;
+ private pageSize: number;
+ private skipCount: number;
+ private entries: Entry[];
+ private objectStore!: ObjectStore;
+ private index!: Index|null;
+ private keyInput!: UI.Toolbar.ToolbarInput;
+ private dataGrid!: DataGrid.DataGrid.DataGridImpl<unknown>;
+ private lastPageSize!: number;
+ private lastSkipCount!: number;
+ private pageBackButton!: UI.Toolbar.ToolbarButton;
+ private pageForwardButton!: UI.Toolbar.ToolbarButton;
// TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration)
// eslint-disable-next-line @typescript-eslint/no-explicit-any
- _lastKey?: any;
- _summaryBarElement?: HTMLElement;
+ private lastKey?: any;
+ private summaryBarElement?: HTMLElement;
constructor(
model: IndexedDBModel, databaseId: DatabaseId, objectStore: ObjectStore, index: Index|null,
@@ -255,43 +255,43 @@
super(i18nString(UIStrings.idb));
this.registerRequiredCSS('panels/application/indexedDBViews.css');
- this._model = model;
- this._databaseId = databaseId;
- this._isIndex = Boolean(index);
- this._refreshObjectStoreCallback = refreshObjectStoreCallback;
+ this.model = model;
+ this.databaseId = databaseId;
+ this.isIndex = Boolean(index);
+ this.refreshObjectStoreCallback = refreshObjectStoreCallback;
this.element.classList.add('indexed-db-data-view', 'storage-view');
- this._refreshButton = new UI.Toolbar.ToolbarButton(i18nString(UIStrings.refresh), 'largeicon-refresh');
- this._refreshButton.addEventListener(UI.Toolbar.ToolbarButton.Events.Click, this._refreshButtonClicked, this);
+ this.refreshButton = new UI.Toolbar.ToolbarButton(i18nString(UIStrings.refresh), 'largeicon-refresh');
+ this.refreshButton.addEventListener(UI.Toolbar.ToolbarButton.Events.Click, this.refreshButtonClicked, this);
- this._deleteSelectedButton = new UI.Toolbar.ToolbarButton(i18nString(UIStrings.deleteSelected), 'largeicon-delete');
- this._deleteSelectedButton.addEventListener(UI.Toolbar.ToolbarButton.Events.Click, _event => {
- this._deleteButtonClicked(null);
+ this.deleteSelectedButton = new UI.Toolbar.ToolbarButton(i18nString(UIStrings.deleteSelected), 'largeicon-delete');
+ this.deleteSelectedButton.addEventListener(UI.Toolbar.ToolbarButton.Events.Click, _event => {
+ this.deleteButtonClicked(null);
});
- this._clearButton = new UI.Toolbar.ToolbarButton(i18nString(UIStrings.clearObjectStore), 'largeicon-clear');
- this._clearButton.addEventListener(UI.Toolbar.ToolbarButton.Events.Click, event => {
- this._clearButtonClicked(event);
+ this.clearButton = new UI.Toolbar.ToolbarButton(i18nString(UIStrings.clearObjectStore), 'largeicon-clear');
+ this.clearButton.addEventListener(UI.Toolbar.ToolbarButton.Events.Click, event => {
+ this.clearButtonClicked(event);
}, this);
- this._needsRefresh = new UI.Toolbar.ToolbarItem(
+ this.needsRefresh = new UI.Toolbar.ToolbarItem(
UI.UIUtils.createIconLabel(i18nString(UIStrings.dataMayBeStale), 'smallicon-warning'));
- this._needsRefresh.setVisible(false);
- this._needsRefresh.setTitle(i18nString(UIStrings.someEntriesMayHaveBeenModified));
- this._clearingObjectStore = false;
+ this.needsRefresh.setVisible(false);
+ this.needsRefresh.setTitle(i18nString(UIStrings.someEntriesMayHaveBeenModified));
+ this.clearingObjectStore = false;
- this._createEditorToolbar();
+ this.createEditorToolbar();
- this._pageSize = 50;
- this._skipCount = 0;
+ this.pageSize = 50;
+ this.skipCount = 0;
this.update(objectStore, index);
- this._entries = [];
+ this.entries = [];
}
- _createDataGrid(): DataGrid.DataGrid.DataGridImpl<unknown> {
- const keyPath = this._isIndex && this._index ? this._index.keyPath : this._objectStore.keyPath;
+ private createDataGrid(): DataGrid.DataGrid.DataGridImpl<unknown> {
+ const keyPath = this.isIndex && this.index ? this.index.keyPath : this.objectStore.keyPath;
const columns = ([] as DataGrid.DataGrid.ColumnDescriptor[]);
@@ -319,14 +319,14 @@
columns.push(({
...columnDefaults,
id: 'key',
- titleDOMFragment: this._keyColumnHeaderFragment(i18nString(UIStrings.keyString), keyPath),
+ titleDOMFragment: this.keyColumnHeaderFragment(i18nString(UIStrings.keyString), keyPath),
sortable: false,
} as DataGrid.DataGrid.ColumnDescriptor));
- if (this._isIndex) {
+ if (this.isIndex) {
columns.push(({
...columnDefaults,
id: 'primaryKey',
- titleDOMFragment: this._keyColumnHeaderFragment(i18nString(UIStrings.primaryKey), this._objectStore.keyPath),
+ titleDOMFragment: this.keyColumnHeaderFragment(i18nString(UIStrings.primaryKey), this.objectStore.keyPath),
sortable: false,
} as DataGrid.DataGrid.ColumnDescriptor));
}
@@ -336,18 +336,18 @@
const dataGrid = new DataGrid.DataGrid.DataGridImpl({
displayName: i18nString(UIStrings.indexedDb),
columns,
- deleteCallback: this._deleteButtonClicked.bind(this),
- refreshCallback: this._updateData.bind(this, true),
+ deleteCallback: this.deleteButtonClicked.bind(this),
+ refreshCallback: this.updateData.bind(this, true),
editCallback: undefined,
});
dataGrid.setStriped(true);
- dataGrid.addEventListener(DataGrid.DataGrid.Events.SelectedNode, _vent => this._updateToolbarEnablement(), this);
+ dataGrid.addEventListener(DataGrid.DataGrid.Events.SelectedNode, _vent => this.updateToolbarEnablement(), this);
return dataGrid;
}
// TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration)
// eslint-disable-next-line @typescript-eslint/no-explicit-any
- _keyColumnHeaderFragment(prefix: string, keyPath: any): DocumentFragment {
+ private keyColumnHeaderFragment(prefix: string, keyPath: any): DocumentFragment {
const keyColumnHeaderFragment = document.createDocumentFragment();
UI.UIUtils.createTextChild(keyColumnHeaderFragment, prefix);
if (keyPath === null) {
@@ -361,18 +361,18 @@
if (i !== 0) {
UI.UIUtils.createTextChild(keyColumnHeaderFragment, ', ');
}
- keyColumnHeaderFragment.appendChild(this._keyPathStringFragment(keyPath[i]));
+ keyColumnHeaderFragment.appendChild(this.keyPathStringFragment(keyPath[i]));
}
UI.UIUtils.createTextChild(keyColumnHeaderFragment, ']');
} else {
const keyPathString = (keyPath as string);
- keyColumnHeaderFragment.appendChild(this._keyPathStringFragment(keyPathString));
+ keyColumnHeaderFragment.appendChild(this.keyPathStringFragment(keyPathString));
}
UI.UIUtils.createTextChild(keyColumnHeaderFragment, ')');
return keyColumnHeaderFragment;
}
- _keyPathStringFragment(keyPathString: string): DocumentFragment {
+ private keyPathStringFragment(keyPathString: string): DocumentFragment {
const keyPathStringFragment = document.createDocumentFragment();
UI.UIUtils.createTextChild(keyPathStringFragment, '"');
const keyPathSpan = keyPathStringFragment.createChild('span', 'source-code indexed-db-key-path');
@@ -381,45 +381,44 @@
return keyPathStringFragment;
}
- _createEditorToolbar(): void {
+ private createEditorToolbar(): void {
const editorToolbar = new UI.Toolbar.Toolbar('data-view-toolbar', this.element);
- editorToolbar.appendToolbarItem(this._refreshButton);
+ editorToolbar.appendToolbarItem(this.refreshButton);
editorToolbar.appendToolbarItem(new UI.Toolbar.ToolbarSeparator());
- this._pageBackButton = new UI.Toolbar.ToolbarButton(i18nString(UIStrings.showPreviousPage), 'largeicon-play-back');
- this._pageBackButton.addEventListener(UI.Toolbar.ToolbarButton.Events.Click, this._pageBackButtonClicked, this);
- editorToolbar.appendToolbarItem(this._pageBackButton);
+ this.pageBackButton = new UI.Toolbar.ToolbarButton(i18nString(UIStrings.showPreviousPage), 'largeicon-play-back');
+ this.pageBackButton.addEventListener(UI.Toolbar.ToolbarButton.Events.Click, this.pageBackButtonClicked, this);
+ editorToolbar.appendToolbarItem(this.pageBackButton);
- this._pageForwardButton = new UI.Toolbar.ToolbarButton(i18nString(UIStrings.showNextPage), 'largeicon-play');
- this._pageForwardButton.setEnabled(false);
- this._pageForwardButton.addEventListener(
- UI.Toolbar.ToolbarButton.Events.Click, this._pageForwardButtonClicked, this);
- editorToolbar.appendToolbarItem(this._pageForwardButton);
+ this.pageForwardButton = new UI.Toolbar.ToolbarButton(i18nString(UIStrings.showNextPage), 'largeicon-play');
+ this.pageForwardButton.setEnabled(false);
+ this.pageForwardButton.addEventListener(UI.Toolbar.ToolbarButton.Events.Click, this.pageForwardButtonClicked, this);
+ editorToolbar.appendToolbarItem(this.pageForwardButton);
- this._keyInput = new UI.Toolbar.ToolbarInput(i18nString(UIStrings.startFromKey), '', 0.5);
- this._keyInput.addEventListener(UI.Toolbar.ToolbarInput.Event.TextChanged, this._updateData.bind(this, false));
- editorToolbar.appendToolbarItem(this._keyInput);
+ this.keyInput = new UI.Toolbar.ToolbarInput(i18nString(UIStrings.startFromKey), '', 0.5);
+ this.keyInput.addEventListener(UI.Toolbar.ToolbarInput.Event.TextChanged, this.updateData.bind(this, false));
+ editorToolbar.appendToolbarItem(this.keyInput);
editorToolbar.appendToolbarItem(new UI.Toolbar.ToolbarSeparator());
- editorToolbar.appendToolbarItem(this._clearButton);
- editorToolbar.appendToolbarItem(this._deleteSelectedButton);
+ editorToolbar.appendToolbarItem(this.clearButton);
+ editorToolbar.appendToolbarItem(this.deleteSelectedButton);
- editorToolbar.appendToolbarItem(this._needsRefresh);
+ editorToolbar.appendToolbarItem(this.needsRefresh);
}
- _pageBackButtonClicked(_event: Common.EventTarget.EventTargetEvent): void {
- this._skipCount = Math.max(0, this._skipCount - this._pageSize);
- this._updateData(false);
+ private pageBackButtonClicked(_event: Common.EventTarget.EventTargetEvent): void {
+ this.skipCount = Math.max(0, this.skipCount - this.pageSize);
+ this.updateData(false);
}
- _pageForwardButtonClicked(_event: Common.EventTarget.EventTargetEvent): void {
- this._skipCount = this._skipCount + this._pageSize;
- this._updateData(false);
+ private pageForwardButtonClicked(_event: Common.EventTarget.EventTargetEvent): void {
+ this.skipCount = this.skipCount + this.pageSize;
+ this.updateData(false);
}
- _populateContextMenu(contextMenu: UI.ContextMenu.ContextMenu, gridNode: DataGrid.DataGrid.DataGridNode<unknown>):
- void {
+ private populateContextMenu(
+ contextMenu: UI.ContextMenu.ContextMenu, gridNode: DataGrid.DataGrid.DataGridNode<unknown>): void {
const node = (gridNode as IDBDataGridNode);
if (node.valueObjectPresentation) {
contextMenu.revealSection().appendItem(i18nString(UIStrings.expandRecursively), () => {
@@ -438,27 +437,27 @@
}
refreshData(): void {
- this._updateData(true);
+ this.updateData(true);
}
update(objectStore: ObjectStore, index: Index|null): void {
- this._objectStore = objectStore;
- this._index = index;
+ this.objectStore = objectStore;
+ this.index = index;
- if (this._dataGrid) {
- this._dataGrid.asWidget().detach();
+ if (this.dataGrid) {
+ this.dataGrid.asWidget().detach();
}
- this._dataGrid = this._createDataGrid();
- this._dataGrid.setRowContextMenuCallback(this._populateContextMenu.bind(this));
- this._dataGrid.asWidget().show(this.element);
+ this.dataGrid = this.createDataGrid();
+ this.dataGrid.setRowContextMenuCallback(this.populateContextMenu.bind(this));
+ this.dataGrid.asWidget().show(this.element);
- this._skipCount = 0;
- this._updateData(true);
+ this.skipCount = 0;
+ this.updateData(true);
}
// TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration)
// eslint-disable-next-line @typescript-eslint/no-explicit-any
- _parseKey(keyString: string): any {
+ private parseKey(keyString: string): any {
let result;
try {
result = JSON.parse(keyString);
@@ -468,29 +467,29 @@
return result;
}
- _updateData(force: boolean): void {
- const key = this._parseKey(this._keyInput.value());
- const pageSize = this._pageSize;
- let skipCount: 0|number = this._skipCount;
- let selected = this._dataGrid.selectedNode ? this._dataGrid.selectedNode.data['number'] : 0;
- selected = Math.max(selected, this._skipCount); // Page forward should select top entry
- this._clearButton.setEnabled(!this._isIndex);
+ private updateData(force: boolean): void {
+ const key = this.parseKey(this.keyInput.value());
+ const pageSize = this.pageSize;
+ let skipCount: 0|number = this.skipCount;
+ let selected = this.dataGrid.selectedNode ? this.dataGrid.selectedNode.data['number'] : 0;
+ selected = Math.max(selected, this.skipCount); // Page forward should select top entry
+ this.clearButton.setEnabled(!this.isIndex);
- if (!force && this._lastKey === key && this._lastPageSize === pageSize && this._lastSkipCount === skipCount) {
+ if (!force && this.lastKey === key && this.lastPageSize === pageSize && this.lastSkipCount === skipCount) {
return;
}
- if (this._lastKey !== key || this._lastPageSize !== pageSize) {
+ if (this.lastKey !== key || this.lastPageSize !== pageSize) {
skipCount = 0;
- this._skipCount = 0;
+ this.skipCount = 0;
}
- this._lastKey = key;
- this._lastPageSize = pageSize;
- this._lastSkipCount = skipCount;
+ this.lastKey = key;
+ this.lastPageSize = pageSize;
+ this.lastSkipCount = skipCount;
function callback(this: IDBDataView, entries: Entry[], hasMore: boolean): void {
this.clear();
- this._entries = entries;
+ this.entries = entries;
let selectedNode: IDBDataGridNode|null = null;
for (let i = 0; i < entries.length; ++i) {
// TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration)
@@ -502,7 +501,7 @@
data['value'] = entries[i].value;
const node = new IDBDataGridNode(data);
- this._dataGrid.rootNode().appendChild(node);
+ this.dataGrid.rootNode().appendChild(node);
if (data['number'] <= selected) {
selectedNode = node;
}
@@ -511,93 +510,93 @@
if (selectedNode) {
selectedNode.select();
}
- this._pageBackButton.setEnabled(Boolean(skipCount));
- this._pageForwardButton.setEnabled(hasMore);
- this._needsRefresh.setVisible(false);
- this._updateToolbarEnablement();
- this._updatedDataForTests();
+ this.pageBackButton.setEnabled(Boolean(skipCount));
+ this.pageForwardButton.setEnabled(hasMore);
+ this.needsRefresh.setVisible(false);
+ this.updateToolbarEnablement();
+ this.updatedDataForTests();
}
const idbKeyRange = key ? window.IDBKeyRange.lowerBound(key) : null;
- if (this._isIndex && this._index) {
- this._model.loadIndexData(
- this._databaseId, this._objectStore.name, this._index.name, idbKeyRange, skipCount, pageSize,
+ if (this.isIndex && this.index) {
+ this.model.loadIndexData(
+ this.databaseId, this.objectStore.name, this.index.name, idbKeyRange, skipCount, pageSize,
callback.bind(this));
} else {
- this._model.loadObjectStoreData(
- this._databaseId, this._objectStore.name, idbKeyRange, skipCount, pageSize, callback.bind(this));
+ this.model.loadObjectStoreData(
+ this.databaseId, this.objectStore.name, idbKeyRange, skipCount, pageSize, callback.bind(this));
}
- this._model.getMetadata(this._databaseId, this._objectStore).then(this._updateSummaryBar.bind(this));
+ this.model.getMetadata(this.databaseId, this.objectStore).then(this.updateSummaryBar.bind(this));
}
- _updateSummaryBar(metadata: ObjectStoreMetadata|null): void {
- if (!this._summaryBarElement) {
- this._summaryBarElement = this.element.createChild('div', 'object-store-summary-bar');
+ private updateSummaryBar(metadata: ObjectStoreMetadata|null): void {
+ if (!this.summaryBarElement) {
+ this.summaryBarElement = this.element.createChild('div', 'object-store-summary-bar');
}
- this._summaryBarElement.removeChildren();
+ this.summaryBarElement.removeChildren();
if (!metadata) {
return;
}
const separator = '\u2002\u2758\u2002';
- const span = this._summaryBarElement.createChild('span');
+ const span = this.summaryBarElement.createChild('span');
span.textContent = i18nString(UIStrings.totalEntriesS, {PH1: String(metadata.entriesCount)});
- if (this._objectStore.autoIncrement) {
+ if (this.objectStore.autoIncrement) {
span.textContent += separator;
span.textContent += i18nString(UIStrings.keyGeneratorValueS, {PH1: String(metadata.keyGeneratorValue)});
}
}
- _updatedDataForTests(): void {
+ private updatedDataForTests(): void {
// Sniffed in tests.
}
- _refreshButtonClicked(_event: Common.EventTarget.EventTargetEvent|null): void {
- this._updateData(true);
+ private refreshButtonClicked(_event: Common.EventTarget.EventTargetEvent|null): void {
+ this.updateData(true);
}
- async _clearButtonClicked(_event: Common.EventTarget.EventTargetEvent): Promise<void> {
- this._clearButton.setEnabled(false);
- this._clearingObjectStore = true;
- await this._model.clearObjectStore(this._databaseId, this._objectStore.name);
- this._clearingObjectStore = false;
- this._clearButton.setEnabled(true);
- this._updateData(true);
+ private async clearButtonClicked(_event: Common.EventTarget.EventTargetEvent): Promise<void> {
+ this.clearButton.setEnabled(false);
+ this.clearingObjectStore = true;
+ await this.model.clearObjectStore(this.databaseId, this.objectStore.name);
+ this.clearingObjectStore = false;
+ this.clearButton.setEnabled(true);
+ this.updateData(true);
}
markNeedsRefresh(): void {
// We expect that calling clearObjectStore() will cause the backend to send us an update.
- if (this._clearingObjectStore) {
+ if (this.clearingObjectStore) {
return;
}
- this._needsRefresh.setVisible(true);
+ this.needsRefresh.setVisible(true);
}
- async _deleteButtonClicked(node: DataGrid.DataGrid.DataGridNode<unknown>|null): Promise<void> {
+ private async deleteButtonClicked(node: DataGrid.DataGrid.DataGridNode<unknown>|null): Promise<void> {
if (!node) {
- node = this._dataGrid.selectedNode;
+ node = this.dataGrid.selectedNode;
if (!node) {
return;
}
}
- const key = (this._isIndex ? node.data.primaryKey : node.data.key as SDK.RemoteObject.RemoteObject);
+ const key = (this.isIndex ? node.data.primaryKey : node.data.key as SDK.RemoteObject.RemoteObject);
// TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration)
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const keyValue = (key.value as string | number | any[] | Date);
- await this._model.deleteEntries(this._databaseId, this._objectStore.name, window.IDBKeyRange.only(keyValue));
- this._refreshObjectStoreCallback();
+ await this.model.deleteEntries(this.databaseId, this.objectStore.name, window.IDBKeyRange.only(keyValue));
+ this.refreshObjectStoreCallback();
}
clear(): void {
- this._dataGrid.rootNode().removeChildren();
- this._entries = [];
+ this.dataGrid.rootNode().removeChildren();
+ this.entries = [];
}
- _updateToolbarEnablement(): void {
- const empty = !this._dataGrid || this._dataGrid.rootNode().children.length === 0;
- this._deleteSelectedButton.setEnabled(!empty && this._dataGrid.selectedNode !== null);
+ private updateToolbarEnablement(): void {
+ const empty = !this.dataGrid || this.dataGrid.rootNode().children.length === 0;
+ this.deleteSelectedButton.setEnabled(!empty && this.dataGrid.selectedNode !== null);
}
}
diff --git a/front_end/panels/application/OpenedWindowDetailsView.ts b/front_end/panels/application/OpenedWindowDetailsView.ts
index 8d9e581..56b5c78 100644
--- a/front_end/panels/application/OpenedWindowDetailsView.ts
+++ b/front_end/panels/application/OpenedWindowDetailsView.ts
@@ -143,105 +143,105 @@
}
export class OpenedWindowDetailsView extends UI.ThrottledWidget.ThrottledWidget {
- _targetInfo: Protocol.Target.TargetInfo;
- _isWindowClosed: boolean;
- _reportView: UI.ReportView.ReportView;
- _documentSection: UI.ReportView.Section;
+ private targetInfo: Protocol.Target.TargetInfo;
+ private isWindowClosed: boolean;
+ private readonly reportView: UI.ReportView.ReportView;
+ private readonly documentSection: UI.ReportView.Section;
// TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration)
// eslint-disable-next-line @typescript-eslint/naming-convention
- _URLFieldValue: HTMLElement;
- _securitySection: UI.ReportView.Section;
- _openerElementField: HTMLElement;
- _hasDOMAccessValue: HTMLElement;
+ private URLFieldValue: HTMLElement;
+ private readonly securitySection: UI.ReportView.Section;
+ private readonly openerElementField: HTMLElement;
+ private hasDOMAccessValue: HTMLElement;
constructor(targetInfo: Protocol.Target.TargetInfo, isWindowClosed: boolean) {
super();
- this._targetInfo = targetInfo;
- this._isWindowClosed = isWindowClosed;
+ this.targetInfo = targetInfo;
+ this.isWindowClosed = isWindowClosed;
this.registerRequiredCSS('panels/application/frameDetailsReportView.css');
this.contentElement.classList.add('frame-details-container');
// TODO(crbug.com/1156978): Replace UI.ReportView.ReportView with ReportView.ts web component.
- this._reportView = new UI.ReportView.ReportView(this.buildTitle());
- this._reportView.registerRequiredCSS('panels/application/frameDetailsReportView.css');
- this._reportView.show(this.contentElement);
- this._reportView.element.classList.add('frame-details-report-container');
+ this.reportView = new UI.ReportView.ReportView(this.buildTitle());
+ this.reportView.registerRequiredCSS('panels/application/frameDetailsReportView.css');
+ this.reportView.show(this.contentElement);
+ this.reportView.element.classList.add('frame-details-report-container');
- this._documentSection = this._reportView.appendSection(i18nString(UIStrings.document));
- this._URLFieldValue = this._documentSection.appendField(i18nString(UIStrings.url));
+ this.documentSection = this.reportView.appendSection(i18nString(UIStrings.document));
+ this.URLFieldValue = this.documentSection.appendField(i18nString(UIStrings.url));
- this._securitySection = this._reportView.appendSection(i18nString(UIStrings.security));
- this._openerElementField = this._securitySection.appendField(i18nString(UIStrings.openerFrame));
- this._securitySection.setFieldVisible(i18nString(UIStrings.openerFrame), false);
- this._hasDOMAccessValue = this._securitySection.appendField(i18nString(UIStrings.accessToOpener));
- UI.Tooltip.Tooltip.install(this._hasDOMAccessValue, i18nString(UIStrings.showsWhetherTheOpenedWindowIs));
+ this.securitySection = this.reportView.appendSection(i18nString(UIStrings.security));
+ this.openerElementField = this.securitySection.appendField(i18nString(UIStrings.openerFrame));
+ this.securitySection.setFieldVisible(i18nString(UIStrings.openerFrame), false);
+ this.hasDOMAccessValue = this.securitySection.appendField(i18nString(UIStrings.accessToOpener));
+ UI.Tooltip.Tooltip.install(this.hasDOMAccessValue, i18nString(UIStrings.showsWhetherTheOpenedWindowIs));
this.update();
}
async doUpdate(): Promise<void> {
- this._reportView.setTitle(this.buildTitle());
- this._URLFieldValue.textContent = this._targetInfo.url;
- this._hasDOMAccessValue.textContent = booleanToYesNo(this._targetInfo.canAccessOpener);
+ this.reportView.setTitle(this.buildTitle());
+ this.URLFieldValue.textContent = this.targetInfo.url;
+ this.hasDOMAccessValue.textContent = booleanToYesNo(this.targetInfo.canAccessOpener);
this.maybeDisplayOpenerFrame();
}
async maybeDisplayOpenerFrame(): Promise<void> {
- this._openerElementField.removeChildren();
- const linkElement = await maybeCreateLinkToElementsPanel(this._targetInfo.openerFrameId);
+ this.openerElementField.removeChildren();
+ const linkElement = await maybeCreateLinkToElementsPanel(this.targetInfo.openerFrameId);
if (linkElement) {
- this._openerElementField.append(linkElement);
- this._securitySection.setFieldVisible(i18nString(UIStrings.openerFrame), true);
+ this.openerElementField.append(linkElement);
+ this.securitySection.setFieldVisible(i18nString(UIStrings.openerFrame), true);
return;
}
- this._securitySection.setFieldVisible(i18nString(UIStrings.openerFrame), false);
+ this.securitySection.setFieldVisible(i18nString(UIStrings.openerFrame), false);
}
buildTitle(): string {
- let title = this._targetInfo.title || i18nString(UIStrings.windowWithoutTitle);
- if (this._isWindowClosed) {
+ let title = this.targetInfo.title || i18nString(UIStrings.windowWithoutTitle);
+ if (this.isWindowClosed) {
title += ` (${i18nString(UIStrings.closed)})`;
}
return title;
}
setIsWindowClosed(isWindowClosed: boolean): void {
- this._isWindowClosed = isWindowClosed;
+ this.isWindowClosed = isWindowClosed;
}
setTargetInfo(targetInfo: Protocol.Target.TargetInfo): void {
- this._targetInfo = targetInfo;
+ this.targetInfo = targetInfo;
}
}
export class WorkerDetailsView extends UI.ThrottledWidget.ThrottledWidget {
- _targetInfo: Protocol.Target.TargetInfo;
- _reportView: UI.ReportView.ReportView;
- _documentSection: UI.ReportView.Section;
+ private readonly targetInfo: Protocol.Target.TargetInfo;
+ private readonly reportView: UI.ReportView.ReportView;
+ private readonly documentSection: UI.ReportView.Section;
// TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration)
// eslint-disable-next-line @typescript-eslint/naming-convention
- _URLFieldValue: HTMLElement;
- _isolationSection: UI.ReportView.Section;
- _coepPolicy: HTMLElement;
+ private readonly URLFieldValue: HTMLElement;
+ private readonly isolationSection: UI.ReportView.Section;
+ private readonly coepPolicy: HTMLElement;
constructor(targetInfo: Protocol.Target.TargetInfo) {
super();
- this._targetInfo = targetInfo;
+ this.targetInfo = targetInfo;
this.registerRequiredCSS('panels/application/frameDetailsReportView.css');
this.contentElement.classList.add('frame-details-container');
// TODO(crbug.com/1156978): Replace UI.ReportView.ReportView with ReportView.ts web component.
- this._reportView =
- new UI.ReportView.ReportView(this._targetInfo.title || this._targetInfo.url || i18nString(UIStrings.worker));
- this._reportView.registerRequiredCSS('panels/application/frameDetailsReportView.css');
- this._reportView.show(this.contentElement);
- this._reportView.element.classList.add('frame-details-report-container');
+ this.reportView =
+ new UI.ReportView.ReportView(this.targetInfo.title || this.targetInfo.url || i18nString(UIStrings.worker));
+ this.reportView.registerRequiredCSS('panels/application/frameDetailsReportView.css');
+ this.reportView.show(this.contentElement);
+ this.reportView.element.classList.add('frame-details-report-container');
- this._documentSection = this._reportView.appendSection(i18nString(UIStrings.document));
- this._URLFieldValue = this._documentSection.appendField(i18nString(UIStrings.url));
- this._URLFieldValue.textContent = this._targetInfo.url;
- const workerType = this._documentSection.appendField(i18nString(UIStrings.type));
- workerType.textContent = this.workerTypeToString(this._targetInfo.type);
+ this.documentSection = this.reportView.appendSection(i18nString(UIStrings.document));
+ this.URLFieldValue = this.documentSection.appendField(i18nString(UIStrings.url));
+ this.URLFieldValue.textContent = this.targetInfo.url;
+ const workerType = this.documentSection.appendField(i18nString(UIStrings.type));
+ workerType.textContent = this.workerTypeToString(this.targetInfo.type);
- this._isolationSection = this._reportView.appendSection(i18nString(UIStrings.securityIsolation));
- this._coepPolicy = this._isolationSection.appendField(i18nString(UIStrings.crossoriginEmbedderPolicy));
+ this.isolationSection = this.reportView.appendSection(i18nString(UIStrings.securityIsolation));
+ this.coepPolicy = this.isolationSection.appendField(i18nString(UIStrings.crossoriginEmbedderPolicy));
this.update();
}
@@ -255,8 +255,8 @@
return i18nString(UIStrings.unknown);
}
- async _updateCoopCoepStatus(): Promise<void> {
- const target = SDK.TargetManager.TargetManager.instance().targetById(this._targetInfo.targetId);
+ private async updateCoopCoepStatus(): Promise<void> {
+ const target = SDK.TargetManager.TargetManager.instance().targetById(this.targetInfo.targetId);
if (!target) {
return;
}
@@ -268,10 +268,10 @@
const coepIsEnabled =
(value: Protocol.Network.CrossOriginEmbedderPolicyValue|Protocol.Network.CrossOriginOpenerPolicyValue):
boolean => value !== Protocol.Network.CrossOriginEmbedderPolicyValue.None;
- this._fillCrossOriginPolicy(this._coepPolicy, coepIsEnabled, info.coep);
+ this.fillCrossOriginPolicy(this.coepPolicy, coepIsEnabled, info.coep);
}
- _fillCrossOriginPolicy(
+ private fillCrossOriginPolicy(
field: HTMLElement,
isEnabled: (arg0: (Protocol.Network.CrossOriginEmbedderPolicyValue|
Protocol.Network.CrossOriginOpenerPolicyValue)) => boolean,
@@ -299,6 +299,6 @@
}
async doUpdate(): Promise<void> {
- await this._updateCoopCoepStatus();
+ await this.updateCoopCoepStatus();
}
}
diff --git a/front_end/panels/application/ResourcesPanel.ts b/front_end/panels/application/ResourcesPanel.ts
index 77c801a..b5a464b 100644
--- a/front_end/panels/application/ResourcesPanel.ts
+++ b/front_end/panels/application/ResourcesPanel.ts
@@ -21,43 +21,43 @@
let resourcesPanelInstance: ResourcesPanel;
export class ResourcesPanel extends UI.Panel.PanelWithSidebar {
- _resourcesLastSelectedItemSetting: Common.Settings.Setting<string[]>;
+ private readonly resourcesLastSelectedItemSetting: Common.Settings.Setting<string[]>;
visibleView: UI.Widget.Widget|null;
- _pendingViewPromise: Promise<UI.Widget.Widget>|null;
- _categoryView: StorageCategoryView|null;
+ private pendingViewPromise: Promise<UI.Widget.Widget>|null;
+ private categoryView: StorageCategoryView|null;
storageViews: HTMLElement;
- _storageViewToolbar: UI.Toolbar.Toolbar;
- _domStorageView: DOMStorageItemsView|null;
- _cookieView: CookieItemsView|null;
- _emptyWidget: UI.EmptyWidget.EmptyWidget|null;
- _sidebar: ApplicationPanelSidebar;
+ private readonly storageViewToolbar: UI.Toolbar.Toolbar;
+ private domStorageView: DOMStorageItemsView|null;
+ private cookieView: CookieItemsView|null;
+ private readonly emptyWidget: UI.EmptyWidget.EmptyWidget|null;
+ private readonly sidebar: ApplicationPanelSidebar;
private constructor() {
super('resources');
this.registerRequiredCSS('panels/application/resourcesPanel.css');
- this._resourcesLastSelectedItemSetting =
+ this.resourcesLastSelectedItemSetting =
Common.Settings.Settings.instance().createSetting('resourcesLastSelectedElementPath', []);
this.visibleView = null;
- this._pendingViewPromise = null;
+ this.pendingViewPromise = null;
- this._categoryView = null;
+ this.categoryView = null;
const mainContainer = new UI.Widget.VBox();
this.storageViews = mainContainer.element.createChild('div', 'vbox flex-auto');
- this._storageViewToolbar = new UI.Toolbar.Toolbar('resources-toolbar', mainContainer.element);
+ this.storageViewToolbar = new UI.Toolbar.Toolbar('resources-toolbar', mainContainer.element);
this.splitWidget().setMainWidget(mainContainer);
- this._domStorageView = null;
+ this.domStorageView = null;
- this._cookieView = null;
+ this.cookieView = null;
- this._emptyWidget = null;
+ this.emptyWidget = null;
- this._sidebar = new ApplicationPanelSidebar(this);
- this._sidebar.show(this.panelSidebarElement());
+ this.sidebar = new ApplicationPanelSidebar(this);
+ this.sidebar.show(this.panelSidebarElement());
}
static instance(opts: {
@@ -71,11 +71,7 @@
return resourcesPanelInstance;
}
- static _instance(): ResourcesPanel {
- return ResourcesPanel.instance();
- }
-
- static _shouldCloseOnReset(view: UI.Widget.Widget): boolean {
+ private static shouldCloseOnReset(view: UI.Widget.Widget): boolean {
const viewClassesToClose = [
SourceFrame.ResourceSourceFrame.ResourceSourceFrame,
SourceFrame.ImageView.ImageView,
@@ -89,29 +85,29 @@
static async showAndGetSidebar(): Promise<ApplicationPanelSidebar> {
await UI.ViewManager.ViewManager.instance().showView('resources');
- return ResourcesPanel._instance()._sidebar;
+ return ResourcesPanel.instance().sidebar;
}
focus(): void {
- this._sidebar.focus();
+ this.sidebar.focus();
}
lastSelectedItemPath(): string[] {
- return this._resourcesLastSelectedItemSetting.get();
+ return this.resourcesLastSelectedItemSetting.get();
}
setLastSelectedItemPath(path: string[]): void {
- this._resourcesLastSelectedItemSetting.set(path);
+ this.resourcesLastSelectedItemSetting.set(path);
}
resetView(): void {
- if (this.visibleView && ResourcesPanel._shouldCloseOnReset(this.visibleView)) {
+ if (this.visibleView && ResourcesPanel.shouldCloseOnReset(this.visibleView)) {
this.showView(null);
}
}
showView(view: UI.Widget.Widget|null): void {
- this._pendingViewPromise = null;
+ this.pendingViewPromise = null;
if (this.visibleView === view) {
return;
}
@@ -125,20 +121,20 @@
}
this.visibleView = view;
- this._storageViewToolbar.removeToolbarItems();
- this._storageViewToolbar.element.classList.toggle('hidden', true);
+ this.storageViewToolbar.removeToolbarItems();
+ this.storageViewToolbar.element.classList.toggle('hidden', true);
if (view instanceof UI.View.SimpleView) {
view.toolbarItems().then(items => {
- items.map(item => this._storageViewToolbar.appendToolbarItem(item));
- this._storageViewToolbar.element.classList.toggle('hidden', !items.length);
+ items.map(item => this.storageViewToolbar.appendToolbarItem(item));
+ this.storageViewToolbar.element.classList.toggle('hidden', !items.length);
});
}
}
async scheduleShowView(viewPromise: Promise<UI.Widget.Widget>): Promise<UI.Widget.Widget|null> {
- this._pendingViewPromise = viewPromise;
+ this.pendingViewPromise = viewPromise;
const view = await viewPromise;
- if (this._pendingViewPromise !== viewPromise) {
+ if (this.pendingViewPromise !== viewPromise) {
return null;
}
this.showView(view);
@@ -146,12 +142,12 @@
}
showCategoryView(categoryName: string, categoryLink: string|null): void {
- if (!this._categoryView) {
- this._categoryView = new StorageCategoryView();
+ if (!this.categoryView) {
+ this.categoryView = new StorageCategoryView();
}
- this._categoryView.setText(categoryName);
- this._categoryView.setLink(categoryLink);
- this.showView(this._categoryView);
+ this.categoryView.setText(categoryName);
+ this.categoryView.setLink(categoryLink);
+ this.showView(this.categoryView);
}
showDOMStorage(domStorage: DOMStorage): void {
@@ -159,12 +155,12 @@
return;
}
- if (!this._domStorageView) {
- this._domStorageView = new DOMStorageItemsView(domStorage);
+ if (!this.domStorageView) {
+ this.domStorageView = new DOMStorageItemsView(domStorage);
} else {
- this._domStorageView.setStorage(domStorage);
+ this.domStorageView.setStorage(domStorage);
}
- this.showView(this._domStorageView);
+ this.showView(this.domStorageView);
}
showCookies(cookieFrameTarget: SDK.Target.Target, cookieDomain: string): void {
@@ -172,12 +168,12 @@
if (!model) {
return;
}
- if (!this._cookieView) {
- this._cookieView = new CookieItemsView(model, cookieDomain);
+ if (!this.cookieView) {
+ this.cookieView = new CookieItemsView(model, cookieDomain);
} else {
- this._cookieView.setCookiesDomain(model, cookieDomain);
+ this.cookieView.setCookiesDomain(model, cookieDomain);
}
- this.showView(this._cookieView);
+ this.showView(this.cookieView);
}
clearCookies(target: SDK.Target.Target, cookieDomain: string): void {
@@ -186,8 +182,8 @@
return;
}
model.clear(cookieDomain).then(() => {
- if (this._cookieView) {
- this._cookieView.refreshItems();
+ if (this.cookieView) {
+ this.cookieView.refreshItems();
}
});
}
@@ -238,15 +234,15 @@
await sidebar.cookieListTreeElement.select();
const contextUrl = cookie.contextUrl();
- if (contextUrl && await this._revealByDomain(sidebar, contextUrl)) {
+ if (contextUrl && await this.revealByDomain(sidebar, contextUrl)) {
return;
}
// Fallback: try to reveal the cookie using its domain as context, which may not work, because the
// Application Panel shows cookies grouped by context, see crbug.com/1060563.
- this._revealByDomain(sidebar, cookie.domain());
+ this.revealByDomain(sidebar, cookie.domain());
}
- async _revealByDomain(sidebar: ApplicationPanelSidebar, domain: string): Promise<boolean> {
+ private async revealByDomain(sidebar: ApplicationPanelSidebar, domain: string): Promise<boolean> {
const item = sidebar.cookieListTreeElement.children().find(
c => /** @type {!CookieTreeElement} */ (c as CookieTreeElement).cookieDomain().endsWith(domain));
if (item) {
diff --git a/front_end/panels/application/ServiceWorkerCacheViews.ts b/front_end/panels/application/ServiceWorkerCacheViews.ts
index a290cda..85cff87 100644
--- a/front_end/panels/application/ServiceWorkerCacheViews.ts
+++ b/front_end/panels/application/ServiceWorkerCacheViews.ts
@@ -72,20 +72,20 @@
const str_ = i18n.i18n.registerUIStrings('panels/application/ServiceWorkerCacheViews.ts', UIStrings);
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
export class ServiceWorkerCacheView extends UI.View.SimpleView {
- _model: SDK.ServiceWorkerCacheModel.ServiceWorkerCacheModel;
- _entriesForTest: Protocol.CacheStorage.DataEntry[]|null;
- _splitWidget: UI.SplitWidget.SplitWidget;
- _previewPanel: UI.Widget.VBox;
- _preview: UI.Widget.Widget|null;
- _cache: SDK.ServiceWorkerCacheModel.Cache;
- _dataGrid: DataGrid.DataGrid.DataGridImpl<DataGridNode>|null;
- _refreshThrottler: Common.Throttler.Throttler;
- _refreshButton: UI.Toolbar.ToolbarButton;
- _deleteSelectedButton: UI.Toolbar.ToolbarButton;
- _entryPathFilter: string;
- _returnCount: number|null;
- _summaryBarElement: Element|null;
- _loadingPromise: Promise<{
+ private model: SDK.ServiceWorkerCacheModel.ServiceWorkerCacheModel;
+ private entriesForTest: Protocol.CacheStorage.DataEntry[]|null;
+ private readonly splitWidget: UI.SplitWidget.SplitWidget;
+ private readonly previewPanel: UI.Widget.VBox;
+ private preview: UI.Widget.Widget|null;
+ private cache: SDK.ServiceWorkerCacheModel.Cache;
+ private dataGrid: DataGrid.DataGrid.DataGridImpl<DataGridNode>|null;
+ private readonly refreshThrottler: Common.Throttler.Throttler;
+ private readonly refreshButton: UI.Toolbar.ToolbarButton;
+ private readonly deleteSelectedButton: UI.Toolbar.ToolbarButton;
+ private entryPathFilter: string;
+ private returnCount: number|null;
+ private summaryBarElement: Element|null;
+ private loadingPromise: Promise<{
entries: Array<Protocol.CacheStorage.DataEntry>,
returnCount: number,
}>|null;
@@ -93,89 +93,89 @@
super(i18nString(UIStrings.cache));
this.registerRequiredCSS('panels/application/serviceWorkerCacheViews.css');
- this._model = model;
- this._entriesForTest = null;
+ this.model = model;
+ this.entriesForTest = null;
this.element.classList.add('service-worker-cache-data-view');
this.element.classList.add('storage-view');
const editorToolbar = new UI.Toolbar.Toolbar('data-view-toolbar', this.element);
- this._splitWidget = new UI.SplitWidget.SplitWidget(false, false);
- this._splitWidget.show(this.element);
+ this.splitWidget = new UI.SplitWidget.SplitWidget(false, false);
+ this.splitWidget.show(this.element);
- this._previewPanel = new UI.Widget.VBox();
- const resizer = this._previewPanel.element.createChild('div', 'cache-preview-panel-resizer');
- this._splitWidget.setMainWidget(this._previewPanel);
- this._splitWidget.installResizer(resizer);
+ this.previewPanel = new UI.Widget.VBox();
+ const resizer = this.previewPanel.element.createChild('div', 'cache-preview-panel-resizer');
+ this.splitWidget.setMainWidget(this.previewPanel);
+ this.splitWidget.installResizer(resizer);
- this._preview = null;
+ this.preview = null;
- this._cache = cache;
- this._dataGrid = null;
- this._refreshThrottler = new Common.Throttler.Throttler(300);
- this._refreshButton = new UI.Toolbar.ToolbarButton(i18nString(UIStrings.refresh), 'largeicon-refresh');
- this._refreshButton.addEventListener(UI.Toolbar.ToolbarButton.Events.Click, this._refreshButtonClicked, this);
- editorToolbar.appendToolbarItem(this._refreshButton);
+ this.cache = cache;
+ this.dataGrid = null;
+ this.refreshThrottler = new Common.Throttler.Throttler(300);
+ this.refreshButton = new UI.Toolbar.ToolbarButton(i18nString(UIStrings.refresh), 'largeicon-refresh');
+ this.refreshButton.addEventListener(UI.Toolbar.ToolbarButton.Events.Click, this.refreshButtonClicked, this);
+ editorToolbar.appendToolbarItem(this.refreshButton);
- this._deleteSelectedButton = new UI.Toolbar.ToolbarButton(i18nString(UIStrings.deleteSelected), 'largeicon-delete');
- this._deleteSelectedButton.addEventListener(UI.Toolbar.ToolbarButton.Events.Click, _event => {
- this._deleteButtonClicked(null);
+ this.deleteSelectedButton = new UI.Toolbar.ToolbarButton(i18nString(UIStrings.deleteSelected), 'largeicon-delete');
+ this.deleteSelectedButton.addEventListener(UI.Toolbar.ToolbarButton.Events.Click, _event => {
+ this.deleteButtonClicked(null);
});
- editorToolbar.appendToolbarItem(this._deleteSelectedButton);
+ editorToolbar.appendToolbarItem(this.deleteSelectedButton);
const entryPathFilterBox = new UI.Toolbar.ToolbarInput(i18nString(UIStrings.filterByPath), '', 1);
editorToolbar.appendToolbarItem(entryPathFilterBox);
const entryPathFilterThrottler = new Common.Throttler.Throttler(300);
- this._entryPathFilter = '';
+ this.entryPathFilter = '';
entryPathFilterBox.addEventListener(UI.Toolbar.ToolbarInput.Event.TextChanged, () => {
entryPathFilterThrottler.schedule(() => {
- this._entryPathFilter = entryPathFilterBox.value();
- return this._updateData(true);
+ this.entryPathFilter = entryPathFilterBox.value();
+ return this.updateData(true);
});
});
- this._returnCount = (null as number | null);
- this._summaryBarElement = (null as Element | null);
- this._loadingPromise = null;
+ this.returnCount = (null as number | null);
+ this.summaryBarElement = (null as Element | null);
+ this.loadingPromise = null;
this.update(cache);
}
- _resetDataGrid(): void {
- if (this._dataGrid) {
- this._dataGrid.asWidget().detach();
+ private resetDataGrid(): void {
+ if (this.dataGrid) {
+ this.dataGrid.asWidget().detach();
}
- this._dataGrid = this._createDataGrid();
- const dataGridWidget = this._dataGrid.asWidget();
- this._splitWidget.setSidebarWidget(dataGridWidget);
+ this.dataGrid = this.createDataGrid();
+ const dataGridWidget = this.dataGrid.asWidget();
+ this.splitWidget.setSidebarWidget(dataGridWidget);
dataGridWidget.setMinimumSize(0, 250);
}
wasShown(): void {
- this._model.addEventListener(
- SDK.ServiceWorkerCacheModel.Events.CacheStorageContentUpdated, this._cacheContentUpdated, this);
- this._updateData(true);
+ this.model.addEventListener(
+ SDK.ServiceWorkerCacheModel.Events.CacheStorageContentUpdated, this.cacheContentUpdated, this);
+ this.updateData(true);
}
willHide(): void {
- this._model.removeEventListener(
- SDK.ServiceWorkerCacheModel.Events.CacheStorageContentUpdated, this._cacheContentUpdated, this);
+ this.model.removeEventListener(
+ SDK.ServiceWorkerCacheModel.Events.CacheStorageContentUpdated, this.cacheContentUpdated, this);
}
- _showPreview(preview: UI.Widget.Widget|null): void {
- if (preview && this._preview === preview) {
+ private showPreview(preview: UI.Widget.Widget|null): void {
+ if (preview && this.preview === preview) {
return;
}
- if (this._preview) {
- this._preview.detach();
+ if (this.preview) {
+ this.preview.detach();
}
if (!preview) {
preview = new UI.EmptyWidget.EmptyWidget(i18nString(UIStrings.selectACacheEntryAboveToPreview));
}
- this._preview = preview;
- this._preview.show(this._previewPanel.element);
+ this.preview = preview;
+ this.preview.show(this.previewPanel.element);
}
- _createDataGrid(): DataGrid.DataGrid.DataGridImpl<DataGridNode> {
+ private createDataGrid(): DataGrid.DataGrid.DataGridImpl<DataGridNode> {
const columns = ([
{id: 'number', title: '#', sortable: false, width: '3px'},
{id: 'name', title: i18nString(UIStrings.name), weight: 4, sortable: true},
@@ -207,32 +207,32 @@
const dataGrid = new DataGrid.DataGrid.DataGridImpl({
displayName: i18nString(UIStrings.serviceWorkerCache),
columns,
- deleteCallback: this._deleteButtonClicked.bind(this),
- refreshCallback: this._updateData.bind(this, true),
+ deleteCallback: this.deleteButtonClicked.bind(this),
+ refreshCallback: this.updateData.bind(this, true),
editCallback: undefined,
});
- dataGrid.addEventListener(DataGrid.DataGrid.Events.SortingChanged, this._sortingChanged, this);
+ dataGrid.addEventListener(DataGrid.DataGrid.Events.SortingChanged, this.sortingChanged, this);
dataGrid.addEventListener(DataGrid.DataGrid.Events.SelectedNode, event => {
- this._previewCachedResponse(event.data.data);
+ this.previewCachedResponse(event.data.data);
}, this);
dataGrid.setStriped(true);
return dataGrid;
}
- _sortingChanged(): void {
- if (!this._dataGrid) {
+ private sortingChanged(): void {
+ if (!this.dataGrid) {
return;
}
- const dataGrid = this._dataGrid;
+ const dataGrid = this.dataGrid;
const accending = dataGrid.isSortOrderAscending();
const columnId = dataGrid.sortColumnId();
let comparator: (arg0: DataGridNode, arg1: DataGridNode) => number;
if (columnId === 'name') {
- comparator = (a: DataGridNode, b: DataGridNode): number => a._name.localeCompare(b._name);
+ comparator = (a: DataGridNode, b: DataGridNode): number => a.name.localeCompare(b.name);
} else if (columnId === 'contentType') {
comparator = (a: DataGridNode, b: DataGridNode): number => a.data.mimeType.localeCompare(b.data.mimeType);
} else if (columnId === 'contentLength') {
@@ -240,9 +240,9 @@
} else if (columnId === 'responseTime') {
comparator = (a: DataGridNode, b: DataGridNode): number => a.data.endTime - b.data.endTime;
} else if (columnId === 'responseType') {
- comparator = (a: DataGridNode, b: DataGridNode): number => a._responseType.localeCompare(b._responseType);
+ comparator = (a: DataGridNode, b: DataGridNode): number => a.responseType.localeCompare(b.responseType);
} else if (columnId === 'varyHeader') {
- comparator = (a: DataGridNode, b: DataGridNode): number => a._varyHeader.localeCompare(b._varyHeader);
+ comparator = (a: DataGridNode, b: DataGridNode): number => a.varyHeader.localeCompare(b.varyHeader);
}
const children = dataGrid.rootNode().children.slice();
@@ -254,51 +254,51 @@
children.forEach(child => dataGrid.rootNode().appendChild(child));
}
- async _deleteButtonClicked(node: DataGrid.DataGrid.DataGridNode<DataGridNode>|null): Promise<void> {
+ private async deleteButtonClicked(node: DataGrid.DataGrid.DataGridNode<DataGridNode>|null): Promise<void> {
if (!node) {
- node = this._dataGrid && this._dataGrid.selectedNode;
+ node = this.dataGrid && this.dataGrid.selectedNode;
if (!node) {
return;
}
}
- await this._model.deleteCacheEntry(this._cache, (node.data.url() as string));
+ await this.model.deleteCacheEntry(this.cache, (node.data.url() as string));
node.remove();
}
update(cache: SDK.ServiceWorkerCacheModel.Cache): void {
- this._cache = cache;
- this._resetDataGrid();
- this._updateData(true);
+ this.cache = cache;
+ this.resetDataGrid();
+ this.updateData(true);
}
- _updateSummaryBar(): void {
- if (!this._summaryBarElement) {
- this._summaryBarElement = this.element.createChild('div', 'cache-storage-summary-bar');
+ private updateSummaryBar(): void {
+ if (!this.summaryBarElement) {
+ this.summaryBarElement = this.element.createChild('div', 'cache-storage-summary-bar');
}
- this._summaryBarElement.removeChildren();
+ this.summaryBarElement.removeChildren();
- const span = this._summaryBarElement.createChild('span');
- if (this._entryPathFilter) {
- span.textContent = i18nString(UIStrings.matchingEntriesS, {PH1: String(this._returnCount)});
+ const span = this.summaryBarElement.createChild('span');
+ if (this.entryPathFilter) {
+ span.textContent = i18nString(UIStrings.matchingEntriesS, {PH1: String(this.returnCount)});
} else {
- span.textContent = i18nString(UIStrings.totalEntriesS, {PH1: String(this._returnCount)});
+ span.textContent = i18nString(UIStrings.totalEntriesS, {PH1: String(this.returnCount)});
}
}
- _updateDataCallback(
+ private updateDataCallback(
this: ServiceWorkerCacheView, skipCount: number, entries: Protocol.CacheStorage.DataEntry[],
returnCount: number): void {
- if (!this._dataGrid) {
+ if (!this.dataGrid) {
return;
}
- const selected = this._dataGrid.selectedNode && this._dataGrid.selectedNode.data.url();
- this._refreshButton.setEnabled(true);
- this._entriesForTest = entries;
- this._returnCount = returnCount;
- this._updateSummaryBar();
+ const selected = this.dataGrid.selectedNode && this.dataGrid.selectedNode.data.url();
+ this.refreshButton.setEnabled(true);
+ this.entriesForTest = entries;
+ this.returnCount = returnCount;
+ this.updateSummaryBar();
const oldEntries = new Map<string, DataGridNode>();
- const rootNode = this._dataGrid.rootNode();
+ const rootNode = this.dataGrid.rootNode();
for (const node of rootNode.children) {
oldEntries.set(node.data.url, (node as DataGridNode));
}
@@ -308,7 +308,7 @@
const entry = entries[i];
let node = oldEntries.get(entry.requestURL);
if (!node || node.data.responseTime !== entry.responseTime) {
- node = new DataGridNode(i, this._createRequest(entry), entry.responseType);
+ node = new DataGridNode(i, this.createRequest(entry), entry.responseType);
node.selectable = true;
} else {
node.data.number = i;
@@ -319,53 +319,53 @@
}
}
if (!selectedNode) {
- this._showPreview(null);
+ this.showPreview(null);
} else {
selectedNode.revealAndSelect();
}
- this._updatedForTest();
+ this.updatedForTest();
}
- async _updateData(force: boolean): Promise<{
+ private async updateData(force: boolean): Promise<{
entries: Protocol.CacheStorage.DataEntry[],
returnCount: number,
}|undefined> {
- if (!force && this._loadingPromise) {
- return this._loadingPromise;
+ if (!force && this.loadingPromise) {
+ return this.loadingPromise;
}
- this._refreshButton.setEnabled(false);
+ this.refreshButton.setEnabled(false);
- if (this._loadingPromise) {
- return this._loadingPromise;
+ if (this.loadingPromise) {
+ return this.loadingPromise;
}
- this._loadingPromise = new Promise(resolve => {
- this._model.loadAllCacheData(
- this._cache, this._entryPathFilter, (entries: Protocol.CacheStorage.DataEntry[], returnCount: number) => {
+ this.loadingPromise = new Promise(resolve => {
+ this.model.loadAllCacheData(
+ this.cache, this.entryPathFilter, (entries: Protocol.CacheStorage.DataEntry[], returnCount: number) => {
resolve({entries, returnCount});
});
});
- const {entries, returnCount} = await this._loadingPromise;
- this._updateDataCallback(0, entries, returnCount);
- this._loadingPromise = null;
+ const {entries, returnCount} = await this.loadingPromise;
+ this.updateDataCallback(0, entries, returnCount);
+ this.loadingPromise = null;
return;
}
- _refreshButtonClicked(_event: Common.EventTarget.EventTargetEvent): void {
- this._updateData(true);
+ private refreshButtonClicked(_event: Common.EventTarget.EventTargetEvent): void {
+ this.updateData(true);
}
- _cacheContentUpdated(
+ private cacheContentUpdated(
event: Common.EventTarget.EventTargetEvent<SDK.ServiceWorkerCacheModel.CacheStorageContentUpdatedEvent>): void {
const {cacheName, origin} = event.data;
- if (this._cache.securityOrigin !== origin || this._cache.cacheName !== cacheName) {
+ if (this.cache.securityOrigin !== origin || this.cache.cacheName !== cacheName) {
return;
}
- this._refreshThrottler.schedule(() => Promise.resolve(this._updateData(true)), true);
+ this.refreshThrottler.schedule(() => Promise.resolve(this.updateData(true)), true);
}
- async _previewCachedResponse(request: SDK.NetworkRequest.NetworkRequest): Promise<void> {
+ private async previewCachedResponse(request: SDK.NetworkRequest.NetworkRequest): Promise<void> {
let preview = networkRequestToPreview.get(request);
if (!preview) {
preview = new RequestView(request);
@@ -373,12 +373,12 @@
}
// It is possible that table selection changes before the preview opens.
- if (this._dataGrid && this._dataGrid.selectedNode && request === this._dataGrid.selectedNode.data) {
- this._showPreview(preview);
+ if (this.dataGrid && this.dataGrid.selectedNode && request === this.dataGrid.selectedNode.data) {
+ this.showPreview(preview);
}
}
- _createRequest(entry: Protocol.CacheStorage.DataEntry): SDK.NetworkRequest.NetworkRequest {
+ private createRequest(entry: Protocol.CacheStorage.DataEntry): SDK.NetworkRequest.NetworkRequest {
const request = SDK.NetworkRequest.NetworkRequest.createWithoutBackendRequest(
'cache-storage-' + entry.requestURL, entry.requestURL, '', null);
request.requestMethod = entry.requestMethod;
@@ -403,78 +403,78 @@
Common.ResourceType.ResourceType.fromURL(entry.requestURL) || Common.ResourceType.resourceTypes.Other;
}
request.setResourceType(resourceType);
- request.setContentDataProvider(this._requestContent.bind(this, request));
+ request.setContentDataProvider(this.requestContent.bind(this, request));
return request;
}
- async _requestContent(request: SDK.NetworkRequest.NetworkRequest): Promise<SDK.NetworkRequest.ContentData> {
+ private async requestContent(request: SDK.NetworkRequest.NetworkRequest): Promise<SDK.NetworkRequest.ContentData> {
const isText = request.resourceType().isTextType();
const contentData: SDK.NetworkRequest.ContentData = {error: null, content: null, encoded: !isText};
- const response = await this._cache.requestCachedResponse(request.url(), request.requestHeaders());
+ const response = await this.cache.requestCachedResponse(request.url(), request.requestHeaders());
if (response) {
contentData.content = isText ? window.atob(response.body) : response.body;
}
return contentData;
}
- _updatedForTest(): void {
+ private updatedForTest(): void {
}
// TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration)
// eslint-disable-next-line @typescript-eslint/naming-convention
- static readonly _previewSymbol = Symbol('preview');
+ private static readonly previewSymbol = Symbol('preview');
}
const networkRequestToPreview = new WeakMap<SDK.NetworkRequest.NetworkRequest, RequestView>();
export class DataGridNode extends DataGrid.DataGrid.DataGridNode<DataGridNode> {
- _number: number;
- _name: string;
- _request: SDK.NetworkRequest.NetworkRequest;
- _responseType: Protocol.CacheStorage.CachedResponseType;
- _varyHeader: string;
+ private number: number;
+ name: string;
+ private request: SDK.NetworkRequest.NetworkRequest;
+ responseType: Protocol.CacheStorage.CachedResponseType;
+ varyHeader: string;
constructor(
number: number, request: SDK.NetworkRequest.NetworkRequest,
responseType: Protocol.CacheStorage.CachedResponseType) {
super(request);
- this._number = number;
+ this.number = number;
const parsed = new Common.ParsedURL.ParsedURL(request.url());
if (parsed.isValid) {
- this._name = Platform.StringUtilities.trimURL(request.url(), parsed.domain());
+ this.name = Platform.StringUtilities.trimURL(request.url(), parsed.domain());
} else {
- this._name = request.url();
+ this.name = request.url();
}
- this._request = request;
- this._responseType = responseType;
- this._varyHeader = request.responseHeaders.find(header => header.name.toLowerCase() === 'vary')?.value || '';
+ this.request = request;
+ this.responseType = responseType;
+ this.varyHeader = request.responseHeaders.find(header => header.name.toLowerCase() === 'vary')?.value || '';
}
createCell(columnId: string): HTMLElement {
const cell = this.createTD(columnId);
let value;
- let tooltip = this._request.url();
+ let tooltip = this.request.url();
if (columnId === 'number') {
- value = String(this._number);
+ value = String(this.number);
} else if (columnId === 'name') {
- value = this._name;
+ value = this.name;
} else if (columnId === 'responseType') {
- if (this._responseType === 'opaqueResponse') {
+ if (this.responseType === 'opaqueResponse') {
value = 'opaque';
- } else if (this._responseType === 'opaqueRedirect') {
+ } else if (this.responseType === 'opaqueRedirect') {
value = 'opaqueredirect';
} else {
- value = this._responseType;
+ value = this.responseType;
}
} else if (columnId === 'contentType') {
- value = this._request.mimeType;
+ value = this.request.mimeType;
} else if (columnId === 'contentLength') {
- value = (this._request.resourceSize | 0).toLocaleString('en-US');
+ value = (this.request.resourceSize | 0).toLocaleString('en-US');
} else if (columnId === 'responseTime') {
- value = new Date(this._request.endTime * 1000).toLocaleString();
+ value = new Date(this.request.endTime * 1000).toLocaleString();
} else if (columnId === 'varyHeader') {
- value = this._varyHeader;
- if (this._varyHeader) {
+ value = this.varyHeader;
+ if (this.varyHeader) {
tooltip = i18nString(UIStrings.varyHeaderWarning);
}
}
@@ -485,41 +485,41 @@
}
export class RequestView extends UI.Widget.VBox {
- _tabbedPane: UI.TabbedPane.TabbedPane;
- _resourceViewTabSetting: Common.Settings.Setting<string>;
+ private tabbedPane: UI.TabbedPane.TabbedPane;
+ private resourceViewTabSetting: Common.Settings.Setting<string>;
constructor(request: SDK.NetworkRequest.NetworkRequest) {
super();
- this._tabbedPane = new UI.TabbedPane.TabbedPane();
- this._tabbedPane.addEventListener(UI.TabbedPane.Events.TabSelected, this._tabSelected, this);
- this._resourceViewTabSetting = Common.Settings.Settings.instance().createSetting('cacheStorageViewTab', 'preview');
+ this.tabbedPane = new UI.TabbedPane.TabbedPane();
+ this.tabbedPane.addEventListener(UI.TabbedPane.Events.TabSelected, this.tabSelected, this);
+ this.resourceViewTabSetting = Common.Settings.Settings.instance().createSetting('cacheStorageViewTab', 'preview');
- this._tabbedPane.appendTab(
+ this.tabbedPane.appendTab(
'headers', i18nString(UIStrings.headers), new Network.RequestHeadersView.RequestHeadersView(request));
- this._tabbedPane.appendTab(
+ this.tabbedPane.appendTab(
'preview', i18nString(UIStrings.preview), new Network.RequestPreviewView.RequestPreviewView(request));
- this._tabbedPane.show(this.element);
+ this.tabbedPane.show(this.element);
}
wasShown(): void {
super.wasShown();
- this._selectTab();
+ this.selectTab();
}
- _selectTab(tabId?: string): void {
+ private selectTab(tabId?: string): void {
if (!tabId) {
- tabId = this._resourceViewTabSetting.get();
+ tabId = this.resourceViewTabSetting.get();
}
- if (tabId && !this._tabbedPane.selectTab(tabId)) {
- this._tabbedPane.selectTab('headers');
+ if (tabId && !this.tabbedPane.selectTab(tabId)) {
+ this.tabbedPane.selectTab('headers');
}
}
- _tabSelected(event: Common.EventTarget.EventTargetEvent): void {
+ private tabSelected(event: Common.EventTarget.EventTargetEvent): void {
if (!event.data.isUserGesture) {
return;
}
- this._resourceViewTabSetting.set(event.data.tabId);
+ this.resourceViewTabSetting.set(event.data.tabId);
}
}
diff --git a/front_end/panels/application/ServiceWorkersView.ts b/front_end/panels/application/ServiceWorkersView.ts
index b40beaf..3655c0b 100644
--- a/front_end/panels/application/ServiceWorkersView.ts
+++ b/front_end/panels/application/ServiceWorkersView.ts
@@ -182,34 +182,36 @@
export class ServiceWorkersView extends UI.Widget.VBox implements
SDK.TargetManager.SDKModelObserver<SDK.ServiceWorkerManager.ServiceWorkerManager> {
- _currentWorkersView: UI.ReportView.ReportView;
- _toolbar: UI.Toolbar.Toolbar;
- _sections: Map<SDK.ServiceWorkerManager.ServiceWorkerRegistration, Section>;
- _manager: SDK.ServiceWorkerManager.ServiceWorkerManager|null;
- _securityOriginManager: SDK.SecurityOriginManager.SecurityOriginManager|null;
- _sectionToRegistration: WeakMap<UI.ReportView.Section, SDK.ServiceWorkerManager.ServiceWorkerRegistration>;
- _eventListeners: Map<SDK.ServiceWorkerManager.ServiceWorkerManager, Common.EventTarget.EventDescriptor[]>;
+ private currentWorkersView: UI.ReportView.ReportView;
+ private readonly toolbar: UI.Toolbar.Toolbar;
+ private readonly sections: Map<SDK.ServiceWorkerManager.ServiceWorkerRegistration, Section>;
+ private manager: SDK.ServiceWorkerManager.ServiceWorkerManager|null;
+ private securityOriginManager: SDK.SecurityOriginManager.SecurityOriginManager|null;
+ private readonly sectionToRegistration:
+ WeakMap<UI.ReportView.Section, SDK.ServiceWorkerManager.ServiceWorkerRegistration>;
+ private readonly eventListeners:
+ Map<SDK.ServiceWorkerManager.ServiceWorkerManager, Common.EventTarget.EventDescriptor[]>;
constructor() {
super(true);
this.registerRequiredCSS('panels/application/serviceWorkersView.css');
// TODO(crbug.com/1156978): Replace UI.ReportView.ReportView with ReportView.ts web component.
- this._currentWorkersView = new UI.ReportView.ReportView(i18n.i18n.lockedString('Service Workers'));
- this._currentWorkersView.setBodyScrollable(false);
+ this.currentWorkersView = new UI.ReportView.ReportView(i18n.i18n.lockedString('Service Workers'));
+ this.currentWorkersView.setBodyScrollable(false);
this.contentElement.classList.add('service-worker-list');
- this._currentWorkersView.show(this.contentElement);
- this._currentWorkersView.element.classList.add('service-workers-this-origin');
+ this.currentWorkersView.show(this.contentElement);
+ this.currentWorkersView.element.classList.add('service-workers-this-origin');
- this._toolbar = this._currentWorkersView.createToolbar();
- this._toolbar.makeWrappable(true /* growVertically */);
+ this.toolbar = this.currentWorkersView.createToolbar();
+ this.toolbar.makeWrappable(true /* growVertically */);
- this._sections = new Map();
+ this.sections = new Map();
- this._manager = null;
- this._securityOriginManager = null;
+ this.manager = null;
+ this.securityOriginManager = null;
- this._sectionToRegistration = new WeakMap();
+ this.sectionToRegistration = new WeakMap();
const othersDiv = this.contentElement.createChild('div', 'service-workers-other-origin');
// TODO(crbug.com/1156978): Replace UI.ReportView.ReportView with ReportView.ts web component.
@@ -229,29 +231,29 @@
});
othersSectionRow.appendChild(seeOthers);
- this._toolbar.appendToolbarItem(
+ this.toolbar.appendToolbarItem(
MobileThrottling.ThrottlingManager.throttlingManager().createOfflineToolbarCheckbox());
const updateOnReloadSetting =
Common.Settings.Settings.instance().createSetting('serviceWorkerUpdateOnReload', false);
updateOnReloadSetting.setTitle(i18nString(UIStrings.updateOnReload));
const forceUpdate =
new UI.Toolbar.ToolbarSettingCheckbox(updateOnReloadSetting, i18nString(UIStrings.onPageReloadForceTheService));
- this._toolbar.appendToolbarItem(forceUpdate);
+ this.toolbar.appendToolbarItem(forceUpdate);
const bypassServiceWorkerSetting = Common.Settings.Settings.instance().createSetting('bypassServiceWorker', false);
bypassServiceWorkerSetting.setTitle(i18nString(UIStrings.bypassForNetwork));
const fallbackToNetwork = new UI.Toolbar.ToolbarSettingCheckbox(
bypassServiceWorkerSetting, i18nString(UIStrings.bypassTheServiceWorkerAndLoad));
- this._toolbar.appendToolbarItem(fallbackToNetwork);
+ this.toolbar.appendToolbarItem(fallbackToNetwork);
- this._eventListeners = new Map();
+ this.eventListeners = new Map();
SDK.TargetManager.TargetManager.instance().observeModels(SDK.ServiceWorkerManager.ServiceWorkerManager, this);
- this._updateListVisibility();
+ this.updateListVisibility();
const drawerChangeHandler = (event: Event): void => {
// @ts-ignore: No support for custom event listener
const isDrawerOpen = event.detail && event.detail.isDrawerOpen;
- if (this._manager && !isDrawerOpen) {
- const {serviceWorkerNetworkRequestsPanelStatus: {isOpen, openedAt}} = this._manager;
+ if (this.manager && !isDrawerOpen) {
+ const {serviceWorkerNetworkRequestsPanelStatus: {isOpen, openedAt}} = this.manager;
if (isOpen) {
const networkLocation = UI.ViewManager.ViewManager.instance().locationNameForViewId('network');
UI.ViewManager.ViewManager.instance().showViewInLocation('network', networkLocation, false);
@@ -263,7 +265,7 @@
Host.userMetrics.actionTaken(Host.UserMetrics.Action.ServiceWorkerNetworkRequestClosedQuickly);
}
- this._manager.serviceWorkerNetworkRequestsPanelStatus = {
+ this.manager.serviceWorkerNetworkRequestsPanelStatus = {
isOpen: false,
openedAt: 0,
};
@@ -274,42 +276,42 @@
}
modelAdded(serviceWorkerManager: SDK.ServiceWorkerManager.ServiceWorkerManager): void {
- if (this._manager) {
+ if (this.manager) {
return;
}
- this._manager = serviceWorkerManager;
- this._securityOriginManager =
+ this.manager = serviceWorkerManager;
+ this.securityOriginManager =
(serviceWorkerManager.target().model(SDK.SecurityOriginManager.SecurityOriginManager) as
SDK.SecurityOriginManager.SecurityOriginManager);
- for (const registration of this._manager.registrations().values()) {
- this._updateRegistration(registration);
+ for (const registration of this.manager.registrations().values()) {
+ this.updateRegistration(registration);
}
- this._eventListeners.set(serviceWorkerManager, [
- this._manager.addEventListener(
- SDK.ServiceWorkerManager.Events.RegistrationUpdated, this._registrationUpdated, this),
- this._manager.addEventListener(
- SDK.ServiceWorkerManager.Events.RegistrationDeleted, this._registrationDeleted, this),
- this._securityOriginManager.addEventListener(
- SDK.SecurityOriginManager.Events.SecurityOriginAdded, this._updateSectionVisibility, this),
- this._securityOriginManager.addEventListener(
- SDK.SecurityOriginManager.Events.SecurityOriginRemoved, this._updateSectionVisibility, this),
+ this.eventListeners.set(serviceWorkerManager, [
+ this.manager.addEventListener(
+ SDK.ServiceWorkerManager.Events.RegistrationUpdated, this.registrationUpdated, this),
+ this.manager.addEventListener(
+ SDK.ServiceWorkerManager.Events.RegistrationDeleted, this.registrationDeleted, this),
+ this.securityOriginManager.addEventListener(
+ SDK.SecurityOriginManager.Events.SecurityOriginAdded, this.updateSectionVisibility, this),
+ this.securityOriginManager.addEventListener(
+ SDK.SecurityOriginManager.Events.SecurityOriginRemoved, this.updateSectionVisibility, this),
]);
}
modelRemoved(serviceWorkerManager: SDK.ServiceWorkerManager.ServiceWorkerManager): void {
- if (!this._manager || this._manager !== serviceWorkerManager) {
+ if (!this.manager || this.manager !== serviceWorkerManager) {
return;
}
- Common.EventTarget.removeEventListeners(this._eventListeners.get(serviceWorkerManager) || []);
- this._eventListeners.delete(serviceWorkerManager);
- this._manager = null;
- this._securityOriginManager = null;
+ Common.EventTarget.removeEventListeners(this.eventListeners.get(serviceWorkerManager) || []);
+ this.eventListeners.delete(serviceWorkerManager);
+ this.manager = null;
+ this.securityOriginManager = null;
}
- _getTimeStamp(registration: SDK.ServiceWorkerManager.ServiceWorkerRegistration): number {
+ private getTimeStamp(registration: SDK.ServiceWorkerManager.ServiceWorkerRegistration): number {
const versions = registration.versionsByMode();
let timestamp: number|undefined = 0;
@@ -332,58 +334,58 @@
return timestamp || 0;
}
- _updateSectionVisibility(): void {
+ private updateSectionVisibility(): void {
let hasThis = false;
const movedSections = [];
- for (const section of this._sections.values()) {
- const expectedView = this._getReportViewForOrigin(section._registration.securityOrigin);
- hasThis = hasThis || expectedView === this._currentWorkersView;
- if (section._section.parentWidget() !== expectedView) {
+ for (const section of this.sections.values()) {
+ const expectedView = this.getReportViewForOrigin(section.registration.securityOrigin);
+ hasThis = hasThis || expectedView === this.currentWorkersView;
+ if (section.section.parentWidget() !== expectedView) {
movedSections.push(section);
}
}
for (const section of movedSections) {
- const registration = section._registration;
- this._removeRegistrationFromList(registration);
- this._updateRegistration(registration, true);
+ const registration = section.registration;
+ this.removeRegistrationFromList(registration);
+ this.updateRegistration(registration, true);
}
- this._currentWorkersView.sortSections((aSection, bSection) => {
- const aRegistration = this._sectionToRegistration.get(aSection);
- const bRegistration = this._sectionToRegistration.get(bSection);
- const aTimestamp = aRegistration ? this._getTimeStamp(aRegistration) : 0;
- const bTimestamp = bRegistration ? this._getTimeStamp(bRegistration) : 0;
+ this.currentWorkersView.sortSections((aSection, bSection) => {
+ const aRegistration = this.sectionToRegistration.get(aSection);
+ const bRegistration = this.sectionToRegistration.get(bSection);
+ const aTimestamp = aRegistration ? this.getTimeStamp(aRegistration) : 0;
+ const bTimestamp = bRegistration ? this.getTimeStamp(bRegistration) : 0;
// the newest (largest timestamp value) should be the first
return bTimestamp - aTimestamp;
});
- for (const section of this._sections.values()) {
- if (section._section.parentWidget() === this._currentWorkersView ||
- this._isRegistrationVisible(section._registration)) {
- section._section.showWidget();
+ for (const section of this.sections.values()) {
+ if (section.section.parentWidget() === this.currentWorkersView ||
+ this.isRegistrationVisible(section.registration)) {
+ section.section.showWidget();
} else {
- section._section.hideWidget();
+ section.section.hideWidget();
}
}
this.contentElement.classList.toggle('service-worker-has-current', Boolean(hasThis));
- this._updateListVisibility();
+ this.updateListVisibility();
}
- _registrationUpdated(event: Common.EventTarget.EventTargetEvent<SDK.ServiceWorkerManager.ServiceWorkerRegistration>):
- void {
- this._updateRegistration(event.data);
- this._gcRegistrations();
+ private registrationUpdated(
+ event: Common.EventTarget.EventTargetEvent<SDK.ServiceWorkerManager.ServiceWorkerRegistration>): void {
+ this.updateRegistration(event.data);
+ this.gcRegistrations();
}
- _gcRegistrations(): void {
- if (!this._manager || !this._securityOriginManager) {
+ private gcRegistrations(): void {
+ if (!this.manager || !this.securityOriginManager) {
return;
}
let hasNonDeletedRegistrations = false;
- const securityOrigins = new Set<string>(this._securityOriginManager.securityOrigins());
- for (const registration of this._manager.registrations().values()) {
- if (!securityOrigins.has(registration.securityOrigin) && !this._isRegistrationVisible(registration)) {
+ const securityOrigins = new Set<string>(this.securityOriginManager.securityOrigins());
+ for (const registration of this.manager.registrations().values()) {
+ if (!securityOrigins.has(registration.securityOrigin) && !this.isRegistrationVisible(registration)) {
continue;
}
if (!registration.canBeRemoved()) {
@@ -396,146 +398,147 @@
return;
}
- for (const registration of this._manager.registrations().values()) {
- const visible = securityOrigins.has(registration.securityOrigin) || this._isRegistrationVisible(registration);
+ for (const registration of this.manager.registrations().values()) {
+ const visible = securityOrigins.has(registration.securityOrigin) || this.isRegistrationVisible(registration);
if (!visible && registration.canBeRemoved()) {
- this._removeRegistrationFromList(registration);
+ this.removeRegistrationFromList(registration);
}
}
}
- _getReportViewForOrigin(origin: string): UI.ReportView.ReportView|null {
- if (this._securityOriginManager &&
- (this._securityOriginManager.securityOrigins().includes(origin) ||
- this._securityOriginManager.unreachableMainSecurityOrigin() === origin)) {
- return this._currentWorkersView;
+ private getReportViewForOrigin(origin: string): UI.ReportView.ReportView|null {
+ if (this.securityOriginManager &&
+ (this.securityOriginManager.securityOrigins().includes(origin) ||
+ this.securityOriginManager.unreachableMainSecurityOrigin() === origin)) {
+ return this.currentWorkersView;
}
return null;
}
- _updateRegistration(registration: SDK.ServiceWorkerManager.ServiceWorkerRegistration, skipUpdate?: boolean): void {
- let section = this._sections.get(registration);
+ private updateRegistration(registration: SDK.ServiceWorkerManager.ServiceWorkerRegistration, skipUpdate?: boolean):
+ void {
+ let section = this.sections.get(registration);
if (!section) {
const title = registration.scopeURL;
- const reportView = this._getReportViewForOrigin(registration.securityOrigin);
+ const reportView = this.getReportViewForOrigin(registration.securityOrigin);
if (!reportView) {
return;
}
const uiSection = reportView.appendSection(title);
uiSection.setUiGroupTitle(i18nString(UIStrings.serviceWorkerForS, {PH1: title}));
- this._sectionToRegistration.set(uiSection, registration);
- section = new Section((this._manager as SDK.ServiceWorkerManager.ServiceWorkerManager), uiSection, registration);
- this._sections.set(registration, section);
+ this.sectionToRegistration.set(uiSection, registration);
+ section = new Section((this.manager as SDK.ServiceWorkerManager.ServiceWorkerManager), uiSection, registration);
+ this.sections.set(registration, section);
}
if (skipUpdate) {
return;
}
- this._updateSectionVisibility();
- section._scheduleUpdate();
+ this.updateSectionVisibility();
+ section.scheduleUpdate();
}
- _registrationDeleted(event: Common.EventTarget.EventTargetEvent<SDK.ServiceWorkerManager.ServiceWorkerRegistration>):
- void {
- this._removeRegistrationFromList(event.data);
+ private registrationDeleted(
+ event: Common.EventTarget.EventTargetEvent<SDK.ServiceWorkerManager.ServiceWorkerRegistration>): void {
+ this.removeRegistrationFromList(event.data);
}
- _removeRegistrationFromList(registration: SDK.ServiceWorkerManager.ServiceWorkerRegistration): void {
- const section = this._sections.get(registration);
+ private removeRegistrationFromList(registration: SDK.ServiceWorkerManager.ServiceWorkerRegistration): void {
+ const section = this.sections.get(registration);
if (section) {
- section._section.detach();
+ section.section.detach();
}
- this._sections.delete(registration);
- this._updateSectionVisibility();
+ this.sections.delete(registration);
+ this.updateSectionVisibility();
}
- _isRegistrationVisible(registration: SDK.ServiceWorkerManager.ServiceWorkerRegistration): boolean {
+ private isRegistrationVisible(registration: SDK.ServiceWorkerManager.ServiceWorkerRegistration): boolean {
if (!registration.scopeURL) {
return true;
}
return false;
}
- _updateListVisibility(): void {
- this.contentElement.classList.toggle('service-worker-list-empty', this._sections.size === 0);
+ private updateListVisibility(): void {
+ this.contentElement.classList.toggle('service-worker-list-empty', this.sections.size === 0);
}
}
export class Section {
- _manager: SDK.ServiceWorkerManager.ServiceWorkerManager;
- _section: UI.ReportView.Section;
- _registration: SDK.ServiceWorkerManager.ServiceWorkerRegistration;
- _fingerprint: symbol|null;
- _pushNotificationDataSetting: Common.Settings.Setting<string>;
- _syncTagNameSetting: Common.Settings.Setting<string>;
- _periodicSyncTagNameSetting: Common.Settings.Setting<string>;
- _toolbar: UI.Toolbar.Toolbar;
- _updateCycleView: ServiceWorkerUpdateCycleView;
- _networkRequests: UI.Toolbar.ToolbarButton;
- _updateButton: UI.Toolbar.ToolbarButton;
- _deleteButton: UI.Toolbar.ToolbarButton;
- _sourceField: Element;
- _statusField: Element;
- _clientsField: Element;
- _linkifier: Components.Linkifier.Linkifier;
- _clientInfoCache: Map<string, Protocol.Target.TargetInfo>;
- _throttler: Common.Throttler.Throttler;
- _updateCycleField?: Element;
+ private manager: SDK.ServiceWorkerManager.ServiceWorkerManager;
+ section: UI.ReportView.Section;
+ registration: SDK.ServiceWorkerManager.ServiceWorkerRegistration;
+ private fingerprint: symbol|null;
+ private readonly pushNotificationDataSetting: Common.Settings.Setting<string>;
+ private readonly syncTagNameSetting: Common.Settings.Setting<string>;
+ private readonly periodicSyncTagNameSetting: Common.Settings.Setting<string>;
+ private readonly toolbar: UI.Toolbar.Toolbar;
+ private readonly updateCycleView: ServiceWorkerUpdateCycleView;
+ private readonly networkRequests: UI.Toolbar.ToolbarButton;
+ private readonly updateButton: UI.Toolbar.ToolbarButton;
+ private readonly deleteButton: UI.Toolbar.ToolbarButton;
+ private sourceField: Element;
+ private readonly statusField: Element;
+ private readonly clientsField: Element;
+ private readonly linkifier: Components.Linkifier.Linkifier;
+ private readonly clientInfoCache: Map<string, Protocol.Target.TargetInfo>;
+ private readonly throttler: Common.Throttler.Throttler;
+ private updateCycleField?: Element;
constructor(
manager: SDK.ServiceWorkerManager.ServiceWorkerManager, section: UI.ReportView.Section,
registration: SDK.ServiceWorkerManager.ServiceWorkerRegistration) {
- this._manager = manager;
- this._section = section;
- this._registration = registration;
- this._fingerprint = null;
- this._pushNotificationDataSetting = Common.Settings.Settings.instance().createLocalSetting(
+ this.manager = manager;
+ this.section = section;
+ this.registration = registration;
+ this.fingerprint = null;
+ this.pushNotificationDataSetting = Common.Settings.Settings.instance().createLocalSetting(
'pushData', i18nString(UIStrings.testPushMessageFromDevtools));
- this._syncTagNameSetting =
+ this.syncTagNameSetting =
Common.Settings.Settings.instance().createLocalSetting('syncTagName', 'test-tag-from-devtools');
- this._periodicSyncTagNameSetting =
+ this.periodicSyncTagNameSetting =
Common.Settings.Settings.instance().createLocalSetting('periodicSyncTagName', 'test-tag-from-devtools');
- this._toolbar = section.createToolbar();
- this._toolbar.renderAsLinks();
+ this.toolbar = section.createToolbar();
+ this.toolbar.renderAsLinks();
- this._updateCycleView = new ServiceWorkerUpdateCycleView(registration);
- this._networkRequests = new UI.Toolbar.ToolbarButton(
+ this.updateCycleView = new ServiceWorkerUpdateCycleView(registration);
+ this.networkRequests = new UI.Toolbar.ToolbarButton(
i18nString(UIStrings.networkRequests), undefined, i18nString(UIStrings.networkRequests));
- this._networkRequests.addEventListener(UI.Toolbar.ToolbarButton.Events.Click, this._networkRequestsClicked, this);
- this._toolbar.appendToolbarItem(this._networkRequests);
- this._updateButton =
+ this.networkRequests.addEventListener(UI.Toolbar.ToolbarButton.Events.Click, this.networkRequestsClicked, this);
+ this.toolbar.appendToolbarItem(this.networkRequests);
+ this.updateButton =
new UI.Toolbar.ToolbarButton(i18nString(UIStrings.update), undefined, i18nString(UIStrings.update));
- this._updateButton.addEventListener(UI.Toolbar.ToolbarButton.Events.Click, this._updateButtonClicked, this);
- this._toolbar.appendToolbarItem(this._updateButton);
- this._deleteButton = new UI.Toolbar.ToolbarButton(
+ this.updateButton.addEventListener(UI.Toolbar.ToolbarButton.Events.Click, this.updateButtonClicked, this);
+ this.toolbar.appendToolbarItem(this.updateButton);
+ this.deleteButton = new UI.Toolbar.ToolbarButton(
i18nString(UIStrings.unregisterServiceWorker), undefined, i18nString(UIStrings.unregister));
- this._deleteButton.addEventListener(UI.Toolbar.ToolbarButton.Events.Click, this._unregisterButtonClicked, this);
- this._toolbar.appendToolbarItem(this._deleteButton);
+ this.deleteButton.addEventListener(UI.Toolbar.ToolbarButton.Events.Click, this.unregisterButtonClicked, this);
+ this.toolbar.appendToolbarItem(this.deleteButton);
// Preserve the order.
- this._sourceField = this._wrapWidget(this._section.appendField(i18nString(UIStrings.source)));
- this._statusField = this._wrapWidget(this._section.appendField(i18nString(UIStrings.status)));
- this._clientsField = this._wrapWidget(this._section.appendField(i18nString(UIStrings.clients)));
- this._createSyncNotificationField(
- i18nString(UIStrings.pushString), this._pushNotificationDataSetting.get(), i18nString(UIStrings.pushData),
- this._push.bind(this));
- this._createSyncNotificationField(
- i18nString(UIStrings.syncString), this._syncTagNameSetting.get(), i18nString(UIStrings.syncTag),
- this._sync.bind(this));
- this._createSyncNotificationField(
- i18nString(UIStrings.periodicSync), this._periodicSyncTagNameSetting.get(),
- i18nString(UIStrings.periodicSyncTag), tag => this._periodicSync(tag));
- this._createUpdateCycleField();
+ this.sourceField = this.wrapWidget(this.section.appendField(i18nString(UIStrings.source)));
+ this.statusField = this.wrapWidget(this.section.appendField(i18nString(UIStrings.status)));
+ this.clientsField = this.wrapWidget(this.section.appendField(i18nString(UIStrings.clients)));
+ this.createSyncNotificationField(
+ i18nString(UIStrings.pushString), this.pushNotificationDataSetting.get(), i18nString(UIStrings.pushData),
+ this.push.bind(this));
+ this.createSyncNotificationField(
+ i18nString(UIStrings.syncString), this.syncTagNameSetting.get(), i18nString(UIStrings.syncTag),
+ this.sync.bind(this));
+ this.createSyncNotificationField(
+ i18nString(UIStrings.periodicSync), this.periodicSyncTagNameSetting.get(),
+ i18nString(UIStrings.periodicSyncTag), tag => this.periodicSync(tag));
+ this.createUpdateCycleField();
- this._linkifier = new Components.Linkifier.Linkifier();
- this._clientInfoCache = new Map();
- this._throttler = new Common.Throttler.Throttler(500);
+ this.linkifier = new Components.Linkifier.Linkifier();
+ this.clientInfoCache = new Map();
+ this.throttler = new Common.Throttler.Throttler(500);
}
- _createSyncNotificationField(
+ private createSyncNotificationField(
label: string, initialValue: string, placeholder: string, callback: (arg0: string) => void): void {
const form =
- this._wrapWidget(this._section.appendField(label)).createChild('form', 'service-worker-editor-with-button');
+ this.wrapWidget(this.section.appendField(label)).createChild('form', 'service-worker-editor-with-button');
const editor = UI.UIUtils.createInput('source-code service-worker-notification-editor');
form.appendChild(editor);
const button = UI.UIUtils.createTextButton(label);
@@ -552,23 +555,23 @@
});
}
- _scheduleUpdate(): void {
+ scheduleUpdate(): void {
if (throttleDisabledForDebugging) {
- this._update();
+ this.update();
return;
}
- this._throttler.schedule(this._update.bind(this));
+ this.throttler.schedule(this.update.bind(this));
}
- _targetForVersionId(versionId: string): SDK.Target.Target|null {
- const version = this._manager.findVersion(versionId);
+ private targetForVersionId(versionId: string): SDK.Target.Target|null {
+ const version = this.manager.findVersion(versionId);
if (!version || !version.targetId) {
return null;
}
return SDK.TargetManager.TargetManager.instance().targetById(version.targetId);
}
- _addVersion(versionsStack: Element, icon: string, label: string): Element {
+ private addVersion(versionsStack: Element, icon: string, label: string): Element {
const installingEntry = versionsStack.createChild('div', 'service-worker-version');
installingEntry.createChild('div', icon);
const statusString = installingEntry.createChild('span', 'service-worker-version-string');
@@ -577,109 +580,107 @@
return installingEntry;
}
- _updateClientsField(version: SDK.ServiceWorkerManager.ServiceWorkerVersion): void {
- this._clientsField.removeChildren();
- this._section.setFieldVisible(i18nString(UIStrings.clients), Boolean(version.controlledClients.length));
+ private updateClientsField(version: SDK.ServiceWorkerManager.ServiceWorkerVersion): void {
+ this.clientsField.removeChildren();
+ this.section.setFieldVisible(i18nString(UIStrings.clients), Boolean(version.controlledClients.length));
for (const client of version.controlledClients) {
- const clientLabelText = this._clientsField.createChild('div', 'service-worker-client');
- const info = this._clientInfoCache.get(client);
+ const clientLabelText = this.clientsField.createChild('div', 'service-worker-client');
+ const info = this.clientInfoCache.get(client);
if (info) {
- this._updateClientInfo(clientLabelText, info);
+ this.updateClientInfo(clientLabelText, info);
}
- this._manager.target()
+ this.manager.target()
.targetAgent()
.invoke_getTargetInfo({targetId: client})
- .then(this._onClientInfo.bind(this, clientLabelText));
+ .then(this.onClientInfo.bind(this, clientLabelText));
}
}
- _updateSourceField(version: SDK.ServiceWorkerManager.ServiceWorkerVersion): void {
- this._sourceField.removeChildren();
+ private updateSourceField(version: SDK.ServiceWorkerManager.ServiceWorkerVersion): void {
+ this.sourceField.removeChildren();
const fileName = Common.ParsedURL.ParsedURL.extractName(version.scriptURL);
- const name = this._sourceField.createChild('div', 'report-field-value-filename');
+ const name = this.sourceField.createChild('div', 'report-field-value-filename');
const link = Components.Linkifier.Linkifier.linkifyURL(
version.scriptURL, ({text: fileName} as Components.Linkifier.LinkifyURLOptions));
link.tabIndex = 0;
name.appendChild(link);
- if (this._registration.errors.length) {
- const errorsLabel = UI.UIUtils.createIconLabel(String(this._registration.errors.length), 'smallicon-error');
+ if (this.registration.errors.length) {
+ const errorsLabel = UI.UIUtils.createIconLabel(String(this.registration.errors.length), 'smallicon-error');
errorsLabel.classList.add('devtools-link', 'link');
errorsLabel.tabIndex = 0;
UI.ARIAUtils.setAccessibleName(
- errorsLabel, i18nString(UIStrings.sRegistrationErrors, {PH1: this._registration.errors.length}));
+ errorsLabel, i18nString(UIStrings.sRegistrationErrors, {PH1: this.registration.errors.length}));
self.onInvokeElement(errorsLabel, () => Common.Console.Console.instance().show());
name.appendChild(errorsLabel);
}
if (version.scriptResponseTime !== undefined) {
- this._sourceField.createChild('div', 'report-field-value-subtitle').textContent =
+ this.sourceField.createChild('div', 'report-field-value-subtitle').textContent =
i18nString(UIStrings.receivedS, {PH1: new Date(version.scriptResponseTime * 1000).toLocaleString()});
}
}
- _update(): Promise<void> {
- const fingerprint = this._registration.fingerprint();
- if (fingerprint === this._fingerprint) {
+ private update(): Promise<void> {
+ const fingerprint = this.registration.fingerprint();
+ if (fingerprint === this.fingerprint) {
return Promise.resolve();
}
- this._fingerprint = fingerprint;
+ this.fingerprint = fingerprint;
- this._toolbar.setEnabled(!this._registration.isDeleted);
+ this.toolbar.setEnabled(!this.registration.isDeleted);
- const versions = this._registration.versionsByMode();
- const scopeURL = this._registration.scopeURL;
- const title = this._registration.isDeleted ? i18nString(UIStrings.sDeleted, {PH1: scopeURL}) : scopeURL;
- this._section.setTitle(title);
+ const versions = this.registration.versionsByMode();
+ const scopeURL = this.registration.scopeURL;
+ const title = this.registration.isDeleted ? i18nString(UIStrings.sDeleted, {PH1: scopeURL}) : scopeURL;
+ this.section.setTitle(title);
const active = versions.get(SDK.ServiceWorkerManager.ServiceWorkerVersion.Modes.Active);
const waiting = versions.get(SDK.ServiceWorkerManager.ServiceWorkerVersion.Modes.Waiting);
const installing = versions.get(SDK.ServiceWorkerManager.ServiceWorkerVersion.Modes.Installing);
const redundant = versions.get(SDK.ServiceWorkerManager.ServiceWorkerVersion.Modes.Redundant);
- this._statusField.removeChildren();
- const versionsStack = this._statusField.createChild('div', 'service-worker-version-stack');
+ this.statusField.removeChildren();
+ const versionsStack = this.statusField.createChild('div', 'service-worker-version-stack');
versionsStack.createChild('div', 'service-worker-version-stack-bar');
if (active) {
- this._updateSourceField(active);
+ this.updateSourceField(active);
const localizedRunningStatus =
SDK.ServiceWorkerManager.ServiceWorkerVersion.RunningStatus[active.currentState.runningStatus]();
// TODO(l10n): Don't concatenate strings here.
- const activeEntry = this._addVersion(
+ const activeEntry = this.addVersion(
versionsStack, 'service-worker-active-circle',
i18nString(UIStrings.sActivatedAndIsS, {PH1: active.id, PH2: localizedRunningStatus}));
if (active.isRunning() || active.isStarting()) {
- this._createLink(activeEntry, i18nString(UIStrings.stopString), this._stopButtonClicked.bind(this, active.id));
- if (!this._targetForVersionId(active.id)) {
- this._createLink(
- activeEntry, i18nString(UIStrings.inspect), this._inspectButtonClicked.bind(this, active.id));
+ this.createLink(activeEntry, i18nString(UIStrings.stopString), this.stopButtonClicked.bind(this, active.id));
+ if (!this.targetForVersionId(active.id)) {
+ this.createLink(activeEntry, i18nString(UIStrings.inspect), this.inspectButtonClicked.bind(this, active.id));
}
} else if (active.isStartable()) {
- this._createLink(activeEntry, i18nString(UIStrings.startString), this._startButtonClicked.bind(this));
+ this.createLink(activeEntry, i18nString(UIStrings.startString), this.startButtonClicked.bind(this));
}
- this._updateClientsField(active);
+ this.updateClientsField(active);
} else if (redundant) {
- this._updateSourceField(redundant);
- this._addVersion(
+ this.updateSourceField(redundant);
+ this.addVersion(
versionsStack, 'service-worker-redundant-circle', i18nString(UIStrings.sIsRedundant, {PH1: redundant.id}));
- this._updateClientsField(redundant);
+ this.updateClientsField(redundant);
}
if (waiting) {
- const waitingEntry = this._addVersion(
+ const waitingEntry = this.addVersion(
versionsStack, 'service-worker-waiting-circle', i18nString(UIStrings.sWaitingToActivate, {PH1: waiting.id}));
- this._createLink(waitingEntry, i18n.i18n.lockedString('skipWaiting'), this._skipButtonClicked.bind(this));
+ this.createLink(waitingEntry, i18n.i18n.lockedString('skipWaiting'), this.skipButtonClicked.bind(this));
if (waiting.scriptResponseTime !== undefined) {
waitingEntry.createChild('div', 'service-worker-subtitle').textContent =
i18nString(UIStrings.receivedS, {PH1: new Date(waiting.scriptResponseTime * 1000).toLocaleString()});
}
- if (!this._targetForVersionId(waiting.id) && (waiting.isRunning() || waiting.isStarting())) {
- this._createLink(
- waitingEntry, i18nString(UIStrings.inspect), this._inspectButtonClicked.bind(this, waiting.id));
+ if (!this.targetForVersionId(waiting.id) && (waiting.isRunning() || waiting.isStarting())) {
+ this.createLink(waitingEntry, i18nString(UIStrings.inspect), this.inspectButtonClicked.bind(this, waiting.id));
}
}
if (installing) {
- const installingEntry = this._addVersion(
+ const installingEntry = this.addVersion(
versionsStack, 'service-worker-installing-circle',
i18nString(UIStrings.sTryingToInstall, {PH1: installing.id}));
if (installing.scriptResponseTime !== undefined) {
@@ -687,18 +688,19 @@
PH1: new Date(installing.scriptResponseTime * 1000).toLocaleString(),
});
}
- if (!this._targetForVersionId(installing.id) && (installing.isRunning() || installing.isStarting())) {
- this._createLink(
- installingEntry, i18nString(UIStrings.inspect), this._inspectButtonClicked.bind(this, installing.id));
+ if (!this.targetForVersionId(installing.id) && (installing.isRunning() || installing.isStarting())) {
+ this.createLink(
+ installingEntry, i18nString(UIStrings.inspect), this.inspectButtonClicked.bind(this, installing.id));
}
}
- this._updateCycleView.refresh();
+ this.updateCycleView.refresh();
return Promise.resolve();
}
- _createLink(parent: Element, title: string, listener: () => void, className?: string, useCapture?: boolean): Element {
+ private createLink(parent: Element, title: string, listener: () => void, className?: string, useCapture?: boolean):
+ Element {
const button = document.createElement('button');
if (className) {
button.className = className;
@@ -711,20 +713,20 @@
return button;
}
- _unregisterButtonClicked(_event: Common.EventTarget.EventTargetEvent): void {
- this._manager.deleteRegistration(this._registration.id);
+ private unregisterButtonClicked(_event: Common.EventTarget.EventTargetEvent): void {
+ this.manager.deleteRegistration(this.registration.id);
}
- _createUpdateCycleField(): void {
- this._updateCycleField = this._wrapWidget(this._section.appendField(i18nString(UIStrings.updateCycle)));
- this._updateCycleField.appendChild(this._updateCycleView.tableElement);
+ private createUpdateCycleField(): void {
+ this.updateCycleField = this.wrapWidget(this.section.appendField(i18nString(UIStrings.updateCycle)));
+ this.updateCycleField.appendChild(this.updateCycleView.tableElement);
}
- _updateButtonClicked(_event: Common.EventTarget.EventTargetEvent): void {
- this._manager.updateRegistration(this._registration.id);
+ private updateButtonClicked(_event: Common.EventTarget.EventTargetEvent): void {
+ this.manager.updateRegistration(this.registration.id);
}
- _networkRequestsClicked(_event: Common.EventTarget.EventTargetEvent): void {
+ private networkRequestsClicked(_event: Common.EventTarget.EventTargetEvent): void {
const applicationTabLocation = UI.ViewManager.ViewManager.instance().locationNameForViewId('resources');
const networkTabLocation = applicationTabLocation === 'drawer-view' ? 'panel' : 'drawer-view';
UI.ViewManager.ViewManager.instance().showViewInLocation('network', networkTabLocation);
@@ -755,38 +757,38 @@
Common.Revealer.reveal(requestLocation);
}
- this._manager.serviceWorkerNetworkRequestsPanelStatus = {
+ this.manager.serviceWorkerNetworkRequestsPanelStatus = {
isOpen: true,
openedAt: Date.now(),
};
Host.userMetrics.actionTaken(Host.UserMetrics.Action.ServiceWorkerNetworkRequestClicked);
}
- _push(data: string): void {
- this._pushNotificationDataSetting.set(data);
- this._manager.deliverPushMessage(this._registration.id, data);
+ private push(data: string): void {
+ this.pushNotificationDataSetting.set(data);
+ this.manager.deliverPushMessage(this.registration.id, data);
}
- _sync(tag: string): void {
- this._syncTagNameSetting.set(tag);
- this._manager.dispatchSyncEvent(this._registration.id, tag, true);
+ private sync(tag: string): void {
+ this.syncTagNameSetting.set(tag);
+ this.manager.dispatchSyncEvent(this.registration.id, tag, true);
}
- _periodicSync(tag: string): void {
- this._periodicSyncTagNameSetting.set(tag);
- this._manager.dispatchPeriodicSyncEvent(this._registration.id, tag);
+ private periodicSync(tag: string): void {
+ this.periodicSyncTagNameSetting.set(tag);
+ this.manager.dispatchPeriodicSyncEvent(this.registration.id, tag);
}
- _onClientInfo(element: Element, targetInfoResponse: Protocol.Target.GetTargetInfoResponse): void {
+ private onClientInfo(element: Element, targetInfoResponse: Protocol.Target.GetTargetInfoResponse): void {
const targetInfo = targetInfoResponse.targetInfo;
if (!targetInfo) {
return;
}
- this._clientInfoCache.set(targetInfo.targetId, targetInfo);
- this._updateClientInfo(element, targetInfo);
+ this.clientInfoCache.set(targetInfo.targetId, targetInfo);
+ this.updateClientInfo(element, targetInfo);
}
- _updateClientInfo(element: Element, targetInfo: Protocol.Target.TargetInfo): void {
+ private updateClientInfo(element: Element, targetInfo: Protocol.Target.TargetInfo): void {
if (targetInfo.type !== 'page' && targetInfo.type === 'iframe') {
const clientString = element.createChild('span', 'service-worker-client-string');
UI.UIUtils.createTextChild(clientString, i18nString(UIStrings.workerS, {PH1: targetInfo.url}));
@@ -795,32 +797,32 @@
element.removeChildren();
const clientString = element.createChild('span', 'service-worker-client-string');
UI.UIUtils.createTextChild(clientString, targetInfo.url);
- this._createLink(
- element, i18nString(UIStrings.focus), this._activateTarget.bind(this, targetInfo.targetId),
+ this.createLink(
+ element, i18nString(UIStrings.focus), this.activateTarget.bind(this, targetInfo.targetId),
'service-worker-client-focus-link');
}
- _activateTarget(targetId: Protocol.Target.TargetID): void {
- this._manager.target().targetAgent().invoke_activateTarget({targetId});
+ private activateTarget(targetId: Protocol.Target.TargetID): void {
+ this.manager.target().targetAgent().invoke_activateTarget({targetId});
}
- _startButtonClicked(): void {
- this._manager.startWorker(this._registration.scopeURL);
+ private startButtonClicked(): void {
+ this.manager.startWorker(this.registration.scopeURL);
}
- _skipButtonClicked(): void {
- this._manager.skipWaiting(this._registration.scopeURL);
+ private skipButtonClicked(): void {
+ this.manager.skipWaiting(this.registration.scopeURL);
}
- _stopButtonClicked(versionId: string): void {
- this._manager.stopWorker(versionId);
+ private stopButtonClicked(versionId: string): void {
+ this.manager.stopWorker(versionId);
}
- _inspectButtonClicked(versionId: string): void {
- this._manager.inspectWorker(versionId);
+ private inspectButtonClicked(versionId: string): void {
+ this.manager.inspectWorker(versionId);
}
- _wrapWidget(container: Element): Element {
+ private wrapWidget(container: Element): Element {
const shadowRoot =
UI.Utils.createShadowRootWithCoreStyles(container, {cssFile: undefined, delegatesFocus: undefined});
UI.Utils.appendStyle(shadowRoot, 'panels/application/serviceWorkersView.css');
diff --git a/front_end/panels/application/StorageItemsView.ts b/front_end/panels/application/StorageItemsView.ts
index 5f5561a..f80782e 100644
--- a/front_end/panels/application/StorageItemsView.ts
+++ b/front_end/panels/application/StorageItemsView.ts
@@ -34,75 +34,75 @@
const str_ = i18n.i18n.registerUIStrings('panels/application/StorageItemsView.ts', UIStrings);
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
export class StorageItemsView extends UI.Widget.VBox {
- _filterRegex: RegExp|null;
- _refreshButton: UI.Toolbar.ToolbarButton;
- _mainToolbar: UI.Toolbar.Toolbar;
- _filterItem: UI.Toolbar.ToolbarInput;
- _deleteAllButton: UI.Toolbar.ToolbarButton;
- _deleteSelectedButton: UI.Toolbar.ToolbarButton;
+ private filterRegex: RegExp|null;
+ private readonly refreshButton: UI.Toolbar.ToolbarButton;
+ private readonly mainToolbar: UI.Toolbar.Toolbar;
+ private readonly filterItem: UI.Toolbar.ToolbarInput;
+ private readonly deleteAllButton: UI.Toolbar.ToolbarButton;
+ private readonly deleteSelectedButton: UI.Toolbar.ToolbarButton;
constructor(_title: string, _filterName: string) {
super(false);
- this._filterRegex = null;
+ this.filterRegex = null;
- this._refreshButton = this._addButton(i18nString(UIStrings.refresh), 'largeicon-refresh', () => {
+ this.refreshButton = this.addButton(i18nString(UIStrings.refresh), 'largeicon-refresh', () => {
this.refreshItems();
UI.ARIAUtils.alert(i18nString(UIStrings.refreshedStatus));
});
- this._mainToolbar = new UI.Toolbar.Toolbar('top-resources-toolbar', this.element);
+ this.mainToolbar = new UI.Toolbar.Toolbar('top-resources-toolbar', this.element);
- this._filterItem = new UI.Toolbar.ToolbarInput(i18nString(UIStrings.filter), '', 0.4);
- this._filterItem.addEventListener(UI.Toolbar.ToolbarInput.Event.TextChanged, this._filterChanged, this);
+ this.filterItem = new UI.Toolbar.ToolbarInput(i18nString(UIStrings.filter), '', 0.4);
+ this.filterItem.addEventListener(UI.Toolbar.ToolbarInput.Event.TextChanged, this.filterChanged, this);
const toolbarSeparator = new UI.Toolbar.ToolbarSeparator();
- this._deleteAllButton = this._addButton(i18nString(UIStrings.clearAll), 'largeicon-clear', this.deleteAllItems);
- this._deleteSelectedButton =
- this._addButton(i18nString(UIStrings.deleteSelected), 'largeicon-delete', this.deleteSelectedItem);
- this._deleteAllButton.element.id = 'storage-items-delete-all';
+ this.deleteAllButton = this.addButton(i18nString(UIStrings.clearAll), 'largeicon-clear', this.deleteAllItems);
+ this.deleteSelectedButton =
+ this.addButton(i18nString(UIStrings.deleteSelected), 'largeicon-delete', this.deleteSelectedItem);
+ this.deleteAllButton.element.id = 'storage-items-delete-all';
const toolbarItems =
- [this._refreshButton, this._filterItem, toolbarSeparator, this._deleteAllButton, this._deleteSelectedButton];
+ [this.refreshButton, this.filterItem, toolbarSeparator, this.deleteAllButton, this.deleteSelectedButton];
for (const item of toolbarItems) {
- this._mainToolbar.appendToolbarItem(item);
+ this.mainToolbar.appendToolbarItem(item);
}
}
setDeleteAllTitle(title: string): void {
- this._deleteAllButton.setTitle(title);
+ this.deleteAllButton.setTitle(title);
}
setDeleteAllGlyph(glyph: string): void {
- this._deleteAllButton.setGlyph(glyph);
+ this.deleteAllButton.setGlyph(glyph);
}
appendToolbarItem(item: UI.Toolbar.ToolbarItem): void {
- this._mainToolbar.appendToolbarItem(item);
+ this.mainToolbar.appendToolbarItem(item);
}
- _addButton(label: string, glyph: string, callback: (arg0: Common.EventTarget.EventTargetEvent) => void):
+ private addButton(label: string, glyph: string, callback: (arg0: Common.EventTarget.EventTargetEvent) => void):
UI.Toolbar.ToolbarButton {
const button = new UI.Toolbar.ToolbarButton(label, glyph);
button.addEventListener(UI.Toolbar.ToolbarButton.Events.Click, callback, this);
return button;
}
- _filterChanged(event: Common.EventTarget.EventTargetEvent): void {
+ private filterChanged(event: Common.EventTarget.EventTargetEvent): void {
const text = (event.data as string | null);
- this._filterRegex = text ? new RegExp(Platform.StringUtilities.escapeForRegExp(text), 'i') : null;
+ this.filterRegex = text ? new RegExp(Platform.StringUtilities.escapeForRegExp(text), 'i') : null;
this.refreshItems();
}
filter<T>(items: T[], keyFunction: (arg0: T) => string): T[] {
- if (this._filterRegex) {
- const regExp = this._filterRegex;
+ if (this.filterRegex) {
+ const regExp = this.filterRegex;
return items.filter(item => regExp.test(keyFunction(item)));
}
return items;
}
hasFilter(): boolean {
- return Boolean(this._filterRegex);
+ return Boolean(this.filterRegex);
}
wasShown(): void {
@@ -110,19 +110,19 @@
}
setCanDeleteAll(enabled: boolean): void {
- this._deleteAllButton.setEnabled(enabled);
+ this.deleteAllButton.setEnabled(enabled);
}
setCanDeleteSelected(enabled: boolean): void {
- this._deleteSelectedButton.setEnabled(enabled);
+ this.deleteSelectedButton.setEnabled(enabled);
}
setCanRefresh(enabled: boolean): void {
- this._refreshButton.setEnabled(enabled);
+ this.refreshButton.setEnabled(enabled);
}
setCanFilter(enabled: boolean): void {
- this._filterItem.setEnabled(enabled);
+ this.filterItem.setEnabled(enabled);
}
deleteAllItems(): void {