chrome-devtools-frontend 1.0.1018569 → 1.0.1019968

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.
Files changed (40) hide show
  1. package/config/gni/devtools_grd_files.gni +3 -0
  2. package/front_end/core/i18n/locales/en-US.json +7 -1
  3. package/front_end/core/i18n/locales/en-XL.json +7 -1
  4. package/front_end/core/sdk/CSSMatchedStyles.ts +1 -1
  5. package/front_end/core/sdk/CSSModel.ts +22 -0
  6. package/front_end/core/sdk/CSSQuery.ts +2 -1
  7. package/front_end/core/sdk/CSSRule.ts +4 -0
  8. package/front_end/core/sdk/CSSScope.ts +30 -0
  9. package/front_end/core/sdk/sdk.ts +2 -0
  10. package/front_end/entrypoints/inspector_main/RenderingOptions.ts +7 -6
  11. package/front_end/entrypoints/inspector_main/inspector_main-meta.ts +1 -1
  12. package/front_end/generated/InspectorBackendCommands.js +13 -3
  13. package/front_end/generated/SupportedCSSProperties.js +2 -2
  14. package/front_end/generated/protocol-mapping.d.ts +5 -0
  15. package/front_end/generated/protocol-proxy-api.d.ts +5 -0
  16. package/front_end/generated/protocol.ts +43 -0
  17. package/front_end/models/bindings/BreakpointManager.ts +22 -14
  18. package/front_end/models/javascript_metadata/NativeFunctions.js +4 -19
  19. package/front_end/panels/elements/CSSRuleValidator.ts +100 -0
  20. package/front_end/panels/elements/ElementsTreeOutline.ts +44 -8
  21. package/front_end/panels/elements/StylePropertiesSection.ts +35 -3
  22. package/front_end/panels/elements/StylePropertyTreeElement.ts +59 -0
  23. package/front_end/panels/elements/StylesSidebarPane.ts +28 -8
  24. package/front_end/panels/elements/TopLayerContainer.ts +9 -1
  25. package/front_end/panels/elements/components/AdornerManager.ts +7 -0
  26. package/front_end/panels/elements/elements.ts +3 -0
  27. package/front_end/panels/elements/elementsTreeOutline.css +4 -0
  28. package/front_end/panels/elements/stylesSectionTree.css +10 -0
  29. package/front_end/panels/emulation/DeviceModeToolbar.ts +1 -0
  30. package/front_end/panels/network/components/RequestHeadersView.ts +16 -16
  31. package/front_end/ui/components/linear_memory_inspector/LinearMemoryInspector.ts +23 -1
  32. package/front_end/ui/components/linear_memory_inspector/LinearMemoryViewer.ts +18 -1
  33. package/front_end/ui/components/linear_memory_inspector/LinearMemoryViewerUtils.ts +8 -0
  34. package/front_end/ui/components/linear_memory_inspector/linearMemoryViewer.css +4 -0
  35. package/front_end/ui/components/linear_memory_inspector/linear_memory_inspector.ts +2 -0
  36. package/front_end/ui/components/node_text/nodeText.css +5 -5
  37. package/front_end/ui/components/panel_feedback/PreviewToggle.ts +1 -8
  38. package/front_end/ui/components/panel_feedback/previewToggle.css +1 -7
  39. package/front_end/ui/components/tree_outline/treeOutline.css +1 -0
  40. package/package.json +1 -1
@@ -605,6 +605,7 @@ grd_files_debug_sources = [
605
605
  "front_end/core/sdk/CSSPropertyParser.js",
606
606
  "front_end/core/sdk/CSSQuery.js",
607
607
  "front_end/core/sdk/CSSRule.js",
608
+ "front_end/core/sdk/CSSScope.js",
608
609
  "front_end/core/sdk/CSSStyleDeclaration.js",
609
610
  "front_end/core/sdk/CSSStyleSheetHeader.js",
610
611
  "front_end/core/sdk/CSSSupports.js",
@@ -933,6 +934,7 @@ grd_files_debug_sources = [
933
934
  "front_end/panels/developer_resources/developerResourcesView.css.js",
934
935
  "front_end/panels/elements/AccessibilityTreeUtils.js",
935
936
  "front_end/panels/elements/AccessibilityTreeView.js",
937
+ "front_end/panels/elements/CSSRuleValidator.js",
936
938
  "front_end/panels/elements/ClassesPaneWidget.js",
937
939
  "front_end/panels/elements/ColorSwatchPopoverIcon.js",
938
940
  "front_end/panels/elements/ComputedStyleModel.js",
@@ -1460,6 +1462,7 @@ grd_files_debug_sources = [
1460
1462
  "front_end/ui/components/linear_memory_inspector/LinearMemoryNavigator.js",
1461
1463
  "front_end/ui/components/linear_memory_inspector/LinearMemoryValueInterpreter.js",
1462
1464
  "front_end/ui/components/linear_memory_inspector/LinearMemoryViewer.js",
1465
+ "front_end/ui/components/linear_memory_inspector/LinearMemoryViewerUtils.js",
1463
1466
  "front_end/ui/components/linear_memory_inspector/ValueInterpreterDisplay.js",
1464
1467
  "front_end/ui/components/linear_memory_inspector/ValueInterpreterDisplayUtils.js",
1465
1468
  "front_end/ui/components/linear_memory_inspector/ValueInterpreterSettings.js",
@@ -903,7 +903,7 @@
903
903
  "message": "Show Rendering"
904
904
  },
905
905
  "entrypoints/inspector_main/inspector_main-meta.ts | toggleCssPrefersColorSchemeMedia": {
906
- "message": "Toggle forces CSS prefers-color-scheme color"
906
+ "message": "Toggle CSS media feature prefers-color-scheme"
907
907
  },
908
908
  "entrypoints/inspector_main/inspector_main-meta.ts | visionDeficiency": {
909
909
  "message": "vision deficiency"
@@ -4688,6 +4688,12 @@
4688
4688
  "panels/elements/ComputedStyleWidget.ts | showAll": {
4689
4689
  "message": "Show all"
4690
4690
  },
4691
+ "panels/elements/CSSRuleValidator.ts | alignContentRuleOnNoWrapFlex": {
4692
+ "message": "This element has flex-wrap: nowrap rule, therefore 'align-content' has no effect."
4693
+ },
4694
+ "panels/elements/CSSRuleValidator.ts | notFlexItemHint": {
4695
+ "message": "Parent of this element is not flex container, therefore {PH1} property has no effect."
4696
+ },
4691
4697
  "panels/elements/DOMLinkifier.ts | node": {
4692
4698
  "message": "<node>"
4693
4699
  },
@@ -903,7 +903,7 @@
903
903
  "message": "Ŝh́ôẃ R̂én̂d́êŕîńĝ"
904
904
  },
905
905
  "entrypoints/inspector_main/inspector_main-meta.ts | toggleCssPrefersColorSchemeMedia": {
906
- "message": "T̂óĝǵl̂é f̂ór̂ćêś ĈŚŜ ṕr̂éf̂ér̂ś-ĉól̂ór̂-śĉh́êḿê ćôĺôŕ"
906
+ "message": "T̂óĝǵl̂é ĈŚŜ ḿêd́îá f̂éât́ûŕê ṕr̂éf̂ér̂ś-ĉól̂ór̂-śĉh́êḿê"
907
907
  },
908
908
  "entrypoints/inspector_main/inspector_main-meta.ts | visionDeficiency": {
909
909
  "message": "v̂íŝíôń d̂éf̂íĉíêńĉý"
@@ -4688,6 +4688,12 @@
4688
4688
  "panels/elements/ComputedStyleWidget.ts | showAll": {
4689
4689
  "message": "Ŝh́ôẃ âĺl̂"
4690
4690
  },
4691
+ "panels/elements/CSSRuleValidator.ts | alignContentRuleOnNoWrapFlex": {
4692
+ "message": "T̂h́îś êĺêḿêńt̂ h́âś f̂ĺêx́-ŵŕâṕ: n̂óŵŕâṕ r̂úl̂é, t̂h́êŕêf́ôŕê 'ál̂íĝń-ĉón̂t́êńt̂' h́âś n̂ó êf́f̂éĉt́."
4693
+ },
4694
+ "panels/elements/CSSRuleValidator.ts | notFlexItemHint": {
4695
+ "message": "P̂ár̂én̂t́ ôf́ t̂h́îś êĺêḿêńt̂ íŝ ńôt́ f̂ĺêx́ ĉón̂t́âín̂ér̂, t́ĥér̂éf̂ór̂é {PH1} p̂ŕôṕêŕt̂ý ĥáŝ ńô éf̂f́êćt̂."
4696
+ },
4691
4697
  "panels/elements/DOMLinkifier.ts | node": {
4692
4698
  "message": "<n̂ód̂é>"
4693
4699
  },
@@ -491,7 +491,7 @@ export class CSSMatchedStyles {
491
491
  return true;
492
492
  }
493
493
  const parentRule = style.parentRule as CSSStyleRule;
494
- const queries = [...parentRule.media, ...parentRule.containerQueries, ...parentRule.supports];
494
+ const queries = [...parentRule.media, ...parentRule.containerQueries, ...parentRule.supports, ...parentRule.scopes];
495
495
  for (const query of queries) {
496
496
  if (!query.active()) {
497
497
  return false;
@@ -461,6 +461,28 @@ export class CSSModel extends SDKModel<EventTypes> {
461
461
  }
462
462
  }
463
463
 
464
+ async setScopeText(
465
+ styleSheetId: Protocol.CSS.StyleSheetId, range: TextUtils.TextRange.TextRange,
466
+ newScopeText: string): Promise<boolean> {
467
+ Host.userMetrics.actionTaken(Host.UserMetrics.Action.StyleRuleEdited);
468
+
469
+ try {
470
+ await this.ensureOriginalStyleSheetText(styleSheetId);
471
+ const {scope} = await this.agent.invoke_setScopeText({styleSheetId, range, text: newScopeText});
472
+
473
+ if (!scope) {
474
+ return false;
475
+ }
476
+ this.#domModel.markUndoableState();
477
+ const edit = new Edit(styleSheetId, range, newScopeText, scope);
478
+ this.fireStyleSheetChanged(styleSheetId, edit);
479
+ return true;
480
+ } catch (e) {
481
+ console.error(e);
482
+ return false;
483
+ }
484
+ }
485
+
464
486
  async addRule(styleSheetId: Protocol.CSS.StyleSheetId, ruleText: string, ruleLocation: TextUtils.TextRange.TextRange):
465
487
  Promise<CSSStyleRule|null> {
466
488
  try {
@@ -9,7 +9,8 @@ import type {CSSModel, Edit} from './CSSModel.js';
9
9
  import {CSSLocation} from './CSSModel.js';
10
10
  import type {CSSStyleSheetHeader} from './CSSStyleSheetHeader.js';
11
11
 
12
- type CSSQueryPayload = Protocol.CSS.CSSMedia|Protocol.CSS.CSSContainerQuery|Protocol.CSS.CSSSupports;
12
+ type CSSQueryPayload =
13
+ Protocol.CSS.CSSMedia|Protocol.CSS.CSSContainerQuery|Protocol.CSS.CSSSupports|Protocol.CSS.CSSScope;
13
14
 
14
15
  export abstract class CSSQuery {
15
16
  text = '';
@@ -9,6 +9,7 @@ import * as Platform from '../platform/platform.js';
9
9
  import {CSSContainerQuery} from './CSSContainerQuery.js';
10
10
  import {CSSLayer} from './CSSLayer.js';
11
11
  import {CSSMedia} from './CSSMedia.js';
12
+ import {CSSScope} from './CSSScope.js';
12
13
  import {CSSSupports} from './CSSSupports.js';
13
14
 
14
15
  import type {CSSModel, Edit} from './CSSModel.js';
@@ -103,6 +104,7 @@ export class CSSStyleRule extends CSSRule {
103
104
  media: CSSMedia[];
104
105
  containerQueries: CSSContainerQuery[];
105
106
  supports: CSSSupports[];
107
+ scopes: CSSScope[];
106
108
  layers: CSSLayer[];
107
109
  wasUsed: boolean;
108
110
  constructor(cssModel: CSSModel, payload: Protocol.CSS.CSSRule, wasUsed?: boolean) {
@@ -113,6 +115,7 @@ export class CSSStyleRule extends CSSRule {
113
115
  this.containerQueries = payload.containerQueries ?
114
116
  CSSContainerQuery.parseContainerQueriesPayload(cssModel, payload.containerQueries) :
115
117
  [];
118
+ this.scopes = payload.scopes ? CSSScope.parseScopesPayload(cssModel, payload.scopes) : [];
116
119
  this.supports = payload.supports ? CSSSupports.parseSupportsPayload(cssModel, payload.supports) : [];
117
120
  this.layers = payload.layers ? CSSLayer.parseLayerPayload(cssModel, payload.layers) : [];
118
121
  this.wasUsed = wasUsed || false;
@@ -200,6 +203,7 @@ export class CSSStyleRule extends CSSRule {
200
203
  }
201
204
  this.media.forEach(media => media.rebase(edit));
202
205
  this.containerQueries.forEach(cq => cq.rebase(edit));
206
+ this.scopes.forEach(scope => scope.rebase(edit));
203
207
  this.supports.forEach(supports => supports.rebase(edit));
204
208
 
205
209
  super.rebase(edit);
@@ -0,0 +1,30 @@
1
+ // Copyright 2022 The Chromium Authors. All rights reserved.
2
+ // Use of this source code is governed by a BSD-style license that can be
3
+ // found in the LICENSE file.
4
+
5
+ import * as TextUtils from '../../models/text_utils/text_utils.js';
6
+ import type * as Protocol from '../../generated/protocol.js';
7
+
8
+ import type {CSSModel} from './CSSModel.js';
9
+ import {CSSQuery} from './CSSQuery.js';
10
+
11
+ export class CSSScope extends CSSQuery {
12
+ static parseScopesPayload(cssModel: CSSModel, payload: Protocol.CSS.CSSScope[]): CSSScope[] {
13
+ return payload.map(scope => new CSSScope(cssModel, scope));
14
+ }
15
+
16
+ constructor(cssModel: CSSModel, payload: Protocol.CSS.CSSScope) {
17
+ super(cssModel);
18
+ this.reinitialize(payload);
19
+ }
20
+
21
+ reinitialize(payload: Protocol.CSS.CSSScope): void {
22
+ this.text = payload.text;
23
+ this.range = payload.range ? TextUtils.TextRange.TextRange.fromObject(payload.range) : null;
24
+ this.styleSheetId = payload.styleSheetId;
25
+ }
26
+
27
+ active(): boolean {
28
+ return true;
29
+ }
30
+ }
@@ -33,6 +33,7 @@ import * as CSSProperty from './CSSProperty.js';
33
33
  import * as CSSPropertyParser from './CSSPropertyParser.js';
34
34
  import * as CSSQuery from './CSSQuery.js';
35
35
  import * as CSSRule from './CSSRule.js';
36
+ import * as CSSScope from './CSSScope.js';
36
37
  import * as CSSStyleDeclaration from './CSSStyleDeclaration.js';
37
38
  import * as CSSStyleSheetHeader from './CSSStyleSheetHeader.js';
38
39
  import * as CSSSupports from './CSSSupports.js';
@@ -103,6 +104,7 @@ export {
103
104
  CSSPropertyParser,
104
105
  CSSQuery,
105
106
  CSSRule,
107
+ CSSScope,
106
108
  CSSStyleDeclaration,
107
109
  CSSStyleSheetHeader,
108
110
  CSSSupports,
@@ -366,13 +366,14 @@ export class ReloadActionDelegate implements UI.ActionRegistration.ActionDelegat
366
366
  Common.Settings.Settings.instance().moduleSetting('emulatedCSSMediaFeaturePrefersColorScheme');
367
367
 
368
368
  switch (actionId) {
369
- case 'rendering.toggle-prefers-color-scheme':
370
- if (emulatedCSSMediaFeaturePrefersColorSchemeSetting.get() === 'light') {
371
- emulatedCSSMediaFeaturePrefersColorSchemeSetting.set('dark');
372
- } else {
373
- emulatedCSSMediaFeaturePrefersColorSchemeSetting.set('light');
374
- }
369
+ case 'rendering.toggle-prefers-color-scheme': {
370
+ // Cycle between no emulation, light, dark
371
+ const options = ['', 'light', 'dark'];
372
+ const current = options.findIndex(x => x === emulatedCSSMediaFeaturePrefersColorSchemeSetting.get() || '');
373
+ emulatedCSSMediaFeaturePrefersColorSchemeSetting.set(options[(current + 1) % 3]);
374
+
375
375
  return true;
376
+ }
376
377
  }
377
378
  return false;
378
379
  }
@@ -103,7 +103,7 @@ const UIStrings = {
103
103
  * @description Title of an action that toggle
104
104
  * "forces CSS prefers-color-scheme" color
105
105
  */
106
- toggleCssPrefersColorSchemeMedia: 'Toggle forces CSS prefers-color-scheme color',
106
+ toggleCssPrefersColorSchemeMedia: 'Toggle CSS media feature prefers-color-scheme',
107
107
  };
108
108
  const str_ = i18n.i18n.registerUIStrings('entrypoints/inspector_main/inspector_main-meta.ts', UIStrings);
109
109
  const i18nLazyString = i18n.i18n.getLazilyComputedLocalizedString.bind(undefined, str_);
@@ -615,6 +615,13 @@ export function registerCommands(inspectorBackend) {
615
615
  {'name': 'range', 'type': 'object', 'optional': false}, {'name': 'text', 'type': 'string', 'optional': false}
616
616
  ],
617
617
  ['supports']);
618
+ inspectorBackend.registerCommand(
619
+ 'CSS.setScopeText',
620
+ [
621
+ {'name': 'styleSheetId', 'type': 'string', 'optional': false},
622
+ {'name': 'range', 'type': 'object', 'optional': false}, {'name': 'text', 'type': 'string', 'optional': false}
623
+ ],
624
+ ['scope']);
618
625
  inspectorBackend.registerCommand(
619
626
  'CSS.setRuleSelector',
620
627
  [
@@ -2149,9 +2156,12 @@ export function registerCommands(inspectorBackend) {
2149
2156
  WindowPlacement: 'window-placement',
2150
2157
  XrSpatialTracking: 'xr-spatial-tracking'
2151
2158
  });
2152
- inspectorBackend.registerEnum(
2153
- 'Page.PermissionsPolicyBlockReason',
2154
- {Header: 'Header', IframeAttribute: 'IframeAttribute', InFencedFrameTree: 'InFencedFrameTree'});
2159
+ inspectorBackend.registerEnum('Page.PermissionsPolicyBlockReason', {
2160
+ Header: 'Header',
2161
+ IframeAttribute: 'IframeAttribute',
2162
+ InFencedFrameTree: 'InFencedFrameTree',
2163
+ InIsolatedApp: 'InIsolatedApp'
2164
+ });
2155
2165
  inspectorBackend.registerEnum('Page.OriginTrialTokenStatus', {
2156
2166
  Success: 'Success',
2157
2167
  NotSupported: 'NotSupported',
@@ -333,7 +333,7 @@ export const generatedProperties = [
333
333
  {'name': 'contain-intrinsic-width', 'keywords': ['auto', 'none']},
334
334
  {'longhands': ['container-name', 'container-type'], 'name': 'container'},
335
335
  {'name': 'container-name', 'keywords': ['none']},
336
- {'name': 'container-type', 'keywords': ['none', 'inline-size', 'size']},
336
+ {'name': 'container-type', 'keywords': ['none', 'inline-size', 'size', 'style']},
337
337
  {'name': 'content'},
338
338
  {'name': 'content-visibility', 'keywords': ['visible', 'auto', 'hidden', 'hidden-matchable']},
339
339
  {'name': 'counter-increment', 'keywords': ['none']},
@@ -952,7 +952,7 @@ export const generatedPropertyValues = {
952
952
  'contain-intrinsic-height': {'values': ['auto', 'none']},
953
953
  'contain-intrinsic-width': {'values': ['auto', 'none']},
954
954
  'container-name': {'values': ['none']},
955
- 'container-type': {'values': ['none', 'inline-size', 'size']},
955
+ 'container-type': {'values': ['none', 'inline-size', 'size', 'style']},
956
956
  'content-visibility': {'values': ['visible', 'auto', 'hidden', 'hidden-matchable']},
957
957
  'counter-increment': {'values': ['none']},
958
958
  'counter-reset': {'values': ['none']},
@@ -1032,6 +1032,11 @@ export namespace ProtocolMapping {
1032
1032
  */
1033
1033
  'CSS.setSupportsText':
1034
1034
  {paramsType: [Protocol.CSS.SetSupportsTextRequest]; returnType: Protocol.CSS.SetSupportsTextResponse;};
1035
+ /**
1036
+ * Modifies the expression of a scope at-rule.
1037
+ */
1038
+ 'CSS.setScopeText':
1039
+ {paramsType: [Protocol.CSS.SetScopeTextRequest]; returnType: Protocol.CSS.SetScopeTextResponse;};
1035
1040
  /**
1036
1041
  * Modifies the rule selector.
1037
1042
  */
@@ -645,6 +645,11 @@ declare namespace ProtocolProxyApi {
645
645
  */
646
646
  invoke_setSupportsText(params: Protocol.CSS.SetSupportsTextRequest): Promise<Protocol.CSS.SetSupportsTextResponse>;
647
647
 
648
+ /**
649
+ * Modifies the expression of a scope at-rule.
650
+ */
651
+ invoke_setScopeText(params: Protocol.CSS.SetScopeTextRequest): Promise<Protocol.CSS.SetScopeTextResponse>;
652
+
648
653
  /**
649
654
  * Modifies the rule selector.
650
655
  */
@@ -1985,6 +1985,11 @@ export namespace CSS {
1985
1985
  * with the innermost layer and going outwards.
1986
1986
  */
1987
1987
  layers?: CSSLayer[];
1988
+ /**
1989
+ * @scope CSS at-rule array.
1990
+ * The array enumerates @scope at-rules starting with the innermost one, going outwards.
1991
+ */
1992
+ scopes?: CSSScope[];
1988
1993
  }
1989
1994
 
1990
1995
  /**
@@ -2250,6 +2255,25 @@ export namespace CSS {
2250
2255
  styleSheetId?: StyleSheetId;
2251
2256
  }
2252
2257
 
2258
+ /**
2259
+ * CSS Scope at-rule descriptor.
2260
+ */
2261
+ export interface CSSScope {
2262
+ /**
2263
+ * Scope rule text.
2264
+ */
2265
+ text: string;
2266
+ /**
2267
+ * The associated rule header range in the enclosing stylesheet (if
2268
+ * available).
2269
+ */
2270
+ range?: SourceRange;
2271
+ /**
2272
+ * Identifier of the stylesheet containing this object (if exists).
2273
+ */
2274
+ styleSheetId?: StyleSheetId;
2275
+ }
2276
+
2253
2277
  /**
2254
2278
  * CSS Layer at-rule descriptor.
2255
2279
  */
@@ -2686,6 +2710,19 @@ export namespace CSS {
2686
2710
  supports: CSSSupports;
2687
2711
  }
2688
2712
 
2713
+ export interface SetScopeTextRequest {
2714
+ styleSheetId: StyleSheetId;
2715
+ range: SourceRange;
2716
+ text: string;
2717
+ }
2718
+
2719
+ export interface SetScopeTextResponse extends ProtocolResponseWithError {
2720
+ /**
2721
+ * The resulting CSS Scope rule after modification.
2722
+ */
2723
+ scope: CSSScope;
2724
+ }
2725
+
2689
2726
  export interface SetRuleSelectorRequest {
2690
2727
  styleSheetId: StyleSheetId;
2691
2728
  range: SourceRange;
@@ -10291,6 +10328,7 @@ export namespace Page {
10291
10328
  Header = 'Header',
10292
10329
  IframeAttribute = 'IframeAttribute',
10293
10330
  InFencedFrameTree = 'InFencedFrameTree',
10331
+ InIsolatedApp = 'InIsolatedApp',
10294
10332
  }
10295
10333
 
10296
10334
  export interface PermissionsPolicyBlockLocator {
@@ -13640,6 +13678,11 @@ export namespace Tracing {
13640
13678
  * Controls how the trace buffer stores data.
13641
13679
  */
13642
13680
  recordMode?: TraceConfigRecordMode;
13681
+ /**
13682
+ * Size of the trace buffer in kilobytes. If not specified or zero is passed, a default value
13683
+ * of 200 MB would be used.
13684
+ */
13685
+ traceBufferSizeInKb?: number;
13643
13686
  /**
13644
13687
  * Turns on JavaScript stack sampling.
13645
13688
  */
@@ -409,13 +409,18 @@ export type EventTypes = {
409
409
  [Events.BreakpointRemoved]: BreakpointLocation,
410
410
  };
411
411
 
412
- const enum DebuggerUpdateResult {
412
+ export const enum DebuggerUpdateResult {
413
413
  OK = 'OK',
414
- ERROR = 'ERROR',
414
+ ERROR_BREAKPOINT_CLASH = 'ERROR_BREAKPOINT_CLASH',
415
+ ERROR_BACKEND = 'ERROR_BACKEND',
416
+
415
417
  // PENDING implies that the current update requires another re-run.
416
418
  PENDING = 'PENDING',
417
419
  }
418
420
 
421
+ export type ScheduleUpdateResult =
422
+ DebuggerUpdateResult.OK|DebuggerUpdateResult.ERROR_BACKEND|DebuggerUpdateResult.ERROR_BREAKPOINT_CLASH;
423
+
419
424
  const enum ResolveLocationResult {
420
425
  OK = 'OK',
421
426
  ERROR = 'ERROR',
@@ -430,7 +435,7 @@ export class Breakpoint implements SDK.TargetManager.SDKModelObserver<SDK.Debugg
430
435
  uiSourceCodes: Set<Workspace.UISourceCode.UISourceCode>;
431
436
  #conditionInternal!: string;
432
437
  #enabledInternal!: boolean;
433
- isRemoved!: boolean;
438
+ isRemoved = false;
434
439
  currentState: Breakpoint.State|null;
435
440
  readonly #modelBreakpoints: Map<SDK.DebuggerModel.DebuggerModel, ModelBreakpoint>;
436
441
 
@@ -629,6 +634,9 @@ export class Breakpoint implements SDK.TargetManager.SDKModelObserver<SDK.Debugg
629
634
  }
630
635
 
631
636
  async remove(keepInStorage: boolean): Promise<void> {
637
+ if (this.getIsRemoved()) {
638
+ return;
639
+ }
632
640
  this.isRemoved = true;
633
641
  const removeFromStorage = !keepInStorage;
634
642
 
@@ -676,9 +684,11 @@ export class Breakpoint implements SDK.TargetManager.SDKModelObserver<SDK.Debugg
676
684
  }
677
685
 
678
686
  async #updateModel(model: ModelBreakpoint): Promise<void> {
679
- const success = await model.scheduleUpdateInDebugger();
680
- if (!success) {
681
- await this.remove(false);
687
+ const result = await model.scheduleUpdateInDebugger();
688
+ if (result === DebuggerUpdateResult.ERROR_BACKEND) {
689
+ await this.remove(true /* keepInStorage */);
690
+ } else if (result === DebuggerUpdateResult.ERROR_BREAKPOINT_CLASH) {
691
+ await this.remove(false /* keepInStorage */);
682
692
  }
683
693
  }
684
694
  }
@@ -722,11 +732,9 @@ export class ModelBreakpoint {
722
732
  this.#liveLocations.disposeAll();
723
733
  }
724
734
 
725
- // Returns true, if scheduling ran as expected.
726
- // Returns false, if an error occurred.
727
- async scheduleUpdateInDebugger(): Promise<boolean> {
735
+ async scheduleUpdateInDebugger(): Promise<ScheduleUpdateResult> {
728
736
  if (!this.#debuggerModel.debuggerEnabled()) {
729
- return true;
737
+ return DebuggerUpdateResult.OK;
730
738
  }
731
739
 
732
740
  const release = await this.#updateMutex.acquire();
@@ -735,7 +743,7 @@ export class ModelBreakpoint {
735
743
  result = await this.#updateInDebugger();
736
744
  }
737
745
  release();
738
- return result === DebuggerUpdateResult.OK;
746
+ return result;
739
747
  }
740
748
 
741
749
  private scriptDiverged(): boolean {
@@ -849,7 +857,7 @@ export class ModelBreakpoint {
849
857
  // Something went wrong: we expect to have a non-null state, but have not received any
850
858
  // breakpointIds from the back-end.
851
859
  if (!breakpointIds.length) {
852
- return DebuggerUpdateResult.ERROR;
860
+ return DebuggerUpdateResult.ERROR_BACKEND;
853
861
  }
854
862
 
855
863
  this.#breakpointIds = breakpointIds;
@@ -859,7 +867,7 @@ export class ModelBreakpoint {
859
867
 
860
868
  // Breakpoint clash: the resolved location resolves to a different breakpoint, report an error.
861
869
  if (resolvedResults.includes(ResolveLocationResult.ERROR)) {
862
- return DebuggerUpdateResult.ERROR;
870
+ return DebuggerUpdateResult.ERROR_BREAKPOINT_CLASH;
863
871
  }
864
872
  return DebuggerUpdateResult.OK;
865
873
  }
@@ -917,7 +925,7 @@ export class ModelBreakpoint {
917
925
  Promise<void> {
918
926
  const result = await this.addResolvedLocation(location);
919
927
  if (result === ResolveLocationResult.ERROR) {
920
- await this.#breakpoint.remove(false);
928
+ await this.#breakpoint.remove(false /* keepInStorage */);
921
929
  }
922
930
  }
923
931
 
@@ -981,11 +981,6 @@ export const NativeFunctions = [
981
981
  signatures: [['?returnValue']],
982
982
  receivers: ['HTMLDialogElement']
983
983
  },
984
- {
985
- name: 'close',
986
- signatures: [['?options']],
987
- receivers: ['TCPSocket','UDPSocket']
988
- },
989
984
  {
990
985
  name: 'close',
991
986
  signatures: [['?closeInfo']],
@@ -6780,20 +6775,6 @@ export const NativeFunctions = [
6780
6775
  name: 'FederatedCredential',
6781
6776
  signatures: [['data']]
6782
6777
  },
6783
- {
6784
- name: 'login',
6785
- signatures: [['?request']]
6786
- },
6787
- {
6788
- name: 'revoke',
6789
- signatures: [['hint']],
6790
- receivers: ['FederatedCredential']
6791
- },
6792
- {
6793
- name: 'revoke',
6794
- signatures: [['permission']],
6795
- receivers: ['Permissions']
6796
- },
6797
6778
  {
6798
6779
  name: 'logoutRps',
6799
6780
  signatures: [['?logout_requests']]
@@ -7384,6 +7365,10 @@ export const NativeFunctions = [
7384
7365
  name: 'RTCSessionDescription',
7385
7366
  signatures: [['?descriptionInitDict']]
7386
7367
  },
7368
+ {
7369
+ name: 'revoke',
7370
+ signatures: [['permission']]
7371
+ },
7387
7372
  {
7388
7373
  name: 'requestAll',
7389
7374
  signatures: [['permissions']]
@@ -0,0 +1,100 @@
1
+ // Copyright 2022 The Chromium Authors. All rights reserved.
2
+ // Use of this source code is governed by a BSD-style license that can be
3
+ // found in the LICENSE file.
4
+
5
+ import * as i18n from '../../core/i18n/i18n.js';
6
+
7
+ const UIStrings = {
8
+ /**
9
+ *@description Hint for Align-content rule where element also has flex-wrap nowrap rule.
10
+ */
11
+ alignContentRuleOnNoWrapFlex: 'This element has flex-wrap: nowrap rule, therefore \'align-content\' has no effect.',
12
+ /**
13
+ *@description Hint for element that does not have effect if parent container is not flex.
14
+ *@example {flex} PH1
15
+ */
16
+ notFlexItemHint: 'Parent of this element is not flex container, therefore {PH1} property has no effect.',
17
+ };
18
+ const str_ = i18n.i18n.registerUIStrings('panels/elements/CSSRuleValidator.ts', UIStrings);
19
+ const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
20
+
21
+ export abstract class CSSRuleValidator {
22
+ readonly #affectedProperties: string[];
23
+
24
+ constructor(affectedProperties: string[]) {
25
+ this.#affectedProperties = affectedProperties;
26
+ }
27
+
28
+ abstract isRuleValid(computedStyles: Map<String, String>|null, parentsComputedStyles?: Map<String, String>|null):
29
+ boolean;
30
+
31
+ getAffectedProperties(): string[] {
32
+ return this.#affectedProperties;
33
+ }
34
+
35
+ abstract getHintMessage(propertyName: string): string;
36
+ }
37
+
38
+ export class AlignContentValidator extends CSSRuleValidator {
39
+ constructor() {
40
+ super(['align-content']);
41
+ }
42
+
43
+ isRuleValid(computedStyles: Map<String, String>|null): boolean {
44
+ if (computedStyles === null || computedStyles === undefined) {
45
+ return true;
46
+ }
47
+ const display = computedStyles.get('display');
48
+ if (display !== 'flex' && display !== 'inline-flex') {
49
+ return true;
50
+ }
51
+ return computedStyles.get('flex-wrap') !== 'nowrap';
52
+ }
53
+
54
+ getHintMessage(): string {
55
+ return i18nString(UIStrings.alignContentRuleOnNoWrapFlex);
56
+ }
57
+ }
58
+
59
+ export class FlexItemValidator extends CSSRuleValidator {
60
+ constructor() {
61
+ super(['flex', 'flex-basis', 'flex-grow', 'flex-shrink']);
62
+ }
63
+
64
+ isRuleValid(computedStyles: Map<String, String>|null, parentsComputedStyles: Map<String, String>|null): boolean {
65
+ if (computedStyles === null || computedStyles === undefined || parentsComputedStyles === null ||
66
+ parentsComputedStyles === undefined) {
67
+ return true;
68
+ }
69
+ const parentDisplay = parentsComputedStyles.get('display');
70
+ return parentDisplay === 'flex' || parentDisplay === 'inline-flex';
71
+ }
72
+
73
+ getHintMessage(property: string): string {
74
+ return i18nString(UIStrings.notFlexItemHint, {
75
+ 'PH1': property,
76
+ });
77
+ }
78
+ }
79
+
80
+ const setupCSSRulesValidators = (): Map<String, CSSRuleValidator[]> => {
81
+ const validators = [new AlignContentValidator(), new FlexItemValidator()];
82
+
83
+ const validatorsMap = new Map<String, CSSRuleValidator[]>();
84
+ for (const validator of validators) {
85
+ const affectedProperties = validator.getAffectedProperties();
86
+
87
+ for (const affectedProperty of affectedProperties) {
88
+ let propertyValidators = validatorsMap.get(affectedProperty);
89
+ if (propertyValidators === undefined) {
90
+ propertyValidators = [];
91
+ }
92
+ propertyValidators.push(validator);
93
+
94
+ validatorsMap.set(affectedProperty, propertyValidators);
95
+ }
96
+ }
97
+ return validatorsMap;
98
+ };
99
+
100
+ export const cssRuleValidatorsMap: Map<String, CSSRuleValidator[]> = setupCSSRulesValidators();