chrome-devtools-frontend 1.0.1011333 → 1.0.1012587
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.
- package/codereview.settings +4 -0
- package/config/gni/devtools_grd_files.gni +2 -0
- package/docs/workflows.md +3 -3
- package/front_end/core/common/Mutex.ts +42 -0
- package/front_end/core/common/common.ts +2 -0
- package/front_end/core/host/UserMetrics.ts +3 -1
- package/front_end/core/i18n/locales/en-US.json +17 -2
- package/front_end/core/i18n/locales/en-XL.json +17 -2
- package/front_end/core/root/Runtime.ts +2 -0
- package/front_end/core/sdk/CSSMatchedStyles.ts +1 -1
- package/front_end/core/sdk/CSSModel.ts +4 -0
- package/front_end/core/sdk/DOMModel.ts +49 -27
- package/front_end/entrypoints/main/MainImpl.ts +9 -0
- package/front_end/entrypoints/wasmparser_worker/WasmParserWorker.ts +2 -14
- package/front_end/generated/protocol.ts +4 -0
- package/front_end/legacy_test_runner/elements_test_runner/ElementsTestRunner.js +1 -1
- package/front_end/models/bindings/BreakpointManager.ts +3 -2
- package/front_end/models/emulation/EmulatedDevices.ts +29 -2
- package/front_end/models/javascript_metadata/NativeFunctions.js +8 -17
- package/front_end/models/persistence/NetworkPersistenceManager.ts +60 -13
- package/front_end/panels/application/DOMStorageItemsView.ts +5 -5
- package/front_end/panels/elements/ElementsTreeOutline.ts +2 -0
- package/front_end/panels/profiler/HeapSnapshotView.ts +3 -1
- package/front_end/panels/sources/FilteredUISourceCodeListProvider.ts +7 -1
- package/front_end/panels/sources/NavigatorView.ts +50 -22
- package/front_end/panels/sources/SourcesNavigator.ts +45 -1
- package/front_end/panels/sources/SourcesPanel.ts +26 -4
- package/front_end/panels/sources/navigatorTree.css +4 -0
- package/front_end/panels/sources/sourcesNavigator.css +10 -0
- package/front_end/panels/webauthn/WebauthnPane.ts +8 -1
- package/front_end/ui/components/panel_feedback/PreviewToggle.ts +34 -13
- package/front_end/ui/components/panel_feedback/previewToggle.css +21 -1
- package/front_end/ui/components/text_editor/config.ts +2 -2
- package/front_end/ui/legacy/ContextMenu.ts +11 -2
- package/front_end/ui/legacy/components/data_grid/dataGrid.css +1 -1
- package/front_end/ui/legacy/components/source_frame/SourceFrame.ts +15 -12
- package/package.json +1 -1
- package/scripts/eslint_rules/lib/lit_template_result_or_nothing.js +6 -0
@@ -18,6 +18,7 @@ export interface PreviewToggleData {
|
|
18
18
|
helperText: string|null;
|
19
19
|
feedbackURL: string|null;
|
20
20
|
experiment: Root.Runtime.ExperimentName;
|
21
|
+
learnMoreURL?: string;
|
21
22
|
onChangeCallback?: (checked: boolean) => void;
|
22
23
|
}
|
23
24
|
|
@@ -26,6 +27,14 @@ const UIStrings = {
|
|
26
27
|
*@description Link text the user can click to provide feedback to the team.
|
27
28
|
*/
|
28
29
|
previewTextFeedbackLink: 'Send us your feedback.',
|
30
|
+
/**
|
31
|
+
*@description Link text the user can click to provide feedback to the team.
|
32
|
+
*/
|
33
|
+
shortFeedbackLink: 'Send feedback',
|
34
|
+
/**
|
35
|
+
*@description Link text the user can click to see documentation.
|
36
|
+
*/
|
37
|
+
learnMoreLink: 'Learn More',
|
29
38
|
};
|
30
39
|
|
31
40
|
const str_ = i18n.i18n.registerUIStrings('ui/components/panel_feedback/PreviewToggle.ts', UIStrings);
|
@@ -38,6 +47,7 @@ export class PreviewToggle extends HTMLElement {
|
|
38
47
|
#name = '';
|
39
48
|
#helperText: string|null = null;
|
40
49
|
#feedbackURL: string|null = null;
|
50
|
+
#learnMoreURL: string|undefined;
|
41
51
|
#experiment: string = '';
|
42
52
|
#onChangeCallback?: (checked: boolean) => void;
|
43
53
|
|
@@ -49,6 +59,7 @@ export class PreviewToggle extends HTMLElement {
|
|
49
59
|
this.#name = data.name;
|
50
60
|
this.#helperText = data.helperText;
|
51
61
|
this.#feedbackURL = data.feedbackURL;
|
62
|
+
this.#learnMoreURL = data.learnMoreURL;
|
52
63
|
this.#experiment = data.experiment;
|
53
64
|
this.#onChangeCallback = data.onChangeCallback;
|
54
65
|
this.#render();
|
@@ -60,20 +71,30 @@ export class PreviewToggle extends HTMLElement {
|
|
60
71
|
// clang-format off
|
61
72
|
render(
|
62
73
|
html`
|
63
|
-
<div class="
|
64
|
-
<
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
74
|
+
<div class="container">
|
75
|
+
<div class="checkbox-line">
|
76
|
+
<label class="experiment-preview">
|
77
|
+
<input type="checkbox" ?checked=${checked} @change=${this.#checkboxChanged} aria-label=${this.#name}/>
|
78
|
+
<${IconButton.Icon.Icon.litTagName} .data=${{
|
79
|
+
iconName: 'ic_preview_feature',
|
80
|
+
width: '16px',
|
81
|
+
height: '16px',
|
82
|
+
color: 'var(--color-text-secondary)',
|
83
|
+
} as IconButton.Icon.IconData}>
|
84
|
+
</${IconButton.Icon.Icon.litTagName}>${this.#name}
|
85
|
+
</label>
|
86
|
+
${this.#feedbackURL && !this.#helperText
|
87
|
+
? html`<div class="feedback"><x-link class="x-link" href=${this.#feedbackURL}>${i18nString(UIStrings.shortFeedbackLink)}</x-link></div>`
|
88
|
+
: nothing}
|
89
|
+
</div>
|
90
|
+
${this.#learnMoreURL
|
91
|
+
? html`<x-link class="x-link" href=${this.#learnMoreURL}>${i18nString(UIStrings.learnMoreLink)}</x-link>`
|
76
92
|
: nothing}
|
93
|
+
<div class="helper">
|
94
|
+
${this.#helperText && this.#feedbackURL
|
95
|
+
? html`<p>${this.#helperText} <x-link class="x-link" href=${this.#feedbackURL}>${i18nString(UIStrings.previewTextFeedbackLink)}</x-link></p>`
|
96
|
+
: nothing}
|
97
|
+
</div>
|
77
98
|
</div>`,
|
78
99
|
this.#shadow,
|
79
100
|
{
|
@@ -18,7 +18,27 @@
|
|
18
18
|
font-style: italic;
|
19
19
|
}
|
20
20
|
|
21
|
-
|
21
|
+
.feedback {
|
22
|
+
text-align: right;
|
23
|
+
}
|
24
|
+
|
25
|
+
.checkbox-line {
|
26
|
+
display: flex;
|
27
|
+
justify-content: space-between;
|
28
|
+
align-items: center;
|
29
|
+
flex-wrap: wrap;
|
30
|
+
}
|
31
|
+
|
32
|
+
.container {
|
33
|
+
padding: 4px;
|
34
|
+
}
|
35
|
+
|
36
|
+
.x-link {
|
22
37
|
color: var(--color-primary);
|
23
38
|
text-decoration-line: underline;
|
39
|
+
padding: 4px;
|
40
|
+
}
|
41
|
+
|
42
|
+
.feedback .x-link {
|
43
|
+
color: var(--color-text-secondary);
|
24
44
|
}
|
@@ -236,7 +236,7 @@ function getTooltipSpace(): DOMRect {
|
|
236
236
|
return sideBarElement.getBoundingClientRect();
|
237
237
|
}
|
238
238
|
|
239
|
-
export function baseConfiguration(text: string): CM.Extension {
|
239
|
+
export function baseConfiguration(text: string|CM.Text): CM.Extension {
|
240
240
|
return [
|
241
241
|
theme(),
|
242
242
|
CM.highlightSpecialChars(),
|
@@ -252,7 +252,7 @@ export function baseConfiguration(text: string): CM.Extension {
|
|
252
252
|
bracketMatching.instance(),
|
253
253
|
indentUnit.instance(),
|
254
254
|
CM.Prec.lowest(CM.EditorView.contentAttributes.of({'aria-label': i18nString(UIStrings.codeEditor)})),
|
255
|
-
detectLineSeparator(text),
|
255
|
+
text instanceof CM.Text ? [] : detectLineSeparator(text),
|
256
256
|
CM.tooltips({
|
257
257
|
tooltipSpace: getTooltipSpace,
|
258
258
|
}),
|
@@ -111,7 +111,7 @@ export class Item {
|
|
111
111
|
};
|
112
112
|
}
|
113
113
|
case 'checkbox': {
|
114
|
-
|
114
|
+
const result = {
|
115
115
|
type: 'checkbox',
|
116
116
|
id: this.idInternal,
|
117
117
|
label: this.label,
|
@@ -119,6 +119,11 @@ export class Item {
|
|
119
119
|
enabled: !this.disabled,
|
120
120
|
subItems: undefined,
|
121
121
|
};
|
122
|
+
if (this.customElement) {
|
123
|
+
const resultAsSoftContextMenuItem = (result as SoftContextMenuDescriptor);
|
124
|
+
resultAsSoftContextMenuItem.element = (this.customElement as Element);
|
125
|
+
}
|
126
|
+
return result;
|
122
127
|
}
|
123
128
|
}
|
124
129
|
throw new Error('Invalid item type:' + this.typeInternal);
|
@@ -187,12 +192,16 @@ export class Section {
|
|
187
192
|
return item;
|
188
193
|
}
|
189
194
|
|
190
|
-
appendCheckboxItem(
|
195
|
+
appendCheckboxItem(
|
196
|
+
label: string, handler: () => void, checked?: boolean, disabled?: boolean, additionalElement?: Element): Item {
|
191
197
|
const item = new Item(this.contextMenu, 'checkbox', label, disabled, checked);
|
192
198
|
this.items.push(item);
|
193
199
|
if (this.contextMenu) {
|
194
200
|
this.contextMenu.setHandler(item.id(), handler);
|
195
201
|
}
|
202
|
+
if (additionalElement) {
|
203
|
+
item.customElement = additionalElement;
|
204
|
+
}
|
196
205
|
return item;
|
197
206
|
}
|
198
207
|
}
|
@@ -105,7 +105,7 @@ export class SourceFrameImpl extends Common.ObjectWrapper.eventMixin<EventTypes,
|
|
105
105
|
UI.View.SimpleView) implements UI.SearchableView.Searchable, UI.SearchableView.Replaceable, Transformer {
|
106
106
|
private readonly lazyContent: () => Promise<TextUtils.ContentProvider.DeferredContent>;
|
107
107
|
private prettyInternal: boolean;
|
108
|
-
private rawContent: string|null;
|
108
|
+
private rawContent: string|CodeMirror.Text|null;
|
109
109
|
private formattedContentPromise: Promise<Formatter.ScriptFormatter.FormattedContent>|null;
|
110
110
|
private formattedMap: Formatter.ScriptFormatter.FormatterSourceMapping|null;
|
111
111
|
private readonly prettyToggle: UI.Toolbar.ToolbarToggle;
|
@@ -203,7 +203,7 @@ export class SourceFrameImpl extends Common.ObjectWrapper.eventMixin<EventTypes,
|
|
203
203
|
});
|
204
204
|
}
|
205
205
|
|
206
|
-
protected editorConfiguration(doc: string): CodeMirror.Extension {
|
206
|
+
protected editorConfiguration(doc: string|CodeMirror.Text): CodeMirror.Extension {
|
207
207
|
return [
|
208
208
|
CodeMirror.EditorView.updateListener.of(update => this.dispatchEventToListeners(Events.EditorUpdate, update)),
|
209
209
|
TextEditor.Config.baseConfiguration(doc),
|
@@ -459,7 +459,7 @@ export class SourceFrameImpl extends Common.ObjectWrapper.eventMixin<EventTypes,
|
|
459
459
|
const worker = Common.Worker.WorkerWrapper.fromURL(
|
460
460
|
new URL('../../../../entrypoints/wasmparser_worker/wasmparser_worker-entrypoint.js', import.meta.url));
|
461
461
|
const promise = new Promise<{
|
462
|
-
|
462
|
+
lines: string[],
|
463
463
|
offsets: number[],
|
464
464
|
functionBodyOffsets: {
|
465
465
|
start: number,
|
@@ -492,8 +492,8 @@ export class SourceFrameImpl extends Common.ObjectWrapper.eventMixin<EventTypes,
|
|
492
492
|
});
|
493
493
|
worker.postMessage({method: 'disassemble', params: {content}});
|
494
494
|
try {
|
495
|
-
const {
|
496
|
-
this.rawContent = content =
|
495
|
+
const {lines, offsets, functionBodyOffsets} = await promise;
|
496
|
+
this.rawContent = content = CodeMirror.Text.of(lines);
|
497
497
|
this.wasmDisassemblyInternal = new Common.WasmDisassembly.WasmDisassembly(offsets, functionBodyOffsets);
|
498
498
|
} catch (e) {
|
499
499
|
this.rawContent = content = error = e.message;
|
@@ -528,8 +528,8 @@ export class SourceFrameImpl extends Common.ObjectWrapper.eventMixin<EventTypes,
|
|
528
528
|
if (this.formattedContentPromise) {
|
529
529
|
return this.formattedContentPromise;
|
530
530
|
}
|
531
|
-
this.
|
532
|
-
|
531
|
+
const content = this.rawContent instanceof CodeMirror.Text ? this.rawContent.sliceString(0) : this.rawContent || '';
|
532
|
+
this.formattedContentPromise = Formatter.ScriptFormatter.formatScriptContent(this.contentType, content);
|
533
533
|
return this.formattedContentPromise;
|
534
534
|
}
|
535
535
|
|
@@ -648,7 +648,7 @@ export class SourceFrameImpl extends Common.ObjectWrapper.eventMixin<EventTypes,
|
|
648
648
|
this.prettyToggle.setEnabled(true);
|
649
649
|
}
|
650
650
|
|
651
|
-
private simplifyMimeType(content: string, mimeType: string): string {
|
651
|
+
private simplifyMimeType(content: string|CodeMirror.Text, mimeType: string): string {
|
652
652
|
if (!mimeType) {
|
653
653
|
return '';
|
654
654
|
}
|
@@ -663,8 +663,11 @@ export class SourceFrameImpl extends Common.ObjectWrapper.eventMixin<EventTypes,
|
|
663
663
|
return 'text/jsx';
|
664
664
|
}
|
665
665
|
// A hack around the fact that files with "php" extension might be either standalone or html embedded php scripts.
|
666
|
-
if (mimeType === 'text/x-php'
|
667
|
-
|
666
|
+
if (mimeType === 'text/x-php') {
|
667
|
+
const strContent = typeof content === 'string' ? content : content.sliceString(0);
|
668
|
+
if (strContent.match(/\<\?.*\?\>/g)) {
|
669
|
+
return 'application/x-httpd-php';
|
670
|
+
}
|
668
671
|
}
|
669
672
|
if (mimeType === 'application/wasm') {
|
670
673
|
// text/webassembly is not a proper MIME type, but CodeMirror uses it for WAT syntax highlighting.
|
@@ -674,7 +677,7 @@ export class SourceFrameImpl extends Common.ObjectWrapper.eventMixin<EventTypes,
|
|
674
677
|
return mimeType;
|
675
678
|
}
|
676
679
|
|
677
|
-
protected async getLanguageSupport(content: string): Promise<CodeMirror.Extension> {
|
680
|
+
protected async getLanguageSupport(content: string|CodeMirror.Text): Promise<CodeMirror.Extension> {
|
678
681
|
const mimeType = this.simplifyMimeType(content, this.contentType) || '';
|
679
682
|
const languageDesc = await CodeHighlighter.CodeHighlighter.languageFromMIME(mimeType);
|
680
683
|
if (!languageDesc) {
|
@@ -694,7 +697,7 @@ export class SourceFrameImpl extends Common.ObjectWrapper.eventMixin<EventTypes,
|
|
694
697
|
this.textEditor.dispatch({effects: config.language.reconfigure(langExtension)});
|
695
698
|
}
|
696
699
|
|
697
|
-
async setContent(content: string): Promise<void> {
|
700
|
+
async setContent(content: string|CodeMirror.Text): Promise<void> {
|
698
701
|
this.muteChangeEventsForSetContent = true;
|
699
702
|
const {textEditor} = this;
|
700
703
|
const wasLoaded = this.loadedInternal;
|
package/package.json
CHANGED
@@ -95,6 +95,9 @@ module.exports = {
|
|
95
95
|
|
96
96
|
function checkTSTypeAnnotationForPotentialIssue(node) {
|
97
97
|
const annotation = node.typeAnnotation;
|
98
|
+
if (!annotation) {
|
99
|
+
return;
|
100
|
+
}
|
98
101
|
if (annotation.type === 'TSUnionType') {
|
99
102
|
// matches foo(): X|Y
|
100
103
|
checkUnionReturnTypeForLit(annotation);
|
@@ -137,6 +140,9 @@ module.exports = {
|
|
137
140
|
},
|
138
141
|
// Match values in interfaces or types.
|
139
142
|
TSPropertySignature(node) {
|
143
|
+
if (!node.typeAnnotation) {
|
144
|
+
return;
|
145
|
+
}
|
140
146
|
checkTSTypeAnnotationForPotentialIssue(node.typeAnnotation);
|
141
147
|
},
|
142
148
|
};
|