chrome-devtools-frontend 1.0.978673 → 1.0.980166

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 (59) hide show
  1. package/front_end/.eslintrc.js +1 -0
  2. package/front_end/core/common/Color.ts +95 -29
  3. package/front_end/core/common/ColorUtils.ts +18 -2
  4. package/front_end/core/common/Settings.ts +2 -0
  5. package/front_end/core/sdk/CSSStyleSheetHeader.ts +21 -9
  6. package/front_end/entrypoints/formatter_worker/FormatterActions.ts +1 -0
  7. package/front_end/entrypoints/formatter_worker/FormatterWorker.ts +2 -2
  8. package/front_end/entrypoints/formatter_worker/Substitute.ts +8 -3
  9. package/front_end/entrypoints/formatter_worker/formatter_worker-entrypoint.ts +7 -1
  10. package/front_end/models/formatter/FormatterWorkerPool.ts +11 -3
  11. package/front_end/models/persistence/PersistenceUtils.ts +1 -2
  12. package/front_end/panels/console/ConsolePrompt.ts +8 -6
  13. package/front_end/panels/elements/StylesSidebarPane.ts +7 -11
  14. package/front_end/panels/elements/components/computedStyleProperty.css +1 -0
  15. package/front_end/panels/elements/components/computedStyleTrace.css +1 -0
  16. package/front_end/panels/media/playerMessagesView.css +0 -7
  17. package/front_end/panels/sources/components/HeadersView.css +3 -6
  18. package/front_end/panels/webauthn/webauthnPane.css +6 -2
  19. package/front_end/third_party/puppeteer/README.chromium +2 -2
  20. package/front_end/third_party/puppeteer/package/README.md +11 -11
  21. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Browser.js +1 -1
  22. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Browser.js.map +1 -1
  23. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FrameManager.d.ts +1 -0
  24. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FrameManager.d.ts.map +1 -1
  25. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FrameManager.js +8 -2
  26. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FrameManager.js.map +1 -1
  27. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/LifecycleWatcher.d.ts +2 -0
  28. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/LifecycleWatcher.d.ts.map +1 -1
  29. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/LifecycleWatcher.js +13 -1
  30. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/LifecycleWatcher.js.map +1 -1
  31. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/Launcher.d.ts.map +1 -1
  32. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/Launcher.js +0 -3
  33. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/Launcher.js.map +1 -1
  34. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.js +1 -1
  35. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Browser.js +1 -1
  36. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Browser.js.map +1 -1
  37. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/FrameManager.d.ts +1 -0
  38. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/FrameManager.d.ts.map +1 -1
  39. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/FrameManager.js +9 -3
  40. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/FrameManager.js.map +1 -1
  41. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/LifecycleWatcher.d.ts +2 -0
  42. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/LifecycleWatcher.d.ts.map +1 -1
  43. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/LifecycleWatcher.js +13 -1
  44. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/LifecycleWatcher.js.map +1 -1
  45. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/Launcher.d.ts.map +1 -1
  46. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/Launcher.js +0 -3
  47. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/Launcher.js.map +1 -1
  48. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.js +1 -1
  49. package/front_end/third_party/puppeteer/package/lib/types.d.ts +3 -0
  50. package/front_end/third_party/puppeteer/package/package.json +14 -7
  51. package/front_end/ui/components/text_editor/config.ts +1 -0
  52. package/front_end/ui/legacy/InspectorView.ts +1 -1
  53. package/front_end/ui/legacy/components/color_picker/Spectrum.ts +23 -9
  54. package/front_end/ui/legacy/components/inline_editor/ColorSwatch.ts +5 -0
  55. package/front_end/ui/legacy/inspectorCommon.css +9 -0
  56. package/inspector_overlay/highlight_common.ts +10 -3
  57. package/package.json +1 -1
  58. package/scripts/eslint_rules/lib/no_importing_images_from_src.js +61 -0
  59. package/scripts/eslint_rules/tests/no_importing_images_from_src_test.js +40 -0
@@ -27,6 +27,7 @@ module.exports = {
27
27
  'files': ['*.ts'],
28
28
  'rules': {
29
29
  '@typescript-eslint/explicit-function-return-type': 2,
30
+ 'rulesdir/no_importing_images_from_src': 2,
30
31
  'rulesdir/enforce_custom_event_names': 2,
31
32
  'rulesdir/set_data_type_reference': 2,
32
33
  'rulesdir/lit_html_data_as_type': 2,
@@ -33,10 +33,11 @@
33
33
 
34
34
  import * as Platform from '../platform/platform.js';
35
35
 
36
- import {blendColors, contrastRatioAPCA, desiredLuminanceAPCA, luminance, luminanceAPCA, rgbaToHsla} from './ColorUtils.js';
36
+ import {blendColors, contrastRatioAPCA, desiredLuminanceAPCA, luminance, luminanceAPCA, rgbaToHsla, rgbaToHwba} from './ColorUtils.js';
37
37
 
38
38
  export class Color {
39
39
  #hslaInternal: number[]|undefined;
40
+ #hwbaInternal: number[]|undefined;
40
41
  #rgbaInternal: number[];
41
42
  #originalText: string|null;
42
43
  readonly #originalTextIsValid: boolean;
@@ -44,6 +45,7 @@ export class Color {
44
45
 
45
46
  constructor(rgba: number[], format: Format, originalText?: string) {
46
47
  this.#hslaInternal = undefined;
48
+ this.#hwbaInternal = undefined;
47
49
  this.#rgbaInternal = rgba;
48
50
  this.#originalText = originalText || null;
49
51
  this.#originalTextIsValid = Boolean(this.#originalText);
@@ -110,29 +112,12 @@ export class Color {
110
112
  return null;
111
113
  }
112
114
 
113
- // rgb/rgba(), hsl/hsla()
114
- match = text.toLowerCase().match(/^\s*(?:(rgba?)|(hsla?))\((.*)\)\s*$/);
115
-
115
+ // rgb/rgba(), hsl/hsla(), hwb/hwba()
116
+ match = text.toLowerCase().match(/^\s*(?:(rgba?)|(hsla?)|(hwba?))\((.*)\)\s*$/);
116
117
  if (match) {
117
- const components = match[3].trim();
118
- let values = components.split(/\s*,\s*/);
119
- if (values.length === 1) {
120
- values = components.split(/\s+/);
121
- if (values[3] === '/') {
122
- values.splice(3, 1);
123
- if (values.length !== 4) {
124
- return null;
125
- }
126
- } else if (
127
- (values.length > 2 && values[2].indexOf('/') !== -1) ||
128
- (values.length > 3 && values[3].indexOf('/') !== -1)) {
129
- const alpha = values.slice(2, 4).join('');
130
- values = values.slice(0, 2).concat(alpha.split(/\//)).concat(values.slice(4));
131
- } else if (values.length >= 4) {
132
- return null;
133
- }
134
- }
135
- if (values.length !== 3 && values.length !== 4 || values.indexOf('') > -1) {
118
+ // hwb(a) must have white space delimiters between its parameters.
119
+ const values = this.splitColorFunctionParameters(match[4], !match[3]);
120
+ if (!values) {
136
121
  return null;
137
122
  }
138
123
  const hasAlpha = (values[3] !== undefined);
@@ -150,19 +135,23 @@ export class Color {
150
135
  return new Color((rgba as number[]), hasAlpha ? Format.RGBA : Format.RGB, text);
151
136
  }
152
137
 
153
- if (match[2]) { // hsl/hsla
154
- const hsla = [
138
+ if (match[2] || match[3]) { // hsl/hsla or hwb/hwba
139
+ const parameters = [
155
140
  Color.parseHueNumeric(values[0]),
156
141
  Color.parseSatLightNumeric(values[1]),
157
142
  Color.parseSatLightNumeric(values[2]),
158
143
  hasAlpha ? Color.parseAlphaNumeric(values[3]) : 1,
159
144
  ];
160
- if (hsla.indexOf(null) > -1) {
145
+ if (parameters.indexOf(null) > -1) {
161
146
  return null;
162
147
  }
163
148
  const rgba: number[] = [];
164
- Color.hsl2rgb((hsla as number[]), rgba);
165
- return new Color(rgba, hasAlpha ? Format.HSLA : Format.HSL, text);
149
+ if (match[2]) {
150
+ Color.hsl2rgb((parameters as number[]), rgba);
151
+ return new Color(rgba, hasAlpha ? Format.HSLA : Format.HSL, text);
152
+ }
153
+ Color.hwb2rgb((parameters as number[]), rgba);
154
+ return new Color(rgba, hasAlpha ? Format.HWBA : Format.HWB, text);
166
155
  }
167
156
  }
168
157
 
@@ -179,6 +168,38 @@ export class Color {
179
168
  return new Color(rgba, Format.HSLA);
180
169
  }
181
170
 
171
+ /**
172
+ * Split the color parameters of (e.g.) rgb(a), hsl(a), hwb(a) functions.
173
+ */
174
+ static splitColorFunctionParameters(content: string, allowCommas: boolean): string[]|null {
175
+ const components = content.trim();
176
+ let values: string[] = [];
177
+
178
+ if (allowCommas) {
179
+ values = components.split(/\s*,\s*/);
180
+ }
181
+ if (!allowCommas || values.length === 1) {
182
+ values = components.split(/\s+/);
183
+ if (values[3] === '/') {
184
+ values.splice(3, 1);
185
+ if (values.length !== 4) {
186
+ return null;
187
+ }
188
+ } else if (
189
+ (values.length > 2 && values[2].indexOf('/') !== -1) ||
190
+ (values.length > 3 && values[3].indexOf('/') !== -1)) {
191
+ const alpha = values.slice(2, 4).join('');
192
+ values = values.slice(0, 2).concat(alpha.split(/\//)).concat(values.slice(4));
193
+ } else if (values.length >= 4) {
194
+ return null;
195
+ }
196
+ }
197
+ if (values.length !== 3 && values.length !== 4 || values.indexOf('') > -1) {
198
+ return null;
199
+ }
200
+ return values;
201
+ }
202
+
182
203
  static parsePercentOrNumber(value: string): number|null {
183
204
  // @ts-ignore: isNaN can accept strings
184
205
  if (isNaN(value.replace('%', ''))) {
@@ -309,6 +330,24 @@ export class Color {
309
330
  out_rgb[3] = hsl[3];
310
331
  }
311
332
 
333
+ // See https://drafts.csswg.org/css-color-4/#hwb-to-rgb for formula reference.
334
+ // eslint-disable-next-line @typescript-eslint/naming-convention
335
+ static hwb2rgb(hwb: number[], out_rgb: number[]): void {
336
+ const h = hwb[0];
337
+ const w = hwb[1];
338
+ const b = hwb[2];
339
+
340
+ if (w + b >= 1) {
341
+ out_rgb[0] = out_rgb[1] = out_rgb[2] = w / (w + b);
342
+ out_rgb[3] = hwb[3];
343
+ } else {
344
+ Color.hsl2rgb([h, 1, 0.5, hwb[3]], out_rgb);
345
+ for (let i = 0; i < 3; ++i) {
346
+ out_rgb[i] += w - (w + b) * out_rgb[i];
347
+ }
348
+ }
349
+ }
350
+
312
351
  // TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration
313
352
  // eslint-disable-next-line @typescript-eslint/naming-convention
314
353
  static hsva2rgba(hsva: number[], out_rgba: number[]): void {
@@ -478,6 +517,21 @@ export class Color {
478
517
  return [h, s !== 0 ? 2 * s / (l + s) : 0, (l + s), hsla[3]];
479
518
  }
480
519
 
520
+ /** HWBA with components within [0..1]
521
+ */
522
+ hwba(): number[] {
523
+ if (this.#hwbaInternal) {
524
+ return this.#hwbaInternal;
525
+ }
526
+ this.#hwbaInternal = rgbaToHwba(this.#rgbaInternal);
527
+ return this.#hwbaInternal;
528
+ }
529
+
530
+ canonicalHWBA(): number[] {
531
+ const hwba = this.hwba();
532
+ return [Math.round(hwba[0] * 360), Math.round(hwba[1] * 100), Math.round(hwba[2] * 100), hwba[3]];
533
+ }
534
+
481
535
  hasAlpha(): boolean {
482
536
  return this.#rgbaInternal[3] !== 1;
483
537
  }
@@ -546,6 +600,16 @@ export class Color {
546
600
  }
547
601
  return start + ')';
548
602
  }
603
+ case Format.HWB:
604
+ case Format.HWBA: {
605
+ const hwba = this.hwba();
606
+ const start = Platform.StringUtilities.sprintf(
607
+ 'hwb(%ddeg %d% %d%', Math.round(hwba[0] * 360), Math.round(hwba[1] * 100), Math.round(hwba[2] * 100));
608
+ if (this.hasAlpha()) {
609
+ return start + Platform.StringUtilities.sprintf(' / %d%)', Math.round(hwba[3] * 100));
610
+ }
611
+ return start + ')';
612
+ }
549
613
  case Format.HEXA: {
550
614
  return Platform.StringUtilities
551
615
  .sprintf(
@@ -670,7 +734,7 @@ export class Color {
670
734
  }
671
735
 
672
736
  export const Regex: RegExp =
673
- /((?:rgb|hsl)a?\([^)]+\)|#[0-9a-fA-F]{8}|#[0-9a-fA-F]{6}|#[0-9a-fA-F]{3,4}|\b[a-zA-Z]+\b(?!-))/g;
737
+ /((?:rgb|hsl|hwb)a?\([^)]+\)|#[0-9a-fA-F]{8}|#[0-9a-fA-F]{6}|#[0-9a-fA-F]{3,4}|\b[a-zA-Z]+\b(?!-))/g;
674
738
 
675
739
  // TODO(crbug.com/1167717): Make this a const enum again
676
740
  // eslint-disable-next-line rulesdir/const_enum
@@ -685,6 +749,8 @@ export enum Format {
685
749
  RGBA = 'rgba',
686
750
  HSL = 'hsl',
687
751
  HSLA = 'hsla',
752
+ HWB = 'hwb',
753
+ HWBA = 'hwba',
688
754
  }
689
755
 
690
756
  const COLOR_TO_RGBA_ENTRIES: Array<readonly[string, number[]]> = [
@@ -15,11 +15,10 @@ export function blendColors(fgRGBA: number[], bgRGBA: number[]): number[] {
15
15
  ];
16
16
  }
17
17
 
18
- export function rgbaToHsla([r, g, b, a]: number[]): number[] {
18
+ function rgbToHue([r, g, b]: number[]): number {
19
19
  const max = Math.max(r, g, b);
20
20
  const min = Math.min(r, g, b);
21
21
  const diff = max - min;
22
- const sum = max + min;
23
22
 
24
23
  let h;
25
24
  if (min === max) {
@@ -31,7 +30,16 @@ export function rgbaToHsla([r, g, b, a]: number[]): number[] {
31
30
  } else {
32
31
  h = (1 / 6 * (r - g) / diff) + 2 / 3;
33
32
  }
33
+ return h;
34
+ }
35
+
36
+ export function rgbaToHsla([r, g, b, a]: number[]): number[] {
37
+ const max = Math.max(r, g, b);
38
+ const min = Math.min(r, g, b);
39
+ const diff = max - min;
40
+ const sum = max + min;
34
41
 
42
+ const h = rgbToHue([r, g, b]);
35
43
  const l = 0.5 * sum;
36
44
 
37
45
  let s;
@@ -48,6 +56,14 @@ export function rgbaToHsla([r, g, b, a]: number[]): number[] {
48
56
  return [h, s, l, a];
49
57
  }
50
58
 
59
+ export function rgbaToHwba([r, g, b, a]: number[]): number[] {
60
+ const h = rgbToHue([r, g, b]);
61
+ const max = Math.max(r, g, b);
62
+ const min = Math.min(r, g, b);
63
+
64
+ return [h, min, 1 - max, a];
65
+ }
66
+
51
67
  /**
52
68
  * Calculate the luminance of this color using the WCAG algorithm.
53
69
  * See http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef
@@ -1113,6 +1113,8 @@ export function detectColorFormat(color: Color): Format {
1113
1113
  format = cf.RGB;
1114
1114
  } else if (formatSetting === cf.HSL) {
1115
1115
  format = cf.HSL;
1116
+ } else if (formatSetting === cf.HWB) {
1117
+ format = cf.HWB;
1116
1118
  } else if (formatSetting === cf.HEX) {
1117
1119
  format = color.detectHEXFormat();
1118
1120
  } else {
@@ -6,6 +6,7 @@ import * as TextUtils from '../../models/text_utils/text_utils.js';
6
6
  import * as Common from '../common/common.js';
7
7
  import * as i18n from '../i18n/i18n.js';
8
8
  import type * as Platform from '../platform/platform.js';
9
+ import * as Root from '../root/root.js';
9
10
  import type * as Protocol from '../../generated/protocol.js';
10
11
 
11
12
  import type {CSSModel} from './CSSModel.js';
@@ -104,27 +105,38 @@ export class CSSStyleSheetHeader implements TextUtils.ContentProvider.ContentPro
104
105
  }
105
106
 
106
107
  resourceURL(): Platform.DevToolsPath.UrlString {
107
- return (this.isViaInspector() ? this.viaInspectorResourceURL() : this.sourceURL);
108
+ const url = this.isViaInspector() ? this.viaInspectorResourceURL() : this.sourceURL;
109
+ if (!url && Root.Runtime.experiments.isEnabled(Root.Runtime.ExperimentName.STYLES_PANE_CSS_CHANGES)) {
110
+ return this.dynamicStyleURL();
111
+ }
112
+ return url;
108
113
  }
109
114
 
110
- private viaInspectorResourceURL(): Platform.DevToolsPath.UrlString {
115
+ private getFrameURLPath(): string {
111
116
  const model = this.#cssModelInternal.target().model(ResourceTreeModel);
112
117
  console.assert(Boolean(model));
113
118
  if (!model) {
114
- return '' as Platform.DevToolsPath.UrlString;
119
+ return '';
115
120
  }
116
121
  const frame = model.frameForId(this.frameId);
117
122
  if (!frame) {
118
- return '' as Platform.DevToolsPath.UrlString;
123
+ return '';
119
124
  }
120
125
  console.assert(Boolean(frame));
121
126
  const parsedURL = new Common.ParsedURL.ParsedURL(frame.url);
122
- let fakeURL = 'inspector://' + parsedURL.host + parsedURL.folderPathComponents;
123
- if (!fakeURL.endsWith('/')) {
124
- fakeURL += '/';
127
+ let urlPath = parsedURL.host + parsedURL.folderPathComponents;
128
+ if (!urlPath.endsWith('/')) {
129
+ urlPath += '/';
125
130
  }
126
- fakeURL += 'inspector-stylesheet';
127
- return fakeURL as Platform.DevToolsPath.UrlString;
131
+ return urlPath;
132
+ }
133
+
134
+ private viaInspectorResourceURL(): Platform.DevToolsPath.UrlString {
135
+ return `inspector://${this.getFrameURLPath()}inspector-stylesheet` as Platform.DevToolsPath.UrlString;
136
+ }
137
+
138
+ private dynamicStyleURL(): Platform.DevToolsPath.UrlString {
139
+ return `stylesheet://${this.getFrameURLPath()}style#${this.id}` as Platform.DevToolsPath.UrlString;
128
140
  }
129
141
 
130
142
  lineNumberInSource(lineNumberInStyleSheet: number): number {
@@ -8,6 +8,7 @@ export const enum FormatterActions {
8
8
  HTML_OUTLINE = 'htmlOutline',
9
9
  JAVASCRIPT_OUTLINE = 'javaScriptOutline',
10
10
  JAVASCRIPT_IDENTIFIERS = 'javaScriptIdentifiers',
11
+ JAVASCRIPT_SUBSTITUTE = 'javaScriptSubstitute',
11
12
  EVALUATE_JAVASCRIPT_SUBSTRING = 'evaluatableJavaScriptSubstring',
12
13
  ARGUMENTS_LIST = 'argumentsList',
13
14
  }
@@ -42,7 +42,7 @@ import {HTMLFormatter} from './HTMLFormatter.js';
42
42
  import {IdentityFormatter} from './IdentityFormatter.js';
43
43
  import {JavaScriptFormatter} from './JavaScriptFormatter.js';
44
44
  import {JSONFormatter} from './JSONFormatter.js';
45
- import {computeSubstitution, applySubstitution} from './Substitute.js';
45
+ import {substituteExpression} from './Substitute.js';
46
46
 
47
47
  export interface Chunk {
48
48
  // TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration
@@ -306,4 +306,4 @@ export function argumentsList(content: string): string[] {
306
306
  }
307
307
  })();
308
308
 
309
- export {applySubstitution, computeSubstitution};
309
+ export {substituteExpression};
@@ -6,7 +6,12 @@ import * as Acorn from '../../third_party/acorn/acorn.js';
6
6
 
7
7
  import {ECMA_VERSION} from './AcornTokenizer.js';
8
8
 
9
- export interface Replacement {
9
+ export function substituteExpression(expression: string, nameMap: Map<string, string>): string {
10
+ const replacements = computeSubstitution(expression, nameMap);
11
+ return applySubstitution(expression, replacements);
12
+ }
13
+
14
+ interface Replacement {
10
15
  from: string;
11
16
  to: string;
12
17
  offset: number;
@@ -17,7 +22,7 @@ export interface Replacement {
17
22
  // function returns a list of replacements sorted by the offset. The function throws if
18
23
  // it cannot parse the expression or the substitution is impossible to perform (for example
19
24
  // if the substitution target is 'this' within a function, it would become bound there).
20
- export function computeSubstitution(expression: string, nameMap: Map<string, string>): Replacement[] {
25
+ function computeSubstitution(expression: string, nameMap: Map<string, string>): Replacement[] {
21
26
  // Parse the expression and find variables and scopes.
22
27
  const root = Acorn.parse(expression, {ecmaVersion: ECMA_VERSION, allowAwaitOutsideFunction: true, ranges: false}) as
23
28
  Acorn.ESTree.Node;
@@ -80,7 +85,7 @@ export function computeSubstitution(expression: string, nameMap: Map<string, str
80
85
  return result;
81
86
  }
82
87
 
83
- export function applySubstitution(expression: string, replacements: Replacement[]): string {
88
+ function applySubstitution(expression: string, replacements: Replacement[]): string {
84
89
  const accumulator = [];
85
90
  let last = 0;
86
91
  for (const r of replacements) {
@@ -10,7 +10,8 @@ import {FormatterActions} from './FormatterActions.js';
10
10
 
11
11
  self.onmessage = function(event: MessageEvent): void {
12
12
  const method: FormatterActions = event.data.method;
13
- const params: {indentString: string, content: string, mimeType: string} = event.data.params;
13
+ const params: {indentString: string, content: string, mimeType: string, mapping: [string, string][]} =
14
+ event.data.params;
14
15
  if (!method) {
15
16
  return;
16
17
  }
@@ -31,6 +32,11 @@ self.onmessage = function(event: MessageEvent): void {
31
32
  case FormatterActions.JAVASCRIPT_IDENTIFIERS:
32
33
  self.postMessage(FormatterWorker.FormatterWorker.javaScriptIdentifiers(params.content));
33
34
  break;
35
+ case FormatterActions.JAVASCRIPT_SUBSTITUTE: {
36
+ const mapping = new Map<string, string>(params.mapping);
37
+ self.postMessage(FormatterWorker.Substitute.substituteExpression(params.content, mapping));
38
+ break;
39
+ }
34
40
  case FormatterActions.EVALUATE_JAVASCRIPT_SUBSTRING:
35
41
  self.postMessage(FormatterWorker.FormatterWorker.evaluatableJavaScriptSubstring(params.content));
36
42
  break;
@@ -108,7 +108,7 @@ export class FormatterWorkerPool {
108
108
  }
109
109
 
110
110
  private runTask(methodName: FormatterActions.FormatterActions, params: {
111
- [x: string]: string,
111
+ [x: string]: string|string[][],
112
112
  // TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration
113
113
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
114
114
  }): Promise<any> {
@@ -132,6 +132,14 @@ export class FormatterWorkerPool {
132
132
  .then(ids => ids || []);
133
133
  }
134
134
 
135
+ javaScriptSubstitute(expression: string, mapping: Map<string, string>): Promise<string> {
136
+ return this
137
+ .runTask(
138
+ FormatterActions.FormatterActions.JAVASCRIPT_SUBSTITUTE,
139
+ {content: expression, mapping: Array.from(mapping.entries())})
140
+ .then(result => result || '');
141
+ }
142
+
135
143
  evaluatableJavaScriptSubstring(content: string): Promise<string> {
136
144
  return this.runTask(FormatterActions.FormatterActions.EVALUATE_JAVASCRIPT_SUBSTRING, {content: content})
137
145
  .then(text => text || '');
@@ -179,13 +187,13 @@ export class FormatterWorkerPool {
179
187
  class Task {
180
188
  method: string;
181
189
  params: {
182
- [x: string]: string,
190
+ [x: string]: string|string[][],
183
191
  };
184
192
  callback: (arg0: MessageEvent|null) => void;
185
193
  isChunked: boolean|undefined;
186
194
  constructor(
187
195
  method: string, params: {
188
- [x: string]: string,
196
+ [x: string]: string|string[][],
189
197
  },
190
198
  callback: (arg0: MessageEvent|null) => void, isChunked?: boolean) {
191
199
  this.method = method;
@@ -53,9 +53,8 @@ export class PersistenceUtils {
53
53
  }
54
54
  const icon = UI.Icon.Icon.create('mediumicon-file-sync');
55
55
  UI.Tooltip.Tooltip.install(icon, PersistenceUtils.tooltipForUISourceCode(binding.network));
56
- // TODO(allada) This will not work properly with dark theme.
57
56
  if (NetworkPersistenceManager.instance().project() === binding.fileSystem.project()) {
58
- icon.style.filter = 'hue-rotate(160deg)';
57
+ icon.classList.add('purple-dot');
59
58
  }
60
59
  return icon;
61
60
  }
@@ -7,6 +7,7 @@ import * as Host from '../../core/host/host.js';
7
7
  import * as i18n from '../../core/i18n/i18n.js';
8
8
  import * as Root from '../../core/root/root.js';
9
9
  import * as SDK from '../../core/sdk/sdk.js';
10
+ import * as Formatter from '../../models/formatter/formatter.js';
10
11
  import * as SourceMapScopes from '../../models/source_map_scopes/source_map_scopes.js';
11
12
  import * as CodeMirror from '../../third_party/codemirror.next/codemirror.next.js';
12
13
  import * as TextEditor from '../../ui/components/text_editor/text_editor.js';
@@ -309,7 +310,7 @@ export class ConsolePrompt extends Common.ObjectWrapper.eventMixin<EventTypes, t
309
310
  const callFrame = executionContext.debuggerModel.selectedCallFrame();
310
311
  if (callFrame) {
311
312
  const nameMap = await SourceMapScopes.NamesResolver.allVariablesInCallFrame(callFrame);
312
- expression = this.substituteNames(expression, nameMap);
313
+ expression = await this.substituteNames(expression, nameMap);
313
314
  }
314
315
  }
315
316
 
@@ -317,11 +318,12 @@ export class ConsolePrompt extends Common.ObjectWrapper.eventMixin<EventTypes, t
317
318
  executionContext, message, expression, useCommandLineAPI);
318
319
  }
319
320
 
320
- private substituteNames(expression: string, mapping: Map<string, string>): string {
321
- // TODO(jarin) Build a more reliable replacer, based on the parsed AST.
322
- // Here, we just replace exact occurrences.
323
- const replacement = mapping.get(expression);
324
- return replacement ?? expression;
321
+ private async substituteNames(expression: string, mapping: Map<string, string>): Promise<string> {
322
+ try {
323
+ return await Formatter.FormatterWorkerPool.formatterWorkerPool().javaScriptSubstitute(expression, mapping);
324
+ } catch {
325
+ return expression;
326
+ }
325
327
  }
326
328
 
327
329
  private editorUpdate(update: CodeMirror.ViewUpdate): void {
@@ -219,9 +219,7 @@ const HIGHLIGHTABLE_PROPERTIES = [
219
219
  {mode: 'flexibility', properties: ['flex', 'flex-basis', 'flex-grow', 'flex-shrink']},
220
220
  ];
221
221
 
222
- // TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration
223
- // eslint-disable-next-line @typescript-eslint/naming-convention
224
- let _stylesSidebarPaneInstance: StylesSidebarPane;
222
+ let stylesSidebarPaneInstance: StylesSidebarPane;
225
223
 
226
224
  // TODO(crbug.com/1172300) This workaround is needed to keep the linter happy.
227
225
  // Otherwise it complains about: Unknown word CssSyntaxError
@@ -258,10 +256,10 @@ export class StylesSidebarPane extends Common.ObjectWrapper.eventMixin<EventType
258
256
  #urlToChangeTracker: Map<string, ChangeTracker> = new Map();
259
257
 
260
258
  static instance(): StylesSidebarPane {
261
- if (!_stylesSidebarPaneInstance) {
262
- _stylesSidebarPaneInstance = new StylesSidebarPane();
259
+ if (!stylesSidebarPaneInstance) {
260
+ stylesSidebarPaneInstance = new StylesSidebarPane();
263
261
  }
264
- return _stylesSidebarPaneInstance;
262
+ return stylesSidebarPaneInstance;
265
263
  }
266
264
 
267
265
  private constructor() {
@@ -292,7 +290,7 @@ export class StylesSidebarPane extends Common.ObjectWrapper.eventMixin<EventType
292
290
  this.swatchPopoverHelperInternal = new InlineEditor.SwatchPopoverHelper.SwatchPopoverHelper();
293
291
  this.swatchPopoverHelperInternal.addEventListener(
294
292
  InlineEditor.SwatchPopoverHelper.Events.WillShowPopover, this.hideAllPopovers, this);
295
- this.linkifier = new Components.Linkifier.Linkifier(_maxLinkLength, /* useLinkDecorator */ true);
293
+ this.linkifier = new Components.Linkifier.Linkifier(MAX_LINK_LENGTH, /* useLinkDecorator */ true);
296
294
  this.decorator = new StylePropertyHighlighter(this);
297
295
  this.lastRevealedProperty = null;
298
296
  this.userOperation = false;
@@ -307,7 +305,7 @@ export class StylesSidebarPane extends Common.ObjectWrapper.eventMixin<EventType
307
305
  this.sectionBlocks = [];
308
306
  this.idleCallbackManager = null;
309
307
  this.needsForceUpdate = false;
310
- _stylesSidebarPaneInstance = this;
308
+ stylesSidebarPaneInstance = this;
311
309
  UI.Context.Context.instance().addFlavorChangeListener(SDK.DOMModel.DOMNode, this.forceUpdate, this);
312
310
  this.contentElement.addEventListener('copy', this.clipboardCopy.bind(this));
313
311
  this.resizeThrottler = new Common.Throttler.Throttler(100);
@@ -1392,9 +1390,7 @@ async function buildPropertyRuleMaps(content: string):
1392
1390
  return {propertyToSelector, ruleToSelector};
1393
1391
  }
1394
1392
 
1395
- // TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration
1396
- // eslint-disable-next-line @typescript-eslint/naming-convention
1397
- export const _maxLinkLength = 23;
1393
+ const MAX_LINK_LENGTH = 23;
1398
1394
 
1399
1395
  export class SectionBlock {
1400
1396
  private readonly titleElementInternal: Element|null;
@@ -44,6 +44,7 @@ slot[name="property-value"] {
44
44
 
45
45
  .goto {
46
46
  display: none;
47
+ cursor: pointer;
47
48
  position: absolute;
48
49
  width: var(--goto-size);
49
50
  height: var(--goto-size);
@@ -24,6 +24,7 @@
24
24
  --size: 16px;
25
25
 
26
26
  display: none;
27
+ cursor: pointer;
27
28
  position: absolute;
28
29
  width: var(--size);
29
30
  height: var(--size);
@@ -14,17 +14,10 @@
14
14
  }
15
15
 
16
16
  .media-messages-level-dropdown-element {
17
- background-color: var(--color-background-elevation-1);
18
- color: var(--color-text-primary);
19
17
  height: 18px;
20
18
  line-height: 18px;
21
19
  }
22
20
 
23
- .media-messages-level-dropdown-element:hover {
24
- background-color: var(--legacy-accent-color-hover);
25
- color: var(--color-background);
26
- }
27
-
28
21
  .media-messages-level-dropdown-text {
29
22
  float: left;
30
23
  }
@@ -6,6 +6,7 @@
6
6
 
7
7
  :host {
8
8
  flex-grow: 1;
9
+ padding: 6px;
9
10
  }
10
11
 
11
12
  .row {
@@ -16,11 +17,7 @@
16
17
  font-size: var(--monospace-font-size);
17
18
  align-items: center;
18
19
  line-height: 18px;
19
- margin: 2em 0 0 0.5em;
20
- }
21
-
22
- .row:first-child {
23
- margin-top: 0.5em;
20
+ margin-top: 3px;
24
21
  }
25
22
 
26
23
  .row devtools-button {
@@ -29,7 +26,7 @@
29
26
  }
30
27
 
31
28
  .padded {
32
- margin: 0.25em 0 0 2em;
29
+ margin-left: 2em;
33
30
  }
34
31
 
35
32
  .separator {
@@ -75,14 +75,18 @@
75
75
  margin: auto;
76
76
  }
77
77
 
78
+ .authenticator-section-header {
79
+ display: flex;
80
+ justify-content: space-between;
81
+ align-items: flex-end;
82
+ }
83
+
78
84
  .authenticator-section-title {
79
85
  line-height: 24px;
80
- width: 260px;
81
86
  display: inline-block;
82
87
  }
83
88
 
84
89
  .authenticator-section-title .authenticator-name-field {
85
- width: 220px;
86
90
  display: inline-block;
87
91
  font-weight: bold;
88
92
  border: none;
@@ -1,7 +1,7 @@
1
1
  Name: Puppeteer
2
2
  Short Name: Puppeteer
3
3
  URL: https://github.com/puppeteer/puppeteer
4
- Version: 13.1.1
4
+ Version: 13.5.1
5
5
  License: Apache-2.0
6
6
  License File: package/LICENSE
7
7
  Security Critical: no
@@ -12,5 +12,5 @@ Puppeteer is a Node library which provides a high-level API to control Chrome or
12
12
  To update this package, run the following command (replace version number with updated version number):
13
13
 
14
14
  ```bash
15
- wget -qO- https://registry.npmjs.org/puppeteer/-/puppeteer-x.y.z.tgz | tar xzf -
15
+ curl --output - $(npm view puppeteer dist.tarball) | tar xzf -
16
16
  ```