chrome-devtools-frontend 1.0.1656291 → 1.0.1656897

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -40,14 +40,14 @@ import * as Common from '../common/common.js';
40
40
  import * as Platform from '../platform/platform.js';
41
41
 
42
42
  import {CSSModel} from './CSSModel.js';
43
- import {FrameManager} from './FrameManager.js';
43
+ import type {FrameManager} from './FrameManager.js';
44
44
  import {OverlayModel} from './OverlayModel.js';
45
45
  import {RemoteObject} from './RemoteObject.js';
46
46
  import {Events as ResourceTreeModelEvents, type ResourceTreeFrame, ResourceTreeModel} from './ResourceTreeModel.js';
47
47
  import {RuntimeModel} from './RuntimeModel.js';
48
48
  import {SDKModel} from './SDKModel.js';
49
49
  import {Capability, type Target} from './Target.js';
50
- import {TargetManager} from './TargetManager.js';
50
+ import type {TargetManager} from './TargetManager.js';
51
51
 
52
52
  /** Keep this list in sync with https://w3c.github.io/aria/#state_prop_def **/
53
53
  export const ARIA_ATTRIBUTES = new Set<string>([
@@ -129,6 +129,7 @@ export interface DOMNodeEventTypes {
129
129
 
130
130
  export class DOMNode extends Common.ObjectWrapper.ObjectWrapper<DOMNodeEventTypes> {
131
131
  #domModel: DOMModel;
132
+ readonly #frameManager: FrameManager;
132
133
  #agent: ProtocolProxyApi.DOMApi;
133
134
  ownerDocument!: DOMDocument|null;
134
135
  #isInShadowTree!: boolean;
@@ -194,6 +195,7 @@ export class DOMNode extends Common.ObjectWrapper.ObjectWrapper<DOMNodeEventType
194
195
  constructor(domModel: DOMModel) {
195
196
  super();
196
197
  this.#domModel = domModel;
198
+ this.#frameManager = domModel.target().targetManager().getFrameManager();
197
199
  this.#agent = this.#domModel.getAgent();
198
200
  }
199
201
 
@@ -313,7 +315,7 @@ export class DOMNode extends Common.ObjectWrapper.ObjectWrapper<DOMNodeEventType
313
315
  }
314
316
 
315
317
  private async requestChildDocument(frameId: Protocol.Page.FrameId, notInTarget: Target): Promise<DOMDocument|null> {
316
- const frame = await FrameManager.instance().getOrWaitForFrame(frameId, notInTarget);
318
+ const frame = await this.#frameManager.getOrWaitForFrame(frameId, notInTarget);
317
319
  const childModel = frame.resourceTreeModel()?.target().model(DOMModel);
318
320
  return await (childModel?.requestDocument() || null);
319
321
  }
@@ -341,7 +343,7 @@ export class DOMNode extends Common.ObjectWrapper.ObjectWrapper<DOMNodeEventType
341
343
  return undefined;
342
344
  }
343
345
 
344
- const frame = FrameManager.instance().getFrame(this.#frameOwnerFrameId);
346
+ const frame = this.#frameManager.getFrame(this.#frameOwnerFrameId);
345
347
  if (frame && frame.adFrameType() !== Protocol.Page.AdFrameType.None) {
346
348
  // The frame is ad-related, but provenance information is unavailable.
347
349
  return {};
@@ -1478,7 +1480,7 @@ export class DOMModel extends SDKModel<EventTypes> {
1478
1480
  return this.target().model(OverlayModel) as OverlayModel;
1479
1481
  }
1480
1482
 
1481
- static cancelSearch(targetManager: TargetManager = TargetManager.instance()): void {
1483
+ static cancelSearch(targetManager: TargetManager): void {
1482
1484
  for (const domModel of targetManager.models(DOMModel)) {
1483
1485
  domModel.cancelSearch();
1484
1486
  }
@@ -8,15 +8,13 @@ import type {DebugId, SourceMapV3} from './SourceMap.js';
8
8
 
9
9
  /** A thin wrapper around the Cache API to store source map JSONs keyed on Debug IDs */
10
10
  export class SourceMapCache {
11
- static readonly #INSTANCE = new SourceMapCache('devtools-source-map-cache');
12
-
13
- static instance(): SourceMapCache {
11
+ static create(): SourceMapCache {
14
12
  if (typeof window === 'undefined') {
15
13
  // TODO(crbug.com/451502260): Move this behind a `HostRuntime` interface.
16
14
  return IN_MEMORY_INSTANCE as unknown as
17
15
  SourceMapCache; // TS doesn't like that our in-memory class doesn't have the same private fields.
18
16
  }
19
- return this.#INSTANCE;
17
+ return new SourceMapCache('devtools-source-map-cache');
20
18
  }
21
19
 
22
20
  static createForTest(name: string): SourceMapCache {
@@ -22,6 +22,7 @@ export class SourceMapManager<T extends FrameAssociated> extends Common.ObjectWr
22
22
  readonly #clientData = new Map<T, ClientData>();
23
23
  readonly #sourceMaps = new Map<SourceMap, T>();
24
24
  #attachingClient: T|null = null;
25
+ readonly #sourceMapCache = SourceMapCache.create();
25
26
 
26
27
  constructor(target: Target, factory?: SourceMapFactory<T>) {
27
28
  super();
@@ -118,7 +119,7 @@ export class SourceMapManager<T extends FrameAssociated> extends Common.ObjectWr
118
119
  // SourceMapManager in their respective constructors.
119
120
  const resourceLoader = this.#target.targetManager().context.get(PageResourceLoader);
120
121
  clientData.sourceMapPromise =
121
- loadSourceMap(resourceLoader, sourceMapURL, client.debugId(), initiator)
122
+ loadSourceMap(resourceLoader, this.#sourceMapCache, sourceMapURL, client.debugId(), initiator)
122
123
  .then(
123
124
  payload => {
124
125
  const sourceMap = this.#factory(sourceURL, sourceMapURL, payload, client);
@@ -185,14 +186,14 @@ export class SourceMapManager<T extends FrameAssociated> extends Common.ObjectWr
185
186
  }
186
187
  }
187
188
 
188
- async function loadSourceMap(
189
- resourceLoader: ResourceLoader, url: Platform.DevToolsPath.UrlString, debugId: DebugId|null,
190
- initiator: PageResourceLoadInitiator): Promise<SourceMapV3> {
189
+ async function loadSourceMap(resourceLoader: ResourceLoader, sourceMapCache: SourceMapCache,
190
+ url: Platform.DevToolsPath.UrlString, debugId: DebugId|null,
191
+ initiator: PageResourceLoadInitiator): Promise<SourceMapV3> {
191
192
  try {
192
193
  if (debugId) {
193
194
  const securityOrigin = initiator.initiatorUrl ? Common.ParsedURL.ParsedURL.extractOrigin(initiator.initiatorUrl) :
194
195
  Platform.DevToolsPath.EmptyUrlString;
195
- const cachedSourceMap = await SourceMapCache.instance().get(debugId, securityOrigin);
196
+ const cachedSourceMap = await sourceMapCache.get(debugId, securityOrigin);
196
197
  if (cachedSourceMap) {
197
198
  return cachedSourceMap;
198
199
  }
@@ -204,7 +205,7 @@ async function loadSourceMap(
204
205
  // In case something goes wrong with updating the cache, we still want to use the source map.
205
206
  const securityOrigin = initiator.initiatorUrl ? Common.ParsedURL.ParsedURL.extractOrigin(initiator.initiatorUrl) :
206
207
  Platform.DevToolsPath.EmptyUrlString;
207
- await SourceMapCache.instance().set(sourceMap.debugId as DebugId, securityOrigin, sourceMap).catch();
208
+ await sourceMapCache.set(sourceMap.debugId as DebugId, securityOrigin, sourceMap).catch();
208
209
  }
209
210
  return sourceMap;
210
211
  } catch (cause) {
@@ -216,7 +217,7 @@ export async function tryLoadSourceMap(
216
217
  resourceLoader: ResourceLoader, url: Platform.DevToolsPath.UrlString,
217
218
  initiator: PageResourceLoadInitiator): Promise<SourceMapV3|null> {
218
219
  try {
219
- return await loadSourceMap(resourceLoader, url, null, initiator);
220
+ return await loadSourceMap(resourceLoader, SourceMapCache.create(), url, null, initiator);
220
221
  } catch (cause) {
221
222
  console.error(cause);
222
223
  return null;
@@ -13,20 +13,7 @@ export class SimpleApp implements UI.App.App {
13
13
  }
14
14
  }
15
15
 
16
- let simpleAppProviderInstance: SimpleAppProvider;
17
-
18
16
  export class SimpleAppProvider implements UI.AppProvider.AppProvider {
19
- static instance(opts: {
20
- forceNew: boolean|null,
21
- } = {forceNew: null}): SimpleAppProvider {
22
- const {forceNew} = opts;
23
- if (!simpleAppProviderInstance || forceNew) {
24
- simpleAppProviderInstance = new SimpleAppProvider();
25
- }
26
-
27
- return simpleAppProviderInstance;
28
- }
29
-
30
17
  createApp(): UI.App.App {
31
18
  return new SimpleApp();
32
19
  }
@@ -949,7 +949,7 @@ UI.Toolbar.registerToolbarItem({
949
949
  UI.AppProvider.registerAppProvider({
950
950
  async loadAppProvider() {
951
951
  const Main = await loadMainModule();
952
- return Main.SimpleApp.SimpleAppProvider.instance();
952
+ return new Main.SimpleApp.SimpleAppProvider();
953
953
  },
954
954
  order: 10,
955
955
  });
@@ -9,6 +9,7 @@ import * as SDK from '../core/sdk/sdk.js';
9
9
  import * as AutofillManager from '../models/autofill_manager/autofill_manager.js';
10
10
  import * as Bindings from '../models/bindings/bindings.js';
11
11
  import * as Breakpoints from '../models/breakpoints/breakpoints.js';
12
+ import * as CrUXManager from '../models/crux-manager/crux-manager.js';
12
13
  import * as JavaScriptMetadata from '../models/javascript_metadata/javascript_metadata.js';
13
14
  import * as Logs from '../models/logs/logs.js';
14
15
  import * as Persistence from '../models/persistence/persistence.js';
@@ -80,6 +81,9 @@ export class Universe {
80
81
  const domDebuggerManager = new SDK.DOMDebuggerModel.DOMDebuggerManager(targetManager);
81
82
  context.set(SDK.DOMDebuggerModel.DOMDebuggerManager, domDebuggerManager);
82
83
 
84
+ const cruxManager = new CrUXManager.CrUXManager(targetManager, settings);
85
+ context.set(CrUXManager.CrUXManager, cruxManager);
86
+
83
87
  const workspace = new Workspace.Workspace.WorkspaceImpl();
84
88
  context.set(Workspace.Workspace.WorkspaceImpl, workspace);
85
89
 
@@ -152,6 +156,10 @@ export class Universe {
152
156
  return this.context.get(SDK.CPUThrottlingManager.CPUThrottlingManager);
153
157
  }
154
158
 
159
+ get cruxManager(): CrUXManager.CrUXManager {
160
+ return this.context.get(CrUXManager.CrUXManager);
161
+ }
162
+
155
163
  get domDebuggerManager(): SDK.DOMDebuggerModel.DOMDebuggerManager {
156
164
  return this.context.get(SDK.DOMDebuggerModel.DOMDebuggerManager);
157
165
  }
@@ -179,4 +187,8 @@ export class Universe {
179
187
  get settings(): Common.Settings.Settings {
180
188
  return this.context.get(Common.Settings.Settings);
181
189
  }
190
+
191
+ get targetManager(): SDK.TargetManager.TargetManager {
192
+ return this.context.get(SDK.TargetManager.TargetManager);
193
+ }
182
194
  }
@@ -510,8 +510,8 @@ inspectorBackend.registerCommand("DeviceOrientation.clearDeviceOrientationOverri
510
510
  inspectorBackend.registerCommand("DeviceOrientation.setDeviceOrientationOverride", [{"name": "alpha", "type": "number", "optional": false, "description": "Mock alpha", "typeRef": null}, {"name": "beta", "type": "number", "optional": false, "description": "Mock beta", "typeRef": null}, {"name": "gamma", "type": "number", "optional": false, "description": "Mock gamma", "typeRef": null}], [], "Overrides the Device Orientation.");
511
511
 
512
512
  // DigitalCredentials.
513
- inspectorBackend.registerEnum("DigitalCredentials.VirtualWalletBehavior", {Respond: "respond", Decline: "decline", Wait: "wait", Clear: "clear"});
514
- inspectorBackend.registerCommand("DigitalCredentials.setVirtualWalletBehavior", [{"name": "behavior", "type": "string", "optional": false, "description": "The behavior of the virtual wallet.", "typeRef": "DigitalCredentials.VirtualWalletBehavior"}, {"name": "protocol", "type": "string", "optional": true, "description": "The protocol identifier (e.g. \\\"openid4vp\\\"). Required when |behavior| is \\\"respond\\\", forbidden otherwise.", "typeRef": null}, {"name": "response", "type": "object", "optional": true, "description": "The response data object returned by the wallet. Required when |behavior| is \\\"respond\\\", forbidden otherwise.", "typeRef": null}], [], "Sets the behavior of the virtual wallet for digital credential requests issued from this frame.");
513
+ inspectorBackend.registerEnum("DigitalCredentials.VirtualWalletAction", {Respond: "respond", Decline: "decline", Wait: "wait", Clear: "clear"});
514
+ inspectorBackend.registerCommand("DigitalCredentials.setVirtualWalletBehavior", [{"name": "action", "type": "string", "optional": false, "description": "The action of the virtual wallet.", "typeRef": "DigitalCredentials.VirtualWalletAction"}, {"name": "protocol", "type": "string", "optional": true, "description": "The protocol identifier (e.g. \\\"openid4vp\\\"). Required when |action| is \\\"respond\\\", forbidden otherwise.", "typeRef": null}, {"name": "response", "type": "object", "optional": true, "description": "The response data object returned by the wallet. Required when |action| is \\\"respond\\\", forbidden otherwise.", "typeRef": null}], [], "Sets the behavior of the virtual wallet for digital credential requests issued from this frame.");
515
515
 
516
516
  // Emulation.
517
517
  inspectorBackend.registerEnum("Emulation.ScreenOrientationType", {PortraitPrimary: "portraitPrimary", PortraitSecondary: "portraitSecondary", LandscapePrimary: "landscapePrimary", LandscapeSecondary: "landscapeSecondary"});
@@ -7018,7 +7018,7 @@ export namespace DigitalCredentials {
7018
7018
  /**
7019
7019
  * The type of virtual wallet action.
7020
7020
  */
7021
- export const enum VirtualWalletBehavior {
7021
+ export const enum VirtualWalletAction {
7022
7022
  Respond = 'respond',
7023
7023
  Decline = 'decline',
7024
7024
  Wait = 'wait',
@@ -7027,17 +7027,17 @@ export namespace DigitalCredentials {
7027
7027
 
7028
7028
  export interface SetVirtualWalletBehaviorRequest {
7029
7029
  /**
7030
- * The behavior of the virtual wallet.
7030
+ * The action of the virtual wallet.
7031
7031
  */
7032
- behavior: VirtualWalletBehavior;
7032
+ action: VirtualWalletAction;
7033
7033
  /**
7034
- * The protocol identifier (e.g. "openid4vp"). Required when |behavior| is
7034
+ * The protocol identifier (e.g. "openid4vp"). Required when |action| is
7035
7035
  * "respond", forbidden otherwise.
7036
7036
  */
7037
7037
  protocol?: string;
7038
7038
  /**
7039
7039
  * The response data object returned by the wallet.
7040
- * Required when |behavior| is "respond", forbidden otherwise.
7040
+ * Required when |action| is "respond", forbidden otherwise.
7041
7041
  */
7042
7042
  response?: any;
7043
7043
  }
@@ -102,8 +102,6 @@ export interface ConfigSetting {
102
102
  originMappings?: OriginMapping[];
103
103
  }
104
104
 
105
- let cruxManagerInstance: CrUXManager;
106
-
107
105
  /** TODO: Potentially support `TABLET`. Tablet field data will always be `null` until then. **/
108
106
  export const DEVICE_SCOPE_LIST: DeviceScope[] = ['ALL', 'DESKTOP', 'PHONE'];
109
107
 
@@ -128,11 +126,13 @@ export class CrUXManager extends Common.ObjectWrapper.ObjectWrapper<EventTypes>
128
126
  #configSetting: Common.Settings.Setting<ConfigSetting>;
129
127
  #endpoint = DEFAULT_ENDPOINT;
130
128
  #pageResult?: PageResult;
129
+ readonly #targetManager: SDK.TargetManager.TargetManager;
131
130
  fieldDeviceOption: DeviceOption = 'AUTO';
132
131
  fieldPageScope: PageScope = 'url';
133
132
 
134
- private constructor() {
133
+ constructor(targetManager: SDK.TargetManager.TargetManager, settings: Common.Settings.Settings) {
135
134
  super();
135
+ this.#targetManager = targetManager;
136
136
 
137
137
  /**
138
138
  * In an incognito or guest window - which is called an "OffTheRecord"
@@ -149,7 +149,7 @@ export class CrUXManager extends Common.ObjectWrapper.ObjectWrapper<EventTypes>
149
149
  const storageTypeForConsent =
150
150
  useSessionStorage ? Common.Settings.SettingStorageType.SESSION : Common.Settings.SettingStorageType.GLOBAL;
151
151
 
152
- this.#configSetting = Common.Settings.Settings.instance().createSetting<ConfigSetting>(
152
+ this.#configSetting = settings.createSetting<ConfigSetting>(
153
153
  'field-data', {enabled: false, override: '', originMappings: [], overrideEnabled: false},
154
154
  storageTypeForConsent);
155
155
 
@@ -157,18 +157,23 @@ export class CrUXManager extends Common.ObjectWrapper.ObjectWrapper<EventTypes>
157
157
  void this.refresh();
158
158
  });
159
159
 
160
- SDK.TargetManager.TargetManager.instance().addModelListener(
161
- SDK.ResourceTreeModel.ResourceTreeModel, SDK.ResourceTreeModel.Events.FrameNavigated, this.#onFrameNavigated,
162
- this);
160
+ this.#targetManager.addModelListener(SDK.ResourceTreeModel.ResourceTreeModel,
161
+ SDK.ResourceTreeModel.Events.FrameNavigated, this.#onFrameNavigated, this);
163
162
  }
164
163
 
165
164
  static instance(opts: {forceNew: boolean|null} = {forceNew: null}): CrUXManager {
166
165
  const {forceNew} = opts;
167
- if (!cruxManagerInstance || forceNew) {
168
- cruxManagerInstance = new CrUXManager();
166
+ if (!Root.DevToolsContext.globalInstance().has(CrUXManager) || forceNew) {
167
+ Root.DevToolsContext.globalInstance().set(
168
+ CrUXManager,
169
+ new CrUXManager(SDK.TargetManager.TargetManager.instance(), Common.Settings.Settings.instance()));
169
170
  }
170
171
 
171
- return cruxManagerInstance;
172
+ return Root.DevToolsContext.globalInstance().get(CrUXManager);
173
+ }
174
+
175
+ static removeInstance(): void {
176
+ Root.DevToolsContext.globalInstance().delete(CrUXManager);
172
177
  }
173
178
 
174
179
  /** The most recent page result from the CrUX service. */
@@ -264,7 +269,7 @@ export class CrUXManager extends Common.ObjectWrapper.ObjectWrapper<EventTypes>
264
269
  }
265
270
 
266
271
  async #getInspectedURL(): Promise<string> {
267
- const targetManager = SDK.TargetManager.TargetManager.instance();
272
+ const targetManager = this.#targetManager;
268
273
  let inspectedURL = targetManager.inspectedURL();
269
274
  if (!inspectedURL) {
270
275
  inspectedURL = await new Promise(resolve => {
@@ -13,6 +13,7 @@ import * as Buttons from '../../ui/components/buttons/buttons.js';
13
13
  import {Link} from '../../ui/kit/kit.js';
14
14
  import * as Components from '../../ui/legacy/components/utils/utils.js';
15
15
  import * as UI from '../../ui/legacy/legacy.js';
16
+ import {html, type LitTemplate, nothing, render} from '../../ui/lit/lit.js';
16
17
  import * as VisualLogging from '../../ui/visual_logging/visual_logging.js';
17
18
  import * as MobileThrottling from '../mobile_throttling/mobile_throttling.js';
18
19
 
@@ -273,14 +274,14 @@ export class ServiceWorkersView extends UI.Widget.VBox implements
273
274
  }
274
275
 
275
276
  this.eventListeners.set(serviceWorkerManager, [
276
- this.manager.addEventListener(
277
- SDK.ServiceWorkerManager.Events.REGISTRATION_UPDATED, this.registrationUpdated, this),
278
- this.manager.addEventListener(
279
- SDK.ServiceWorkerManager.Events.REGISTRATION_DELETED, this.registrationDeleted, this),
280
- this.securityOriginManager.addEventListener(
281
- SDK.SecurityOriginManager.Events.SecurityOriginAdded, this.updateSectionVisibility, this),
282
- this.securityOriginManager.addEventListener(
283
- SDK.SecurityOriginManager.Events.SecurityOriginRemoved, this.updateSectionVisibility, this),
277
+ this.manager.addEventListener(SDK.ServiceWorkerManager.Events.REGISTRATION_UPDATED, this.registrationUpdated,
278
+ this),
279
+ this.manager.addEventListener(SDK.ServiceWorkerManager.Events.REGISTRATION_DELETED, this.registrationDeleted,
280
+ this),
281
+ this.securityOriginManager.addEventListener(SDK.SecurityOriginManager.Events.SecurityOriginAdded,
282
+ this.updateSectionVisibility, this),
283
+ this.securityOriginManager.addEventListener(SDK.SecurityOriginManager.Events.SecurityOriginRemoved,
284
+ this.updateSectionVisibility, this),
284
285
  ]);
285
286
  }
286
287
 
@@ -331,7 +332,7 @@ export class ServiceWorkersView extends UI.Widget.VBox implements
331
332
 
332
333
  for (const section of movedSections) {
333
334
  const registration = section.registration;
334
- this.removeRegistrationFromList(registration);
335
+ this.removeRegistrationFromList(registration, true);
335
336
  this.updateRegistration(registration, true);
336
337
  }
337
338
 
@@ -399,8 +400,8 @@ export class ServiceWorkersView extends UI.Widget.VBox implements
399
400
  return null;
400
401
  }
401
402
 
402
- private updateRegistration(registration: SDK.ServiceWorkerManager.ServiceWorkerRegistration, skipUpdate?: boolean):
403
- void {
403
+ private updateRegistration(registration: SDK.ServiceWorkerManager.ServiceWorkerRegistration,
404
+ skipUpdate?: boolean): void {
404
405
  let section = this.sections.get(registration);
405
406
  if (!section) {
406
407
  const title = registration.scopeURL;
@@ -426,13 +427,16 @@ export class ServiceWorkersView extends UI.Widget.VBox implements
426
427
  this.removeRegistrationFromList(event.data);
427
428
  }
428
429
 
429
- private removeRegistrationFromList(registration: SDK.ServiceWorkerManager.ServiceWorkerRegistration): void {
430
+ private removeRegistrationFromList(registration: SDK.ServiceWorkerManager.ServiceWorkerRegistration,
431
+ skipVisibilityUpdate = false): void {
430
432
  const section = this.sections.get(registration);
431
433
  if (section) {
432
434
  section.section.detach();
433
435
  }
434
436
  this.sections.delete(registration);
435
- this.updateSectionVisibility();
437
+ if (!skipVisibilityUpdate) {
438
+ this.updateSectionVisibility();
439
+ }
436
440
  }
437
441
 
438
442
  private isRegistrationVisible(registration: SDK.ServiceWorkerManager.ServiceWorkerRegistration): boolean {
@@ -468,9 +472,8 @@ export class Section {
468
472
  private updateCycleField?: HTMLElement;
469
473
  private routerField?: HTMLElement;
470
474
 
471
- constructor(
472
- manager: SDK.ServiceWorkerManager.ServiceWorkerManager, section: UI.ReportView.Section,
473
- registration: SDK.ServiceWorkerManager.ServiceWorkerRegistration) {
475
+ constructor(manager: SDK.ServiceWorkerManager.ServiceWorkerManager, section: UI.ReportView.Section,
476
+ registration: SDK.ServiceWorkerManager.ServiceWorkerRegistration) {
474
477
  this.manager = manager;
475
478
  this.section = section;
476
479
  this.registration = registration;
@@ -509,15 +512,13 @@ export class Section {
509
512
  this.sourceField = this.wrapWidget(this.section.appendField(i18nString(UIStrings.source)));
510
513
  this.statusField = this.wrapWidget(this.section.appendField(i18nString(UIStrings.status)));
511
514
  this.clientsField = this.wrapWidget(this.section.appendField(i18nString(UIStrings.clients)));
512
- this.createSyncNotificationField(
513
- i18nString(UIStrings.pushString), this.pushNotificationDataSetting.get(), i18nString(UIStrings.pushData),
514
- this.push.bind(this), 'push-message');
515
- this.createSyncNotificationField(
516
- i18nString(UIStrings.syncString), this.syncTagNameSetting.get(), i18nString(UIStrings.syncTag),
517
- this.sync.bind(this), 'sync-tag');
518
- this.createSyncNotificationField(
519
- i18nString(UIStrings.periodicSync), this.periodicSyncTagNameSetting.get(),
520
- i18nString(UIStrings.periodicSyncTag), tag => this.periodicSync(tag), 'periodic-sync-tag');
515
+ this.createSyncNotificationField(i18nString(UIStrings.pushString), this.pushNotificationDataSetting.get(),
516
+ i18nString(UIStrings.pushData), this.push.bind(this), 'push-message');
517
+ this.createSyncNotificationField(i18nString(UIStrings.syncString), this.syncTagNameSetting.get(),
518
+ i18nString(UIStrings.syncTag), this.sync.bind(this), 'sync-tag');
519
+ this.createSyncNotificationField(i18nString(UIStrings.periodicSync), this.periodicSyncTagNameSetting.get(),
520
+ i18nString(UIStrings.periodicSyncTag), tag => this.periodicSync(tag),
521
+ 'periodic-sync-tag');
521
522
  this.createUpdateCycleField();
522
523
  this.maybeCreateRouterField();
523
524
 
@@ -525,26 +526,34 @@ export class Section {
525
526
  this.throttler = new Common.Throttler.Throttler(500);
526
527
  }
527
528
 
528
- private createSyncNotificationField(
529
- label: string, initialValue: string, placeholder: string, callback: (arg0: string) => void,
530
- jslogContext: string): void {
531
- const form =
532
- this.wrapWidget(this.section.appendField(label)).createChild('form', 'service-worker-editor-with-button');
533
- const editor = UI.UIUtils.createInput('source-code service-worker-notification-editor');
534
- editor.setAttribute('jslog', `${VisualLogging.textField().track({change: true}).context(jslogContext)}`);
535
- form.appendChild(editor);
536
- const button = UI.UIUtils.createTextButton(label, undefined, {jslogContext});
537
- button.type = 'submit';
538
- form.appendChild(button);
539
-
540
- editor.value = initialValue;
541
- editor.placeholder = placeholder;
542
- UI.ARIAUtils.setLabel(editor, label);
543
-
544
- form.addEventListener('submit', (e: Event) => {
545
- callback(editor.value || '');
546
- e.consume(true);
547
- });
529
+ private createSyncNotificationField(label: string, initialValue: string, placeholder: string,
530
+ callback: (arg0: string) => void, jslogContext: string): void {
531
+ const fieldElement = this.wrapWidget(this.section.appendField(label));
532
+
533
+ // clang-format off
534
+ // eslint-disable-next-line @devtools/no-lit-render-outside-of-view
535
+ render(html`
536
+ <form class="service-worker-editor-with-button" @submit=${(e: Event) => {
537
+ const {editor} = e.target as HTMLFormElement;
538
+ callback(editor.value || '');
539
+ e.consume(true);
540
+ }}>
541
+ <input name="editor" class="source-code service-worker-notification-editor harmony-input" type="text"
542
+ .value=${initialValue}
543
+ placeholder=${placeholder}
544
+ aria-label=${label}
545
+ .spellcheck=${false}
546
+ jslog=${VisualLogging.textField().track({change: true}).context(jslogContext)}
547
+ >
548
+ <devtools-button .data=${{
549
+ type: 'submit',
550
+ variant: Buttons.Button.Variant.OUTLINED,
551
+ jslogContext} as Buttons.Button.ButtonData}>
552
+ ${label}
553
+ </devtools-button>
554
+ </form>
555
+ `, fieldElement);
556
+ // clang-format on
548
557
  }
549
558
 
550
559
  scheduleUpdate(): void {
@@ -555,13 +564,17 @@ export class Section {
555
564
  void this.throttler.schedule(this.performUpdate.bind(this));
556
565
  }
557
566
 
558
- private addVersion(versionsStack: Element, icon: string, label: string): Element {
559
- const installingEntry = versionsStack.createChild('div', 'service-worker-version');
560
- installingEntry.createChild('div', icon);
561
- const statusString = installingEntry.createChild('span', 'service-worker-version-string');
562
- statusString.textContent = label;
563
- UI.ARIAUtils.markAsAlert(statusString);
564
- return installingEntry;
567
+ private renderVersion(icon: string, label: string, content: LitTemplate = nothing): LitTemplate {
568
+ // clang-format off
569
+ return html`
570
+ <div class="service-worker-version">
571
+ <div class=${icon}></div>
572
+ <span class="service-worker-version-string" role="alert" aria-live="polite">
573
+ ${label}
574
+ </span>
575
+ ${content}
576
+ </div>`;
577
+ // clang-format on
565
578
  }
566
579
 
567
580
  private updateClientsField(version: SDK.ServiceWorkerManager.ServiceWorkerVersion): void {
@@ -571,7 +584,8 @@ export class Section {
571
584
  const clientLabelText = this.clientsField.createChild('div', 'service-worker-client') as HTMLElement;
572
585
  const info = this.clientInfoCache.get(client);
573
586
  if (info) {
574
- this.updateClientInfo(clientLabelText, info);
587
+ // eslint-disable-next-line @devtools/no-lit-render-outside-of-view
588
+ render(this.renderClientInfo(info), clientLabelText);
575
589
  }
576
590
  void this.manager.target()
577
591
  .targetAgent()
@@ -581,31 +595,31 @@ export class Section {
581
595
  }
582
596
 
583
597
  private updateSourceField(version: SDK.ServiceWorkerManager.ServiceWorkerVersion): void {
584
- this.sourceField.removeChildren();
585
598
  const fileName = Common.ParsedURL.ParsedURL.extractName(version.scriptURL);
586
- const name = this.sourceField.createChild('div', 'report-field-value-filename');
587
- const link = Components.Linkifier.Linkifier.linkifyURL(
588
- version.scriptURL, ({text: fileName} as Components.Linkifier.LinkifyURLOptions));
589
- link.tabIndex = 0;
590
- link.setAttribute('jslog', `${VisualLogging.link('source-location').track({click: true})}`);
591
- name.appendChild(link);
592
- if (this.registration.errors.length) {
593
- const errorsLabel = UI.UIUtils.createIconLabel({
594
- title: String(this.registration.errors.length),
595
- iconName: 'cross-circle-filled',
596
- color: 'var(--icon-error)',
597
- });
598
- errorsLabel.classList.add('devtools-link', 'link');
599
- errorsLabel.tabIndex = 0;
600
- UI.ARIAUtils.setLabel(
601
- errorsLabel, i18nString(UIStrings.sRegistrationErrors, {PH1: this.registration.errors.length}));
602
- self.onInvokeElement(errorsLabel, () => Common.Console.Console.instance().show());
603
- name.appendChild(errorsLabel);
604
- }
605
- if (version.scriptResponseTime !== undefined) {
606
- this.sourceField.createChild('div', 'report-field-value-subtitle').textContent =
607
- i18nString(UIStrings.receivedS, {PH1: new Date(version.scriptResponseTime * 1000).toLocaleString()});
608
- }
599
+ // clang-format off
600
+ // eslint-disable-next-line @devtools/no-lit-render-outside-of-view
601
+ render(html`
602
+ <div class="report-field-value-filename">
603
+ ${Components.Linkifier.Linkifier.renderLinkifiedUrl(version.scriptURL, {
604
+ text: fileName, tabStop: true, jslogContext: 'source-location'})}
605
+ ${this.registration.errors.length ? html`
606
+ <button
607
+ class="devtools-link link"
608
+ tabindex="0"
609
+ aria-label=${i18nString(UIStrings.sRegistrationErrors, {PH1: this.registration.errors.length})}
610
+ @click=${() => Common.Console.Console.instance().show()}>
611
+ <devtools-icon name="cross-circle-filled" class="error-icon">
612
+ </devtools-icon>
613
+ ${this.registration.errors.length}
614
+ </button>` : nothing}
615
+ </div>
616
+ ${version.scriptResponseTime !== undefined ? html`
617
+ <div class="report-field-value-subtitle">
618
+ ${i18nString(UIStrings.receivedS, {PH1: new Date(version.scriptResponseTime * 1000).toLocaleString()})}
619
+ </div>
620
+ ` : nothing}
621
+ `, this.sourceField);
622
+ // clang-format on
609
623
  }
610
624
 
611
625
  private performUpdate(): Promise<void> {
@@ -627,62 +641,69 @@ export class Section {
627
641
  const installing = versions.get(SDK.ServiceWorkerManager.ServiceWorkerVersion.Modes.INSTALLING);
628
642
  const redundant = versions.get(SDK.ServiceWorkerManager.ServiceWorkerVersion.Modes.REDUNDANT);
629
643
 
630
- this.statusField.removeChildren();
631
- const versionsStack = this.statusField.createChild('div', 'service-worker-version-stack');
632
- versionsStack.createChild('div', 'service-worker-version-stack-bar');
644
+ // clang-format off
645
+ // eslint-disable-next-line @devtools/no-lit-render-outside-of-view
646
+ render(html`
647
+ <div class="service-worker-version-stack">
648
+ <div class="service-worker-version-stack-bar"></div>
649
+ ${active ? this.renderVersion(
650
+ 'service-worker-active-circle',
651
+ i18nString(UIStrings.sActivatedAndIsS, {
652
+ PH1: active.id,
653
+ PH2: SDK.ServiceWorkerManager.ServiceWorkerVersion.RunningStatus[active.currentState.runningStatus](),
654
+ }),
655
+ active.isRunning() || active.isStarting() ? html`
656
+ <devtools-button .data=${{jslogContext: 'stop', variant: Buttons.Button.Variant.OUTLINED} as Buttons.Button.ButtonData}
657
+ @click=${this.stopButtonClicked.bind(this, active.id)}>
658
+ ${i18nString(UIStrings.stopString)}
659
+ </devtools-button>`
660
+ : active.isStartable() ? html`
661
+ <devtools-button .data=${{jslogContext: 'start', variant: Buttons.Button.Variant.OUTLINED} as Buttons.Button.ButtonData}
662
+ @click=${this.startButtonClicked.bind(this)}>
663
+ ${i18nString(UIStrings.startString)}
664
+ </devtools-button>`
665
+ : nothing)
666
+ : redundant ? this.renderVersion(
667
+ 'service-worker-redundant-circle',
668
+ i18nString(UIStrings.sIsRedundant, {PH1: redundant.id}))
669
+ : nothing}
670
+ ${waiting ? this.renderVersion(
671
+ 'service-worker-waiting-circle',
672
+ i18nString(UIStrings.sWaitingToActivate, {PH1: waiting.id}), html`
673
+ <devtools-button .data=${{
674
+ jslogContext: 'skip-waiting',
675
+ title: i18n.i18n.lockedString('skipWaiting'),
676
+ variant: Buttons.Button.Variant.OUTLINED} as Buttons.Button.ButtonData}
677
+ @click=${this.skipButtonClicked.bind(this)}>
678
+ ${i18n.i18n.lockedString('skipWaiting')}
679
+ </devtools-button>
680
+ ${waiting.scriptResponseTime !== undefined ? html`
681
+ <div class="service-worker-subtitle">
682
+ ${i18nString(UIStrings.receivedS, {PH1: new Date(waiting.scriptResponseTime * 1000).toLocaleString()})}
683
+ </div>
684
+ ` : nothing}
685
+ `,
686
+ ) : nothing}
687
+ ${installing ? this.renderVersion(
688
+ 'service-worker-installing-circle',
689
+ i18nString(UIStrings.sTryingToInstall, {PH1: installing.id}),
690
+ installing.scriptResponseTime !== undefined ? html`
691
+ <div class="service-worker-subtitle">
692
+ ${i18nString(UIStrings.receivedS, {PH1: new Date(installing.scriptResponseTime * 1000).toLocaleString()})}
693
+ </div>` : nothing) : nothing}
694
+ </div>
695
+ `, this.statusField);
696
+ // clang-format on
633
697
 
634
698
  if (active) {
635
699
  this.updateSourceField(active);
636
- const localizedRunningStatus =
637
- SDK.ServiceWorkerManager.ServiceWorkerVersion.RunningStatus[active.currentState.runningStatus]();
638
- // TODO(l10n): Don't concatenate strings here.
639
- const activeEntry = this.addVersion(
640
- versionsStack, 'service-worker-active-circle',
641
- i18nString(UIStrings.sActivatedAndIsS, {PH1: active.id, PH2: localizedRunningStatus}));
642
-
643
- if (active.isRunning() || active.isStarting()) {
644
- const stopButton = UI.UIUtils.createTextButton(
645
- i18nString(UIStrings.stopString), this.stopButtonClicked.bind(this, active.id), {jslogContext: 'stop'});
646
- activeEntry.appendChild(stopButton);
647
- } else if (active.isStartable()) {
648
- const startButton = UI.UIUtils.createTextButton(
649
- i18nString(UIStrings.startString), this.startButtonClicked.bind(this), {jslogContext: 'start'});
650
- activeEntry.appendChild(startButton);
651
- }
652
700
  this.updateClientsField(active);
653
701
  this.maybeCreateRouterField();
654
702
  } else if (redundant) {
655
703
  this.updateSourceField(redundant);
656
- this.addVersion(
657
- versionsStack, 'service-worker-redundant-circle', i18nString(UIStrings.sIsRedundant, {PH1: redundant.id}));
658
704
  this.updateClientsField(redundant);
659
705
  }
660
706
 
661
- if (waiting) {
662
- const waitingEntry = this.addVersion(
663
- versionsStack, 'service-worker-waiting-circle', i18nString(UIStrings.sWaitingToActivate, {PH1: waiting.id}));
664
- const skipWaitingButton =
665
- UI.UIUtils.createTextButton(i18n.i18n.lockedString('skipWaiting'), this.skipButtonClicked.bind(this), {
666
- title: i18n.i18n.lockedString('skipWaiting'),
667
- jslogContext: 'skip-waiting',
668
- });
669
- waitingEntry.appendChild(skipWaitingButton);
670
- if (waiting.scriptResponseTime !== undefined) {
671
- waitingEntry.createChild('div', 'service-worker-subtitle').textContent =
672
- i18nString(UIStrings.receivedS, {PH1: new Date(waiting.scriptResponseTime * 1000).toLocaleString()});
673
- }
674
- }
675
- if (installing) {
676
- const installingEntry = this.addVersion(
677
- versionsStack, 'service-worker-installing-circle',
678
- i18nString(UIStrings.sTryingToInstall, {PH1: installing.id}));
679
- if (installing.scriptResponseTime !== undefined) {
680
- installingEntry.createChild('div', 'service-worker-subtitle').textContent = i18nString(UIStrings.receivedS, {
681
- PH1: new Date(installing.scriptResponseTime * 1000).toLocaleString(),
682
- });
683
- }
684
- }
685
-
686
707
  this.updateCycleView.refresh();
687
708
 
688
709
  return Promise.resolve();
@@ -753,30 +774,34 @@ export class Section {
753
774
  return;
754
775
  }
755
776
  this.clientInfoCache.set(targetInfo.targetId, targetInfo);
756
- this.updateClientInfo(element, targetInfo);
777
+ // eslint-disable-next-line @devtools/no-lit-render-outside-of-view
778
+ render(this.renderClientInfo(targetInfo), element);
757
779
  }
758
780
 
759
- private updateClientInfo(element: HTMLElement, targetInfo: Protocol.Target.TargetInfo): void {
760
- if (targetInfo.type !== 'page' && targetInfo.type === 'iframe') {
761
- const clientString = element.createChild('span', 'service-worker-client-string');
762
- UI.UIUtils.createTextChild(clientString, i18nString(UIStrings.workerS, {PH1: targetInfo.url}));
763
- return;
781
+ private renderClientInfo(targetInfo: Protocol.Target.TargetInfo): LitTemplate {
782
+ if (targetInfo.type !== 'page' && targetInfo.type !== 'iframe') {
783
+ // clang-format off
784
+ return html`<span class="service-worker-client-string">
785
+ ${i18nString(UIStrings.workerS, {PH1: targetInfo.url})}
786
+ </span>`;
787
+ // clang-format on
764
788
  }
765
- element.removeChildren();
766
- const clientString = element.createChild('span', 'service-worker-client-string');
767
- UI.UIUtils.createTextChild(clientString, targetInfo.url);
768
-
769
- const focusButton = new Buttons.Button.Button();
770
- focusButton.data = {
771
- iconName: 'select-element',
772
- variant: Buttons.Button.Variant.ICON,
773
- size: Buttons.Button.Size.SMALL,
774
- title: i18nString(UIStrings.focus),
775
- jslogContext: 'client-focus',
776
- };
777
- focusButton.className = 'service-worker-client-focus-link';
778
- focusButton.addEventListener('click', this.activateTarget.bind(this, targetInfo.targetId));
779
- element.appendChild(focusButton);
789
+
790
+ // clang-format off
791
+ return html`
792
+ <span class="service-worker-client-string">${targetInfo.url}</span>
793
+ <devtools-button
794
+ .data=${{
795
+ iconName: 'select-element',
796
+ variant: Buttons.Button.Variant.ICON,
797
+ size: Buttons.Button.Size.SMALL,
798
+ title: i18nString(UIStrings.focus),
799
+ jslogContext: 'client-focus',
800
+ } as Buttons.Button.ButtonData}
801
+ class="service-worker-client-focus-link"
802
+ @click=${this.activateTarget.bind(this, targetInfo.targetId)}
803
+ ></devtools-button>`;
804
+ // clang-format on
780
805
  }
781
806
 
782
807
  private activateTarget(targetId: Protocol.Target.TargetID): void {
@@ -154,3 +154,11 @@ button.link {
154
154
  button.link:focus-visible {
155
155
  background-color: inherit;
156
156
  }
157
+
158
+ devtools-icon.error-icon {
159
+ color: var(--sys-color-error-bright);
160
+ height: var(--sys-size-7);
161
+ margin-right: var(--sys-size-2);
162
+ vertical-align: bottom;
163
+ width: var(--sys-size-7);
164
+ }
@@ -214,13 +214,25 @@ export class ElementsPanel extends UI.Panel.Panel implements UI.SearchableView.S
214
214
  private cssStyleTrackerByCSSModel: Map<SDK.CSSModel.CSSModel, SDK.CSSModel.CSSPropertyTracker>;
215
215
  #domTreeWidget: DOMTreeWidget;
216
216
  #computedStyleModel: ComputedStyle.ComputedStyleModel.ComputedStyleModel;
217
+ readonly #targetManager: SDK.TargetManager.TargetManager;
218
+ readonly #settings: Common.Settings.Settings;
219
+
220
+ get settings(): Common.Settings.Settings {
221
+ return this.#settings;
222
+ }
223
+
224
+ get targetManager(): SDK.TargetManager.TargetManager {
225
+ return this.#targetManager;
226
+ }
217
227
 
218
228
  getTreeOutlineForTesting(): ElementsTreeOutline|undefined {
219
229
  return this.#domTreeWidget.getTreeOutlineForTesting();
220
230
  }
221
231
 
222
- constructor() {
232
+ constructor(targetManager?: SDK.TargetManager.TargetManager, settings?: Common.Settings.Settings) {
223
233
  super('elements');
234
+ this.#targetManager = targetManager ?? SDK.TargetManager.TargetManager.instance();
235
+ this.#settings = settings ?? Common.Settings.Settings.instance();
224
236
  this.registerRequiredCSS(elementsPanelStyles);
225
237
 
226
238
  this.splitWidget = new UI.SplitWidget.SplitWidget(true, true, 'elements-panel-split-view-state', 325, 325);
@@ -251,12 +263,10 @@ export class ElementsPanel extends UI.Panel.Panel implements UI.SearchableView.S
251
263
  this.domTreeContainer.id = 'elements-content';
252
264
  this.domTreeContainer.tabIndex = -1;
253
265
  // FIXME: crbug.com/425984
254
- if (Common.Settings.Settings.instance().moduleSetting('dom-word-wrap').get()) {
266
+ if (this.#settings.moduleSetting('dom-word-wrap').get()) {
255
267
  this.domTreeContainer.classList.add('elements-wrap');
256
268
  }
257
- Common.Settings.Settings.instance()
258
- .moduleSetting('dom-word-wrap')
259
- .addChangeListener(this.domWordWrapSettingChanged.bind(this));
269
+ this.#settings.moduleSetting('dom-word-wrap').addChangeListener(this.domWordWrapSettingChanged.bind(this));
260
270
 
261
271
  crumbsContainer.id = 'elements-crumbs';
262
272
  this.accessibilityTreeView = new AccessibilityTreeView(new TreeOutline.TreeOutline.TreeOutline<AXTreeNodeData>());
@@ -286,9 +296,7 @@ export class ElementsPanel extends UI.Panel.Panel implements UI.SearchableView.S
286
296
 
287
297
  this.metricsWidget = new MetricsSidebarPane(this.#computedStyleModel);
288
298
 
289
- Common.Settings.Settings.instance()
290
- .moduleSetting('sidebar-position')
291
- .addChangeListener(this.updateSidebarPosition.bind(this));
299
+ this.#settings.moduleSetting('sidebar-position').addChangeListener(this.updateSidebarPosition.bind(this));
292
300
  this.updateSidebarPosition();
293
301
 
294
302
  this.cssStyleTrackerByCSSModel = new Map();
@@ -296,8 +304,8 @@ export class ElementsPanel extends UI.Panel.Panel implements UI.SearchableView.S
296
304
 
297
305
  this.pendingNodeReveal = false;
298
306
 
299
- this.adornerManager = new ElementsComponents.AdornerManager.AdornerManager(
300
- Common.Settings.Settings.instance().moduleSetting('adorner-settings'));
307
+ this.adornerManager =
308
+ new ElementsComponents.AdornerManager.AdornerManager(this.#settings.moduleSetting('adorner-settings'));
301
309
  this.adornersByName = new Map();
302
310
 
303
311
  this.#domTreeWidget = new DOMTreeWidget();
@@ -306,14 +314,12 @@ export class ElementsPanel extends UI.Panel.Panel implements UI.SearchableView.S
306
314
  this.#domTreeWidget.onSelectedNodeChanged = this.selectedNodeChanged.bind(this);
307
315
  this.#domTreeWidget.onElementsTreeUpdated = this.updateBreadcrumbIfNeeded.bind(this);
308
316
  this.#domTreeWidget.onDocumentUpdated = this.documentUpdated.bind(this);
309
- this.#domTreeWidget.setWordWrap(Common.Settings.Settings.instance().moduleSetting('dom-word-wrap').get());
310
-
311
- SDK.TargetManager.TargetManager.instance().observeModels(SDK.DOMModel.DOMModel, this, {scoped: true});
312
- SDK.TargetManager.TargetManager.instance().addEventListener(
313
- SDK.TargetManager.Events.NAME_CHANGED, event => this.targetNameChanged(event.data));
314
- Common.Settings.Settings.instance()
315
- .moduleSetting('show-ua-shadow-dom')
316
- .addChangeListener(this.showUAShadowDOMChanged.bind(this));
317
+ this.#domTreeWidget.setWordWrap(this.#settings.moduleSetting('dom-word-wrap').get());
318
+
319
+ this.#targetManager.observeModels(SDK.DOMModel.DOMModel, this, {scoped: true});
320
+ this.#targetManager.addEventListener(SDK.TargetManager.Events.NAME_CHANGED,
321
+ event => this.targetNameChanged(event.data));
322
+ this.#settings.moduleSetting('show-ua-shadow-dom').addChangeListener(this.showUAShadowDOMChanged.bind(this));
317
323
  PanelCommon.ExtensionServer.ExtensionServer.instance().addEventListener(
318
324
  PanelCommon.ExtensionServer.Events.SidebarPaneAdded, this.extensionSidebarPaneAdded, this);
319
325
  }
@@ -378,10 +384,12 @@ export class ElementsPanel extends UI.Panel.Panel implements UI.SearchableView.S
378
384
 
379
385
  static instance(opts: {
380
386
  forceNew: boolean|null,
387
+ targetManager?: SDK.TargetManager.TargetManager,
388
+ settings?: Common.Settings.Settings,
381
389
  }|undefined = {forceNew: null}): ElementsPanel {
382
- const {forceNew} = opts;
390
+ const {forceNew, targetManager, settings} = opts || {};
383
391
  if (!elementsPanelInstance || forceNew) {
384
- elementsPanelInstance = new ElementsPanel();
392
+ elementsPanelInstance = new ElementsPanel(targetManager, settings);
385
393
  }
386
394
 
387
395
  return elementsPanelInstance;
@@ -734,7 +742,7 @@ export class ElementsPanel extends UI.Panel.Panel implements UI.SearchableView.S
734
742
  this.currentSearchResultIndex = -1;
735
743
  delete this.searchResults;
736
744
 
737
- SDK.DOMModel.DOMModel.cancelSearch();
745
+ SDK.DOMModel.DOMModel.cancelSearch(this.#targetManager);
738
746
  }
739
747
 
740
748
  performSearch(searchConfig: UI.SearchableView.SearchConfig, shouldJump: boolean, jumpBackwards?: boolean): void {
@@ -753,8 +761,8 @@ export class ElementsPanel extends UI.Panel.Panel implements UI.SearchableView.S
753
761
 
754
762
  this.searchConfig = searchConfig;
755
763
 
756
- const showUAShadowDOM = Common.Settings.Settings.instance().moduleSetting('show-ua-shadow-dom').get();
757
- const domModels = SDK.TargetManager.TargetManager.instance().models(SDK.DOMModel.DOMModel, {scoped: true});
764
+ const showUAShadowDOM = this.#settings.moduleSetting('show-ua-shadow-dom').get();
765
+ const domModels = this.#targetManager.models(SDK.DOMModel.DOMModel, {scoped: true});
758
766
  const promises = domModels.map(domModel => domModel.performSearch(whitespaceTrimmedQuery, showUAShadowDOM));
759
767
  void Promise.all(promises).then(resultCounts => {
760
768
  this.searchResults = [];
@@ -952,9 +960,8 @@ export class ElementsPanel extends UI.Panel.Panel implements UI.SearchableView.S
952
960
  const {showPanel = true, focusNode = false, highlightInOverlay = true} = opts ?? {};
953
961
  this.omitDefaultSelection = true;
954
962
 
955
- const node = Common.Settings.Settings.instance().moduleSetting('show-ua-shadow-dom').get() ?
956
- nodeToReveal :
957
- this.leaveUserAgentShadowDOM(nodeToReveal);
963
+ const node = this.#settings.moduleSetting('show-ua-shadow-dom').get() ? nodeToReveal :
964
+ this.leaveUserAgentShadowDOM(nodeToReveal);
958
965
  if (highlightInOverlay) {
959
966
  node.highlightForTwoSeconds();
960
967
  }
@@ -1167,7 +1174,7 @@ export class ElementsPanel extends UI.Panel.Panel implements UI.SearchableView.S
1167
1174
  return;
1168
1175
  } // We can't reparent extension iframes.
1169
1176
 
1170
- const position = Common.Settings.Settings.instance().moduleSetting('sidebar-position').get();
1177
+ const position = this.#settings.moduleSetting('sidebar-position').get();
1171
1178
  let splitMode = SplitMode.HORIZONTAL;
1172
1179
  if (position === 'right' || (position === 'auto' && this.splitWidget.element.offsetWidth > 680)) {
1173
1180
  splitMode = SplitMode.VERTICAL;
@@ -1508,7 +1515,7 @@ export class ElementsActionDelegate implements UI.ActionRegistration.ActionDeleg
1508
1515
  ElementsPanel.instance().toggleAccessibilityTree();
1509
1516
  return true;
1510
1517
  case 'elements.toggle-word-wrap': {
1511
- const setting = Common.Settings.Settings.instance().moduleSetting<boolean>('dom-word-wrap');
1518
+ const setting = ElementsPanel.instance().settings.moduleSetting<boolean>('dom-word-wrap');
1512
1519
  setting.set(!setting.get());
1513
1520
  return true;
1514
1521
  }
@@ -186,9 +186,10 @@ UI.ViewManager.registerViewExtension({
186
186
  order: 10,
187
187
  persistence: UI.ViewManager.ViewPersistence.PERMANENT,
188
188
  hasToolbar: false,
189
- async loadView() {
189
+ async loadView(universe) {
190
190
  const Elements = await loadElementsModule();
191
- return Elements.ElementsPanel.ElementsPanel.instance();
191
+ const {targetManager, settings} = universe;
192
+ return Elements.ElementsPanel.ElementsPanel.instance({forceNew: null, targetManager, settings});
192
193
  },
193
194
  });
194
195
 
@@ -1,7 +1,7 @@
1
1
  Name: Dependencies sourced from the upstream `chromium` repository
2
2
  URL: Internal
3
3
  Version: N/A
4
- Revision: 0ace4caef4948b4cbf54725b4133cb02bd286e24
4
+ Revision: 53dca21fdb660ead59f15a05a34d6fe08bd1dd35
5
5
  Update Mechanism: Manual (https://crbug.com/428069060)
6
6
  License: BSD-3-Clause
7
7
  License File: LICENSE
package/package.json CHANGED
@@ -92,5 +92,5 @@
92
92
  "webidl2": "24.5.0",
93
93
  "yargs": "17.7.2"
94
94
  },
95
- "version": "1.0.1656291"
95
+ "version": "1.0.1656897"
96
96
  }