[global] Remaps self.Common.settings
This CL changes references to self.Common.settings (the global
instance of SDK.Common.Settings) over to
Common.Settings.Settings.instance(). To keep both TypeScript and
Closure happy we must make a method on the Settings class itself,
since it only allows private constructors to be accessed by static
methods on the class.
Bug: 1058320
Change-Id: I04afc8caf64acf29cdda13ef03ad05cfff4786a1
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2091450
Commit-Queue: Paul Lewis <[email protected]>
Reviewed-by: Tim van der Lippe <[email protected]>
diff --git a/.eslintignore b/.eslintignore
index c1e1404..b817e3d 100644
--- a/.eslintignore
+++ b/.eslintignore
@@ -18,4 +18,5 @@
test/shared/**/*.js
test/**/fixtures/
scripts/jsdoc_validator/tests/
-scripts/migration/**/*.js
\ No newline at end of file
+scripts/migration/**/*.js
+node_modules
diff --git a/front_end/bindings/BlackboxManager.js b/front_end/bindings/BlackboxManager.js
index 549af69..fa4ccc7 100644
--- a/front_end/bindings/BlackboxManager.js
+++ b/front_end/bindings/BlackboxManager.js
@@ -22,8 +22,12 @@
SDK.SDKModel.TargetManager.instance().addModelListener(
SDK.DebuggerModel.DebuggerModel, SDK.DebuggerModel.Events.GlobalObjectCleared,
this._clearCacheIfNeeded.bind(this), this);
- self.Common.settings.moduleSetting('skipStackFramesPattern').addChangeListener(this._patternChanged.bind(this));
- self.Common.settings.moduleSetting('skipContentScripts').addChangeListener(this._patternChanged.bind(this));
+ Common.Settings.Settings.instance()
+ .moduleSetting('skipStackFramesPattern')
+ .addChangeListener(this._patternChanged.bind(this));
+ Common.Settings.Settings.instance()
+ .moduleSetting('skipContentScripts')
+ .addChangeListener(this._patternChanged.bind(this));
/** @type {!Set<function()>} */
this._listeners = new Set();
@@ -81,7 +85,7 @@
* @return {!Promise<boolean>}
*/
_setBlackboxPatterns(debuggerModel) {
- const regexPatterns = self.Common.settings.moduleSetting('skipStackFramesPattern').getAsArray();
+ const regexPatterns = Common.Settings.Settings.instance().moduleSetting('skipStackFramesPattern').getAsArray();
const patterns = /** @type {!Array<string>} */ ([]);
for (const item of regexPatterns) {
if (!item.disabled && item.pattern) {
@@ -98,7 +102,7 @@
isBlackboxedUISourceCode(uiSourceCode) {
const projectType = uiSourceCode.project().type();
const isContentScript = projectType === Workspace.Workspace.projectTypes.ContentScripts;
- if (isContentScript && self.Common.settings.moduleSetting('skipContentScripts').get()) {
+ if (isContentScript && Common.Settings.Settings.instance().moduleSetting('skipContentScripts').get()) {
return true;
}
const url = this._uiSourceCodeURL(uiSourceCode);
@@ -114,10 +118,10 @@
if (this._isBlackboxedURLCache.has(url)) {
return !!this._isBlackboxedURLCache.get(url);
}
- if (isContentScript && self.Common.settings.moduleSetting('skipContentScripts').get()) {
+ if (isContentScript && Common.Settings.Settings.instance().moduleSetting('skipContentScripts').get()) {
return true;
}
- const regex = self.Common.settings.moduleSetting('skipStackFramesPattern').asRegExp();
+ const regex = Common.Settings.Settings.instance().moduleSetting('skipStackFramesPattern').asRegExp();
const isBlackboxed = (regex && regex.test(url)) || false;
this._isBlackboxedURLCache.set(url, isBlackboxed);
return isBlackboxed;
@@ -234,18 +238,18 @@
}
blackboxContentScripts() {
- self.Common.settings.moduleSetting('skipContentScripts').set(true);
+ Common.Settings.Settings.instance().moduleSetting('skipContentScripts').set(true);
}
unblackboxContentScripts() {
- self.Common.settings.moduleSetting('skipContentScripts').set(false);
+ Common.Settings.Settings.instance().moduleSetting('skipContentScripts').set(false);
}
/**
* @param {string} url
*/
_blackboxURL(url) {
- const regexPatterns = self.Common.settings.moduleSetting('skipStackFramesPattern').getAsArray();
+ const regexPatterns = Common.Settings.Settings.instance().moduleSetting('skipStackFramesPattern').getAsArray();
const regexValue = this._urlToRegExpString(url);
if (!regexValue) {
return;
@@ -262,14 +266,14 @@
if (!found) {
regexPatterns.push({pattern: regexValue});
}
- self.Common.settings.moduleSetting('skipStackFramesPattern').setAsArray(regexPatterns);
+ Common.Settings.Settings.instance().moduleSetting('skipStackFramesPattern').setAsArray(regexPatterns);
}
/**
* @param {string} url
*/
_unblackboxURL(url) {
- let regexPatterns = self.Common.settings.moduleSetting('skipStackFramesPattern').getAsArray();
+ let regexPatterns = Common.Settings.Settings.instance().moduleSetting('skipStackFramesPattern').getAsArray();
const regexValue = self.Bindings.blackboxManager._urlToRegExpString(url);
if (!regexValue) {
return;
@@ -290,7 +294,7 @@
} catch (e) {
}
}
- self.Common.settings.moduleSetting('skipStackFramesPattern').setAsArray(regexPatterns);
+ Common.Settings.Settings.instance().moduleSetting('skipStackFramesPattern').setAsArray(regexPatterns);
}
async _patternChanged() {
diff --git a/front_end/bindings/BreakpointManager.js b/front_end/bindings/BreakpointManager.js
index 1b02ceb..79204a5 100644
--- a/front_end/bindings/BreakpointManager.js
+++ b/front_end/bindings/BreakpointManager.js
@@ -806,7 +806,7 @@
class Storage {
constructor() {
- this._setting = self.Common.settings.createLocalSetting('breakpoints', []);
+ this._setting = Common.Settings.Settings.instance().createLocalSetting('breakpoints', []);
/** @type {!Map<string, !Storage.Item>} */
this._breakpoints = new Map();
const items = /** @type {!Array<!Storage.Item>} */ (this._setting.get());
diff --git a/front_end/color_picker/Spectrum.js b/front_end/color_picker/Spectrum.js
index fb356a7..e149809 100644
--- a/front_end/color_picker/Spectrum.js
+++ b/front_end/color_picker/Spectrum.js
@@ -647,13 +647,15 @@
this._palettes.set(MaterialPalette.title, MaterialPalette);
/** @type {!Palette} */
const defaultCustomPalette = {title: 'Custom', colors: [], colorNames: [], mutable: true};
- this._customPaletteSetting = self.Common.settings.createSetting('customColorPalette', defaultCustomPalette);
+ this._customPaletteSetting =
+ Common.Settings.Settings.instance().createSetting('customColorPalette', defaultCustomPalette);
const customPalette = this._customPaletteSetting.get();
// Fallback case for custom palettes created pre-m67
customPalette.colorNames = customPalette.colorNames || [];
this._palettes.set(customPalette.title, customPalette);
- this._selectedColorPalette = self.Common.settings.createSetting('selectedColorPalette', GeneratedPaletteTitle);
+ this._selectedColorPalette =
+ Common.Settings.Settings.instance().createSetting('selectedColorPalette', GeneratedPaletteTitle);
const palette = this._palettes.get(this._selectedColorPalette.get());
if (palette) {
this._showPalette(palette, true);
diff --git a/front_end/common/Settings.js b/front_end/common/Settings.js
index ec638d7..2702a55 100644
--- a/front_end/common/Settings.js
+++ b/front_end/common/Settings.js
@@ -34,10 +34,16 @@
import {Console} from './Console.js';
/**
+ * @type {!Settings}
+ */
+let settingsInstance;
+
+/**
* @unrestricted
*/
export class Settings {
/**
+ * @private
* @param {!SettingsStorage} globalStorage
* @param {!SettingsStorage} localStorage
*/
@@ -54,6 +60,26 @@
self.runtime.extensions('setting').forEach(this._registerModuleSetting.bind(this));
}
+ static hasInstance() {
+ return typeof settingsInstance !== 'undefined';
+ }
+
+ /**
+ * @param {{forceNew: ?boolean, globalStorage: ?SettingsStorage, localStorage: ?SettingsStorage}} opts
+ */
+ static instance(opts = {forceNew: null, globalStorage: null, localStorage: null}) {
+ const {forceNew, globalStorage, localStorage} = opts;
+ if (!settingsInstance || forceNew) {
+ if (!globalStorage || !localStorage) {
+ throw new Error(`Unable to create settings: global and local storage must be provided: ${new Error().stack}`);
+ }
+
+ settingsInstance = new Settings(globalStorage, localStorage);
+ }
+
+ return settingsInstance;
+ }
+
/**
* @param {!Root.Runtime.Extension} extension
*/
@@ -155,7 +181,7 @@
clearAll() {
this._globalStorage.removeAll();
this._localStorage.removeAll();
- const versionSetting = self.Common.settings.createSetting(VersionController._currentVersionName, 0);
+ const versionSetting = Settings.instance().createSetting(VersionController._currentVersionName, 0);
versionSetting.set(VersionController.currentVersion);
}
@@ -481,7 +507,7 @@
updateVersion() {
const localStorageVersion = window.localStorage ? window.localStorage[VersionController._currentVersionName] : 0;
- const versionSetting = self.Common.settings.createSetting(VersionController._currentVersionName, 0);
+ const versionSetting = Settings.instance().createSetting(VersionController._currentVersionName, 0);
const currentVersion = VersionController.currentVersion;
const oldVersion = versionSetting.get() || parseInt(localStorageVersion || '0', 10);
if (oldVersion === 0) {
@@ -509,20 +535,20 @@
}
_updateVersionFrom0To1() {
- this._clearBreakpointsWhenTooMany(self.Common.settings.createLocalSetting('breakpoints', []), 500000);
+ this._clearBreakpointsWhenTooMany(Settings.instance().createLocalSetting('breakpoints', []), 500000);
}
_updateVersionFrom1To2() {
- self.Common.settings.createSetting('previouslyViewedFiles', []).set([]);
+ Settings.instance().createSetting('previouslyViewedFiles', []).set([]);
}
_updateVersionFrom2To3() {
- self.Common.settings.createSetting('fileSystemMapping', {}).set({});
- self.Common.settings.createSetting('fileMappingEntries', []).remove();
+ Settings.instance().createSetting('fileSystemMapping', {}).set({});
+ Settings.instance().createSetting('fileMappingEntries', []).remove();
}
_updateVersionFrom3To4() {
- const advancedMode = self.Common.settings.createSetting('showHeaSnapshotObjectsHiddenProperties', false);
+ const advancedMode = Settings.instance().createSetting('showHeaSnapshotObjectsHiddenProperties', false);
moduleSetting('showAdvancedHeapSnapshotProperties').set(advancedMode.get());
advancedMode.remove();
}
@@ -555,14 +581,14 @@
const oldNameH = oldName + 'H';
let newValue = null;
- const oldSetting = self.Common.settings.createSetting(oldName, empty);
+ const oldSetting = Settings.instance().createSetting(oldName, empty);
if (oldSetting.get() !== empty) {
newValue = newValue || {};
newValue.vertical = {};
newValue.vertical.size = oldSetting.get();
oldSetting.remove();
}
- const oldSettingH = self.Common.settings.createSetting(oldNameH, empty);
+ const oldSettingH = Settings.instance().createSetting(oldNameH, empty);
if (oldSettingH.get() !== empty) {
newValue = newValue || {};
newValue.horizontal = {};
@@ -570,7 +596,7 @@
oldSettingH.remove();
}
if (newValue) {
- self.Common.settings.createSetting(newName, {}).set(newValue);
+ Settings.instance().createSetting(newName, {}).set(newValue);
}
}
}
@@ -583,7 +609,7 @@
};
for (const oldName in settingNames) {
- const oldSetting = self.Common.settings.createSetting(oldName, null);
+ const oldSetting = Settings.instance().createSetting(oldName, null);
if (oldSetting.get() === null) {
oldSetting.remove();
continue;
@@ -595,7 +621,7 @@
oldSetting.remove();
const showMode = hidden ? 'OnlyMain' : 'Both';
- const newSetting = self.Common.settings.createSetting(newName, {});
+ const newSetting = Settings.instance().createSetting(newName, {});
const newValue = newSetting.get() || {};
newValue.vertical = newValue.vertical || {};
newValue.vertical.showMode = showMode;
@@ -615,7 +641,7 @@
const empty = {};
for (const name in settingNames) {
- const setting = self.Common.settings.createSetting(name, empty);
+ const setting = Settings.instance().createSetting(name, empty);
const value = setting.get();
if (value === empty) {
continue;
@@ -638,7 +664,7 @@
const settingNames = ['skipStackFramesPattern', 'workspaceFolderExcludePattern'];
for (let i = 0; i < settingNames.length; ++i) {
- const setting = self.Common.settings.createSetting(settingNames[i], '');
+ const setting = Settings.instance().createSetting(settingNames[i], '');
let value = setting.get();
if (!value) {
return;
@@ -670,7 +696,7 @@
_updateVersionFrom10To11() {
const oldSettingName = 'customDevicePresets';
const newSettingName = 'customEmulatedDeviceList';
- const oldSetting = self.Common.settings.createSetting(oldSettingName, undefined);
+ const oldSetting = Settings.instance().createSetting(oldSettingName, undefined);
const list = oldSetting.get();
if (!Array.isArray(list)) {
return;
@@ -699,7 +725,7 @@
newList.push(device);
}
if (newList.length) {
- self.Common.settings.createSetting(newSettingName, []).set(newList);
+ Settings.instance().createSetting(newSettingName, []).set(newList);
}
oldSetting.remove();
}
@@ -710,16 +736,16 @@
_updateVersionFrom12To13() {
this._migrateSettingsFromLocalStorage();
- self.Common.settings.createSetting('timelineOverviewMode', '').remove();
+ Settings.instance().createSetting('timelineOverviewMode', '').remove();
}
_updateVersionFrom13To14() {
const defaultValue = {'throughput': -1, 'latency': 0};
- self.Common.settings.createSetting('networkConditions', defaultValue).set(defaultValue);
+ Settings.instance().createSetting('networkConditions', defaultValue).set(defaultValue);
}
_updateVersionFrom14To15() {
- const setting = self.Common.settings.createLocalSetting('workspaceExcludedFolders', {});
+ const setting = Settings.instance().createLocalSetting('workspaceExcludedFolders', {});
const oldValue = setting.get();
const newValue = {};
for (const fileSystemPath in oldValue) {
@@ -732,7 +758,7 @@
}
_updateVersionFrom15To16() {
- const setting = self.Common.settings.createSetting('InspectorView.panelOrder', {});
+ const setting = Settings.instance().createSetting('InspectorView.panelOrder', {});
const tabOrders = setting.get();
for (const key of Object.keys(tabOrders)) {
tabOrders[key] = (tabOrders[key] + 1) * 10;
@@ -741,7 +767,7 @@
}
_updateVersionFrom16To17() {
- const setting = self.Common.settings.createSetting('networkConditionsCustomProfiles', []);
+ const setting = Settings.instance().createSetting('networkConditionsCustomProfiles', []);
const oldValue = setting.get();
const newValue = [];
if (Array.isArray(oldValue)) {
@@ -760,7 +786,7 @@
}
_updateVersionFrom17To18() {
- const setting = self.Common.settings.createLocalSetting('workspaceExcludedFolders', {});
+ const setting = Settings.instance().createLocalSetting('workspaceExcludedFolders', {});
const oldValue = setting.get();
const newValue = {};
for (const oldKey in oldValue) {
@@ -779,7 +805,7 @@
_updateVersionFrom18To19() {
const defaultColumns = {status: true, type: true, initiator: true, size: true, time: true};
- const visibleColumnSettings = self.Common.settings.createSetting('networkLogColumnsVisibility', defaultColumns);
+ const visibleColumnSettings = Settings.instance().createSetting('networkLogColumnsVisibility', defaultColumns);
const visibleColumns = visibleColumnSettings.get();
visibleColumns.name = true;
visibleColumns.timeline = true;
@@ -791,20 +817,20 @@
}
configs[columnId.toLowerCase()] = {visible: visibleColumns[columnId]};
}
- const newSetting = self.Common.settings.createSetting('networkLogColumns', {});
+ const newSetting = Settings.instance().createSetting('networkLogColumns', {});
newSetting.set(configs);
visibleColumnSettings.remove();
}
_updateVersionFrom19To20() {
- const oldSetting = self.Common.settings.createSetting('InspectorView.panelOrder', {});
- const newSetting = self.Common.settings.createSetting('panel-tabOrder', {});
+ const oldSetting = Settings.instance().createSetting('InspectorView.panelOrder', {});
+ const newSetting = Settings.instance().createSetting('panel-tabOrder', {});
newSetting.set(oldSetting.get());
oldSetting.remove();
}
_updateVersionFrom20To21() {
- const networkColumns = self.Common.settings.createSetting('networkLogColumns', {});
+ const networkColumns = Settings.instance().createSetting('networkLogColumns', {});
const columns = /** @type {!Object} */ (networkColumns.get());
delete columns['timeline'];
delete columns['waterfall'];
@@ -812,7 +838,7 @@
}
_updateVersionFrom21To22() {
- const breakpointsSetting = self.Common.settings.createLocalSetting('breakpoints', []);
+ const breakpointsSetting = Settings.instance().createLocalSetting('breakpoints', []);
const breakpoints = breakpointsSetting.get();
for (const breakpoint of breakpoints) {
breakpoint['url'] = breakpoint['sourceFileId'];
@@ -826,26 +852,26 @@
}
_updateVersionFrom23To24() {
- const oldSetting = self.Common.settings.createSetting('searchInContentScripts', false);
- const newSetting = self.Common.settings.createSetting('searchInAnonymousAndContentScripts', false);
+ const oldSetting = Settings.instance().createSetting('searchInContentScripts', false);
+ const newSetting = Settings.instance().createSetting('searchInAnonymousAndContentScripts', false);
newSetting.set(oldSetting.get());
oldSetting.remove();
}
_updateVersionFrom24To25() {
const defaultColumns = {status: true, type: true, initiator: true, size: true, time: true};
- const networkLogColumnsSetting = self.Common.settings.createSetting('networkLogColumns', defaultColumns);
+ const networkLogColumnsSetting = Settings.instance().createSetting('networkLogColumns', defaultColumns);
const columns = networkLogColumnsSetting.get();
delete columns.product;
networkLogColumnsSetting.set(columns);
}
_updateVersionFrom25To26() {
- const oldSetting = self.Common.settings.createSetting('messageURLFilters', {});
+ const oldSetting = Settings.instance().createSetting('messageURLFilters', {});
const urls = Object.keys(oldSetting.get());
const textFilter = urls.map(url => `-url:${url}`).join(' ');
if (textFilter) {
- const textFilterSetting = self.Common.settings.createSetting('console.textFilter', '');
+ const textFilterSetting = Settings.instance().createSetting('console.textFilter', '');
const suffix = textFilterSetting.get() ? ` ${textFilterSetting.get()}` : '';
textFilterSetting.set(`${textFilter}${suffix}`);
}
@@ -859,7 +885,7 @@
* @param {string} to
*/
function renameKeyInObjectSetting(settingName, from, to) {
- const setting = self.Common.settings.createSetting(settingName, {});
+ const setting = Settings.instance().createSetting(settingName, {});
const value = setting.get();
if (from in value) {
value[to] = value[from];
@@ -874,7 +900,7 @@
* @param {string} to
*/
function renameInStringSetting(settingName, from, to) {
- const setting = self.Common.settings.createSetting(settingName, '');
+ const setting = Settings.instance().createSetting(settingName, '');
const value = setting.get();
if (value === from) {
setting.set(to);
@@ -887,7 +913,7 @@
}
_updateVersionFrom27To28() {
- const setting = self.Common.settings.createSetting('uiTheme', 'systemPreferred');
+ const setting = Settings.instance().createSetting('uiTheme', 'systemPreferred');
if (setting.get() === 'default') {
setting.set('systemPreferred');
}
@@ -900,7 +926,7 @@
* @param {string} to
*/
function renameKeyInObjectSetting(settingName, from, to) {
- const setting = self.Common.settings.createSetting(settingName, {});
+ const setting = Settings.instance().createSetting(settingName, {});
const value = setting.get();
if (from in value) {
value[to] = value[from];
@@ -915,7 +941,7 @@
* @param {string} to
*/
function renameInStringSetting(settingName, from, to) {
- const setting = self.Common.settings.createSetting(settingName, '');
+ const setting = Settings.instance().createSetting(settingName, '');
const value = setting.get();
if (value === from) {
setting.set(to);
@@ -944,7 +970,7 @@
}
const value = window.localStorage[key];
window.localStorage.removeItem(key);
- self.Common.settings._globalStorage[key] = value;
+ Settings.instance()._globalStorage[key] = value;
}
}
@@ -975,7 +1001,7 @@
* @return {!Setting}
*/
export function moduleSetting(settingName) {
- return self.Common.settings.moduleSetting(settingName);
+ return Settings.instance().moduleSetting(settingName);
}
/**
@@ -983,7 +1009,7 @@
* @return {!Setting}
*/
export function settingForTest(settingName) {
- return self.Common.settings.settingForTest(settingName);
+ return Settings.instance().settingForTest(settingName);
}
/**
@@ -993,7 +1019,7 @@
export function detectColorFormat(color) {
const cf = Format;
let format;
- const formatSetting = self.Common.settings.moduleSetting('colorFormat').get();
+ const formatSetting = Settings.instance().moduleSetting('colorFormat').get();
if (formatSetting === cf.Original) {
format = cf.Original;
} else if (formatSetting === cf.RGB) {
diff --git a/front_end/common/UIString.js b/front_end/common/UIString.js
index fdd94dd..bec475a 100644
--- a/front_end/common/UIString.js
+++ b/front_end/common/UIString.js
@@ -115,9 +115,10 @@
/**
* @param {!ITemplateArray|string} strings
+ * @param {...*} vararg
* @return {string}
*/
-export function ls(strings) {
+export function ls(strings, ...vararg) {
if (typeof strings === 'string') {
return strings;
}
@@ -127,5 +128,5 @@
_substitutionStrings.set(strings, substitutionString);
}
// @ts-ignore TS gets confused with the arguments slicing
- return UIString(substitutionString, ...Array.prototype.slice.call(arguments, 1));
+ return UIString(substitutionString, ...vararg);
}
diff --git a/front_end/common/common-legacy.js b/front_end/common/common-legacy.js
index e36e050..d12ddaf 100644
--- a/front_end/common/common-legacy.js
+++ b/front_end/common/common-legacy.js
@@ -221,7 +221,7 @@
/**
* @type {!Common.Settings}
*/
-self.Common.settings;
+Common.settings;
/**
* @param {!ITemplateArray|string} strings
diff --git a/front_end/common/common.js b/front_end/common/common.js
index 780ea2b..502b8e1 100644
--- a/front_end/common/common.js
+++ b/front_end/common/common.js
@@ -30,6 +30,8 @@
import * as UIString from './UIString.js';
import * as Worker from './Worker.js';
+export const ls = UIString.ls;
+
/**
* @type {!Settings.Settings}
*/
diff --git a/front_end/components/DockController.js b/front_end/components/DockController.js
index 9ce12d3..804d29d 100644
--- a/front_end/components/DockController.js
+++ b/front_end/components/DockController.js
@@ -56,9 +56,9 @@
}
this._states = [State.DockedToRight, State.DockedToBottom, State.DockedToLeft, State.Undocked];
- this._currentDockStateSetting = self.Common.settings.moduleSetting('currentDockState');
+ this._currentDockStateSetting = Common.Settings.Settings.instance().moduleSetting('currentDockState');
this._currentDockStateSetting.addChangeListener(this._dockSideChanged, this);
- this._lastDockStateSetting = self.Common.settings.createSetting('lastDockState', 'bottom');
+ this._lastDockStateSetting = Common.Settings.Settings.instance().createSetting('lastDockState', 'bottom');
if (this._states.indexOf(this._currentDockStateSetting.get()) === -1) {
this._currentDockStateSetting.set('right');
}
diff --git a/front_end/components/Linkifier.js b/front_end/components/Linkifier.js
index 1546864..f809f5b 100644
--- a/front_end/components/Linkifier.js
+++ b/front_end/components/Linkifier.js
@@ -593,7 +593,8 @@
*/
static _linkHandlerSetting() {
if (!Linkifier._linkHandlerSettingInstance) {
- Linkifier._linkHandlerSettingInstance = self.Common.settings.createSetting('openLinkHandler', ls`auto`);
+ Linkifier._linkHandlerSettingInstance =
+ Common.Settings.Settings.instance().createSetting('openLinkHandler', ls`auto`);
}
return Linkifier._linkHandlerSettingInstance;
}
diff --git a/front_end/console/ConsolePinPane.js b/front_end/console/ConsolePinPane.js
index 1aa4b25..65ff11a 100644
--- a/front_end/console/ConsolePinPane.js
+++ b/front_end/console/ConsolePinPane.js
@@ -24,7 +24,7 @@
/** @type {!Set<!ConsolePin>} */
this._pins = new Set();
- this._pinsSetting = self.Common.settings.createLocalSetting('consolePins', []);
+ this._pinsSetting = Common.Settings.Settings.instance().createLocalSetting('consolePins', []);
for (const expression of this._pinsSetting.get()) {
this.addPin(expression);
}
diff --git a/front_end/console/ConsolePrompt.js b/front_end/console/ConsolePrompt.js
index a5d2470..feb3101 100644
--- a/front_end/console/ConsolePrompt.js
+++ b/front_end/console/ConsolePrompt.js
@@ -35,7 +35,7 @@
this.element.appendChild(this._promptIcon);
this._iconThrottler = new Common.Throttler.Throttler(0);
- this._eagerEvalSetting = self.Common.settings.moduleSetting('consoleEagerEval');
+ this._eagerEvalSetting = Common.Settings.Settings.instance().moduleSetting('consoleEagerEval');
this._eagerEvalSetting.addChangeListener(this._eagerSettingChanged.bind(this));
this._eagerPreviewElement.classList.toggle('hidden', !this._eagerEvalSetting.get());
diff --git a/front_end/console/ConsoleSidebar.js b/front_end/console/ConsoleSidebar.js
index 0ab6bfc..b5583c6 100644
--- a/front_end/console/ConsoleSidebar.js
+++ b/front_end/console/ConsoleSidebar.js
@@ -24,7 +24,8 @@
this._selectedTreeElement = null;
/** @type {!Array<!FilterTreeElement>} */
this._treeElements = [];
- const selectedFilterSetting = self.Common.settings.createSetting('console.sidebarSelectedFilter', null);
+ const selectedFilterSetting =
+ Common.Settings.Settings.instance().createSetting('console.sidebarSelectedFilter', null);
const Levels = SDK.ConsoleModel.MessageLevel;
const consoleAPIParsedFilters =
diff --git a/front_end/console/ConsoleView.js b/front_end/console/ConsoleView.js
index e6a2399..5d07484 100644
--- a/front_end/console/ConsoleView.js
+++ b/front_end/console/ConsoleView.js
@@ -105,11 +105,12 @@
this._filterStatusText = new UI.Toolbar.ToolbarText();
this._filterStatusText.element.classList.add('dimmed');
- this._showSettingsPaneSetting = self.Common.settings.createSetting('consoleShowSettingsToolbar', false);
+ this._showSettingsPaneSetting =
+ Common.Settings.Settings.instance().createSetting('consoleShowSettingsToolbar', false);
this._showSettingsPaneButton = new UI.Toolbar.ToolbarSettingToggle(
this._showSettingsPaneSetting, 'largeicon-settings-gear', Common.UIString.UIString('Console settings'));
this._progressToolbarItem = new UI.Toolbar.ToolbarItem(createElement('div'));
- this._groupSimilarSetting = self.Common.settings.moduleSetting('consoleGroupSimilar');
+ this._groupSimilarSetting = Common.Settings.Settings.instance().moduleSetting('consoleGroupSimilar');
this._groupSimilarSetting.addChangeListener(() => this._updateMessageList());
const groupSimilarToggle =
new UI.Toolbar.ToolbarSettingCheckbox(this._groupSimilarSetting, Common.UIString.UIString('Group similar'));
@@ -134,7 +135,7 @@
rightToolbar.appendToolbarItem(this._showSettingsPaneButton);
this._preserveLogCheckbox = new UI.Toolbar.ToolbarSettingCheckbox(
- self.Common.settings.moduleSetting('preserveConsoleLog'),
+ Common.Settings.Settings.instance().moduleSetting('preserveConsoleLog'),
Common.UIString.UIString('Do not clear log on page reload / navigation'),
Common.UIString.UIString('Preserve log'));
this._hideNetworkMessagesCheckbox = new UI.Toolbar.ToolbarSettingCheckbox(
@@ -144,9 +145,10 @@
this._filter._filterByExecutionContextSetting,
Common.UIString.UIString('Only show messages from the current context (top, iframe, worker, extension)'),
Common.UIString.UIString('Selected context only'));
- const monitoringXHREnabledSetting = self.Common.settings.moduleSetting('monitoringXHREnabled');
- this._timestampsSetting = self.Common.settings.moduleSetting('consoleTimestampsEnabled');
- this._consoleHistoryAutocompleteSetting = self.Common.settings.moduleSetting('consoleHistoryAutocomplete');
+ const monitoringXHREnabledSetting = Common.Settings.Settings.instance().moduleSetting('monitoringXHREnabled');
+ this._timestampsSetting = Common.Settings.Settings.instance().moduleSetting('consoleTimestampsEnabled');
+ this._consoleHistoryAutocompleteSetting =
+ Common.Settings.Settings.instance().moduleSetting('consoleHistoryAutocomplete');
const settingsPane = new UI.Widget.HBox();
settingsPane.show(this._contentsElement);
@@ -165,12 +167,12 @@
settingsToolbarRight.makeVertical();
settingsToolbarRight.appendToolbarItem(new UI.Toolbar.ToolbarSettingCheckbox(monitoringXHREnabledSetting));
const eagerEvalCheckbox = new UI.Toolbar.ToolbarSettingCheckbox(
- self.Common.settings.moduleSetting('consoleEagerEval'), ls`Eagerly evaluate text in the prompt`);
+ Common.Settings.Settings.instance().moduleSetting('consoleEagerEval'), ls`Eagerly evaluate text in the prompt`);
settingsToolbarRight.appendToolbarItem(eagerEvalCheckbox);
settingsToolbarRight.appendToolbarItem(
new UI.Toolbar.ToolbarSettingCheckbox(this._consoleHistoryAutocompleteSetting));
- const userGestureCheckbox =
- new UI.Toolbar.ToolbarSettingCheckbox(self.Common.settings.moduleSetting('consoleUserActivationEval'));
+ const userGestureCheckbox = new UI.Toolbar.ToolbarSettingCheckbox(
+ Common.Settings.Settings.instance().moduleSetting('consoleUserActivationEval'));
settingsToolbarRight.appendToolbarItem(userGestureCheckbox);
if (!this._showSettingsPaneSetting.get()) {
settingsPane.element.classList.add('hidden');
@@ -227,7 +229,7 @@
this._consoleMessages = [];
this._viewMessageSymbol = Symbol('viewMessage');
- this._consoleHistorySetting = self.Common.settings.createLocalSetting('consoleHistory', []);
+ this._consoleHistorySetting = Common.Settings.Settings.instance().createLocalSetting('consoleHistory', []);
this._prompt = new ConsolePrompt();
this._prompt.show(this._promptElement);
@@ -1281,8 +1283,9 @@
this._filterChanged = filterChangedCallback;
this._messageLevelFiltersSetting = ConsoleViewFilter.levelFilterSetting();
- this._hideNetworkMessagesSetting = self.Common.settings.moduleSetting('hideNetworkMessages');
- this._filterByExecutionContextSetting = self.Common.settings.moduleSetting('selectedContextFilterEnabled');
+ this._hideNetworkMessagesSetting = Common.Settings.Settings.instance().moduleSetting('hideNetworkMessages');
+ this._filterByExecutionContextSetting =
+ Common.Settings.Settings.instance().moduleSetting('selectedContextFilterEnabled');
this._messageLevelFiltersSetting.addChangeListener(this._onFilterChanged.bind(this));
this._hideNetworkMessagesSetting.addChangeListener(this._onFilterChanged.bind(this));
@@ -1294,7 +1297,7 @@
this._textFilterUI = new UI.Toolbar.ToolbarInput(
Common.UIString.UIString('Filter'), '', 0.2, 1, Common.UIString.UIString('e.g. /event\\d/ -cdn url:a.com'),
this._suggestionBuilder.completions.bind(this._suggestionBuilder));
- this._textFilterSetting = self.Common.settings.createSetting('console.textFilter', '');
+ this._textFilterSetting = Common.Settings.Settings.instance().createSetting('console.textFilter', '');
if (this._textFilterSetting.get()) {
this._textFilterUI.setValue(this._textFilterSetting.get());
}
@@ -1345,7 +1348,8 @@
* @return {!Common.Settings.Setting}
*/
static levelFilterSetting() {
- return self.Common.settings.createSetting('messageLevelFilters', ConsoleFilter.defaultLevelsFilterValue());
+ return Common.Settings.Settings.instance().createSetting(
+ 'messageLevelFilters', ConsoleFilter.defaultLevelsFilterValue());
}
_updateCurrentFilter() {
diff --git a/front_end/console/ConsoleViewMessage.js b/front_end/console/ConsoleViewMessage.js
index 534ebb6..1cf5ec6 100644
--- a/front_end/console/ConsoleViewMessage.js
+++ b/front_end/console/ConsoleViewMessage.js
@@ -231,7 +231,7 @@
break;
case SDK.ConsoleModel.MessageType.Clear:
messageElement = createElementWithClass('span', 'console-info');
- if (self.Common.settings.moduleSetting('preserveConsoleLog').get()) {
+ if (Common.Settings.Settings.instance().moduleSetting('preserveConsoleLog').get()) {
messageElement.textContent =
Common.UIString.UIString('console.clear() was prevented due to \'Preserve log\'');
} else {
@@ -1015,7 +1015,7 @@
return;
}
- if (self.Common.settings.moduleSetting('consoleTimestampsEnabled').get()) {
+ if (Common.Settings.Settings.instance().moduleSetting('consoleTimestampsEnabled').get()) {
if (!this._timestampElement) {
this._timestampElement = createElementWithClass('span', 'console-timestamp');
}
diff --git a/front_end/coverage/CoverageView.js b/front_end/coverage/CoverageView.js
index f3e9e0e..d53f9b7 100644
--- a/front_end/coverage/CoverageView.js
+++ b/front_end/coverage/CoverageView.js
@@ -115,7 +115,7 @@
toolbar.appendToolbarItem(this._filterByTypeComboBox);
toolbar.appendSeparator();
- this._showContentScriptsSetting = self.Common.settings.createSetting('showContentScripts', false);
+ this._showContentScriptsSetting = Common.Settings.Settings.instance().createSetting('showContentScripts', false);
this._showContentScriptsSetting.addChangeListener(this._onFilterChanged, this);
const contentScriptsCheckbox = new UI.Toolbar.ToolbarSettingCheckbox(
this._showContentScriptsSetting, Common.UIString.UIString('Include extension content scripts'),
diff --git a/front_end/data_grid/DataGrid.js b/front_end/data_grid/DataGrid.js
index 5078ced..a1e90f2 100644
--- a/front_end/data_grid/DataGrid.js
+++ b/front_end/data_grid/DataGrid.js
@@ -882,7 +882,8 @@
* @param {string} name
*/
setName(name) {
- this._columnWeightsSetting = self.Common.settings.createSetting('dataGrid-' + name + '-columnWeights', {});
+ this._columnWeightsSetting =
+ Common.Settings.Settings.instance().createSetting('dataGrid-' + name + '-columnWeights', {});
this._loadColumnWeights();
}
diff --git a/front_end/elements/ComputedStyleWidget.js b/front_end/elements/ComputedStyleWidget.js
index 550ec1d..0e7eb89 100644
--- a/front_end/elements/ComputedStyleWidget.js
+++ b/front_end/elements/ComputedStyleWidget.js
@@ -50,7 +50,7 @@
this._computedStyleModel.addEventListener(Events.ComputedStyleChanged, this.update, this);
this._showInheritedComputedStylePropertiesSetting =
- self.Common.settings.createSetting('showInheritedComputedStyleProperties', false);
+ Common.Settings.Settings.instance().createSetting('showInheritedComputedStyleProperties', false);
this._showInheritedComputedStylePropertiesSetting.addChangeListener(
this._showInheritedComputedStyleChanged.bind(this));
diff --git a/front_end/elements/ElementsPanel.js b/front_end/elements/ElementsPanel.js
index 4aa3eaf..80d2d10 100644
--- a/front_end/elements/ElementsPanel.js
+++ b/front_end/elements/ElementsPanel.js
@@ -76,10 +76,12 @@
this._contentElement.id = 'elements-content';
// FIXME: crbug.com/425984
- if (self.Common.settings.moduleSetting('domWordWrap').get()) {
+ if (Common.Settings.Settings.instance().moduleSetting('domWordWrap').get()) {
this._contentElement.classList.add('elements-wrap');
}
- self.Common.settings.moduleSetting('domWordWrap').addChangeListener(this._domWordWrapSettingChanged.bind(this));
+ Common.Settings.Settings.instance()
+ .moduleSetting('domWordWrap')
+ .addChangeListener(this._domWordWrapSettingChanged.bind(this));
crumbsContainer.id = 'elements-crumbs';
this._breadcrumbs = new ElementsBreadcrumbs();
@@ -90,7 +92,9 @@
this._computedStyleWidget = new ComputedStyleWidget();
this._metricsWidget = new MetricsSidebarPane();
- self.Common.settings.moduleSetting('sidebarPosition').addChangeListener(this._updateSidebarPosition.bind(this));
+ Common.Settings.Settings.instance()
+ .moduleSetting('sidebarPosition')
+ .addChangeListener(this._updateSidebarPosition.bind(this));
this._updateSidebarPosition();
/** @type {!Set.<!ElementsTreeOutline>} */
@@ -101,7 +105,9 @@
SDK.SDKModel.TargetManager.instance().addEventListener(
SDK.SDKModel.Events.NameChanged,
event => this._targetNameChanged(/** @type {!SDK.SDKModel.Target} */ (event.data)));
- self.Common.settings.moduleSetting('showUAShadowDOM').addChangeListener(this._showUAShadowDOMChanged.bind(this));
+ Common.Settings.Settings.instance()
+ .moduleSetting('showUAShadowDOM')
+ .addChangeListener(this._showUAShadowDOMChanged.bind(this));
SDK.SDKModel.TargetManager.instance().addModelListener(
SDK.DOMModel.DOMModel, SDK.DOMModel.Events.DocumentUpdated, this._documentUpdatedEvent, this);
self.Extensions.extensionServer.addEventListener(
@@ -156,7 +162,7 @@
let treeOutline = parentModel ? ElementsTreeOutline.forDOMModel(parentModel) : null;
if (!treeOutline) {
treeOutline = new ElementsTreeOutline(true, true);
- treeOutline.setWordWrap(self.Common.settings.moduleSetting('domWordWrap').get());
+ treeOutline.setWordWrap(Common.Settings.Settings.instance().moduleSetting('domWordWrap').get());
treeOutline.addEventListener(ElementsTreeOutline.Events.SelectedNodeChanged, this._selectedNodeChanged, this);
treeOutline.addEventListener(
ElementsTreeOutline.Events.ElementsTreeUpdated, this._updateBreadcrumbIfNeeded, this);
@@ -465,7 +471,7 @@
this._searchConfig = searchConfig;
- const showUAShadowDOM = self.Common.settings.moduleSetting('showUAShadowDOM').get();
+ const showUAShadowDOM = Common.Settings.Settings.instance().moduleSetting('showUAShadowDOM').get();
const domModels = SDK.SDKModel.TargetManager.instance().models(SDK.DOMModel.DOMModel);
const promises = domModels.map(domModel => domModel.performSearch(whitespaceTrimmedQuery, showUAShadowDOM));
Promise.all(promises).then(resultCountCallback.bind(this));
@@ -726,7 +732,9 @@
revealAndSelectNode(node, focus, omitHighlight) {
this._omitDefaultSelection = true;
- node = self.Common.settings.moduleSetting('showUAShadowDOM').get() ? node : this._leaveUserAgentShadowDOM(node);
+ node = Common.Settings.Settings.instance().moduleSetting('showUAShadowDOM').get() ?
+ node :
+ this._leaveUserAgentShadowDOM(node);
if (!omitHighlight) {
node.highlightForTwoSeconds();
}
@@ -810,7 +818,7 @@
} // We can't reparent extension iframes.
let splitMode;
- const position = self.Common.settings.moduleSetting('sidebarPosition').get();
+ const position = Common.Settings.Settings.instance().moduleSetting('sidebarPosition').get();
if (position === 'right' || (position === 'auto' && self.UI.inspectorView.element.offsetWidth > 680)) {
splitMode = _splitMode.Vertical;
} else if (self.UI.inspectorView.element.offsetWidth > 415) {
diff --git a/front_end/elements/ElementsTreeElement.js b/front_end/elements/ElementsTreeElement.js
index 4e9c628..059f3e6 100644
--- a/front_end/elements/ElementsTreeElement.js
+++ b/front_end/elements/ElementsTreeElement.js
@@ -89,7 +89,7 @@
*/
static visibleShadowRoots(node) {
let roots = node.shadowRoots();
- if (roots.length && !self.Common.settings.moduleSetting('showUAShadowDOM').get()) {
+ if (roots.length && !Common.Settings.Settings.instance().moduleSetting('showUAShadowDOM').get()) {
roots = roots.filter(filter);
}
@@ -873,7 +873,7 @@
function gotFactory(factory) {
const editor = factory.createEditor({
lineNumbers: false,
- lineWrapping: self.Common.settings.moduleSetting('domWordWrap').get(),
+ lineWrapping: Common.Settings.Settings.instance().moduleSetting('domWordWrap').get(),
mimeType: 'text/html',
autoHeight: false,
padBottom: false
diff --git a/front_end/elements/ElementsTreeElementHighlighter.js b/front_end/elements/ElementsTreeElementHighlighter.js
index ba277e9..42ae23e 100644
--- a/front_end/elements/ElementsTreeElementHighlighter.js
+++ b/front_end/elements/ElementsTreeElementHighlighter.js
@@ -31,7 +31,7 @@
* @param {!Common.EventTarget.EventTargetEvent} event
*/
_highlightNode(event) {
- if (!self.Common.settings.moduleSetting('highlightNodeOnHoverInOverlay').get()) {
+ if (!Common.Settings.Settings.instance().moduleSetting('highlightNodeOnHoverInOverlay').get()) {
return;
}
diff --git a/front_end/elements/ElementsTreeOutline.js b/front_end/elements/ElementsTreeOutline.js
index 0504fea..373eb52 100644
--- a/front_end/elements/ElementsTreeOutline.js
+++ b/front_end/elements/ElementsTreeOutline.js
@@ -97,7 +97,7 @@
/** @type {!Set<!ElementsTreeElement>} */
this._treeElementsBeingUpdated = new Set();
- this._showHTMLCommentsSetting = self.Common.settings.moduleSetting('showHTMLComments');
+ this._showHTMLCommentsSetting = Common.Settings.Settings.instance().moduleSetting('showHTMLComments');
this._showHTMLCommentsSetting.addChangeListener(this._onShowHTMLCommentsChange.bind(this));
this.useLightSelectionColor();
}
diff --git a/front_end/elements/EventListenersWidget.js b/front_end/elements/EventListenersWidget.js
index b2c7e01..0c1beb1 100644
--- a/front_end/elements/EventListenersWidget.js
+++ b/front_end/elements/EventListenersWidget.js
@@ -41,14 +41,15 @@
super();
this._toolbarItems = [];
- this._showForAncestorsSetting = self.Common.settings.moduleSetting('showEventListenersForAncestors');
+ this._showForAncestorsSetting = Common.Settings.Settings.instance().moduleSetting('showEventListenersForAncestors');
this._showForAncestorsSetting.addChangeListener(this.update.bind(this));
this._dispatchFilterBySetting =
- self.Common.settings.createSetting('eventListenerDispatchFilterType', DispatchFilterBy.All);
+ Common.Settings.Settings.instance().createSetting('eventListenerDispatchFilterType', DispatchFilterBy.All);
this._dispatchFilterBySetting.addChangeListener(this.update.bind(this));
- this._showFrameworkListenersSetting = self.Common.settings.createSetting('showFrameowkrListeners', true);
+ this._showFrameworkListenersSetting =
+ Common.Settings.Settings.instance().createSetting('showFrameowkrListeners', true);
this._showFrameworkListenersSetting.setTitle(Common.UIString.UIString('Framework listeners'));
this._showFrameworkListenersSetting.addChangeListener(this._showFrameworkListenersChanged.bind(this));
this._eventListenersView = new EventListeners.EventListenersView.EventListenersView(this.update.bind(this));
diff --git a/front_end/elements/InspectElementModeController.js b/front_end/elements/InspectElementModeController.js
index f4239eb..429f068 100644
--- a/front_end/elements/InspectElementModeController.js
+++ b/front_end/elements/InspectElementModeController.js
@@ -28,6 +28,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import * as Common from '../common/common.js';
import * as SDK from '../sdk/sdk.js';
import * as UI from '../ui/ui.js';
@@ -52,7 +53,8 @@
SDK.OverlayModel.OverlayModel.setInspectNodeHandler(this._inspectNode.bind(this));
SDK.SDKModel.TargetManager.instance().observeModels(SDK.OverlayModel.OverlayModel, this);
- this._showDetailedInspectTooltipSetting = self.Common.settings.moduleSetting('showDetailedInspectTooltip');
+ this._showDetailedInspectTooltipSetting =
+ Common.Settings.Settings.instance().moduleSetting('showDetailedInspectTooltip');
this._showDetailedInspectTooltipSetting.addChangeListener(this._showDetailedInspectTooltipChanged.bind(this));
document.addEventListener('keydown', event => {
@@ -99,7 +101,7 @@
if (this._isInInspectElementMode()) {
mode = Protocol.Overlay.InspectMode.None;
} else {
- mode = self.Common.settings.moduleSetting('showUAShadowDOM').get() ?
+ mode = Common.Settings.Settings.instance().moduleSetting('showUAShadowDOM').get() ?
Protocol.Overlay.InspectMode.SearchForUAShadowDOM :
Protocol.Overlay.InspectMode.SearchForNode;
}
diff --git a/front_end/elements/StylePropertyTreeElement.js b/front_end/elements/StylePropertyTreeElement.js
index 0955978..cc61ca9 100644
--- a/front_end/elements/StylePropertyTreeElement.js
+++ b/front_end/elements/StylePropertyTreeElement.js
@@ -269,7 +269,7 @@
return createTextNode(propertyValue);
}
- const indent = self.Common.settings.moduleSetting('textEditorIndent').get();
+ const indent = Common.Settings.Settings.instance().moduleSetting('textEditorIndent').get();
const container = createDocumentFragment();
for (const result of splitResult) {
const value = result.value.trim();
@@ -480,7 +480,7 @@
return;
}
- const indent = self.Common.settings.moduleSetting('textEditorIndent').get();
+ const indent = Common.Settings.Settings.instance().moduleSetting('textEditorIndent').get();
this.listItemElement.createChild('span', 'styles-clipboard-only')
.createTextChild(indent + (this.property.disabled ? '/* ' : ''));
this.listItemElement.appendChild(this.nameElement);
diff --git a/front_end/elements/StylesSidebarPane.js b/front_end/elements/StylesSidebarPane.js
index d54ba7b..051168e 100644
--- a/front_end/elements/StylesSidebarPane.js
+++ b/front_end/elements/StylesSidebarPane.js
@@ -49,8 +49,8 @@
this.setMinimumSize(96, 26);
this.registerRequiredCSS('elements/stylesSidebarPane.css');
- self.Common.settings.moduleSetting('colorFormat').addChangeListener(this.update.bind(this));
- self.Common.settings.moduleSetting('textEditorIndent').addChangeListener(this.update.bind(this));
+ Common.Settings.Settings.instance().moduleSetting('colorFormat').addChangeListener(this.update.bind(this));
+ Common.Settings.Settings.instance().moduleSetting('textEditorIndent').addChangeListener(this.update.bind(this));
/** @type {?UI.Widget.Widget} */
this._currentToolbarPane = null;
diff --git a/front_end/emulation/AdvancedApp.js b/front_end/emulation/AdvancedApp.js
index 567a8d4..01ae147 100644
--- a/front_end/emulation/AdvancedApp.js
+++ b/front_end/emulation/AdvancedApp.js
@@ -84,7 +84,8 @@
* @param {!Document} toolboxDocument
*/
toolboxLoaded(toolboxDocument) {
- UI.UIUtils.initializeUIUtils(toolboxDocument, self.Common.settings.createSetting('uiTheme', 'default'));
+ UI.UIUtils.initializeUIUtils(
+ toolboxDocument, Common.Settings.Settings.instance().createSetting('uiTheme', 'default'));
UI.UIUtils.installComponentRootStyles(/** @type {!Element} */ (toolboxDocument.body));
UI.ContextMenu.ContextMenu.installHandler(toolboxDocument);
UI.Tooltip.Tooltip.installHandler(toolboxDocument);
diff --git a/front_end/emulation/DeviceModeModel.js b/front_end/emulation/DeviceModeModel.js
index 64d329c..de8eb5e 100644
--- a/front_end/emulation/DeviceModeModel.js
+++ b/front_end/emulation/DeviceModeModel.js
@@ -26,14 +26,14 @@
this._appliedDeviceScaleFactor = window.devicePixelRatio;
this._appliedUserAgentType = UA.Desktop;
- this._scaleSetting = self.Common.settings.createSetting('emulation.deviceScale', 1);
+ this._scaleSetting = Common.Settings.Settings.instance().createSetting('emulation.deviceScale', 1);
// We've used to allow zero before.
if (!this._scaleSetting.get()) {
this._scaleSetting.set(1);
}
this._scaleSetting.addChangeListener(this._scaleSettingChanged, this);
- this._widthSetting = self.Common.settings.createSetting('emulation.deviceWidth', 400);
+ this._widthSetting = Common.Settings.Settings.instance().createSetting('emulation.deviceWidth', 400);
if (this._widthSetting.get() < MinDeviceSize) {
this._widthSetting.set(MinDeviceSize);
}
@@ -42,7 +42,7 @@
}
this._widthSetting.addChangeListener(this._widthSettingChanged, this);
- this._heightSetting = self.Common.settings.createSetting('emulation.deviceHeight', 0);
+ this._heightSetting = Common.Settings.Settings.instance().createSetting('emulation.deviceHeight', 0);
if (this._heightSetting.get() && this._heightSetting.get() < MinDeviceSize) {
this._heightSetting.set(MinDeviceSize);
}
@@ -51,15 +51,16 @@
}
this._heightSetting.addChangeListener(this._heightSettingChanged, this);
- this._uaSetting = self.Common.settings.createSetting('emulation.deviceUA', UA.Mobile);
+ this._uaSetting = Common.Settings.Settings.instance().createSetting('emulation.deviceUA', UA.Mobile);
this._uaSetting.addChangeListener(this._uaSettingChanged, this);
- this._deviceScaleFactorSetting = self.Common.settings.createSetting('emulation.deviceScaleFactor', 0);
+ this._deviceScaleFactorSetting =
+ Common.Settings.Settings.instance().createSetting('emulation.deviceScaleFactor', 0);
this._deviceScaleFactorSetting.addChangeListener(this._deviceScaleFactorSettingChanged, this);
- this._deviceOutlineSetting = self.Common.settings.moduleSetting('emulation.showDeviceOutline');
+ this._deviceOutlineSetting = Common.Settings.Settings.instance().moduleSetting('emulation.showDeviceOutline');
this._deviceOutlineSetting.addChangeListener(this._deviceOutlineSettingChanged, this);
- this._toolbarControlsEnabledSetting = self.Common.settings.createSetting(
+ this._toolbarControlsEnabledSetting = Common.Settings.Settings.instance().createSetting(
'emulation.toolbarControlsEnabled', true, Common.Settings.SettingStorageType.Session);
/** @type {!Type} */
@@ -353,7 +354,7 @@
* @return {!Common.Settings.Setting}
*/
enabledSetting() {
- return self.Common.settings.createSetting('emulation.showDeviceMode', false);
+ return Common.Settings.Settings.instance().createSetting('emulation.showDeviceMode', false);
}
/**
diff --git a/front_end/emulation/DeviceModeToolbar.js b/front_end/emulation/DeviceModeToolbar.js
index f6f94cbe..7ed461e 100644
--- a/front_end/emulation/DeviceModeToolbar.js
+++ b/front_end/emulation/DeviceModeToolbar.js
@@ -25,13 +25,15 @@
this._showRulersSetting = showRulersSetting;
this._deviceOutlineSetting = this._model.deviceOutlineSetting();
- this._showDeviceScaleFactorSetting = self.Common.settings.createSetting('emulation.showDeviceScaleFactor', false);
+ this._showDeviceScaleFactorSetting =
+ Common.Settings.Settings.instance().createSetting('emulation.showDeviceScaleFactor', false);
this._showDeviceScaleFactorSetting.addChangeListener(this._updateDeviceScaleFactorVisibility, this);
- this._showUserAgentTypeSetting = self.Common.settings.createSetting('emulation.showUserAgentType', false);
+ this._showUserAgentTypeSetting =
+ Common.Settings.Settings.instance().createSetting('emulation.showUserAgentType', false);
this._showUserAgentTypeSetting.addChangeListener(this._updateUserAgentTypeVisibility, this);
- this._autoAdjustScaleSetting = self.Common.settings.createSetting('emulation.autoAdjustScale', true);
+ this._autoAdjustScaleSetting = Common.Settings.Settings.instance().createSetting('emulation.autoAdjustScale', true);
/** @type {!Map<!EmulatedDevice, !Mode>} */
this._lastMode = new Map();
@@ -64,8 +66,8 @@
this._emulatedDevicesList.addEventListener(Events.CustomDevicesUpdated, this._deviceListChanged, this);
this._emulatedDevicesList.addEventListener(Events.StandardDevicesUpdated, this._deviceListChanged, this);
- this._persistenceSetting =
- self.Common.settings.createSetting('emulation.deviceModeValue', {device: '', orientation: '', mode: ''});
+ this._persistenceSetting = Common.Settings.Settings.instance().createSetting(
+ 'emulation.deviceModeValue', {device: '', orientation: '', mode: ''});
this._model.toolbarControlsEnabledSetting().addChangeListener(updateToolbarsEnabled);
updateToolbarsEnabled();
diff --git a/front_end/emulation/DeviceModeView.js b/front_end/emulation/DeviceModeView.js
index ea0e98c..8e9273e 100644
--- a/front_end/emulation/DeviceModeView.js
+++ b/front_end/emulation/DeviceModeView.js
@@ -30,9 +30,9 @@
this._model.addEventListener(Events.Updated, this._updateUI, this);
this._mediaInspector =
new MediaQueryInspector(() => this._model.appliedDeviceSize().width, this._model.setWidth.bind(this._model));
- this._showMediaInspectorSetting = self.Common.settings.moduleSetting('showMediaQueryInspector');
+ this._showMediaInspectorSetting = Common.Settings.Settings.instance().moduleSetting('showMediaQueryInspector');
this._showMediaInspectorSetting.addChangeListener(this._updateUI, this);
- this._showRulersSetting = self.Common.settings.moduleSetting('emulation.showRulers');
+ this._showRulersSetting = Common.Settings.Settings.instance().moduleSetting('emulation.showRulers');
this._showRulersSetting.addChangeListener(this._updateUI, this);
this._topRuler = new Ruler(true, this._model.setWidthAndScaleToFit.bind(this._model));
diff --git a/front_end/emulation/EmulatedDevices.js b/front_end/emulation/EmulatedDevices.js
index 2b1a042..bfabea5 100644
--- a/front_end/emulation/EmulatedDevices.js
+++ b/front_end/emulation/EmulatedDevices.js
@@ -388,14 +388,14 @@
super();
/** @type {!Common.Settings.Setting} */
- this._standardSetting = self.Common.settings.createSetting('standardEmulatedDeviceList', []);
+ this._standardSetting = Common.Settings.Settings.instance().createSetting('standardEmulatedDeviceList', []);
/** @type {!Set.<!EmulatedDevice>} */
this._standard = new Set();
this._listFromJSONV1(this._standardSetting.get(), this._standard);
this._updateStandardDevices();
/** @type {!Common.Settings.Setting} */
- this._customSetting = self.Common.settings.createSetting('customEmulatedDeviceList', []);
+ this._customSetting = Common.Settings.Settings.instance().createSetting('customEmulatedDeviceList', []);
/** @type {!Set.<!EmulatedDevice>} */
this._custom = new Set();
if (!this._listFromJSONV1(this._customSetting.get(), this._custom)) {
diff --git a/front_end/emulation/GeolocationsSettingsTab.js b/front_end/emulation/GeolocationsSettingsTab.js
index ce3f273..cf21081 100644
--- a/front_end/emulation/GeolocationsSettingsTab.js
+++ b/front_end/emulation/GeolocationsSettingsTab.js
@@ -25,7 +25,7 @@
this._list.registerRequiredCSS('emulation/geolocationsSettingsTab.css');
this._list.show(this.contentElement);
- this._customSetting = self.Common.settings.moduleSetting('emulation.geolocations');
+ this._customSetting = Common.Settings.Settings.instance().moduleSetting('emulation.geolocations');
this._customSetting.addChangeListener(this._geolocationsUpdated, this);
this.setDefaultFocusedElement(addButton);
diff --git a/front_end/emulation/SensorsView.js b/front_end/emulation/SensorsView.js
index 49c27dd..c86143f 100644
--- a/front_end/emulation/SensorsView.js
+++ b/front_end/emulation/SensorsView.js
@@ -16,14 +16,15 @@
this.registerRequiredCSS('emulation/sensors.css');
this.contentElement.classList.add('sensors-view');
- this._geolocationSetting = self.Common.settings.createSetting('emulation.geolocationOverride', '');
+ this._geolocationSetting = Common.Settings.Settings.instance().createSetting('emulation.geolocationOverride', '');
this._geolocation = SDK.EmulationModel.Geolocation.parseSetting(this._geolocationSetting.get());
this._geolocationOverrideEnabled = false;
this._createGeolocationSection(this._geolocation);
this.contentElement.createChild('div').classList.add('panel-section-separator');
- this._deviceOrientationSetting = self.Common.settings.createSetting('emulation.deviceOrientationOverride', '');
+ this._deviceOrientationSetting =
+ Common.Settings.Settings.instance().createSetting('emulation.deviceOrientationOverride', '');
this._deviceOrientation = SDK.EmulationModel.DeviceOrientation.parseSetting(this._deviceOrientationSetting.get());
this._deviceOrientationOverrideEnabled = false;
this._createDeviceOrientationSection();
@@ -63,7 +64,7 @@
// Locations
this._customLocationsGroup = this._locationSelectElement.createChild('optgroup');
this._customLocationsGroup.label = ls`Overrides`;
- const customGeolocations = self.Common.settings.moduleSetting('emulation.geolocations');
+ const customGeolocations = Common.Settings.Settings.instance().moduleSetting('emulation.geolocations');
const manageButton = UI.UIUtils.createTextButton(ls`Manage`, () => Common.Revealer.reveal(customGeolocations));
UI.ARIAUtils.setAccessibleName(manageButton, ls`Manage the list of geolocations`);
fields.appendChild(manageButton);
diff --git a/front_end/formatter/ScriptFormatter.js b/front_end/formatter/ScriptFormatter.js
index fb031f6..1e9af61 100644
--- a/front_end/formatter/ScriptFormatter.js
+++ b/front_end/formatter/ScriptFormatter.js
@@ -94,7 +94,7 @@
this._originalContent = content;
formatterWorkerPool()
- .format(mimeType, content, self.Common.settings.moduleSetting('textEditorIndent').get())
+ .format(mimeType, content, Common.Settings.Settings.instance().moduleSetting('textEditorIndent').get())
.then(this._didFormatContent.bind(this));
}
diff --git a/front_end/help/HelpImpl.js b/front_end/help/HelpImpl.js
index 7d038bd..da822e6 100644
--- a/front_end/help/HelpImpl.js
+++ b/front_end/help/HelpImpl.js
@@ -29,7 +29,7 @@
export function showReleaseNoteIfNeeded() {
innerShowReleaseNoteIfNeeded(
Help._releaseNoteVersionSetting.get(), latestReleaseNote().version,
- self.Common.settings.moduleSetting('help.show-release-note').get());
+ Common.Settings.Settings.instance().moduleSetting('help.show-release-note').get());
}
/**
diff --git a/front_end/help/help-legacy.js b/front_end/help/help-legacy.js
index 3f4d859..e4fdf39 100644
--- a/front_end/help/help-legacy.js
+++ b/front_end/help/help-legacy.js
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+import * as Common from '../common/common.js';
+
import * as HelpModule from './help.js';
self.Help = self.Help || {};
@@ -11,8 +13,8 @@
Help._innerShowReleaseNoteIfNeeded = HelpModule.Help.innerShowReleaseNoteIfNeeded;
Help._showReleaseNoteIfNeeded = HelpModule.Help.showReleaseNoteIfNeeded;
-/** @type {!Common.Setting} */
-Help._releaseNoteVersionSetting = self.self.Common.settings.createSetting('releaseNoteVersionSeen', 0);
+/** @type {!Common.Settings.Setting} */
+Help._releaseNoteVersionSetting = Common.Settings.Settings.instance().createSetting('releaseNoteVersionSeen', 0);
/**
* @constructor
diff --git a/front_end/host/InspectorFrontendHost.js b/front_end/host/InspectorFrontendHost.js
index 68afec6..4987b8c 100644
--- a/front_end/host/InspectorFrontendHost.js
+++ b/front_end/host/InspectorFrontendHost.js
@@ -618,5 +618,6 @@
if (prefs) {
return prefs['isUnderTest'] === 'true';
}
- return self.Common.settings && self.Common.settings.createSetting('isUnderTest', false).get();
+ return Common.Settings.Settings.hasInstance() &&
+ Common.Settings.Settings.instance().createSetting('isUnderTest', false).get();
}
diff --git a/front_end/inspector_main/InspectorMain.js b/front_end/inspector_main/InspectorMain.js
index aeb74fa..a736277 100644
--- a/front_end/inspector_main/InspectorMain.js
+++ b/front_end/inspector_main/InspectorMain.js
@@ -140,12 +140,14 @@
*/
export class SourcesPanelIndicator {
constructor() {
- self.Common.settings.moduleSetting('javaScriptDisabled').addChangeListener(javaScriptDisabledChanged);
+ Common.Settings.Settings.instance()
+ .moduleSetting('javaScriptDisabled')
+ .addChangeListener(javaScriptDisabledChanged);
javaScriptDisabledChanged();
function javaScriptDisabledChanged() {
let icon = null;
- const javaScriptDisabled = self.Common.settings.moduleSetting('javaScriptDisabled').get();
+ const javaScriptDisabled = Common.Settings.Settings.instance().moduleSetting('javaScriptDisabled').get();
if (javaScriptDisabled) {
icon = UI.Icon.Icon.create('smallicon-warning');
icon.title = Common.UIString.UIString('JavaScript is disabled');
@@ -161,14 +163,14 @@
*/
export class BackendSettingsSync {
constructor() {
- this._autoAttachSetting = self.Common.settings.moduleSetting('autoAttachToCreatedPages');
+ this._autoAttachSetting = Common.Settings.Settings.instance().moduleSetting('autoAttachToCreatedPages');
this._autoAttachSetting.addChangeListener(this._updateAutoAttach, this);
this._updateAutoAttach();
- this._adBlockEnabledSetting = self.Common.settings.moduleSetting('network.adBlockingEnabled');
+ this._adBlockEnabledSetting = Common.Settings.Settings.instance().moduleSetting('network.adBlockingEnabled');
this._adBlockEnabledSetting.addChangeListener(this._update, this);
- this._emulatePageFocusSetting = self.Common.settings.moduleSetting('emulatePageFocus');
+ this._emulatePageFocusSetting = Common.Settings.Settings.instance().moduleSetting('emulatePageFocus');
this._emulatePageFocusSetting.addChangeListener(this._update, this);
SDK.SDKModel.TargetManager.instance().observeTargets(this);
diff --git a/front_end/inspector_main/RenderingOptions.js b/front_end/inspector_main/RenderingOptions.js
index 0eb4db2..c0ca8fe 100644
--- a/front_end/inspector_main/RenderingOptions.js
+++ b/front_end/inspector_main/RenderingOptions.js
@@ -40,44 +40,45 @@
ls`Paint flashing`,
ls
`Highlights areas of the page (green) that need to be repainted. May not be suitable for people prone to photosensitive epilepsy.`,
- self.Common.settings.moduleSetting('showPaintRects'));
+ Common.Settings.Settings.instance().moduleSetting('showPaintRects'));
this._appendCheckbox(
ls`Layout Shift Regions`,
ls
`Highlights areas of the page (blue) that were shifted. May not be suitable for people prone to photosensitive epilepsy.`,
- self.Common.settings.moduleSetting('showLayoutShiftRegions'));
+ Common.Settings.Settings.instance().moduleSetting('showLayoutShiftRegions'));
this._appendCheckbox(
ls`Layer borders`, ls`Shows layer borders (orange/olive) and tiles (cyan).`,
- self.Common.settings.moduleSetting('showDebugBorders'));
+ Common.Settings.Settings.instance().moduleSetting('showDebugBorders'));
this._appendCheckbox(
ls`FPS meter`, ls`Plots frames per second, frame rate distribution, and GPU memory.`,
- self.Common.settings.moduleSetting('showFPSCounter'));
+ Common.Settings.Settings.instance().moduleSetting('showFPSCounter'));
this._appendCheckbox(
ls`Scrolling performance issues`,
ls
`Highlights elements (teal) that can slow down scrolling, including touch & wheel event handlers and other main-thread scrolling situations.`,
- self.Common.settings.moduleSetting('showScrollBottleneckRects'));
+ Common.Settings.Settings.instance().moduleSetting('showScrollBottleneckRects'));
this._appendCheckbox(
ls`Highlight ad frames`, ls`Highlights frames (red) detected to be ads.`,
- self.Common.settings.moduleSetting('showAdHighlights'));
+ Common.Settings.Settings.instance().moduleSetting('showAdHighlights'));
this._appendCheckbox(
ls`Hit-test borders`, ls`Shows borders around hit-test regions.`,
- self.Common.settings.moduleSetting('showHitTestBorders'));
+ Common.Settings.Settings.instance().moduleSetting('showHitTestBorders'));
this.contentElement.createChild('div').classList.add('panel-section-separator');
this._appendSelect(
ls`Forces media type for testing print and screen styles`,
- self.Common.settings.moduleSetting('emulatedCSSMedia'));
+ Common.Settings.Settings.instance().moduleSetting('emulatedCSSMedia'));
this._appendSelect(
ls`Forces CSS prefers-color-scheme media feature`,
- self.Common.settings.moduleSetting('emulatedCSSMediaFeaturePrefersColorScheme'));
+ Common.Settings.Settings.instance().moduleSetting('emulatedCSSMediaFeaturePrefersColorScheme'));
this._appendSelect(
ls`Forces CSS prefers-reduced-motion media feature`,
- self.Common.settings.moduleSetting('emulatedCSSMediaFeaturePrefersReducedMotion'));
+ Common.Settings.Settings.instance().moduleSetting('emulatedCSSMediaFeaturePrefersReducedMotion'));
this.contentElement.createChild('div').classList.add('panel-section-separator');
this._appendSelect(
- ls`Forces vision deficiency emulation`, self.Common.settings.moduleSetting('emulatedVisionDeficiency'));
+ ls`Forces vision deficiency emulation`,
+ Common.Settings.Settings.instance().moduleSetting('emulatedVisionDeficiency'));
}
/**
diff --git a/front_end/layer_viewer/LayerViewHost.js b/front_end/layer_viewer/LayerViewHost.js
index 6c234fb..ad94c02 100644
--- a/front_end/layer_viewer/LayerViewHost.js
+++ b/front_end/layer_viewer/LayerViewHost.js
@@ -168,7 +168,8 @@
this._views = [];
this._selectedObject = null;
this._hoveredObject = null;
- this._showInternalLayersSetting = self.Common.settings.createSetting('layersShowInternalLayers', false);
+ this._showInternalLayersSetting =
+ Common.Settings.Settings.instance().createSetting('layersShowInternalLayers', false);
}
/**
diff --git a/front_end/layer_viewer/Layers3DView.js b/front_end/layer_viewer/Layers3DView.js
index e08c4e2..3ce432e 100644
--- a/front_end/layer_viewer/Layers3DView.js
+++ b/front_end/layer_viewer/Layers3DView.js
@@ -570,7 +570,7 @@
return;
}
- const drawChrome = !self.Common.settings.moduleSetting('frameViewerHideChromeWindow').get() &&
+ const drawChrome = !Common.Settings.Settings.instance().moduleSetting('frameViewerHideChromeWindow').get() &&
this._chromeTextures.length >= 3 && this._chromeTextures.indexOf(undefined) < 0;
const z = (this._maxDepth + 1) * LayerSpacing;
const borderWidth = Math.ceil(ViewportBorderWidth * this._scale);
@@ -700,7 +700,7 @@
* @return {!Common.Settings.Setting}
*/
_createVisibilitySetting(caption, name, value, toolbar) {
- const setting = self.Common.settings.createSetting(name, value);
+ const setting = Common.Settings.Settings.instance().createSetting(name, value);
setting.setTitle(Common.UIString.UIString(caption));
setting.addChangeListener(this._update, this);
toolbar.appendToolbarItem(new UI.Toolbar.ToolbarSettingCheckbox(setting));
@@ -715,7 +715,9 @@
this._showPaintsSetting =
this._createVisibilitySetting(ls`Paints`, 'frameViewerShowPaints', true, this._panelToolbar);
this._showPaintsSetting.addChangeListener(this._updatePaints, this);
- self.Common.settings.moduleSetting('frameViewerHideChromeWindow').addChangeListener(this._update, this);
+ Common.Settings.Settings.instance()
+ .moduleSetting('frameViewerHideChromeWindow')
+ .addChangeListener(this._update, this);
}
/**
diff --git a/front_end/lighthouse/LighthouseController.js b/front_end/lighthouse/LighthouseController.js
index fe9b982..457663d 100644
--- a/front_end/lighthouse/LighthouseController.js
+++ b/front_end/lighthouse/LighthouseController.js
@@ -211,37 +211,37 @@
export const Presets = [
// configID maps to Lighthouse's Object.keys(config.categories)[0] value
{
- setting: self.Common.settings.createSetting('lighthouse.cat_perf', true),
+ setting: Common.Settings.Settings.instance().createSetting('lighthouse.cat_perf', true),
configID: 'performance',
title: ls`Performance`,
description: ls`How long does this app take to show content and become usable`
},
{
- setting: self.Common.settings.createSetting('lighthouse.cat_pwa', true),
+ setting: Common.Settings.Settings.instance().createSetting('lighthouse.cat_pwa', true),
configID: 'pwa',
title: ls`Progressive Web App`,
description: ls`Does this page meet the standard of a Progressive Web App`
},
{
- setting: self.Common.settings.createSetting('lighthouse.cat_best_practices', true),
+ setting: Common.Settings.Settings.instance().createSetting('lighthouse.cat_best_practices', true),
configID: 'best-practices',
title: ls`Best practices`,
description: ls`Does this page follow best practices for modern web development`
},
{
- setting: self.Common.settings.createSetting('lighthouse.cat_a11y', true),
+ setting: Common.Settings.Settings.instance().createSetting('lighthouse.cat_a11y', true),
configID: 'accessibility',
title: ls`Accessibility`,
description: ls`Is this page usable by people with disabilities or impairments`
},
{
- setting: self.Common.settings.createSetting('lighthouse.cat_seo', true),
+ setting: Common.Settings.Settings.instance().createSetting('lighthouse.cat_seo', true),
configID: 'seo',
title: ls`SEO`,
description: ls`Is this page optimized for search engine results ranking`
},
{
- setting: self.Common.settings.createSetting('lighthouse.cat_pubads', false),
+ setting: Common.Settings.Settings.instance().createSetting('lighthouse.cat_pubads', false),
plugin: true,
configID: 'lighthouse-plugin-publisher-ads',
title: ls`Publisher Ads`,
@@ -252,7 +252,7 @@
/** @type {!Array.<!RuntimeSetting>} */
export const RuntimeSettings = [
{
- setting: self.Common.settings.createSetting('lighthouse.device_type', 'mobile'),
+ setting: Common.Settings.Settings.instance().createSetting('lighthouse.device_type', 'mobile'),
description: ls`Apply mobile emulation during auditing`,
setFlags: (flags, value) => {
// See Audits.AuditsPanel._setupEmulationAndProtocolConnection()
@@ -265,7 +265,7 @@
},
{
// This setting is disabled, but we keep it around to show in the UI.
- setting: self.Common.settings.createSetting('lighthouse.throttling', true),
+ setting: Common.Settings.Settings.instance().createSetting('lighthouse.throttling', true),
title: ls`Simulated throttling`,
// We will disable this when we have a Lantern trace viewer within DevTools.
learnMore:
@@ -277,7 +277,7 @@
},
},
{
- setting: self.Common.settings.createSetting('lighthouse.clear_storage', true),
+ setting: Common.Settings.Settings.instance().createSetting('lighthouse.clear_storage', true),
title: ls`Clear storage`,
description: ls`Reset storage (localStorage, IndexedDB, etc) before auditing. (Good for performance & PWA testing)`,
setFlags: (flags, value) => {
diff --git a/front_end/lighthouse/LighthousePanel.js b/front_end/lighthouse/LighthousePanel.js
index 379336c..3476ced 100644
--- a/front_end/lighthouse/LighthousePanel.js
+++ b/front_end/lighthouse/LighthousePanel.js
@@ -105,7 +105,8 @@
this._settingsPane.show(this.contentElement);
this._settingsPane.element.classList.add('lighthouse-settings-pane');
this._settingsPane.element.appendChild(this._startView.settingsToolbar().element);
- this._showSettingsPaneSetting = self.Common.settings.createSetting('lighthouseShowSettingsToolbar', false);
+ this._showSettingsPaneSetting =
+ Common.Settings.Settings.instance().createSetting('lighthouseShowSettingsToolbar', false);
this._rightToolbar = new UI.Toolbar.Toolbar('', lighthouseToolbarContainer);
this._rightToolbar.appendSeparator();
diff --git a/front_end/main/MainImpl.js b/front_end/main/MainImpl.js
index 0948a18..f08aa44 100644
--- a/front_end/main/MainImpl.js
+++ b/front_end/main/MainImpl.js
@@ -120,7 +120,10 @@
prefs, Host.InspectorFrontendHost.InspectorFrontendHostInstance.setPreference,
Host.InspectorFrontendHost.InspectorFrontendHostInstance.removePreference,
Host.InspectorFrontendHost.InspectorFrontendHostInstance.clearPreferences, storagePrefix);
- self.Common.settings = new Common.Settings.Settings(globalStorage, localStorage);
+ Common.Settings.Settings.instance({forceNew: true, globalStorage, localStorage});
+
+ self.Common.settings = Common.Settings.Settings.instance();
+
if (!Host.InspectorFrontendHost.isUnderTest()) {
new Common.Settings.VersionController().updateVersion();
}
@@ -196,7 +199,7 @@
// Request filesystems early, we won't create connections until callback is fired. Things will happen in parallel.
self.Persistence.isolatedFileSystemManager = new Persistence.IsolatedFileSystemManager.IsolatedFileSystemManager();
- const themeSetting = self.Common.settings.createSetting('uiTheme', 'systemPreferred');
+ const themeSetting = Common.Settings.Settings.instance().createSetting('uiTheme', 'systemPreferred');
UI.UIUtils.initializeUIUtils(document, themeSetting);
themeSetting.addChangeListener(Components.Reload.reload.bind(Components));
@@ -332,7 +335,7 @@
const promises = [];
for (const extension of extensions) {
const setting = extension.descriptor()['setting'];
- if (!setting || self.Common.settings.moduleSetting(setting).get()) {
+ if (!setting || Common.Settings.Settings.instance().moduleSetting(setting).get()) {
promises.push(
extension.instance().then(instance => (/** @type {!Common.Runnable.Runnable} */ (instance)).run()));
continue;
@@ -344,10 +347,10 @@
if (!event.data) {
return;
}
- self.Common.settings.moduleSetting(setting).removeChangeListener(changeListener);
+ Common.Settings.Settings.instance().moduleSetting(setting).removeChangeListener(changeListener);
(/** @type {!Common.Runnable.Runnable} */ (await extension.instance())).run();
}
- self.Common.settings.moduleSetting(setting).addChangeListener(changeListener);
+ Common.Settings.Settings.instance().moduleSetting(setting).addChangeListener(changeListener);
}
this._lateInitDonePromise = Promise.all(promises);
MainImpl.timeEnd('Main._lateInitialization');
diff --git a/front_end/mobile_throttling/ThrottlingManager.js b/front_end/mobile_throttling/ThrottlingManager.js
index fc22249..6130a0c 100644
--- a/front_end/mobile_throttling/ThrottlingManager.js
+++ b/front_end/mobile_throttling/ThrottlingManager.js
@@ -23,7 +23,7 @@
this._cpuThrottlingControls = new Set();
this._cpuThrottlingRates = cpuThrottlingPresets;
/** @type {!Common.Settings.Setting<!Array<!SDK.NetworkManager.Conditions>>} */
- this._customNetworkConditionsSetting = self.Common.settings.moduleSetting('customNetworkConditions');
+ this._customNetworkConditionsSetting = Common.Settings.Settings.instance().moduleSetting('customNetworkConditions');
/** @type {!SDK.NetworkManager.Conditions} */
this._currentNetworkThrottlingConditions = SDK.NetworkManager.NoThrottlingConditions;
/** @type {!SDK.NetworkManager.Conditions} */
diff --git a/front_end/mobile_throttling/ThrottlingSettingsTab.js b/front_end/mobile_throttling/ThrottlingSettingsTab.js
index c7a49b3..ec335a5 100644
--- a/front_end/mobile_throttling/ThrottlingSettingsTab.js
+++ b/front_end/mobile_throttling/ThrottlingSettingsTab.js
@@ -28,7 +28,7 @@
this._list.registerRequiredCSS('mobile_throttling/throttlingSettingsTab.css');
this._list.show(this.contentElement);
- this._customSetting = self.Common.settings.moduleSetting('customNetworkConditions');
+ this._customSetting = Common.Settings.Settings.instance().moduleSetting('customNetworkConditions');
this._customSetting.addChangeListener(this._conditionsUpdated, this);
this.setDefaultFocusedElement(addButton);
diff --git a/front_end/network/BinaryResourceView.js b/front_end/network/BinaryResourceView.js
index 11ae0db..5a6babf 100644
--- a/front_end/network/BinaryResourceView.js
+++ b/front_end/network/BinaryResourceView.js
@@ -44,7 +44,7 @@
this._binaryResourceViewFactory.createUtf8View.bind(this._binaryResourceViewFactory),
this._binaryResourceViewFactory.utf8.bind(this._binaryResourceViewFactory)),
];
- this._binaryViewTypeSetting = self.Common.settings.createSetting('binaryViewType', 'hex');
+ this._binaryViewTypeSetting = Common.Settings.Settings.instance().createSetting('binaryViewType', 'hex');
this._binaryViewTypeCombobox =
new UI.Toolbar.ToolbarComboBox(this._binaryViewTypeChanged.bind(this), ls`Binary view type`);
for (const viewObject of this._binaryViewObjects) {
diff --git a/front_end/network/NetworkConfigView.js b/front_end/network/NetworkConfigView.js
index 649c200..0cd025a 100644
--- a/front_end/network/NetworkConfigView.js
+++ b/front_end/network/NetworkConfigView.js
@@ -25,7 +25,7 @@
* @return {{select: !Element, input: !Element, error: !Element}}
*/
static createUserAgentSelectAndInput(title) {
- const userAgentSetting = self.Common.settings.createSetting('customUserAgent', '');
+ const userAgentSetting = Common.Settings.Settings.instance().createSetting('customUserAgent', '');
const userAgentSelectElement = createElement('select');
UI.ARIAUtils.setAccessibleName(userAgentSelectElement, title);
@@ -123,7 +123,8 @@
_createCacheSection() {
const section = this._createSection(Common.UIString.UIString('Caching'), 'network-config-disable-cache');
section.appendChild(UI.SettingsUI.createSettingCheckbox(
- Common.UIString.UIString('Disable cache'), self.Common.settings.moduleSetting('cacheDisabled'), true));
+ Common.UIString.UIString('Disable cache'), Common.Settings.Settings.instance().moduleSetting('cacheDisabled'),
+ true));
}
_createNetworkThrottlingSection() {
@@ -142,7 +143,7 @@
section.appendChild(checkboxLabel);
const autoCheckbox = checkboxLabel.checkboxElement;
- const customUserAgentSetting = self.Common.settings.createSetting('customUserAgent', '');
+ const customUserAgentSetting = Common.Settings.Settings.instance().createSetting('customUserAgent', '');
customUserAgentSetting.addChangeListener(() => {
if (autoCheckbox.checked) {
return;
diff --git a/front_end/network/NetworkItemView.js b/front_end/network/NetworkItemView.js
index 4e46f8b..df53cb3 100644
--- a/front_end/network/NetworkItemView.js
+++ b/front_end/network/NetworkItemView.js
@@ -55,7 +55,7 @@
this._request = request;
this.element.classList.add('network-item-view');
- this._resourceViewTabSetting = self.Common.settings.createSetting('resourceViewTab', 'preview');
+ this._resourceViewTabSetting = Common.Settings.Settings.instance().createSetting('resourceViewTab', 'preview');
this._headersView = new RequestHeadersView(request);
this.appendTab(
diff --git a/front_end/network/NetworkLogView.js b/front_end/network/NetworkLogView.js
index 27b8625..c3d41d5 100644
--- a/front_end/network/NetworkLogView.js
+++ b/front_end/network/NetworkLogView.js
@@ -63,10 +63,13 @@
this.element.id = 'network-container';
this.element.classList.add('no-node-selected');
- this._networkHideDataURLSetting = self.Common.settings.createSetting('networkHideDataURL', false);
- this._networkShowIssuesOnlySetting = self.Common.settings.createSetting('networkShowIssuesOnly', false);
- this._networkOnlyBlockedRequestsSetting = self.Common.settings.createSetting('networkOnlyBlockedRequests', false);
- this._networkResourceTypeFiltersSetting = self.Common.settings.createSetting('networkResourceTypeFilters', {});
+ this._networkHideDataURLSetting = Common.Settings.Settings.instance().createSetting('networkHideDataURL', false);
+ this._networkShowIssuesOnlySetting =
+ Common.Settings.Settings.instance().createSetting('networkShowIssuesOnly', false);
+ this._networkOnlyBlockedRequestsSetting =
+ Common.Settings.Settings.instance().createSetting('networkOnlyBlockedRequests', false);
+ this._networkResourceTypeFiltersSetting =
+ Common.Settings.Settings.instance().createSetting('networkResourceTypeFilters', {});
this._rawRowHeight = 0;
this._progressBarContainer = progressBarContainer;
@@ -183,7 +186,8 @@
this.element, [UI.DropTarget.Type.File], Common.UIString.UIString('Drop HAR files here'),
this._handleDrop.bind(this));
- self.Common.settings.moduleSetting('networkColorCodeResourceTypes')
+ Common.Settings.Settings.instance()
+ .moduleSetting('networkColorCodeResourceTypes')
.addChangeListener(this._invalidateAllItems.bind(this, false), this);
SDK.SDKModel.TargetManager.instance().observeModels(SDK.NetworkManager.NetworkManager, this);
@@ -192,13 +196,15 @@
self.SDK.networkLog.addEventListener(SDK.NetworkLog.Events.Reset, this._reset, this);
this._updateGroupByFrame();
- self.Common.settings.moduleSetting('network.group-by-frame').addChangeListener(() => this._updateGroupByFrame());
+ Common.Settings.Settings.instance()
+ .moduleSetting('network.group-by-frame')
+ .addChangeListener(() => this._updateGroupByFrame());
this._filterBar = filterBar;
}
_updateGroupByFrame() {
- const value = self.Common.settings.moduleSetting('network.group-by-frame').get();
+ const value = Common.Settings.Settings.instance().moduleSetting('network.group-by-frame').get();
this._setGrouping(value ? 'Frame' : null);
}
diff --git a/front_end/network/NetworkLogViewColumns.js b/front_end/network/NetworkLogViewColumns.js
index 1f8326e..8e4feed 100644
--- a/front_end/network/NetworkLogViewColumns.js
+++ b/front_end/network/NetworkLogViewColumns.js
@@ -29,7 +29,7 @@
this._networkLogView = networkLogView;
/** @type {!Common.Settings.Setting} */
- this._persistantSettings = self.Common.settings.createSetting('networkLogColumns', {});
+ this._persistantSettings = Common.Settings.Settings.instance().createSetting('networkLogColumns', {});
this._networkLogLargeRowsSetting = networkLogLargeRowsSetting;
this._networkLogLargeRowsSetting.addChangeListener(this._updateRowsSize, this);
diff --git a/front_end/network/NetworkPanel.js b/front_end/network/NetworkPanel.js
index cd25661..f613685 100644
--- a/front_end/network/NetworkPanel.js
+++ b/front_end/network/NetworkPanel.js
@@ -55,9 +55,11 @@
super('network');
this.registerRequiredCSS('network/networkPanel.css');
- this._networkLogShowOverviewSetting = self.Common.settings.createSetting('networkLogShowOverview', true);
- this._networkLogLargeRowsSetting = self.Common.settings.createSetting('networkLogLargeRows', false);
- this._networkRecordFilmStripSetting = self.Common.settings.createSetting('networkRecordFilmStripSetting', false);
+ this._networkLogShowOverviewSetting =
+ Common.Settings.Settings.instance().createSetting('networkLogShowOverview', true);
+ this._networkLogLargeRowsSetting = Common.Settings.Settings.instance().createSetting('networkLogLargeRows', false);
+ this._networkRecordFilmStripSetting =
+ Common.Settings.Settings.instance().createSetting('networkRecordFilmStripSetting', false);
this._toggleRecordAction =
/** @type {!UI.Action.Action }*/ (self.UI.actionRegistry.action('network.toggle-recording'));
@@ -85,7 +87,8 @@
this._settingsPane = new UI.Widget.HBox();
this._settingsPane.element.classList.add('network-settings-pane');
this._settingsPane.show(panel.contentElement);
- this._showSettingsPaneSetting = self.Common.settings.createSetting('networkShowSettingsToolbar', false);
+ this._showSettingsPaneSetting =
+ Common.Settings.Settings.instance().createSetting('networkShowSettingsToolbar', false);
this._showSettingsPaneSetting.addChangeListener(this._updateSettingsPaneVisibility.bind(this));
this._updateSettingsPaneVisibility();
@@ -159,7 +162,7 @@
this._networkLogLargeRowsSetting.addChangeListener(this._toggleLargerRequests, this);
this._networkRecordFilmStripSetting.addChangeListener(this._toggleRecordFilmStrip, this);
- this._preserveLogSetting = self.Common.settings.moduleSetting('network_log.preserve-log');
+ this._preserveLogSetting = Common.Settings.Settings.instance().moduleSetting('network_log.preserve-log');
this._throttlingSelect = this._createThrottlingConditionsSelect();
this._setupToolbarButtons(splitWidget);
@@ -254,7 +257,7 @@
Common.UIString.UIString('Preserve log')));
const disableCacheCheckbox = new UI.Toolbar.ToolbarSettingCheckbox(
- self.Common.settings.moduleSetting('cacheDisabled'),
+ Common.Settings.Settings.instance().moduleSetting('cacheDisabled'),
Common.UIString.UIString('Disable cache (while DevTools is open)'), Common.UIString.UIString('Disable cache'));
this._panelToolbar.appendToolbarItem(disableCacheCheckbox);
@@ -276,8 +279,8 @@
const settingsToolbarRight = new UI.Toolbar.Toolbar('', this._settingsPane.element);
settingsToolbarRight.makeVertical();
settingsToolbarRight.appendToolbarItem(new UI.Toolbar.ToolbarSettingCheckbox(
- self.Common.settings.moduleSetting('network.group-by-frame'), ls`Group requests by top level request frame`,
- ls`Group by frame`));
+ Common.Settings.Settings.instance().moduleSetting('network.group-by-frame'),
+ ls`Group requests by top level request frame`, ls`Group by frame`));
settingsToolbarRight.appendToolbarItem(new UI.Toolbar.ToolbarSettingCheckbox(
this._networkRecordFilmStripSetting, ls`Capture screenshots when loading a page`, ls`Capture screenshots`));
diff --git a/front_end/network/NetworkWaterfallColumn.js b/front_end/network/NetworkWaterfallColumn.js
index 28cd0a8..9317da87 100644
--- a/front_end/network/NetworkWaterfallColumn.js
+++ b/front_end/network/NetworkWaterfallColumn.js
@@ -217,8 +217,8 @@
if (!request) {
return null;
}
- const useTimingBars =
- !self.Common.settings.moduleSetting('networkColorCodeResourceTypes').get() && !this._calculator.startAtZero;
+ const useTimingBars = !Common.Settings.Settings.instance().moduleSetting('networkColorCodeResourceTypes').get() &&
+ !this._calculator.startAtZero;
let range;
let start;
let end;
@@ -417,8 +417,8 @@
}
_draw() {
- const useTimingBars =
- !self.Common.settings.moduleSetting('networkColorCodeResourceTypes').get() && !this._calculator.startAtZero;
+ const useTimingBars = !Common.Settings.Settings.instance().moduleSetting('networkColorCodeResourceTypes').get() &&
+ !this._calculator.startAtZero;
const nodes = this._nodes;
const context = this._canvas.getContext('2d');
context.save();
diff --git a/front_end/network/RequestCookiesView.js b/front_end/network/RequestCookiesView.js
index 90a5eaa..7c4a592 100644
--- a/front_end/network/RequestCookiesView.js
+++ b/front_end/network/RequestCookiesView.js
@@ -46,8 +46,8 @@
this._request = request;
/** @type {?Array<!SDK.Cookie.Cookie>} */
this._detailedRequestCookies = null;
- this._showFilteredOutCookiesSetting =
- self.Common.settings.createSetting('show-filtered-out-request-cookies', /* defaultValue */ false);
+ this._showFilteredOutCookiesSetting = Common.Settings.Settings.instance().createSetting(
+ 'show-filtered-out-request-cookies', /* defaultValue */ false);
this._emptyWidget = new UI.EmptyWidget.EmptyWidget(Common.UIString.UIString('This request has no cookies.'));
this._emptyWidget.show(this.element);
diff --git a/front_end/network/RequestHeadersView.js b/front_end/network/RequestHeadersView.js
index 72d3060..5ccadf7 100644
--- a/front_end/network/RequestHeadersView.js
+++ b/front_end/network/RequestHeadersView.js
@@ -872,7 +872,8 @@
super(title || '', true);
this.toggleOnClick = true;
this.hidden = true;
- this._expandedSetting = self.Common.settings.createSetting('request-info-' + name + '-category-expanded', true);
+ this._expandedSetting =
+ Common.Settings.Settings.instance().createSetting('request-info-' + name + '-category-expanded', true);
this.expanded = this._expandedSetting.get();
root.appendChild(this);
}
diff --git a/front_end/perf_ui/ChartViewport.js b/front_end/perf_ui/ChartViewport.js
index 8eecf6d..9a39c7d 100644
--- a/front_end/perf_ui/ChartViewport.js
+++ b/front_end/perf_ui/ChartViewport.js
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+import * as Common from '../common/common.js';
import * as Platform from '../platform/platform.js';
import * as UI from '../ui/ui.js';
@@ -207,7 +208,7 @@
*/
_onMouseWheel(e) {
const doZoomInstead =
- e.shiftKey ^ (self.Common.settings.moduleSetting('flamechartMouseWheelAction').get() === 'zoom');
+ e.shiftKey ^ (Common.Settings.Settings.instance().moduleSetting('flamechartMouseWheelAction').get() === 'zoom');
const panVertically = !doZoomInstead && (e.wheelDeltaY || Math.abs(e.wheelDeltaX) === 120);
const panHorizontally = doZoomInstead && Math.abs(e.wheelDeltaX) > Math.abs(e.wheelDeltaY);
if (panVertically) {
diff --git a/front_end/perf_ui/LiveHeapProfile.js b/front_end/perf_ui/LiveHeapProfile.js
index 01d9a2c..75abc43 100644
--- a/front_end/perf_ui/LiveHeapProfile.js
+++ b/front_end/perf_ui/LiveHeapProfile.js
@@ -17,7 +17,7 @@
this._running = false;
this._sessionId = 0;
this._loadEventCallback = () => {};
- this._setting = self.Common.settings.moduleSetting('memoryLiveHeapProfile');
+ this._setting = Common.Settings.Settings.instance().moduleSetting('memoryLiveHeapProfile');
this._setting.addChangeListener(event => event.data ? this._startProfiling() : this._stopProfiling());
if (this._setting.get()) {
this._startProfiling();
diff --git a/front_end/performance_monitor/PerformanceMonitor.js b/front_end/performance_monitor/PerformanceMonitor.js
index 4492eee..a88e5ae 100644
--- a/front_end/performance_monitor/PerformanceMonitor.js
+++ b/front_end/performance_monitor/PerformanceMonitor.js
@@ -413,8 +413,8 @@
super();
this.element = parent.createChild('div', 'perfmon-control-pane');
- this._enabledChartsSetting =
- self.Common.settings.createSetting('perfmonActiveIndicators2', ['TaskDuration', 'JSHeapTotalSize', 'Nodes']);
+ this._enabledChartsSetting = Common.Settings.Settings.instance().createSetting(
+ 'perfmonActiveIndicators2', ['TaskDuration', 'JSHeapTotalSize', 'Nodes']);
/** @type {!Set<string>} */
this._enabledCharts = new Set(this._enabledChartsSetting.get());
const format = Format;
diff --git a/front_end/persistence/IsolatedFileSystem.js b/front_end/persistence/IsolatedFileSystem.js
index 2d6b90e..499b036 100644
--- a/front_end/persistence/IsolatedFileSystem.js
+++ b/front_end/persistence/IsolatedFileSystem.js
@@ -50,7 +50,8 @@
this._manager = manager;
this._embedderPath = embedderPath;
this._domFileSystem = domFileSystem;
- this._excludedFoldersSetting = self.Common.settings.createLocalSetting('workspaceExcludedFolders', {});
+ this._excludedFoldersSetting =
+ Common.Settings.Settings.instance().createLocalSetting('workspaceExcludedFolders', {});
/** @type {!Set<string>} */
this._excludedFolders = new Set(this._excludedFoldersSetting.get()[path] || []);
/** @type {!Array<string>} */
diff --git a/front_end/persistence/IsolatedFileSystemManager.js b/front_end/persistence/IsolatedFileSystemManager.js
index 2f5c8a1..7d398f1 100644
--- a/front_end/persistence/IsolatedFileSystemManager.js
+++ b/front_end/persistence/IsolatedFileSystemManager.js
@@ -277,7 +277,7 @@
defaultExcludedFolders = defaultExcludedFolders.concat(defaultLinuxExcludedFolders);
}
const defaultExcludedFoldersPattern = defaultExcludedFolders.join('|');
- this._workspaceFolderExcludePatternSetting = self.Common.settings.createRegExpSetting(
+ this._workspaceFolderExcludePatternSetting = Common.Settings.Settings.instance().createRegExpSetting(
'workspaceFolderExcludePattern', defaultExcludedFoldersPattern, Host.Platform.isWin() ? 'i' : '');
}
diff --git a/front_end/persistence/NetworkPersistenceManager.js b/front_end/persistence/NetworkPersistenceManager.js
index e161852..f6f0293 100644
--- a/front_end/persistence/NetworkPersistenceManager.js
+++ b/front_end/persistence/NetworkPersistenceManager.js
@@ -19,7 +19,7 @@
this._originalResponseContentPromiseSymbol = Symbol('OriginalResponsePromise');
this._savingSymbol = Symbol('SavingForOverrides');
- this._enabledSetting = self.Common.settings.moduleSetting('persistenceNetworkOverridesEnabled');
+ this._enabledSetting = Common.Settings.Settings.instance().moduleSetting('persistenceNetworkOverridesEnabled');
this._enabledSetting.addChangeListener(this._enabledChanged, this);
this._workspace = workspace;
diff --git a/front_end/profiler/HeapSnapshotView.js b/front_end/profiler/HeapSnapshotView.js
index 8bbf452..04245f4 100644
--- a/front_end/profiler/HeapSnapshotView.js
+++ b/front_end/profiler/HeapSnapshotView.js
@@ -1084,7 +1084,8 @@
SDK.SDKModel.TargetManager.instance().addModelListener(
SDK.HeapProfilerModel.HeapProfilerModel, SDK.HeapProfilerModel.Events.ReportHeapSnapshotProgress,
this._reportHeapSnapshotProgress, this);
- this._treatGlobalObjectsAsRoots = self.Common.settings.createSetting('treatGlobalObjectsAsRoots', true);
+ this._treatGlobalObjectsAsRoots =
+ Common.Settings.Settings.instance().createSetting('treatGlobalObjectsAsRoots', true);
/** @type {?UI.UIUtils.CheckboxLabel} */
this._customContent = null;
}
@@ -1270,7 +1271,8 @@
export class TrackingHeapSnapshotProfileType extends HeapSnapshotProfileType {
constructor() {
super(TrackingHeapSnapshotProfileType.TypeId, ls`Allocation instrumentation on timeline`);
- this._recordAllocationStacksSetting = self.Common.settings.createSetting('recordAllocationStacks', false);
+ this._recordAllocationStacksSetting =
+ Common.Settings.Settings.instance().createSetting('recordAllocationStacks', false);
/** @type {?UI.UIUtils.CheckboxLabel} */
this._customContent = null;
}
diff --git a/front_end/profiler/LiveHeapProfileView.js b/front_end/profiler/LiveHeapProfileView.js
index 035a385..fef3a23 100644
--- a/front_end/profiler/LiveHeapProfileView.js
+++ b/front_end/profiler/LiveHeapProfileView.js
@@ -19,7 +19,7 @@
this._gridNodeByUrl = new Map();
this.registerRequiredCSS('profiler/liveHeapProfile.css');
- this._setting = self.Common.settings.moduleSetting('memoryLiveHeapProfile');
+ this._setting = Common.Settings.Settings.instance().moduleSetting('memoryLiveHeapProfile');
const toolbar = new UI.Toolbar.Toolbar('live-heap-profile-toolbar', this.contentElement);
this._toggleRecordAction =
diff --git a/front_end/profiler/ProfileLauncherView.js b/front_end/profiler/ProfileLauncherView.js
index ae8e3cd..0c17306 100644
--- a/front_end/profiler/ProfileLauncherView.js
+++ b/front_end/profiler/ProfileLauncherView.js
@@ -50,7 +50,7 @@
this._contentElement = this.element.createChild('div', 'profile-launcher-view-content vbox');
const profileTypeSelectorElement = this._contentElement.createChild('div', 'vbox');
- this._selectedProfileTypeSetting = self.Common.settings.createSetting('selectedProfileType', 'CPU');
+ this._selectedProfileTypeSetting = Common.Settings.Settings.instance().createSetting('selectedProfileType', 'CPU');
this._profileTypeHeaderElement = profileTypeSelectorElement.createChild('h1');
this._profileTypeSelectorForm = profileTypeSelectorElement.createChild('form');
UI.ARIAUtils.markAsRadioGroup(this._profileTypeSelectorForm);
diff --git a/front_end/profiler/ProfileView.js b/front_end/profiler/ProfileView.js
index 81686fb..8475d5f 100644
--- a/front_end/profiler/ProfileView.js
+++ b/front_end/profiler/ProfileView.js
@@ -110,7 +110,7 @@
initialize(nodeFormatter, viewTypes) {
this._nodeFormatter = nodeFormatter;
- this._viewType = self.Common.settings.createSetting('profileView', ViewTypes.Heavy);
+ this._viewType = Common.Settings.Settings.instance().createSetting('profileView', ViewTypes.Heavy);
viewTypes = viewTypes || [ViewTypes.Flame, ViewTypes.Heavy, ViewTypes.Tree];
const optionNames = new Map([
diff --git a/front_end/quick_open/CommandMenu.js b/front_end/quick_open/CommandMenu.js
index b695fcd..f45541f 100644
--- a/front_end/quick_open/CommandMenu.js
+++ b/front_end/quick_open/CommandMenu.js
@@ -49,7 +49,7 @@
static createSettingCommand(extension, title, value) {
const category = extension.descriptor()['category'] || '';
const tags = extension.descriptor()['tags'] || '';
- const setting = self.Common.settings.moduleSetting(extension.descriptor()['settingName']);
+ const setting = Common.Settings.Settings.instance().moduleSetting(extension.descriptor()['settingName']);
return CommandMenu.createCommand(ls(category), tags, title, '', setting.set.bind(setting, value), availableHandler);
/**
diff --git a/front_end/resources/AppManifestView.js b/front_end/resources/AppManifestView.js
index af93629..af1d45b 100644
--- a/front_end/resources/AppManifestView.js
+++ b/front_end/resources/AppManifestView.js
@@ -17,7 +17,9 @@
super(true);
this.registerRequiredCSS('resources/appManifestView.css');
- self.Common.settings.moduleSetting('colorFormat').addChangeListener(this._updateManifest.bind(this, true));
+ Common.Settings.Settings.instance()
+ .moduleSetting('colorFormat')
+ .addChangeListener(this._updateManifest.bind(this, true));
this._emptyView = new UI.EmptyWidget.EmptyWidget(Common.UIString.UIString('No manifest detected'));
this._emptyView.appendLink(
diff --git a/front_end/resources/ApplicationPanelSidebar.js b/front_end/resources/ApplicationPanelSidebar.js
index 1bd37cb..fc19546 100644
--- a/front_end/resources/ApplicationPanelSidebar.js
+++ b/front_end/resources/ApplicationPanelSidebar.js
@@ -760,8 +760,8 @@
*/
constructor(storagePanel, categoryName, settingsKey) {
super(storagePanel, categoryName, false);
- this._expandedSetting =
- self.Common.settings.createSetting('resources' + settingsKey + 'Expanded', settingsKey === 'Frames');
+ this._expandedSetting = Common.Settings.Settings.instance().createSetting(
+ 'resources' + settingsKey + 'Expanded', settingsKey === 'Frames');
this._categoryName = categoryName;
this._categoryLink = null;
}
diff --git a/front_end/resources/ClearStorageView.js b/front_end/resources/ClearStorageView.js
index 3783d90..fa9db5d 100644
--- a/front_end/resources/ClearStorageView.js
+++ b/front_end/resources/ClearStorageView.js
@@ -40,7 +40,7 @@
this._settings = new Map();
for (const type of AllStorageTypes) {
- this._settings.set(type, self.Common.settings.createSetting('clear-storage-' + type, true));
+ this._settings.set(type, Common.Settings.Settings.instance().createSetting('clear-storage-' + type, true));
}
const quota = this._reportView.appendSection(Common.UIString.UIString('Usage'));
diff --git a/front_end/resources/DatabaseTableView.js b/front_end/resources/DatabaseTableView.js
index 46eae65..ebe9038 100644
--- a/front_end/resources/DatabaseTableView.js
+++ b/front_end/resources/DatabaseTableView.js
@@ -39,7 +39,8 @@
this.element.classList.add('storage-view', 'table');
- this._visibleColumnsSetting = self.Common.settings.createSetting('databaseTableViewVisibleColumns', {});
+ this._visibleColumnsSetting =
+ Common.Settings.Settings.instance().createSetting('databaseTableViewVisibleColumns', {});
this.refreshButton = new UI.Toolbar.ToolbarButton(Common.UIString.UIString('Refresh'), 'largeicon-refresh');
this.refreshButton.addEventListener(UI.Toolbar.ToolbarButton.Events.Click, this._refreshButtonClicked, this);
diff --git a/front_end/resources/ResourcesPanel.js b/front_end/resources/ResourcesPanel.js
index 116512c..0a073cf 100644
--- a/front_end/resources/ResourcesPanel.js
+++ b/front_end/resources/ResourcesPanel.js
@@ -20,7 +20,8 @@
super('resources');
this.registerRequiredCSS('resources/resourcesPanel.css');
- this._resourcesLastSelectedItemSetting = self.Common.settings.createSetting('resourcesLastSelectedElementPath', []);
+ this._resourcesLastSelectedItemSetting =
+ Common.Settings.Settings.instance().createSetting('resourcesLastSelectedElementPath', []);
/** @type {?UI.Widget.Widget} */
this.visibleView = null;
diff --git a/front_end/resources/ServiceWorkerCacheViews.js b/front_end/resources/ServiceWorkerCacheViews.js
index a15765b..0bbe564 100644
--- a/front_end/resources/ServiceWorkerCacheViews.js
+++ b/front_end/resources/ServiceWorkerCacheViews.js
@@ -434,7 +434,7 @@
this._tabbedPane = new UI.TabbedPane.TabbedPane();
this._tabbedPane.addEventListener(UI.TabbedPane.Events.TabSelected, this._tabSelected, this);
- this._resourceViewTabSetting = self.Common.settings.createSetting('cacheStorageViewTab', 'preview');
+ this._resourceViewTabSetting = Common.Settings.Settings.instance().createSetting('cacheStorageViewTab', 'preview');
this._tabbedPane.appendTab(
'headers', Common.UIString.UIString('Headers'), new Network.RequestHeadersView.RequestHeadersView(request));
diff --git a/front_end/resources/ServiceWorkersView.js b/front_end/resources/ServiceWorkersView.js
index 3ebd1ba..ecaad0f 100644
--- a/front_end/resources/ServiceWorkersView.js
+++ b/front_end/resources/ServiceWorkersView.js
@@ -64,12 +64,13 @@
this._toolbar.appendToolbarItem(
MobileThrottling.ThrottlingManager.throttlingManager().createOfflineToolbarCheckbox());
- const updateOnReloadSetting = self.Common.settings.createSetting('serviceWorkerUpdateOnReload', false);
+ const updateOnReloadSetting =
+ Common.Settings.Settings.instance().createSetting('serviceWorkerUpdateOnReload', false);
updateOnReloadSetting.setTitle(Common.UIString.UIString('Update on reload'));
const forceUpdate = new UI.Toolbar.ToolbarSettingCheckbox(
updateOnReloadSetting, ls`On page reload, force the service worker to update, and activate it`);
this._toolbar.appendToolbarItem(forceUpdate);
- const bypassServiceWorkerSetting = self.Common.settings.createSetting('bypassServiceWorker', false);
+ const bypassServiceWorkerSetting = Common.Settings.Settings.instance().createSetting('bypassServiceWorker', false);
bypassServiceWorkerSetting.setTitle(Common.UIString.UIString('Bypass for network'));
const fallbackToNetwork = new UI.Toolbar.ToolbarSettingCheckbox(
bypassServiceWorkerSetting, ls`Bypass the service worker and load resources from the network`);
@@ -336,11 +337,12 @@
this._registration = registration;
/** @type {?symbol} */
this._fingerprint = null;
- this._pushNotificationDataSetting = self.Common.settings.createLocalSetting(
+ this._pushNotificationDataSetting = Common.Settings.Settings.instance().createLocalSetting(
'pushData', Common.UIString.UIString('Test push message from DevTools.'));
- this._syncTagNameSetting = self.Common.settings.createLocalSetting('syncTagName', 'test-tag-from-devtools');
+ this._syncTagNameSetting =
+ Common.Settings.Settings.instance().createLocalSetting('syncTagName', 'test-tag-from-devtools');
this._periodicSyncTagNameSetting =
- self.Common.settings.createLocalSetting('periodicSyncTagName', 'test-tag-from-devtools');
+ Common.Settings.Settings.instance().createLocalSetting('periodicSyncTagName', 'test-tag-from-devtools');
this._toolbar = section.createToolbar();
this._toolbar.renderAsLinks();
diff --git a/front_end/screencast/ScreencastApp.js b/front_end/screencast/ScreencastApp.js
index 1fa1845..30f6590 100644
--- a/front_end/screencast/ScreencastApp.js
+++ b/front_end/screencast/ScreencastApp.js
@@ -18,7 +18,7 @@
*/
export class ScreencastApp {
constructor() {
- this._enabledSetting = self.Common.settings.createSetting('screencastEnabled', true);
+ this._enabledSetting = Common.Settings.Settings.instance().createSetting('screencastEnabled', true);
this._toggleButton = new UI.Toolbar.ToolbarToggle(Common.UIString.UIString('Toggle screencast'), 'largeicon-phone');
this._toggleButton.setToggled(this._enabledSetting.get());
this._toggleButton.setEnabled(false);
diff --git a/front_end/screencast/ScreencastView.js b/front_end/screencast/ScreencastView.js
index d3d13cb..cf8233a 100644
--- a/front_end/screencast/ScreencastView.js
+++ b/front_end/screencast/ScreencastView.js
@@ -259,7 +259,7 @@
const node = await this._domModel.nodeForLocation(
Math.floor(position.x / this._pageScaleFactor + this._scrollOffsetX),
Math.floor(position.y / this._pageScaleFactor + this._scrollOffsetY),
- self.Common.settings.moduleSetting('showUAShadowDOM').get());
+ Common.Settings.Settings.instance().moduleSetting('showUAShadowDOM').get());
if (!node) {
return;
diff --git a/front_end/sdk/CPUProfileDataModel.js b/front_end/sdk/CPUProfileDataModel.js
index 2d36b04..52a6cad 100644
--- a/front_end/sdk/CPUProfileDataModel.js
+++ b/front_end/sdk/CPUProfileDataModel.js
@@ -173,7 +173,7 @@
buildChildrenFromParents(nodes);
this.totalHitCount = nodes.reduce((acc, node) => acc + node.hitCount, 0);
const sampleTime = (this.profileEndTime - this.profileStartTime) / this.totalHitCount;
- const keepNatives = !!self.Common.settings.moduleSetting('showNativeFunctionsInJSProfile').get();
+ const keepNatives = !!Common.Settings.Settings.instance().moduleSetting('showNativeFunctionsInJSProfile').get();
const root = nodes[0];
/** @type {!Map<number, number>} */
const idMap = new Map([[root.id, root.id]]);
diff --git a/front_end/sdk/CPUProfilerModel.js b/front_end/sdk/CPUProfilerModel.js
index 2c3ef2b..33ac0d5 100644
--- a/front_end/sdk/CPUProfilerModel.js
+++ b/front_end/sdk/CPUProfilerModel.js
@@ -127,7 +127,8 @@
*/
startRecording() {
this._isRecording = true;
- const intervalUs = self.Common.settings.moduleSetting('highResolutionCpuProfiling').get() ? 100 : 1000;
+ const intervalUs =
+ Common.Settings.Settings.instance().moduleSetting('highResolutionCpuProfiling').get() ? 100 : 1000;
this._profilerAgent.setSamplingInterval(intervalUs);
return this._profilerAgent.start();
}
diff --git a/front_end/sdk/CSSModel.js b/front_end/sdk/CSSModel.js
index 128557d..f19c9b38 100644
--- a/front_end/sdk/CSSModel.js
+++ b/front_end/sdk/CSSModel.js
@@ -28,6 +28,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import * as Common from '../common/common.js';
import * as HostModule from '../host/host.js';
import * as Platform from '../platform/platform.js';
import * as ProtocolModule from '../protocol/protocol.js';
@@ -76,8 +77,9 @@
/** @type {boolean} */
this._isRuleUsageTrackingEnabled = false;
- this._sourceMapManager.setEnabled(self.Common.settings.moduleSetting('cssSourceMapsEnabled').get());
- self.Common.settings.moduleSetting('cssSourceMapsEnabled')
+ this._sourceMapManager.setEnabled(Common.Settings.Settings.instance().moduleSetting('cssSourceMapsEnabled').get());
+ Common.Settings.Settings.instance()
+ .moduleSetting('cssSourceMapsEnabled')
.addChangeListener(event => this._sourceMapManager.setEnabled(/** @type {boolean} */ (event.data)));
}
diff --git a/front_end/sdk/CSSProperty.js b/front_end/sdk/CSSProperty.js
index ec6fd7b..9c7fe9b 100644
--- a/front_end/sdk/CSSProperty.js
+++ b/front_end/sdk/CSSProperty.js
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+import * as Common from '../common/common.js';
import * as HostModule from '../host/host.js';
import * as Platform from '../platform/platform.js';
@@ -180,8 +181,9 @@
}
const range = this.range.relativeTo(this.ownerStyle.range.startLine, this.ownerStyle.range.startColumn);
- const indentation = this.ownerStyle.cssText ? this._detectIndentation(this.ownerStyle.cssText) :
- self.Common.settings.moduleSetting('textEditorIndent').get();
+ const indentation = this.ownerStyle.cssText ?
+ this._detectIndentation(this.ownerStyle.cssText) :
+ Common.Settings.Settings.instance().moduleSetting('textEditorIndent').get();
const endIndentation = this.ownerStyle.cssText ? indentation.substring(0, this.ownerStyle.range.endColumn) : '';
const text = new TextUtils.Text(this.ownerStyle.cssText || '');
const newStyleText = text.replaceRange(range, Platform.StringUtilities.sprintf(';%s;', propertyText));
diff --git a/front_end/sdk/ConsoleModel.js b/front_end/sdk/ConsoleModel.js
index dd06651..b3d6ed8 100644
--- a/front_end/sdk/ConsoleModel.js
+++ b/front_end/sdk/ConsoleModel.js
@@ -147,7 +147,7 @@
generatePreview: true,
replMode: true
},
- self.Common.settings.moduleSetting('consoleUserActivationEval').get(), awaitPromise);
+ Common.Settings.Settings.instance().moduleSetting('consoleUserActivationEval').get(), awaitPromise);
HostModule.userMetrics.actionTaken(Host.UserMetrics.Action.ConsoleEvaluated);
if (result.error) {
return;
@@ -267,7 +267,7 @@
}
_clearIfNecessary() {
- if (!self.Common.settings.moduleSetting('preserveConsoleLog').get()) {
+ if (!Common.Settings.Settings.instance().moduleSetting('preserveConsoleLog').get()) {
this._clear();
}
++this._pageLoadSequenceNumber;
@@ -277,7 +277,7 @@
* @param {!Common.EventTarget.EventTargetEvent} event
*/
_mainFrameNavigated(event) {
- if (self.Common.settings.moduleSetting('preserveConsoleLog').get()) {
+ if (Common.Settings.Settings.instance().moduleSetting('preserveConsoleLog').get()) {
Common.Console.Console.instance().log(Common.UIString.UIString('Navigated to %s', event.data.url));
}
}
diff --git a/front_end/sdk/DOMDebuggerModel.js b/front_end/sdk/DOMDebuggerModel.js
index c19cebe..73e8d0f 100644
--- a/front_end/sdk/DOMDebuggerModel.js
+++ b/front_end/sdk/DOMDebuggerModel.js
@@ -24,7 +24,7 @@
/** @type {!Array<!DOMBreakpoint>} */
this._domBreakpoints = [];
- this._domBreakpointsSetting = self.Common.settings.createLocalSetting('domBreakpoints', []);
+ this._domBreakpointsSetting = Common.Settings.Settings.instance().createLocalSetting('domBreakpoints', []);
if (this._domModel.existingDocument()) {
this._documentUpdated();
}
@@ -585,7 +585,7 @@
*/
export class DOMDebuggerManager {
constructor() {
- this._xhrBreakpointsSetting = self.Common.settings.createLocalSetting('xhrBreakpoints', []);
+ this._xhrBreakpointsSetting = Common.Settings.Settings.instance().createLocalSetting('xhrBreakpoints', []);
/** @type {!Map<string, boolean>} */
this._xhrBreakpoints = new Map();
for (const breakpoint of this._xhrBreakpointsSetting.get()) {
diff --git a/front_end/sdk/DebuggerModel.js b/front_end/sdk/DebuggerModel.js
index d373cec..772a448 100644
--- a/front_end/sdk/DebuggerModel.js
+++ b/front_end/sdk/DebuggerModel.js
@@ -74,13 +74,18 @@
this._autoStepOver = false;
this._isPausing = false;
- self.Common.settings.moduleSetting('pauseOnExceptionEnabled')
+ Common.Settings.Settings.instance()
+ .moduleSetting('pauseOnExceptionEnabled')
.addChangeListener(this._pauseOnExceptionStateChanged, this);
- self.Common.settings.moduleSetting('pauseOnCaughtException')
+ Common.Settings.Settings.instance()
+ .moduleSetting('pauseOnCaughtException')
.addChangeListener(this._pauseOnExceptionStateChanged, this);
- self.Common.settings.moduleSetting('disableAsyncStackTraces')
+ Common.Settings.Settings.instance()
+ .moduleSetting('disableAsyncStackTraces')
.addChangeListener(this._asyncStackTracesStateChanged, this);
- self.Common.settings.moduleSetting('breakpointsActive').addChangeListener(this._breakpointsActiveChanged, this);
+ Common.Settings.Settings.instance()
+ .moduleSetting('breakpointsActive')
+ .addChangeListener(this._breakpointsActiveChanged, this);
if (!target.suspended()) {
this._enableDebugger();
@@ -88,8 +93,9 @@
/** @type {!Map<string, string>} */
this._stringMap = new Map();
- this._sourceMapManager.setEnabled(self.Common.settings.moduleSetting('jsSourceMapsEnabled').get());
- self.Common.settings.moduleSetting('jsSourceMapsEnabled')
+ this._sourceMapManager.setEnabled(Common.Settings.Settings.instance().moduleSetting('jsSourceMapsEnabled').get());
+ Common.Settings.Settings.instance()
+ .moduleSetting('jsSourceMapsEnabled')
.addChangeListener(event => this._sourceMapManager.setEnabled(/** @type {boolean} */ (event.data)));
}
@@ -144,7 +150,7 @@
enablePromise.then(this._registerDebugger.bind(this));
this._pauseOnExceptionStateChanged();
this._asyncStackTracesStateChanged();
- if (!self.Common.settings.moduleSetting('breakpointsActive').get()) {
+ if (!Common.Settings.Settings.instance().moduleSetting('breakpointsActive').get()) {
this._breakpointsActiveChanged();
}
if (DebuggerModel._scheduledPauseOnAsyncCall) {
@@ -223,9 +229,9 @@
_pauseOnExceptionStateChanged() {
let state;
- if (!self.Common.settings.moduleSetting('pauseOnExceptionEnabled').get()) {
+ if (!Common.Settings.Settings.instance().moduleSetting('pauseOnExceptionEnabled').get()) {
state = PauseOnExceptionsState.DontPauseOnExceptions;
- } else if (self.Common.settings.moduleSetting('pauseOnCaughtException').get()) {
+ } else if (Common.Settings.Settings.instance().moduleSetting('pauseOnCaughtException').get()) {
state = PauseOnExceptionsState.PauseOnAllExceptions;
} else {
state = PauseOnExceptionsState.PauseOnUncaughtExceptions;
@@ -236,12 +242,13 @@
_asyncStackTracesStateChanged() {
const maxAsyncStackChainDepth = 32;
- const enabled = !self.Common.settings.moduleSetting('disableAsyncStackTraces').get() && this._debuggerEnabled;
+ const enabled =
+ !Common.Settings.Settings.instance().moduleSetting('disableAsyncStackTraces').get() && this._debuggerEnabled;
return this._agent.setAsyncCallStackDepth(enabled ? maxAsyncStackChainDepth : 0);
}
_breakpointsActiveChanged() {
- this._agent.setBreakpointsActive(self.Common.settings.moduleSetting('breakpointsActive').get());
+ this._agent.setBreakpointsActive(Common.Settings.Settings.instance().moduleSetting('breakpointsActive').get());
}
stepInto() {
@@ -953,11 +960,14 @@
dispose() {
this._sourceMapManager.dispose();
_debuggerIdToModel.delete(this._debuggerId);
- self.Common.settings.moduleSetting('pauseOnExceptionEnabled')
+ Common.Settings.Settings.instance()
+ .moduleSetting('pauseOnExceptionEnabled')
.removeChangeListener(this._pauseOnExceptionStateChanged, this);
- self.Common.settings.moduleSetting('pauseOnCaughtException')
+ Common.Settings.Settings.instance()
+ .moduleSetting('pauseOnCaughtException')
.removeChangeListener(this._pauseOnExceptionStateChanged, this);
- self.Common.settings.moduleSetting('disableAsyncStackTraces')
+ Common.Settings.Settings.instance()
+ .moduleSetting('disableAsyncStackTraces')
.removeChangeListener(this._asyncStackTracesStateChanged, this);
}
diff --git a/front_end/sdk/EmulationModel.js b/front_end/sdk/EmulationModel.js
index 3e6277d..7baa779 100644
--- a/front_end/sdk/EmulationModel.js
+++ b/front_end/sdk/EmulationModel.js
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+import * as Common from '../common/common.js';
+
import {CSSModel} from './CSSModel.js';
import {Events, OverlayModel} from './OverlayModel.js';
import {Capability, SDKModel, Target} from './SDKModel.js'; // eslint-disable-line no-unused-vars
@@ -21,18 +23,18 @@
this._overlayModel.addEventListener(Events.InspectModeWillBeToggled, this._updateTouch, this);
}
- const disableJavascriptSetting = self.Common.settings.moduleSetting('javaScriptDisabled');
+ const disableJavascriptSetting = Common.Settings.Settings.instance().moduleSetting('javaScriptDisabled');
disableJavascriptSetting.addChangeListener(
() => this._emulationAgent.setScriptExecutionDisabled(disableJavascriptSetting.get()));
if (disableJavascriptSetting.get()) {
this._emulationAgent.setScriptExecutionDisabled(true);
}
- const mediaTypeSetting = self.Common.settings.moduleSetting('emulatedCSSMedia');
+ const mediaTypeSetting = Common.Settings.Settings.instance().moduleSetting('emulatedCSSMedia');
const mediaFeaturePrefersColorSchemeSetting =
- self.Common.settings.moduleSetting('emulatedCSSMediaFeaturePrefersColorScheme');
+ Common.Settings.Settings.instance().moduleSetting('emulatedCSSMediaFeaturePrefersColorScheme');
const mediaFeaturePrefersReducedMotionSetting =
- self.Common.settings.moduleSetting('emulatedCSSMediaFeaturePrefersReducedMotion');
+ Common.Settings.Settings.instance().moduleSetting('emulatedCSSMediaFeaturePrefersReducedMotion');
// Note: this uses a different format than what the CDP API expects,
// because we want to update these values per media type/feature
// without having to search the `features` array (inefficient) or
@@ -56,7 +58,7 @@
});
this._updateCssMedia();
- const visionDeficiencySetting = self.Common.settings.moduleSetting('emulatedVisionDeficiency');
+ const visionDeficiencySetting = Common.Settings.Settings.instance().moduleSetting('emulatedVisionDeficiency');
visionDeficiencySetting.addChangeListener(() => this._emulateVisionDeficiency(visionDeficiencySetting.get()));
if (visionDeficiencySetting.get()) {
this._emulateVisionDeficiency(visionDeficiencySetting.get());
diff --git a/front_end/sdk/NetworkLog.js b/front_end/sdk/NetworkLog.js
index 2739f98..9475fa0 100644
--- a/front_end/sdk/NetworkLog.js
+++ b/front_end/sdk/NetworkLog.js
@@ -306,7 +306,7 @@
}
_willReloadPage() {
- if (!self.Common.settings.moduleSetting('network_log.preserve-log').get()) {
+ if (!Common.Settings.Settings.instance().moduleSetting('network_log.preserve-log').get()) {
this.reset();
}
}
@@ -370,7 +370,7 @@
this.dispatchEventToListeners(Events.RequestAdded, request);
}
- if (self.Common.settings.moduleSetting('network_log.preserve-log').get()) {
+ if (Common.Settings.Settings.instance().moduleSetting('network_log.preserve-log').get()) {
for (const request of oldRequestsSet) {
this._requests.push(request);
this._requestsSet.add(request);
diff --git a/front_end/sdk/NetworkManager.js b/front_end/sdk/NetworkManager.js
index 43ee462..15ad374 100644
--- a/front_end/sdk/NetworkManager.js
+++ b/front_end/sdk/NetworkManager.js
@@ -49,19 +49,21 @@
this._dispatcher = new NetworkDispatcher(this);
this._networkAgent = target.networkAgent();
target.registerNetworkDispatcher(this._dispatcher);
- if (self.Common.settings.moduleSetting('cacheDisabled').get()) {
+ if (Common.Settings.Settings.instance().moduleSetting('cacheDisabled').get()) {
this._networkAgent.setCacheDisabled(true);
}
this._networkAgent.enable(undefined, undefined, MAX_EAGER_POST_REQUEST_BODY_LENGTH);
- this._bypassServiceWorkerSetting = self.Common.settings.createSetting('bypassServiceWorker', false);
+ this._bypassServiceWorkerSetting = Common.Settings.Settings.instance().createSetting('bypassServiceWorker', false);
if (this._bypassServiceWorkerSetting.get()) {
this._bypassServiceWorkerChanged();
}
this._bypassServiceWorkerSetting.addChangeListener(this._bypassServiceWorkerChanged, this);
- self.Common.settings.moduleSetting('cacheDisabled').addChangeListener(this._cacheDisabledSettingChanged, this);
+ Common.Settings.Settings.instance()
+ .moduleSetting('cacheDisabled')
+ .addChangeListener(this._cacheDisabledSettingChanged, this);
}
/**
@@ -202,7 +204,9 @@
* @override
*/
dispose() {
- self.Common.settings.moduleSetting('cacheDisabled').removeChangeListener(this._cacheDisabledSettingChanged, this);
+ Common.Settings.Settings.instance()
+ .moduleSetting('cacheDisabled')
+ .removeChangeListener(this._cacheDisabledSettingChanged, this);
}
_bypassServiceWorkerChanged() {
@@ -972,7 +976,7 @@
Events.MessageGenerated, {message: message, requestId: networkRequest.requestId(), warning: true});
}
- if (self.Common.settings.moduleSetting('monitoringXHREnabled').get() &&
+ if (Common.Settings.Settings.instance().moduleSetting('monitoringXHREnabled').get() &&
networkRequest.resourceType().category() === Common.ResourceType.resourceCategories.XHR) {
let message;
const failedToLoad = networkRequest.failed || networkRequest.hasErrorStatusCode();
@@ -1024,8 +1028,8 @@
this._updatingInterceptionPatternsPromise = null;
// TODO(allada) Remove these and merge it with request interception.
- this._blockingEnabledSetting = self.Common.settings.moduleSetting('requestBlockingEnabled');
- this._blockedPatternsSetting = self.Common.settings.createSetting('networkBlockedPatterns', []);
+ this._blockingEnabledSetting = Common.Settings.Settings.instance().moduleSetting('requestBlockingEnabled');
+ this._blockedPatternsSetting = Common.Settings.Settings.instance().createSetting('networkBlockedPatterns', []);
this._effectiveBlockedURLs = [];
this._updateBlockedPatterns();
@@ -1290,8 +1294,8 @@
* @return {!Promise}
*/
_updateInterceptionPatterns() {
- if (!self.Common.settings.moduleSetting('cacheDisabled').get()) {
- self.Common.settings.moduleSetting('cacheDisabled').set(true);
+ if (!Common.Settings.Settings.instance().moduleSetting('cacheDisabled').get()) {
+ Common.Settings.Settings.instance().moduleSetting('cacheDisabled').set(true);
}
this._updatingInterceptionPatternsPromise = null;
const promises = /** @type {!Array<!Promise>} */ ([]);
@@ -1350,7 +1354,7 @@
headers['User-Agent'] = currentUserAgent;
}
- if (self.Common.settings.moduleSetting('cacheDisabled').get()) {
+ if (Common.Settings.Settings.instance().moduleSetting('cacheDisabled').get()) {
headers['Cache-Control'] = 'no-cache';
}
diff --git a/front_end/sdk/OverlayModel.js b/front_end/sdk/OverlayModel.js
index bcf0df8..6697102 100644
--- a/front_end/sdk/OverlayModel.js
+++ b/front_end/sdk/OverlayModel.js
@@ -25,7 +25,8 @@
this._debuggerModel = target.model(DebuggerModel);
if (this._debuggerModel) {
- self.Common.settings.moduleSetting('disablePausedStateOverlay')
+ Common.Settings.Settings.instance()
+ .moduleSetting('disablePausedStateOverlay')
.addChangeListener(this._updatePausedInDebuggerMessage, this);
this._debuggerModel.addEventListener(DebuggerModelEvents.DebuggerPaused, event => {
this._updatePausedInDebuggerMessage();
@@ -44,13 +45,14 @@
this._defaultHighlighter = new DefaultHighlighter(this);
this._highlighter = this._defaultHighlighter;
- this._showPaintRectsSetting = self.Common.settings.moduleSetting('showPaintRects');
- this._showLayoutShiftRegionsSetting = self.Common.settings.moduleSetting('showLayoutShiftRegions');
- this._showAdHighlightsSetting = self.Common.settings.moduleSetting('showAdHighlights');
- this._showDebugBordersSetting = self.Common.settings.moduleSetting('showDebugBorders');
- this._showFPSCounterSetting = self.Common.settings.moduleSetting('showFPSCounter');
- this._showScrollBottleneckRectsSetting = self.Common.settings.moduleSetting('showScrollBottleneckRects');
- this._showHitTestBordersSetting = self.Common.settings.moduleSetting('showHitTestBorders');
+ this._showPaintRectsSetting = Common.Settings.Settings.instance().moduleSetting('showPaintRects');
+ this._showLayoutShiftRegionsSetting = Common.Settings.Settings.instance().moduleSetting('showLayoutShiftRegions');
+ this._showAdHighlightsSetting = Common.Settings.Settings.instance().moduleSetting('showAdHighlights');
+ this._showDebugBordersSetting = Common.Settings.Settings.instance().moduleSetting('showDebugBorders');
+ this._showFPSCounterSetting = Common.Settings.Settings.instance().moduleSetting('showFPSCounter');
+ this._showScrollBottleneckRectsSetting =
+ Common.Settings.Settings.instance().moduleSetting('showScrollBottleneckRects');
+ this._showHitTestBordersSetting = Common.Settings.Settings.instance().moduleSetting('showHitTestBorders');
this._registeredListeners = [];
this._showViewportSizeOnResize = true;
@@ -165,8 +167,8 @@
if (this.target().suspended()) {
return;
}
- const message =
- this._debuggerModel.isPaused() && !self.Common.settings.moduleSetting('disablePausedStateOverlay').get() ?
+ const message = this._debuggerModel.isPaused() &&
+ !Common.Settings.Settings.instance().moduleSetting('disablePausedStateOverlay').get() ?
Common.UIString.UIString('Paused in debugger') :
undefined;
this._overlayAgent.setPausedInDebuggerMessage(message);
@@ -249,7 +251,7 @@
* @return {!Protocol.Overlay.HighlightConfig}
*/
_buildHighlightConfig(mode = 'all', showStyles = false) {
- const showRulers = self.Common.settings.moduleSetting('showMetricsRulers').get();
+ const showRulers = Common.Settings.Settings.instance().moduleSetting('showMetricsRulers').get();
const highlightConfig =
{showInfo: mode === 'all', showRulers: showRulers, showStyles, showExtensionLines: showRulers};
if (mode === 'all' || mode === 'content') {
diff --git a/front_end/sdk/RuntimeModel.js b/front_end/sdk/RuntimeModel.js
index 92d40f8..c427bf7 100644
--- a/front_end/sdk/RuntimeModel.js
+++ b/front_end/sdk/RuntimeModel.js
@@ -58,11 +58,12 @@
/** @type {?boolean} */
this._hasSideEffectSupport = null;
- if (self.Common.settings.moduleSetting('customFormatters').get()) {
+ if (Common.Settings.Settings.instance().moduleSetting('customFormatters').get()) {
this._agent.setCustomObjectFormatterEnabled(true);
}
- self.Common.settings.moduleSetting('customFormatters')
+ Common.Settings.Settings.instance()
+ .moduleSetting('customFormatters')
.addChangeListener(this._customFormattersStateChanged.bind(this));
}
diff --git a/front_end/sdk/ServerTiming.js b/front_end/sdk/ServerTiming.js
index 18b3d31..3f06dc8 100644
--- a/front_end/sdk/ServerTiming.js
+++ b/front_end/sdk/ServerTiming.js
@@ -3,6 +3,7 @@
// found in the LICENSE file.
import * as Common from '../common/common.js';
+import {ls} from '../common/common.js'; // eslint-disable-line rulesdir/es_modules_import
import {NameValue} from './NetworkRequest.js'; // eslint-disable-line no-unused-vars
diff --git a/front_end/sdk/ServiceWorkerManager.js b/front_end/sdk/ServiceWorkerManager.js
index 31bc38a..6dbb030 100644
--- a/front_end/sdk/ServiceWorkerManager.js
+++ b/front_end/sdk/ServiceWorkerManager.js
@@ -48,7 +48,7 @@
/** @type {!Map.<string, !ServiceWorkerRegistration>} */
this._registrations = new Map();
this.enable();
- this._forceUpdateSetting = self.Common.settings.createSetting('serviceWorkerUpdateOnReload', false);
+ this._forceUpdateSetting = Common.Settings.Settings.instance().createSetting('serviceWorkerUpdateOnReload', false);
if (this._forceUpdateSetting.get()) {
this._forceUpdateSettingChanged();
}
diff --git a/front_end/search/SearchView.js b/front_end/search/SearchView.js
index aba7e56..7c52a41 100644
--- a/front_end/search/SearchView.js
+++ b/front_end/search/SearchView.js
@@ -79,7 +79,7 @@
this._searchProgressPlaceholderElement = searchStatusBarElement.createChild('div', 'flex-centered');
this._searchResultsMessageElement = searchStatusBarElement.createChild('div', 'search-message');
- this._advancedSearchConfig = self.Common.settings.createLocalSetting(
+ this._advancedSearchConfig = Common.Settings.Settings.instance().createLocalSetting(
settingKey + 'SearchConfig', new SearchConfig('', true, false).toPlainObject());
this._load();
diff --git a/front_end/settings/FrameworkBlackboxSettingsTab.js b/front_end/settings/FrameworkBlackboxSettingsTab.js
index 3f3f200..4eeae3f 100644
--- a/front_end/settings/FrameworkBlackboxSettingsTab.js
+++ b/front_end/settings/FrameworkBlackboxSettingsTab.js
@@ -22,7 +22,7 @@
const blackboxContentScripts = this.contentElement.createChild('div', 'blackbox-content-scripts');
blackboxContentScripts.appendChild(UI.SettingsUI.createSettingCheckbox(
- ls`Blackbox content scripts`, self.Common.settings.moduleSetting('skipContentScripts'), true));
+ ls`Blackbox content scripts`, Common.Settings.Settings.instance().moduleSetting('skipContentScripts'), true));
blackboxContentScripts.title = ls`Blackbox content scripts (extension scripts in the page)`;
this._blackboxLabel = Common.UIString.UIString('Blackbox');
@@ -40,7 +40,7 @@
Common.UIString.UIString('Add pattern...'), this._addButtonClicked.bind(this), 'add-button');
this.contentElement.appendChild(addPatternButton);
- this._setting = self.Common.settings.moduleSetting('skipStackFramesPattern');
+ this._setting = Common.Settings.Settings.instance().moduleSetting('skipStackFramesPattern');
this._setting.addChangeListener(this._settingUpdated, this);
this.setDefaultFocusedElement(addPatternButton);
diff --git a/front_end/settings/SettingsScreen.js b/front_end/settings/SettingsScreen.js
index 30b5669..640ae53 100644
--- a/front_end/settings/SettingsScreen.js
+++ b/front_end/settings/SettingsScreen.js
@@ -168,7 +168,7 @@
UI.UIUtils.createTextButton(Common.UIString.UIString('Restore defaults and reload'), restoreAndReload));
function restoreAndReload() {
- self.Common.settings.clearAll();
+ Common.Settings.Settings.instance().clearAll();
Components.Reload.reload();
}
}
@@ -196,7 +196,7 @@
return;
}
const sectionElement = this._sectionElement(extension.descriptor()['category']);
- const setting = self.Common.settings.moduleSetting(extension.descriptor()['settingName']);
+ const setting = Common.Settings.Settings.instance().moduleSetting(extension.descriptor()['settingName']);
const settingControl = UI.SettingsUI.createControlForSetting(setting);
if (settingControl) {
sectionElement.appendChild(settingControl);
diff --git a/front_end/snippets/ScriptSnippetFileSystem.js b/front_end/snippets/ScriptSnippetFileSystem.js
index aa2e828..3b5b1b4 100644
--- a/front_end/snippets/ScriptSnippetFileSystem.js
+++ b/front_end/snippets/ScriptSnippetFileSystem.js
@@ -10,8 +10,9 @@
class SnippetFileSystem extends Persistence.PlatformFileSystem.PlatformFileSystem {
constructor() {
super('snippet://', 'snippets');
- this._lastSnippetIdentifierSetting = self.Common.settings.createSetting('scriptSnippets_lastIdentifier', 0);
- this._snippetsSetting = self.Common.settings.createSetting('scriptSnippets', []);
+ this._lastSnippetIdentifierSetting =
+ Common.Settings.Settings.instance().createSetting('scriptSnippets_lastIdentifier', 0);
+ this._snippetsSetting = Common.Settings.Settings.instance().createSetting('scriptSnippets', []);
}
/**
diff --git a/front_end/source_frame/SourcesTextEditor.js b/front_end/source_frame/SourcesTextEditor.js
index 893c112..8a9f829 100644
--- a/front_end/source_frame/SourcesTextEditor.js
+++ b/front_end/source_frame/SourcesTextEditor.js
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+import * as Common from '../common/common.js';
import * as TextEditor from '../text_editor/text_editor.js';
import * as TextUtils from '../text_utils/text_utils.js';
import * as UI from '../ui/ui.js';
@@ -18,8 +19,8 @@
const defaultCodeMirrorOptions = {
lineNumbers: true,
lineWrapping: false,
- bracketMatchingSetting: self.Common.settings.moduleSetting('textEditorBracketMatching'),
- padBottom: self.Common.settings.moduleSetting('allowScrollPastEof').get()
+ bracketMatchingSetting: Common.Settings.Settings.instance().moduleSetting('textEditorBracketMatching'),
+ padBottom: Common.Settings.Settings.instance().moduleSetting('allowScrollPastEof').get()
};
if (codeMirrorOptions) {
Object.assign(defaultCodeMirrorOptions, codeMirrorOptions);
@@ -67,17 +68,28 @@
this.element.addEventListener('mousedown', updateAnticipateJumpFlag.bind(this, true), true);
this.element.addEventListener('mousedown', updateAnticipateJumpFlag.bind(this, false), false);
- self.Common.settings.moduleSetting('textEditorIndent').addChangeListener(this._onUpdateEditorIndentation, this);
- self.Common.settings.moduleSetting('textEditorAutoDetectIndent')
+ Common.Settings.Settings.instance()
+ .moduleSetting('textEditorIndent')
.addChangeListener(this._onUpdateEditorIndentation, this);
- self.Common.settings.moduleSetting('showWhitespacesInEditor').addChangeListener(this._updateWhitespace, this);
- self.Common.settings.moduleSetting('textEditorCodeFolding').addChangeListener(this._updateCodeFolding, this);
- self.Common.settings.moduleSetting('allowScrollPastEof').addChangeListener(this._updateScrollPastEof, this);
+ Common.Settings.Settings.instance()
+ .moduleSetting('textEditorAutoDetectIndent')
+ .addChangeListener(this._onUpdateEditorIndentation, this);
+ Common.Settings.Settings.instance()
+ .moduleSetting('showWhitespacesInEditor')
+ .addChangeListener(this._updateWhitespace, this);
+ Common.Settings.Settings.instance()
+ .moduleSetting('textEditorCodeFolding')
+ .addChangeListener(this._updateCodeFolding, this);
+ Common.Settings.Settings.instance()
+ .moduleSetting('allowScrollPastEof')
+ .addChangeListener(this._updateScrollPastEof, this);
this._updateCodeFolding();
/** @type {?UI.TextEditor.AutocompleteConfig} */
this._autocompleteConfig = {isWordChar: TextUtils.TextUtils.Utils.isWordChar};
- self.Common.settings.moduleSetting('textEditorAutocompletion').addChangeListener(this._updateAutocomplete, this);
+ Common.Settings.Settings.instance()
+ .moduleSetting('textEditorAutocompletion')
+ .addChangeListener(this._updateAutocomplete, this);
this._updateAutocomplete();
this._onUpdateEditorIndentation();
@@ -141,7 +153,7 @@
}
}
if (minimumIndent === Infinity) {
- return self.Common.settings.moduleSetting('textEditorIndent').get();
+ return Common.Settings.Settings.instance().moduleSetting('textEditorIndent').get();
}
return ' '.repeat(minimumIndent);
}
@@ -395,7 +407,7 @@
*/
editRange(range, text, origin) {
const newRange = super.editRange(range, text, origin);
- if (self.Common.settings.moduleSetting('textEditorAutoDetectIndent').get()) {
+ if (Common.Settings.Settings.instance().moduleSetting('textEditorAutoDetectIndent').get()) {
this._onUpdateEditorIndentation();
}
@@ -412,8 +424,8 @@
*/
_setEditorIndentation(lines) {
const extraKeys = {};
- let indent = self.Common.settings.moduleSetting('textEditorIndent').get();
- if (self.Common.settings.moduleSetting('textEditorAutoDetectIndent').get()) {
+ let indent = Common.Settings.Settings.instance().moduleSetting('textEditorIndent').get();
+ if (Common.Settings.Settings.instance().moduleSetting('textEditorAutoDetectIndent').get()) {
indent = SourcesTextEditor._guessIndentationLevel(lines);
}
@@ -523,12 +535,21 @@
*/
dispose() {
super.dispose();
- self.Common.settings.moduleSetting('textEditorIndent').removeChangeListener(this._onUpdateEditorIndentation, this);
- self.Common.settings.moduleSetting('textEditorAutoDetectIndent')
+ Common.Settings.Settings.instance()
+ .moduleSetting('textEditorIndent')
.removeChangeListener(this._onUpdateEditorIndentation, this);
- self.Common.settings.moduleSetting('showWhitespacesInEditor').removeChangeListener(this._updateWhitespace, this);
- self.Common.settings.moduleSetting('textEditorCodeFolding').removeChangeListener(this._updateCodeFolding, this);
- self.Common.settings.moduleSetting('allowScrollPastEof').removeChangeListener(this._updateScrollPastEof, this);
+ Common.Settings.Settings.instance()
+ .moduleSetting('textEditorAutoDetectIndent')
+ .removeChangeListener(this._onUpdateEditorIndentation, this);
+ Common.Settings.Settings.instance()
+ .moduleSetting('showWhitespacesInEditor')
+ .removeChangeListener(this._updateWhitespace, this);
+ Common.Settings.Settings.instance()
+ .moduleSetting('textEditorCodeFolding')
+ .removeChangeListener(this._updateCodeFolding, this);
+ Common.Settings.Settings.instance()
+ .moduleSetting('allowScrollPastEof')
+ .removeChangeListener(this._updateScrollPastEof, this);
}
/**
@@ -545,7 +566,7 @@
}
_updateCodeFolding() {
- if (self.Common.settings.moduleSetting('textEditorCodeFolding').get()) {
+ if (Common.Settings.Settings.instance().moduleSetting('textEditorCodeFolding').get()) {
this.installGutter('CodeMirror-foldgutter', false);
this.element.addEventListener('mousemove', this._gutterMouseMove);
this.element.addEventListener('mouseout', this._gutterMouseOut);
@@ -561,7 +582,7 @@
}
_updateScrollPastEof() {
- this.toggleScrollPastEof(self.Common.settings.moduleSetting('allowScrollPastEof').get());
+ this.toggleScrollPastEof(Common.Settings.Settings.instance().moduleSetting('allowScrollPastEof').get());
}
/**
@@ -571,7 +592,7 @@
*/
rewriteMimeType(mimeType) {
this._setupWhitespaceHighlight();
- const whitespaceMode = self.Common.settings.moduleSetting('showWhitespacesInEditor').get();
+ const whitespaceMode = Common.Settings.Settings.instance().moduleSetting('showWhitespacesInEditor').get();
this.element.classList.toggle('show-whitespaces', whitespaceMode === 'all');
if (whitespaceMode === 'all') {
@@ -652,7 +673,7 @@
_setupWhitespaceHighlight() {
const doc = this.element.ownerDocument;
if (doc._codeMirrorWhitespaceStyleInjected ||
- !self.Common.settings.moduleSetting('showWhitespacesInEditor').get()) {
+ !Common.Settings.Settings.instance().moduleSetting('showWhitespacesInEditor').get()) {
return;
}
doc._codeMirrorWhitespaceStyleInjected = true;
@@ -681,7 +702,8 @@
_updateAutocomplete() {
super.configureAutocomplete(
- self.Common.settings.moduleSetting('textEditorAutocompletion').get() ? this._autocompleteConfig : null);
+ Common.Settings.Settings.instance().moduleSetting('textEditorAutocompletion').get() ? this._autocompleteConfig :
+ null);
}
}
diff --git a/front_end/sources/DebuggerPlugin.js b/front_end/sources/DebuggerPlugin.js
index bb82674..dbc972a 100644
--- a/front_end/sources/DebuggerPlugin.js
+++ b/front_end/sources/DebuggerPlugin.js
@@ -126,9 +126,12 @@
/** @type {!Map.<!SDK.DebuggerModel.DebuggerModel, !Bindings.ResourceScriptMapping.ResourceScriptFile>}*/
this._scriptFileForDebuggerModel = new Map();
- self.Common.settings.moduleSetting('skipStackFramesPattern')
+ Common.Settings.Settings.instance()
+ .moduleSetting('skipStackFramesPattern')
.addChangeListener(this._showBlackboxInfobarIfNeeded, this);
- self.Common.settings.moduleSetting('skipContentScripts').addChangeListener(this._showBlackboxInfobarIfNeeded, this);
+ Common.Settings.Settings.instance()
+ .moduleSetting('skipContentScripts')
+ .addChangeListener(this._showBlackboxInfobarIfNeeded, this);
/** @type {!Map.<number, !Element>} */
this._valueWidgets = new Map();
@@ -346,7 +349,7 @@
*/
function populateSourceMapMembers() {
if (this._uiSourceCode.project().type() === Workspace.Workspace.projectTypes.Network &&
- self.Common.settings.moduleSetting('jsSourceMapsEnabled').get() &&
+ Common.Settings.Settings.instance().moduleSetting('jsSourceMapsEnabled').get() &&
!self.Bindings.blackboxManager.isBlackboxedUISourceCode(this._uiSourceCode)) {
if (this._scriptFileForDebuggerModel.size) {
const scriptFile = this._scriptFileForDebuggerModel.values().next().value;
@@ -779,7 +782,7 @@
}
_generateValuesInSource() {
- if (!self.Common.settings.moduleSetting('inlineVariableValues').get()) {
+ if (!Common.Settings.Settings.instance().moduleSetting('inlineVariableValues').get()) {
return;
}
const executionContext = self.UI.context.flavor(SDK.RuntimeModel.ExecutionContext);
@@ -1586,7 +1589,7 @@
}
this._sourceMapInfobar = UI.Infobar.Infobar.create(
UI.Infobar.Type.Info, Common.UIString.UIString('Source Map detected.'), [],
- self.Common.settings.createSetting('sourceMapInfobarDisabled', false));
+ Common.Settings.Settings.instance().createSetting('sourceMapInfobarDisabled', false));
if (!this._sourceMapInfobar) {
return;
}
@@ -1617,8 +1620,7 @@
this._prettyPrintInfobar = UI.Infobar.Infobar.create(
UI.Infobar.Type.Info, Common.UIString.UIString('Pretty-print this minified file?'),
[{text: ls`Pretty-print`, delegate: formatterCallback, highlight: true, dismiss: true}],
- self.Common.settings.createSetting('prettyPrintInfobarDisabled', false));
-
+ Common.Settings.Settings.instance().createSetting('prettyPrintInfobarDisabled', false));
if (!this._prettyPrintInfobar) {
return;
}
@@ -1717,7 +1719,7 @@
return;
}
- self.Common.settings.moduleSetting('breakpointsActive').set(true);
+ Common.Settings.Settings.instance().moduleSetting('breakpointsActive').set(true);
await this._breakpointManager.setBreakpoint(this._uiSourceCode, lineNumber, columnNumber, condition, enabled);
this._breakpointWasSetForTest(lineNumber, columnNumber, condition, enabled);
}
@@ -1797,9 +1799,11 @@
this._uiSourceCode.removeEventListener(
Workspace.UISourceCode.Events.WorkingCopyCommitted, this._workingCopyCommitted, this);
- self.Common.settings.moduleSetting('skipStackFramesPattern')
+ Common.Settings.Settings.instance()
+ .moduleSetting('skipStackFramesPattern')
.removeChangeListener(this._showBlackboxInfobarIfNeeded, this);
- self.Common.settings.moduleSetting('skipContentScripts')
+ Common.Settings.Settings.instance()
+ .moduleSetting('skipContentScripts')
.removeChangeListener(this._showBlackboxInfobarIfNeeded, this);
super.dispose();
diff --git a/front_end/sources/JavaScriptBreakpointsSidebarPane.js b/front_end/sources/JavaScriptBreakpointsSidebarPane.js
index 2acf5e8..a68be20 100644
--- a/front_end/sources/JavaScriptBreakpointsSidebarPane.js
+++ b/front_end/sources/JavaScriptBreakpointsSidebarPane.js
@@ -22,7 +22,7 @@
this._breakpointManager = self.Bindings.breakpointManager;
this._breakpointManager.addEventListener(Bindings.BreakpointManager.Events.BreakpointAdded, this.update, this);
this._breakpointManager.addEventListener(Bindings.BreakpointManager.Events.BreakpointRemoved, this.update, this);
- self.Common.settings.moduleSetting('breakpointsActive').addChangeListener(this.update, this);
+ Common.Settings.Settings.instance().moduleSetting('breakpointsActive').addChangeListener(this.update, this);
/** @type {!UI.ListModel.ListModel.<!BreakpointItem>} */
this._breakpoints = new UI.ListModel.ListModel();
@@ -107,7 +107,7 @@
self.UI.viewManager.showView('sources.jsBreakpoints');
}
this._list.element.classList.toggle(
- 'breakpoints-list-deactivated', !self.Common.settings.moduleSetting('breakpointsActive').get());
+ 'breakpoints-list-deactivated', !Common.Settings.Settings.instance().moduleSetting('breakpointsActive').get());
this._breakpoints.replaceAll(breakpoints);
this._list.selectItem(itemToSelect || this._breakpoints.at(0));
if (hadFocus) {
@@ -299,11 +299,12 @@
contextMenu.defaultSection().appendItem(ls`Reveal location`, this._revealLocation.bind(this, event.target));
}
- const breakpointActive = self.Common.settings.moduleSetting('breakpointsActive').get();
+ const breakpointActive = Common.Settings.Settings.instance().moduleSetting('breakpointsActive').get();
const breakpointActiveTitle = breakpointActive ? Common.UIString.UIString('Deactivate breakpoints') :
Common.UIString.UIString('Activate breakpoints');
contextMenu.defaultSection().appendItem(
- breakpointActiveTitle, () => self.Common.settings.moduleSetting('breakpointsActive').set(!breakpointActive));
+ breakpointActiveTitle,
+ () => Common.Settings.Settings.instance().moduleSetting('breakpointsActive').set(!breakpointActive));
if (breakpoints.some(breakpoint => !breakpoint.enabled())) {
const enableTitle = Common.UIString.UIString('Enable all breakpoints');
diff --git a/front_end/sources/NavigatorView.js b/front_end/sources/NavigatorView.js
index c81abaa..b11eef6 100644
--- a/front_end/sources/NavigatorView.js
+++ b/front_end/sources/NavigatorView.js
@@ -72,7 +72,7 @@
self.UI.shortcutRegistry.addShortcutListener(
this.contentElement, 'sources.rename', this._renameShortcut.bind(this), true);
- this._navigatorGroupByFolderSetting = self.Common.settings.moduleSetting('navigatorGroupByFolder');
+ this._navigatorGroupByFolderSetting = Common.Settings.Settings.instance().moduleSetting('navigatorGroupByFolder');
this._navigatorGroupByFolderSetting.addChangeListener(this._groupingChanged.bind(this));
this._initGrouping();
diff --git a/front_end/sources/SourcesNavigator.js b/front_end/sources/SourcesNavigator.js
index 882ada3..a1c086c 100644
--- a/front_end/sources/SourcesNavigator.js
+++ b/front_end/sources/SourcesNavigator.js
@@ -185,7 +185,7 @@
const project = self.Persistence.networkPersistenceManager.project();
if (project) {
const enableCheckbox = new UI.Toolbar.ToolbarSettingCheckbox(
- self.Common.settings.moduleSetting('persistenceNetworkOverridesEnabled'));
+ Common.Settings.Settings.instance().moduleSetting('persistenceNetworkOverridesEnabled'));
this._toolbar.appendToolbarItem(enableCheckbox);
this._toolbar.appendToolbarItem(new UI.Toolbar.ToolbarSeparator(true));
@@ -210,7 +210,7 @@
if (!fileSystem) {
return;
}
- self.Common.settings.moduleSetting('persistenceNetworkOverridesEnabled').set(true);
+ Common.Settings.Settings.instance().moduleSetting('persistenceNetworkOverridesEnabled').set(true);
}
/**
diff --git a/front_end/sources/SourcesPanel.js b/front_end/sources/SourcesPanel.js
index 5d51037..db4e64d 100644
--- a/front_end/sources/SourcesPanel.js
+++ b/front_end/sources/SourcesPanel.js
@@ -122,18 +122,22 @@
this._watchSidebarPane = /** @type {!UI.View.View} */ (self.UI.viewManager.view('sources.watch'));
this._callstackPane = self.runtime.sharedInstance(CallStackSidebarPane);
- self.Common.settings.moduleSetting('sidebarPosition').addChangeListener(this._updateSidebarPosition.bind(this));
+ Common.Settings.Settings.instance()
+ .moduleSetting('sidebarPosition')
+ .addChangeListener(this._updateSidebarPosition.bind(this));
this._updateSidebarPosition();
this._updateDebuggerButtonsAndStatus();
this._pauseOnExceptionEnabledChanged();
- self.Common.settings.moduleSetting('pauseOnExceptionEnabled')
+ Common.Settings.Settings.instance()
+ .moduleSetting('pauseOnExceptionEnabled')
.addChangeListener(this._pauseOnExceptionEnabledChanged, this);
this._liveLocationPool = new Bindings.LiveLocation.LiveLocationPool();
this._setTarget(self.UI.context.flavor(SDK.SDKModel.Target));
- self.Common.settings.moduleSetting('breakpointsActive')
+ Common.Settings.Settings.instance()
+ .moduleSetting('breakpointsActive')
.addChangeListener(this._breakpointsActiveStateChanged, this);
self.UI.context.addFlavorChangeListener(SDK.SDKModel.Target, this._onCurrentTargetChanged, this);
self.UI.context.addFlavorChangeListener(SDK.DebuggerModel.CallFrame, this._callFrameChanged, this);
@@ -304,7 +308,7 @@
* @override
*/
onResize() {
- if (self.Common.settings.moduleSetting('sidebarPosition').get() === 'auto') {
+ if (Common.Settings.Settings.instance().moduleSetting('sidebarPosition').get() === 'auto') {
this.element.window().requestAnimationFrame(this._updateSidebarPosition.bind(this));
} // Do not force layout.
}
@@ -445,7 +449,7 @@
* @param {!UI.ContextMenu.ContextMenu} contextMenu
*/
_populateNavigatorMenu(contextMenu) {
- const groupByFolderSetting = self.Common.settings.moduleSetting('navigatorGroupByFolder');
+ const groupByFolderSetting = Common.Settings.Settings.instance().moduleSetting('navigatorGroupByFolder');
contextMenu.appendItemsAtLocation('navigatorMenu');
contextMenu.viewSection().appendCheckboxItem(
Common.UIString.UIString('Group by folder'), () => groupByFolderSetting.set(!groupByFolderSetting.get()),
@@ -499,7 +503,7 @@
}
_pauseOnExceptionEnabledChanged() {
- const enabled = self.Common.settings.moduleSetting('pauseOnExceptionEnabled').get();
+ const enabled = Common.Settings.Settings.instance().moduleSetting('pauseOnExceptionEnabled').get();
this._pauseOnExceptionButton.setToggled(enabled);
this._pauseOnExceptionButton.setTitle(enabled ? ls`Don't pause on exceptions` : ls`Pause on exceptions`);
this._debugToolbarDrawer.classList.toggle('expanded', enabled);
@@ -569,7 +573,9 @@
}
_togglePauseOnExceptions() {
- self.Common.settings.moduleSetting('pauseOnExceptionEnabled').set(!this._pauseOnExceptionButton.toggled());
+ Common.Settings.Settings.instance()
+ .moduleSetting('pauseOnExceptionEnabled')
+ .set(!this._pauseOnExceptionButton.toggled());
}
_runSnippet() {
@@ -584,7 +590,8 @@
*/
_editorSelected(event) {
const uiSourceCode = /** @type {!Workspace.UISourceCode.UISourceCode} */ (event.data);
- if (this.editorView.mainWidget() && self.Common.settings.moduleSetting('autoRevealInNavigator').get()) {
+ if (this.editorView.mainWidget() &&
+ Common.Settings.Settings.instance().moduleSetting('autoRevealInNavigator').get()) {
this._revealInNavigator(uiSourceCode, true);
}
}
@@ -713,12 +720,13 @@
}
_toggleBreakpointsActive() {
- self.Common.settings.moduleSetting('breakpointsActive')
- .set(!self.Common.settings.moduleSetting('breakpointsActive').get());
+ Common.Settings.Settings.instance()
+ .moduleSetting('breakpointsActive')
+ .set(!Common.Settings.Settings.instance().moduleSetting('breakpointsActive').get());
}
_breakpointsActiveStateChanged() {
- const active = self.Common.settings.moduleSetting('breakpointsActive').get();
+ const active = Common.Settings.Settings.instance().moduleSetting('breakpointsActive').get();
this._toggleBreakpointsActiveAction.setToggled(!active);
this._sourcesView.toggleBreakpointsActiveState(active);
}
@@ -758,7 +766,7 @@
const debugToolbarDrawer = createElementWithClass('div', 'scripts-debug-toolbar-drawer');
const label = Common.UIString.UIString('Pause on caught exceptions');
- const setting = self.Common.settings.moduleSetting('pauseOnCaughtException');
+ const setting = Common.Settings.Settings.instance().moduleSetting('pauseOnCaughtException');
debugToolbarDrawer.appendChild(UI.SettingsUI.createSettingCheckbox(label, setting, true));
return debugToolbarDrawer;
@@ -911,7 +919,7 @@
_updateSidebarPosition() {
let vertically;
- const position = self.Common.settings.moduleSetting('sidebarPosition').get();
+ const position = Common.Settings.Settings.instance().moduleSetting('sidebarPosition').get();
if (position === 'right') {
vertically = false;
} else if (position === 'bottom') {
diff --git a/front_end/sources/SourcesSearchScope.js b/front_end/sources/SourcesSearchScope.js
index 1850e5a..2e2fc79 100644
--- a/front_end/sources/SourcesSearchScope.js
+++ b/front_end/sources/SourcesSearchScope.js
@@ -101,7 +101,7 @@
*/
_projects() {
const searchInAnonymousAndContentScripts =
- self.Common.settings.moduleSetting('searchInAnonymousAndContentScripts').get();
+ Common.Settings.Settings.instance().moduleSetting('searchInAnonymousAndContentScripts').get();
return self.Workspace.workspace.projects().filter(project => {
if (project.type() === Workspace.Workspace.projectTypes.Service) {
diff --git a/front_end/sources/SourcesView.js b/front_end/sources/SourcesView.js
index 94e83bd..6f79e3f 100644
--- a/front_end/sources/SourcesView.js
+++ b/front_end/sources/SourcesView.js
@@ -40,8 +40,8 @@
this._sourceViewByUISourceCode = new Map();
this._editorContainer = new TabbedEditorContainer(
- this, self.Common.settings.createLocalSetting('previouslyViewedFiles', []), this._placeholderElement(),
- this._focusedPlaceholderElement);
+ this, Common.Settings.Settings.instance().createLocalSetting('previouslyViewedFiles', []),
+ this._placeholderElement(), this._focusedPlaceholderElement);
this._editorContainer.show(this._searchableView.element);
this._editorContainer.addEventListener(TabbedEditorContainerEvents.EditorSelected, this._editorSelected, this);
this._editorContainer.addEventListener(TabbedEditorContainerEvents.EditorClosed, this._editorClosed, this);
diff --git a/front_end/sources/UISourceCodeFrame.js b/front_end/sources/UISourceCodeFrame.js
index 9921057..ae7e469 100644
--- a/front_end/sources/UISourceCodeFrame.js
+++ b/front_end/sources/UISourceCodeFrame.js
@@ -78,7 +78,8 @@
SourceFrame.SourcesTextEditor.Events.EditorBlurred, () => self.UI.context.setFlavor(UISourceCodeFrame, null));
this.textEditor.addEventListener(
SourceFrame.SourcesTextEditor.Events.EditorFocused, () => self.UI.context.setFlavor(UISourceCodeFrame, this));
- self.Common.settings.moduleSetting('persistenceNetworkOverridesEnabled')
+ Common.Settings.Settings.instance()
+ .moduleSetting('persistenceNetworkOverridesEnabled')
.addChangeListener(this._onNetworkPersistenceChanged, this);
@@ -448,7 +449,8 @@
this._unloadUISourceCode();
this.textEditor.dispose();
this.detach();
- self.Common.settings.moduleSetting('persistenceNetworkOverridesEnabled')
+ Common.Settings.Settings.instance()
+ .moduleSetting('persistenceNetworkOverridesEnabled')
.removeChangeListener(this._onNetworkPersistenceChanged, this);
}
diff --git a/front_end/sources/WatchExpressionsSidebarPane.js b/front_end/sources/WatchExpressionsSidebarPane.js
index 4696b7b..ba93658 100644
--- a/front_end/sources/WatchExpressionsSidebarPane.js
+++ b/front_end/sources/WatchExpressionsSidebarPane.js
@@ -55,7 +55,7 @@
// to an e2e test or no longer accesses this variable directly.
/** @type {!Array.<!WatchExpression>} */
this._watchExpressions = [];
- this._watchExpressionsSetting = self.Common.settings.createLocalSetting('watchExpressions', []);
+ this._watchExpressionsSetting = Common.Settings.Settings.instance().createLocalSetting('watchExpressions', []);
this._addButton = new UI.Toolbar.ToolbarButton(ls`Add watch expression`, 'largeicon-add');
this._addButton.addEventListener(UI.Toolbar.ToolbarButton.Events.Click, event => {
diff --git a/front_end/text_editor/CodeMirrorTextEditor.js b/front_end/text_editor/CodeMirrorTextEditor.js
index b4eaa66..2a0396f 100644
--- a/front_end/text_editor/CodeMirrorTextEditor.js
+++ b/front_end/text_editor/CodeMirrorTextEditor.js
@@ -28,6 +28,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import * as Common from '../common/common.js';
import * as Host from '../host/host.js';
import * as Platform from '../platform/platform.js';
import * as TextUtils from '../text_utils/text_utils.js';
@@ -51,8 +52,8 @@
this.registerRequiredCSS('cm/codemirror.css');
this.registerRequiredCSS('text_editor/cmdevtools.css');
- const {indentWithTabs, indentUnit} =
- CodeMirrorTextEditor._getIndentation(self.Common.settings.moduleSetting('textEditorIndent').get());
+ const {indentWithTabs, indentUnit} = CodeMirrorTextEditor._getIndentation(
+ Common.Settings.Settings.instance().moduleSetting('textEditorIndent').get());
this._codeMirror = new CodeMirror(this.element, {
devtoolsAccessibleName: options.devtoolsAccessibleName,
@@ -74,7 +75,9 @@
this._codeMirror._codeMirrorTextEditor = this;
- self.Common.settings.moduleSetting('textEditorIndent').addChangeListener(this._updateIndentSize.bind(this));
+ Common.Settings.Settings.instance()
+ .moduleSetting('textEditorIndent')
+ .addChangeListener(this._updateIndentSize.bind(this));
CodeMirror.keyMap['devtools-common'] = {
'Left': 'goCharLeft',
@@ -618,7 +621,7 @@
* @param {!Event} e
*/
_handleKeyDown(e) {
- if (e.key === 'Tab' && self.Common.settings.moduleSetting('textEditorTabMovesFocus').get()) {
+ if (e.key === 'Tab' && Common.Settings.Settings.instance().moduleSetting('textEditorTabMovesFocus').get()) {
e.consume(false);
return;
}
@@ -1465,7 +1468,7 @@
return;
}
- const indentation = self.Common.settings.moduleSetting('textEditorIndent').get();
+ const indentation = Common.Settings.Settings.instance().moduleSetting('textEditorIndent').get();
codeMirror.replaceSelection(indentation);
};
diff --git a/front_end/timeline/CountersGraph.js b/front_end/timeline/CountersGraph.js
index 8652cc4..57efc51 100644
--- a/front_end/timeline/CountersGraph.js
+++ b/front_end/timeline/CountersGraph.js
@@ -381,7 +381,7 @@
this.counter = counter;
this._formatter = formatter || Number.withThousandsSeparator;
- this._setting = self.Common.settings.createSetting('timelineCountersGraph-' + title, true);
+ this._setting = Common.Settings.Settings.instance().createSetting('timelineCountersGraph-' + title, true);
this._setting.setTitle(title);
this._filter = new UI.Toolbar.ToolbarSettingCheckbox(this._setting, title);
this._filter.inputElement.classList.add('-theme-preserve');
diff --git a/front_end/timeline/TimelineController.js b/front_end/timeline/TimelineController.js
index 5d1b791..ad7eba6 100644
--- a/front_end/timeline/TimelineController.js
+++ b/front_end/timeline/TimelineController.js
@@ -80,7 +80,7 @@
}
if (!Root.Runtime.queryParam('timelineTracingJSProfileDisabled') && options.enableJSSampling) {
categoriesArray.push(disabledByDefault('v8.cpu_profiler'));
- if (self.Common.settings.moduleSetting('highResolutionCpuProfiling').get()) {
+ if (Common.Settings.Settings.instance().moduleSetting('highResolutionCpuProfiling').get()) {
categoriesArray.push(disabledByDefault('v8.cpu_profiler.hires'));
}
}
@@ -217,7 +217,8 @@
return;
}
- const samplingFrequencyHz = self.Common.settings.moduleSetting('highResolutionCpuProfiling').get() ? 10000 : 1000;
+ const samplingFrequencyHz =
+ Common.Settings.Settings.instance().moduleSetting('highResolutionCpuProfiling').get() ? 10000 : 1000;
const options = 'sampling-frequency=' + samplingFrequencyHz;
return this._tracingManager.start(this, categories, options);
}
diff --git a/front_end/timeline/TimelineFlameChartView.js b/front_end/timeline/TimelineFlameChartView.js
index fa6ad11..abcf979 100644
--- a/front_end/timeline/TimelineFlameChartView.js
+++ b/front_end/timeline/TimelineFlameChartView.js
@@ -39,13 +39,13 @@
/** @type {!Array<!Common.EventTarget.EventDescriptor>} */
this._eventListeners = [];
- this._showMemoryGraphSetting = self.Common.settings.createSetting('timelineShowMemory', false);
+ this._showMemoryGraphSetting = Common.Settings.Settings.instance().createSetting('timelineShowMemory', false);
// Create main and network flamecharts.
this._networkSplitWidget = new UI.SplitWidget.SplitWidget(false, false, 'timelineFlamechartMainView', 150);
const mainViewGroupExpansionSetting =
- self.Common.settings.createSetting('timelineFlamechartMainViewGroupExpansion', {});
+ Common.Settings.Settings.instance().createSetting('timelineFlamechartMainViewGroupExpansion', {});
this._mainDataProvider = new TimelineFlameChartDataProvider();
this._mainDataProvider.addEventListener(
TimelineFlameChartDataProviderEvents.DataChanged, () => this._mainFlameChart.scheduleUpdate());
@@ -55,7 +55,7 @@
this._mainFlameChart.enableRuler(false);
this._networkFlameChartGroupExpansionSetting =
- self.Common.settings.createSetting('timelineFlamechartNetworkViewGroupExpansion', {});
+ Common.Settings.Settings.instance().createSetting('timelineFlamechartNetworkViewGroupExpansion', {});
this._networkDataProvider = new TimelineFlameChartNetworkDataProvider();
this._networkFlameChart =
new PerfUI.FlameChart.FlameChart(this._networkDataProvider, this, this._networkFlameChartGroupExpansionSetting);
@@ -103,8 +103,8 @@
this._selectedTrack = null;
this._mainDataProvider.setEventColorMapping(TimelineUIUtils.eventColor);
- this._groupBySetting =
- self.Common.settings.createSetting('timelineTreeGroupBy', AggregatedTimelineTreeView.GroupBy.None);
+ this._groupBySetting = Common.Settings.Settings.instance().createSetting(
+ 'timelineTreeGroupBy', AggregatedTimelineTreeView.GroupBy.None);
this._groupBySetting.addChangeListener(this._updateColorMapper, this);
this._updateColorMapper();
}
diff --git a/front_end/timeline/TimelinePanel.js b/front_end/timeline/TimelinePanel.js
index 41a94e1..4e07e94 100644
--- a/front_end/timeline/TimelinePanel.js
+++ b/front_end/timeline/TimelinePanel.js
@@ -79,20 +79,21 @@
/** @type {?PerformanceModel} */
this._performanceModel = null;
- this._viewModeSetting = self.Common.settings.createSetting('timelineViewMode', ViewMode.FlameChart);
+ this._viewModeSetting = Common.Settings.Settings.instance().createSetting('timelineViewMode', ViewMode.FlameChart);
- this._disableCaptureJSProfileSetting = self.Common.settings.createSetting('timelineDisableJSSampling', false);
+ this._disableCaptureJSProfileSetting =
+ Common.Settings.Settings.instance().createSetting('timelineDisableJSSampling', false);
this._disableCaptureJSProfileSetting.setTitle(Common.UIString.UIString('Disable JavaScript samples'));
this._captureLayersAndPicturesSetting =
- self.Common.settings.createSetting('timelineCaptureLayersAndPictures', false);
+ Common.Settings.Settings.instance().createSetting('timelineCaptureLayersAndPictures', false);
this._captureLayersAndPicturesSetting.setTitle(
Common.UIString.UIString('Enable advanced paint instrumentation (slow)'));
- this._showScreenshotsSetting = self.Common.settings.createSetting('timelineShowScreenshots', true);
+ this._showScreenshotsSetting = Common.Settings.Settings.instance().createSetting('timelineShowScreenshots', true);
this._showScreenshotsSetting.setTitle(Common.UIString.UIString('Screenshots'));
this._showScreenshotsSetting.addChangeListener(this._updateOverviewControls, this);
- this._startCoverage = self.Common.settings.createSetting('timelineStartCoverage', false);
+ this._startCoverage = Common.Settings.Settings.instance().createSetting('timelineStartCoverage', false);
this._startCoverage.setTitle(ls`Coverage`);
if (!Root.Runtime.experiments.isEnabled('recordCoverageWithPerformanceTracing')) {
@@ -100,7 +101,7 @@
}
- this._showMemorySetting = self.Common.settings.createSetting('timelineShowMemory', false);
+ this._showMemorySetting = Common.Settings.Settings.instance().createSetting('timelineShowMemory', false);
this._showMemorySetting.setTitle(Common.UIString.UIString('Memory'));
this._showMemorySetting.addChangeListener(this._onModeChanged, this);
@@ -279,7 +280,8 @@
}
_createSettingsPane() {
- this._showSettingsPaneSetting = self.Common.settings.createSetting('timelineShowSettingsToolbar', false);
+ this._showSettingsPaneSetting =
+ Common.Settings.Settings.instance().createSetting('timelineShowSettingsToolbar', false);
this._showSettingsPaneButton = new UI.Toolbar.ToolbarSettingToggle(
this._showSettingsPaneSetting, 'largeicon-settings-gear', Common.UIString.UIString('Capture settings'));
self.SDK.multitargetNetworkManager.addEventListener(
@@ -342,7 +344,7 @@
let setting = traceProvider[traceProviderSettingSymbol];
if (!setting) {
const providerId = traceProvider.persistentIdentifier();
- setting = self.Common.settings.createSetting(providerId, false);
+ setting = Common.Settings.Settings.instance().createSetting(providerId, false);
setting.setTitle(traceProvider.shortDisplayName());
traceProvider[traceProviderSettingSymbol] = setting;
}
diff --git a/front_end/timeline/TimelineTreeView.js b/front_end/timeline/TimelineTreeView.js
index 0f3335c..b355a94 100644
--- a/front_end/timeline/TimelineTreeView.js
+++ b/front_end/timeline/TimelineTreeView.js
@@ -85,7 +85,7 @@
new TimelineModel.TimelineModelFilter.ExclusiveNameFilter([TimelineModel.TimelineModel.RecordType.Task]);
this._textFilter = new TimelineRegExp();
- this._currentThreadSetting = self.Common.settings.createSetting('timelineTreeCurrentThread', 0);
+ this._currentThreadSetting = Common.Settings.Settings.instance().createSetting('timelineTreeCurrentThread', 0);
this._currentThreadSetting.addChangeListener(this.refreshTree, this);
const columns = /** @type {!Array<!DataGrid.DataGrid.ColumnDescriptor>} */ ([]);
@@ -682,8 +682,8 @@
export class AggregatedTimelineTreeView extends TimelineTreeView {
constructor() {
super();
- this._groupBySetting =
- self.Common.settings.createSetting('timelineTreeGroupBy', AggregatedTimelineTreeView.GroupBy.None);
+ this._groupBySetting = Common.Settings.Settings.instance().createSetting(
+ 'timelineTreeGroupBy', AggregatedTimelineTreeView.GroupBy.None);
this._groupBySetting.addChangeListener(this.refreshTree.bind(this));
this.init();
this._stackView = new TimelineStackView(this);
diff --git a/front_end/timeline_model/TimelineJSProfile.js b/front_end/timeline_model/TimelineJSProfile.js
index 2876be5..29b85ca 100644
--- a/front_end/timeline_model/TimelineJSProfile.js
+++ b/front_end/timeline_model/TimelineJSProfile.js
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+import * as Common from '../common/common.js';
import * as SDK from '../sdk/sdk.js';
import {RecordType, TimelineModelImpl} from './TimelineModel.js';
@@ -87,7 +88,8 @@
let ordinal = 0;
const showAllEvents = Root.Runtime.experiments.isEnabled('timelineShowAllEvents');
const showRuntimeCallStats = Root.Runtime.experiments.isEnabled('timelineV8RuntimeCallStats');
- const showNativeFunctions = self.Common.settings.moduleSetting('showNativeFunctionsInJSProfile').get();
+ const showNativeFunctions =
+ Common.Settings.Settings.instance().moduleSetting('showNativeFunctionsInJSProfile').get();
/**
* @param {!SDK.TracingModel.Event} e
diff --git a/front_end/ui/FilterBar.js b/front_end/ui/FilterBar.js
index 6b0f37d..377737d 100644
--- a/front_end/ui/FilterBar.js
+++ b/front_end/ui/FilterBar.js
@@ -30,8 +30,8 @@
import * as Common from '../common/common.js';
import * as Host from '../host/host.js';
-
import * as ARIAUtils from './ARIAUtils.js';
+
import {Icon} from './Icon.js';
import {KeyboardShortcut, Modifiers} from './KeyboardShortcut.js';
import {bindCheckbox} from './SettingsUI.js';
@@ -56,7 +56,8 @@
this.element.classList.add('filter-bar');
// Note: go via self.Common for globally-namespaced singletons.
- this._stateSetting = self.self.Common.settings.createSetting('filterBar-' + name + '-toggled', !!visibleByDefault);
+ this._stateSetting =
+ Common.Settings.Settings.instance().createSetting('filterBar-' + name + '-toggled', !!visibleByDefault);
this._filterButton =
new ToolbarSettingToggle(this._stateSetting, 'largeicon-filter', Common.UIString.UIString('Filter'));
diff --git a/front_end/ui/SearchableView.js b/front_end/ui/SearchableView.js
index 00860a2..e8916e9 100644
--- a/front_end/ui/SearchableView.js
+++ b/front_end/ui/SearchableView.js
@@ -30,6 +30,7 @@
*/
import * as Common from '../common/common.js';
+
import {HistoryInput} from './HistoryInput.js';
import {Toolbar, ToolbarButton, ToolbarToggle} from './Toolbar.js';
import {createTextButton} from './UIUtils.js';
@@ -50,7 +51,7 @@
this._searchProvider = searchable;
// Note: go via self.Common for globally-namespaced singletons.
- this._setting = settingName ? self.self.Common.settings.createSetting(settingName, {}) : null;
+ this._setting = settingName ? Common.Settings.Settings.instance().createSetting(settingName, {}) : null;
this._replaceable = false;
this.contentElement.createChild('slot');
diff --git a/front_end/ui/SplitWidget.js b/front_end/ui/SplitWidget.js
index e8e3898..0356973 100644
--- a/front_end/ui/SplitWidget.js
+++ b/front_end/ui/SplitWidget.js
@@ -75,7 +75,7 @@
this._constraintsInDip = !!constraintsInDip;
this._resizeStartSizeDIP = 0;
// Note: go via self.Common for globally-namespaced singletons.
- this._setting = settingName ? self.self.Common.settings.createSetting(settingName, {}) : null;
+ this._setting = settingName ? Common.Settings.Settings.instance().createSetting(settingName, {}) : null;
this._totalSizeCSS = 0;
this._totalSizeOtherDimensionCSS = 0;
diff --git a/front_end/ui/ViewManager.js b/front_end/ui/ViewManager.js
index 779d50d..5a15759 100644
--- a/front_end/ui/ViewManager.js
+++ b/front_end/ui/ViewManager.js
@@ -3,8 +3,8 @@
// found in the LICENSE file.
import * as Common from '../common/common.js';
-
import * as ARIAUtils from './ARIAUtils.js';
+
import {ContextMenu} from './ContextMenu.js'; // eslint-disable-line no-unused-vars
import {Icon} from './Icon.js';
import {Events as TabbedPaneEvents, TabbedPane} from './TabbedPane.js';
@@ -407,13 +407,13 @@
this._tabbedPane.addEventListener(TabbedPaneEvents.TabSelected, this._tabSelected, this);
this._tabbedPane.addEventListener(TabbedPaneEvents.TabClosed, this._tabClosed, this);
// Note: go via self.Common for globally-namespaced singletons.
- this._closeableTabSetting = self.self.Common.settings.createSetting(location + '-closeableTabs', {});
+ this._closeableTabSetting = Common.Settings.Settings.instance().createSetting(location + '-closeableTabs', {});
// Note: go via self.Common for globally-namespaced singletons.
- this._tabOrderSetting = self.self.Common.settings.createSetting(location + '-tabOrder', {});
+ this._tabOrderSetting = Common.Settings.Settings.instance().createSetting(location + '-tabOrder', {});
this._tabbedPane.addEventListener(TabbedPaneEvents.TabOrderChanged, this._persistTabOrder, this);
if (restoreSelection) {
// Note: go via self.Common for globally-namespaced singletons.
- this._lastSelectedTabSetting = self.self.Common.settings.createSetting(location + '-selectedTab', '');
+ this._lastSelectedTabSetting = Common.Settings.Settings.instance().createSetting(location + '-selectedTab', '');
}
this._defaultTab = defaultTab;
diff --git a/scripts/test/run_lint_check.py b/scripts/test/run_lint_check.py
index 82b4798..c14211b 100755
--- a/scripts/test/run_lint_check.py
+++ b/scripts/test/run_lint_check.py
@@ -52,6 +52,6 @@
sys.exit(eslint_proc.returncode)
-
+# Run
if __name__ == '__main__':
main()
diff --git a/test/unittests/front_end/ui/ListModel.ts b/test/unittests/front_end/ui/ListModel.ts
index 10c6697..5098b23 100644
--- a/test/unittests/front_end/ui/ListModel.ts
+++ b/test/unittests/front_end/ui/ListModel.ts
@@ -4,7 +4,6 @@
const {assert} = chai;
-import '/front_end/common/common-legacy.js';
import {ListModel, Events} from '/front_end/ui/ListModel.js';
describe('ListModel', () => {
diff --git a/test/unittests/front_end/ui/Widget.ts b/test/unittests/front_end/ui/Widget.ts
deleted file mode 100644
index 7fe693e..0000000
--- a/test/unittests/front_end/ui/Widget.ts
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-const {assert} = chai;
-
-import '/front_end/root.js';
-import {Widget} from '/front_end/ui/Widget.js';
-
-describe('Widget', () => {
- after(() => {
- // Clean up polluted globals.
- // TODO(https://crbug.com/1006759): These need removing once the ESM migration is complete.
- const globalObj = (self as any);
- delete globalObj.Root;
- });
-
- it('can be instantiated correctly', () => {
- const widget = new Widget(false, false);
- assert.isFalse(widget.isShowing(), 'widget should not be showing upon creation');
- });
-
- // TODO continue writing tests here or use another describe block
-});
diff --git a/test/unittests/front_end/ui/XWidget.ts b/test/unittests/front_end/ui/XWidget.ts
deleted file mode 100644
index cb0315a..0000000
--- a/test/unittests/front_end/ui/XWidget.ts
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright 2019 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-const {assert} = chai;
-
-import {XWidget} from '/front_end/ui/XWidget.js';
-
-describe('XWidget', () => {
- it('can be instantiated correctly', () => {
- const xWidget = new XWidget();
- assert.isFalse(xWidget.isShowing(), 'xwidget should not be showing upon initialization');
- });
-
- // TODO continue writing tests here or use another describe block
-});