chrome-devtools-frontend 1.0.1030457 → 1.0.1030946

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 (55) hide show
  1. package/front_end/Tests.js +0 -28
  2. package/front_end/core/host/UserMetrics.ts +2 -1
  3. package/front_end/core/i18n/locales/en-US.json +11 -8
  4. package/front_end/core/i18n/locales/en-XL.json +11 -8
  5. package/front_end/core/root/Runtime.ts +1 -0
  6. package/front_end/core/sdk/CSSStyleSheetHeader.ts +0 -4
  7. package/front_end/core/sdk/CompilerSourceMappingContentProvider.ts +0 -4
  8. package/front_end/core/sdk/NetworkRequest.ts +0 -4
  9. package/front_end/core/sdk/Resource.ts +0 -5
  10. package/front_end/core/sdk/Script.ts +71 -76
  11. package/front_end/entrypoints/main/MainImpl.ts +4 -0
  12. package/front_end/generated/InspectorBackendCommands.js +10 -8
  13. package/front_end/generated/protocol-mapping.d.ts +16 -2
  14. package/front_end/generated/protocol-proxy-api.d.ts +11 -1
  15. package/front_end/generated/protocol.ts +75 -1
  16. package/front_end/models/bindings/CompilerScriptMapping.ts +6 -3
  17. package/front_end/models/bindings/ContentProviderBasedProject.ts +2 -3
  18. package/front_end/models/bindings/DebuggerWorkspaceBinding.ts +1 -4
  19. package/front_end/models/bindings/IgnoreListManager.ts +10 -8
  20. package/front_end/models/bindings/ResourceMapping.ts +0 -4
  21. package/front_end/models/bindings/StylesSourceMapping.ts +0 -5
  22. package/front_end/models/extensions/ExtensionServer.ts +2 -3
  23. package/front_end/models/issues_manager/AttributionReportingIssue.ts +8 -0
  24. package/front_end/models/issues_manager/descriptions/arTooManyConcurrentRequests.md +5 -0
  25. package/front_end/models/javascript_metadata/NativeFunctions.js +6 -2
  26. package/front_end/models/persistence/NetworkPersistenceManager.ts +4 -6
  27. package/front_end/models/persistence/PersistenceActions.ts +5 -4
  28. package/front_end/models/text_utils/CodeMirrorUtils.ts +17 -4
  29. package/front_end/models/text_utils/ContentProvider.ts +0 -1
  30. package/front_end/models/text_utils/StaticContentProvider.ts +0 -4
  31. package/front_end/models/workspace/UISourceCode.ts +10 -5
  32. package/front_end/panels/elements/CSSRuleValidator.ts +107 -123
  33. package/front_end/panels/elements/components/CSSHintDetailsView.ts +23 -20
  34. package/front_end/panels/elements/components/cssHintDetailsView.css +2 -0
  35. package/front_end/panels/issues/AttributionReportingIssueDetailsView.ts +12 -0
  36. package/front_end/panels/network/components/RequestHeadersView.css +1 -0
  37. package/front_end/panels/network/components/RequestHeadersView.ts +7 -0
  38. package/front_end/panels/sources/NavigatorView.ts +22 -0
  39. package/front_end/third_party/codemirror.next/bundle.ts +1 -1
  40. package/front_end/third_party/codemirror.next/chunk/codemirror.js +1 -1
  41. package/front_end/third_party/codemirror.next/chunk/cpp.js +1 -2
  42. package/front_end/third_party/codemirror.next/chunk/java.js +1 -2
  43. package/front_end/third_party/codemirror.next/chunk/json.js +1 -2
  44. package/front_end/third_party/codemirror.next/chunk/markdown.js +1 -2
  45. package/front_end/third_party/codemirror.next/chunk/php.js +1 -2
  46. package/front_end/third_party/codemirror.next/chunk/python.js +1 -2
  47. package/front_end/third_party/codemirror.next/chunk/wast.js +1 -2
  48. package/front_end/third_party/codemirror.next/chunk/xml.js +1 -2
  49. package/front_end/third_party/codemirror.next/codemirror.next.d.ts +1247 -116
  50. package/front_end/third_party/codemirror.next/codemirror.next.js +1 -2
  51. package/front_end/ui/components/docs/building-ui-documentation/StylingComponents.md +64 -0
  52. package/front_end/ui/legacy/components/source_frame/ImageView.ts +10 -11
  53. package/front_end/ui/legacy/components/source_frame/PreviewFactory.ts +1 -1
  54. package/front_end/ui/legacy/components/source_frame/SourceFrame.ts +49 -0
  55. package/package.json +1 -1
@@ -1,2 +1 @@
1
- export{$ as cursorMatchingBracket,_ as closeBracketsKeymap,A as cpp,a$ as gutters,a0 as cursorSubwordBackward,a1 as cursorSubwordForward,a2 as indentLess,a3 as indentMore,a4 as insertNewlineAndIndent,a5 as selectMatchingBracket,a6 as selectSubwordBackward,a7 as selectSubwordForward,a8 as standardKeymap,a9 as toggleComment,a_ as GutterMarker,aA as Compartment,aa as history,aB as EditorState,ab as historyKeymap,aC as Facet,ac as redo,aD as MapMode,ad as redoSelection,aE as SelectionRange,ae as undo,aF as StateEffect,af as undoSelection,aG as StateEffectType,ag as css,aH as StateField,ah as html,aI as Transaction,ai as javascript,aJ as Range,aj as ensureSyntaxTree,aK as RangeSet,ak as indentOnInput,aL as RangeSetBuilder,al as indentUnit,aM as Line,am as codeFolding,aN as Text,an as foldGutter,aO as Decoration,ao as foldKeymap,ap as HighlightStyle,aP as drawSelection,aQ as EditorView,aq as syntaxHighlighting,ar as bracketMatching,aR as highlightSpecialChars,aS as MatchDecorator,as as StreamLanguage,at as StringStream,aT as placeholder,au as highlightSelectionMatches,aU as scrollPastEnd,aV as ViewPlugin,av as selectNextOccurrence,aw as Annotation,aW as ViewUpdate,ax as AnnotationType,aX as WidgetType,ay as ChangeDesc,aY as showPanel,az as ChangeSet,aZ as gutter,B as java,b0 as lineNumberMarkers,b1 as lineNumbers,b2 as repositionTooltips,b3 as showTooltip,b4 as tooltips,b5 as TreeCursor,b6 as highlightTree,b7 as StyleModule,D as json,e as LanguageSupport,F as markdown,g as NodeProp,G as php,h as NodeSet,H as python,I as shell,j as Tree,J as cssStreamParser,k as Language,K as wast,L as LRParser,l as syntaxTree,m as EditorSelection,M as xml,N as NodeType,n as Prec,O as acceptCompletion,o as keymap,P as Parser,Q as autocompletion,R as closeCompletion,S as completeAnyWord,T as Tag,t as tags,U as CompletionContext,V as currentCompletions,W as ifNotIn,X as selectedCompletion,y as clojure,Y as startCompletion,Z as closeBrackets,z as coffeescript}from"./chunk/codemirror.js";
2
-
1
+ export{aw as Annotation,ax as AnnotationType,ay as ChangeDesc,az as ChangeSet,aA as Compartment,W as CompletionContext,aO as Decoration,m as EditorSelection,aB as EditorState,aQ as EditorView,aC as Facet,aS as GutterMarker,ao as HighlightStyle,L as LRParser,k as Language,e as LanguageSupport,aD as Line,aE as MapMode,aX as MatchDecorator,g as NodeProp,h as NodeSet,N as NodeType,P as Parser,n as Prec,aF as Range,aG as RangeSet,aH as RangeSetBuilder,aI as SelectionRange,aJ as StateEffect,aK as StateEffectType,aL as StateField,ar as StreamLanguage,as as StringStream,b7 as StyleModule,T as Tag,aM as Text,aN as Transaction,j as Tree,b5 as TreeCursor,b2 as ViewPlugin,b3 as ViewUpdate,b4 as WidgetType,O as acceptCompletion,Q as autocompletion,aj as bracketMatching,y as clojure,R as closeBrackets,S as closeBracketsKeymap,U as closeCompletion,ak as codeFolding,z as coffeescript,V as completeAnyWord,A as cpp,ag as css,J as cssStreamParser,X as currentCompletions,$ as cursorMatchingBracket,a0 as cursorSubwordBackward,a1 as cursorSubwordForward,aP as drawSelection,al as ensureSyntaxTree,am as foldGutter,an as foldKeymap,aR as gutter,aT as gutters,au as highlightSelectionMatches,aU as highlightSpecialChars,b6 as highlightTree,a2 as history,a3 as historyKeymap,ah as html,Y as ifNotIn,a4 as indentLess,a5 as indentMore,ap as indentOnInput,aq as indentUnit,a6 as insertNewlineAndIndent,B as java,ai as javascript,D as json,o as keymap,aV as lineNumberMarkers,aW as lineNumbers,F as markdown,G as php,aY as placeholder,H as python,a7 as redo,a8 as redoSelection,aZ as repositionTooltips,a_ as scrollPastEnd,a9 as selectMatchingBracket,av as selectNextOccurrence,aa as selectSubwordBackward,ab as selectSubwordForward,Z as selectedCompletion,I as shell,a$ as showPanel,b0 as showTooltip,ac as standardKeymap,_ as startCompletion,at as syntaxHighlighting,l as syntaxTree,t as tags,ad as toggleComment,b1 as tooltips,ae as undo,af as undoSelection,K as wast,M as xml}from"./chunk/codemirror.js";
@@ -0,0 +1,64 @@
1
+ # Styling Components
2
+
3
+ Components are styled by a CSS file that is co-located next to the TypeScript source file. The only difference in file name is the extension and that for CSS files, the first letter is lowercase:
4
+
5
+ ```
6
+ - ElementsBreadcrumbs.ts
7
+ - elementsBreadcrumbs.css
8
+ ```
9
+
10
+ To import this file you use a regular `import` statement, and import the filename with `.js` appended:
11
+
12
+ ```ts
13
+ import elementsBreadcrumbsStyles from './elementsBreadcrumbs.css.js';
14
+ ```
15
+
16
+ As part of the build tool step, each CSS file is converted into a JS file that exports a `CSSStyleSheet` instance. This is done by Rollup in [`generate_css_js_files`](https://source.chromium.org/chromium/chromium/src/+/main:third_party/devtools-frontend/src/scripts/build/generate_css_js_files.js;l=1;drc=28af9fbe783d82aa64bfa5f9b9509572dc2b3efe).
17
+
18
+ ## `BUILD.gn` changes
19
+
20
+ Use the `generate_css` action (`scripts/build/ninja/generate_css.gni`) to declare stylesheets:
21
+
22
+ ```gn
23
+ import("scripts/build/ninja/generate_css.gni") // Edit path correctly: this must be relative
24
+
25
+ generate_css("css_files") {
26
+ sources = [ "elementsBreadcrumbs.css"]
27
+ }
28
+ ```
29
+
30
+ And then add `:css_files` as a dependency to the `devtools_entrypoint`:
31
+
32
+ ```gn
33
+ devtools_entrypoint("bundle") {
34
+ deps = [ ":css_files" , "..."]
35
+ }
36
+ ```
37
+
38
+ ## Adopting the stylesheet
39
+
40
+ Importing the stylesheet is not enough to have it apply to the component's ShadowDOM, it must be adopted. The `connectedCallback` method is the best place for this:
41
+
42
+ ```ts
43
+ connectedCallback() {
44
+ this.#shadow.adoptedStyleSheets = [elementsBreadcrumbs];
45
+ }
46
+ ```
47
+
48
+ ## Tips for writing CSS.
49
+
50
+ Use `:host` to style the component itself. By default elements are `display: inline`. Often it can be useful to set `display: block`.
51
+
52
+ Remember to use theme colors (`var(--color-text-primary)`) when styling elements to ensure consistency across DevTools.
53
+
54
+ If you want your component to have its colors configurable by users, consider defining `--override` variables. In your component's CSS, you would have something like:
55
+
56
+ ```css
57
+ :host {
58
+ color: var(--override-custom-color, var(--color-text-primary));
59
+ }
60
+ ```
61
+
62
+ This allows someone to define that `--override-custom-color` variable, but also ensures if it isn't defined that the default `color-text-primary` will be used. **Be careful with this!** We try to ensure consistent colors across DevTools; so most of the time you shouldn't allow configurable colors and should use the correct theme variables.
63
+
64
+
@@ -95,7 +95,7 @@ export class ImageView extends UI.View.SimpleView {
95
95
  private readonly mimeTypeLabel: UI.Toolbar.ToolbarText;
96
96
  private readonly container: HTMLElement;
97
97
  private imagePreviewElement: HTMLImageElement;
98
- private cachedContent?: string|null;
98
+ private cachedContent?: TextUtils.ContentProvider.DeferredContent;
99
99
  constructor(mimeType: string, contentProvider: TextUtils.ContentProvider.ContentProvider) {
100
100
  super(i18nString(UIStrings.image));
101
101
  this.registerRequiredCSS(imageViewStyles);
@@ -153,20 +153,21 @@ export class ImageView extends UI.View.SimpleView {
153
153
  }
154
154
 
155
155
  private async updateContentIfNeeded(): Promise<void> {
156
- const {content} = await this.contentProvider.requestContent();
157
- if (this.cachedContent === content) {
156
+ const content = await this.contentProvider.requestContent();
157
+ if (this.cachedContent?.content === content.content) {
158
158
  return;
159
159
  }
160
160
 
161
- const contentEncoded = await this.contentProvider.contentEncoded();
162
161
  this.cachedContent = content;
163
- const imageSrc = TextUtils.ContentProvider.contentAsDataURL(content, this.mimeType, contentEncoded) || this.url;
162
+ const imageSrc =
163
+ TextUtils.ContentProvider.contentAsDataURL(content.content, this.mimeType, content.isEncoded) || this.url;
164
164
  const loadPromise = new Promise(x => {
165
165
  this.imagePreviewElement.onload = x;
166
166
  });
167
167
  this.imagePreviewElement.src = imageSrc;
168
168
  this.imagePreviewElement.alt = i18nString(UIStrings.imageFromS, {PH1: this.url});
169
- const size = content && !contentEncoded ? content.length : Platform.StringUtilities.base64ToSize(content);
169
+ const size = content.content && !content.isEncoded ? content.content.length :
170
+ Platform.StringUtilities.base64ToSize(content.content);
170
171
  this.sizeLabel.setText(Platform.NumberUtilities.bytesToString(size));
171
172
  await loadPromise;
172
173
  this.dimensionsLabel.setText(i18nString(
@@ -203,13 +204,11 @@ export class ImageView extends UI.View.SimpleView {
203
204
  }
204
205
 
205
206
  private async saveImage(): Promise<void> {
206
- const contentEncoded = await this.contentProvider.contentEncoded();
207
- if (!this.cachedContent) {
207
+ if (!this.cachedContent || !this.cachedContent.content) {
208
208
  return;
209
209
  }
210
- const cachedContent = this.cachedContent;
211
- const imageDataURL =
212
- TextUtils.ContentProvider.contentAsDataURL(cachedContent, this.mimeType, contentEncoded, '', false);
210
+ const imageDataURL = TextUtils.ContentProvider.contentAsDataURL(
211
+ this.cachedContent.content, this.mimeType, this.cachedContent.isEncoded, '', false);
213
212
 
214
213
  if (!imageDataURL) {
215
214
  return;
@@ -45,7 +45,7 @@ export class PreviewFactory {
45
45
  }
46
46
 
47
47
  let content: string = deferredContent.content;
48
- if (await provider.contentEncoded()) {
48
+ if (deferredContent.isEncoded) {
49
49
  content = window.atob(content);
50
50
  }
51
51
 
@@ -460,6 +460,55 @@ export class SourceFrameImpl extends Common.ObjectWrapper.eventMixin<EventTypes,
460
460
  }
461
461
  }
462
462
 
463
+ // If the input is wasm but v8-based wasm disassembly failed, fall back to wasmparser for backwards compatibility.
464
+ if (content && this.contentType === 'application/wasm' && !this.wasmDisassemblyInternal) {
465
+ const worker = Common.Worker.WorkerWrapper.fromURL(
466
+ new URL('../../../../entrypoints/wasmparser_worker/wasmparser_worker-entrypoint.js', import.meta.url));
467
+ const promise = new Promise<{
468
+ lines: string[],
469
+ offsets: number[],
470
+ functionBodyOffsets: {
471
+ start: number,
472
+ end: number,
473
+ }[],
474
+ }>((resolve, reject) => {
475
+ worker.onmessage =
476
+ // TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration)
477
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
478
+ ({data}: MessageEvent<any>): void => {
479
+ if ('event' in data) {
480
+ switch (data.event) {
481
+ case 'progress':
482
+ progressIndicator.setWorked(data.params.percentage);
483
+ break;
484
+ }
485
+ } else if ('method' in data) {
486
+ switch (data.method) {
487
+ case 'disassemble':
488
+ if ('error' in data) {
489
+ reject(data.error);
490
+ } else if ('result' in data) {
491
+ resolve(data.result);
492
+ }
493
+ break;
494
+ }
495
+ }
496
+ };
497
+ worker.onerror = reject;
498
+ });
499
+ worker.postMessage({method: 'disassemble', params: {content}});
500
+ try {
501
+ const {lines, offsets, functionBodyOffsets} = await promise;
502
+ this.rawContent = content = CodeMirror.Text.of(lines);
503
+ this.wasmDisassemblyInternal =
504
+ new Common.WasmDisassembly.WasmDisassembly(lines, offsets, functionBodyOffsets);
505
+ } catch (e) {
506
+ this.rawContent = content = error = e.message;
507
+ } finally {
508
+ worker.terminate();
509
+ }
510
+ }
511
+
463
512
  progressIndicator.setWorked(100);
464
513
  progressIndicator.done();
465
514
 
package/package.json CHANGED
@@ -56,5 +56,5 @@
56
56
  "unittest": "scripts/test/run_unittests.py --no-text-coverage",
57
57
  "watch": "vpython third_party/node/node.py --output scripts/watch_build.js"
58
58
  },
59
- "version": "1.0.1030457"
59
+ "version": "1.0.1030946"
60
60
  }