chrome-devtools-frontend 1.0.1012379 → 1.0.1013298
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/config/gni/devtools_grd_files.gni +3 -0
- package/front_end/core/host/UserMetrics.ts +4 -2
- package/front_end/core/i18n/locales/en-US.json +38 -2
- package/front_end/core/i18n/locales/en-XL.json +38 -2
- package/front_end/core/root/Runtime.ts +1 -0
- package/front_end/core/sdk/CSSFontFace.ts +6 -0
- package/front_end/entrypoints/main/MainImpl.ts +4 -0
- package/front_end/generated/InspectorBackendCommands.js +2 -0
- package/front_end/generated/protocol.ts +16 -0
- package/front_end/panels/application/AppManifestView.ts +12 -1
- package/front_end/panels/application/DOMStorageItemsView.ts +5 -5
- package/front_end/panels/application/components/ProtocolHandlersView.ts +182 -0
- package/front_end/panels/application/components/components.ts +2 -0
- package/front_end/panels/application/components/protocolHandlersView.css +39 -0
- package/front_end/panels/profiler/HeapSnapshotView.ts +3 -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/third_party/lighthouse/lighthouse-dt-bundle.js +15 -15
- package/front_end/third_party/lighthouse/report/bundle.d.ts +23 -2
- package/front_end/third_party/lighthouse/report/bundle.js +45 -19
- package/front_end/third_party/lighthouse/report-assets/report-generator.mjs +1 -1
- package/front_end/ui/components/linear_memory_inspector/LinearMemoryViewer.ts +16 -11
- package/front_end/ui/components/linear_memory_inspector/linearMemoryInspector.css +4 -0
- package/front_end/ui/components/panel_feedback/PreviewToggle.ts +35 -14
- package/front_end/ui/components/panel_feedback/previewToggle.css +21 -1
- package/front_end/ui/legacy/ContextMenu.ts +11 -2
- package/package.json +1 -1
- package/scripts/build/ninja/devtools_entrypoint.gni +3 -3
- package/scripts/build/ninja/wasm.gni +25 -0
- package/scripts/build/wasm-as.py +87 -0
- package/scripts/build/wasm_sourcemap.mjs +22 -0
- package/scripts/eslint_rules/lib/lit_template_result_or_nothing.js +6 -0
@@ -115,19 +115,22 @@ export class LinearMemoryViewer extends HTMLElement {
|
|
115
115
|
|
116
116
|
// We initially just plot one row with one byte group (here: byte group size of 4).
|
117
117
|
// Depending on that initially plotted row we can determine how many rows and
|
118
|
-
// bytes per row we can fit
|
119
|
-
// >
|
120
|
-
//
|
121
|
-
//
|
122
|
-
//
|
123
|
-
//
|
118
|
+
// bytes per row we can fit.
|
119
|
+
// > 0000000 | b0 b1 b2 b4 | a0 a1 a2 a3 <
|
120
|
+
// ^-------^ ^-^ ^-^
|
121
|
+
// | byteCellWidth textCellWidth
|
122
|
+
// |
|
123
|
+
// addressTextAndDividerWidth
|
124
|
+
// ^--^ + ^----------------------------^
|
125
|
+
// widthToFill
|
124
126
|
|
125
127
|
const firstByteCell = this.shadowRoot.querySelector('.byte-cell');
|
126
128
|
const textCell = this.shadowRoot.querySelector('.text-cell');
|
127
129
|
const divider = this.shadowRoot.querySelector('.divider');
|
128
130
|
const rowElement = this.shadowRoot.querySelector('.row');
|
131
|
+
const addressText = this.shadowRoot.querySelector('.address');
|
129
132
|
|
130
|
-
if (!firstByteCell || !textCell || !divider || !rowElement) {
|
133
|
+
if (!firstByteCell || !textCell || !divider || !rowElement || !addressText) {
|
131
134
|
this.#numBytesInRow = BYTE_GROUP_SIZE;
|
132
135
|
this.#numRows = 1;
|
133
136
|
return;
|
@@ -140,16 +143,18 @@ export class LinearMemoryViewer extends HTMLElement {
|
|
140
143
|
|
141
144
|
// Calculate the width to fill.
|
142
145
|
const dividerWidth = divider.getBoundingClientRect().width;
|
143
|
-
|
146
|
+
const addressTextAndDividerWidth =
|
147
|
+
firstByteCell.getBoundingClientRect().left - addressText.getBoundingClientRect().left;
|
148
|
+
|
149
|
+
// this.clientWidth is rounded, while the other values are not. Subtract 1 to make
|
144
150
|
// sure that we correctly calculate the widths.
|
145
|
-
const widthToFill = this.clientWidth - 1 -
|
146
|
-
|
151
|
+
const widthToFill = this.clientWidth - 1 - addressTextAndDividerWidth - dividerWidth;
|
152
|
+
|
147
153
|
if (widthToFill < groupWidth) {
|
148
154
|
this.#numBytesInRow = BYTE_GROUP_SIZE;
|
149
155
|
this.#numRows = 1;
|
150
156
|
return;
|
151
157
|
}
|
152
|
-
|
153
158
|
this.#numBytesInRow = Math.floor(widthToFill / groupWidth) * BYTE_GROUP_SIZE;
|
154
159
|
this.#numRows = Math.floor(this.clientHeight / rowElement.clientHeight);
|
155
160
|
}
|
@@ -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,21 +71,31 @@ export class PreviewToggle extends HTMLElement {
|
|
60
71
|
// clang-format off
|
61
72
|
render(
|
62
73
|
html`
|
63
|
-
<
|
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}
|
77
|
-
|
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>
|
98
|
+
</div>`,
|
78
99
|
this.#shadow,
|
79
100
|
{
|
80
101
|
host: this,
|
@@ -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
|
}
|
@@ -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
|
}
|
package/package.json
CHANGED
@@ -121,9 +121,9 @@ template("devtools_entrypoint") {
|
|
121
121
|
|
122
122
|
is_web_worker = _is_web_worker
|
123
123
|
|
124
|
-
if (defined(
|
125
|
-
|
126
|
-
|
124
|
+
if (defined(use_remoteexec) && use_remoteexec &&
|
125
|
+
defined(devtools_use_remoteexec) && devtools_use_remoteexec) {
|
126
|
+
use_remoteexec = false
|
127
127
|
}
|
128
128
|
}
|
129
129
|
|
@@ -0,0 +1,25 @@
|
|
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
|
+
import("./copy.gni")
|
5
|
+
|
6
|
+
template("wasm_module") {
|
7
|
+
assert(defined(invoker.sources), "Need sources in $target_name")
|
8
|
+
action_foreach(target_name) {
|
9
|
+
script = devtools_location_prepend + "scripts/build/wasm-as.py"
|
10
|
+
outputs = [
|
11
|
+
"$target_gen_dir/{{source_name_part}}.wasm",
|
12
|
+
"$target_gen_dir/{{source_name_part}}.wasm.map",
|
13
|
+
"$target_gen_dir/{{source_name_part}}.wasm.map.json",
|
14
|
+
]
|
15
|
+
args = [
|
16
|
+
"{{source}}",
|
17
|
+
rebase_path("$target_gen_dir/{{source_name_part}}.wasm", root_build_dir),
|
18
|
+
]
|
19
|
+
sources = invoker.sources
|
20
|
+
}
|
21
|
+
|
22
|
+
copy_to_gen(target_name + "_sources") {
|
23
|
+
sources = invoker.sources
|
24
|
+
}
|
25
|
+
}
|
@@ -0,0 +1,87 @@
|
|
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 argparse
|
6
|
+
import json
|
7
|
+
from os import path
|
8
|
+
import platform
|
9
|
+
import re
|
10
|
+
import subprocess
|
11
|
+
import sys
|
12
|
+
|
13
|
+
REPO_DIR = path.join(path.dirname(__file__), '..', '..')
|
14
|
+
|
15
|
+
|
16
|
+
def llvm_readobj():
|
17
|
+
binary_name = {
|
18
|
+
'Darwin': 'llvm-readobj',
|
19
|
+
'Linux': 'llvm-readobj',
|
20
|
+
'Windows': 'llvm-readobj.exe',
|
21
|
+
}[platform.system()]
|
22
|
+
return path.realpath(
|
23
|
+
path.join(REPO_DIR, 'third_party', 'emscripten-releases', 'install',
|
24
|
+
'bin', binary_name))
|
25
|
+
|
26
|
+
|
27
|
+
def wasm_as():
|
28
|
+
binary_name = {
|
29
|
+
'Darwin': 'wasm-as',
|
30
|
+
'Linux': 'wasm-as',
|
31
|
+
'Windows': 'wasm-as.exe',
|
32
|
+
}[platform.system()]
|
33
|
+
return path.realpath(
|
34
|
+
path.join(REPO_DIR, 'third_party', 'emscripten-releases', 'install',
|
35
|
+
'bin', binary_name))
|
36
|
+
|
37
|
+
|
38
|
+
def script_main(args):
|
39
|
+
parser = argparse.ArgumentParser()
|
40
|
+
parser.add_argument('input')
|
41
|
+
parser.add_argument('output')
|
42
|
+
options = parser.parse_args(args)
|
43
|
+
|
44
|
+
sourcemap = f'{options.output}.map'
|
45
|
+
subprocess.check_call([
|
46
|
+
wasm_as(), options.input, '-g', '-sm', sourcemap, '-o', options.output
|
47
|
+
])
|
48
|
+
|
49
|
+
wasm_obj_headers = subprocess.check_output([
|
50
|
+
llvm_readobj(),
|
51
|
+
'-e',
|
52
|
+
# TODO(crbug.com/1328729): use JSON output as soon as that's supported for wasm
|
53
|
+
# '--elf-output-style=JSON',
|
54
|
+
options.output
|
55
|
+
])
|
56
|
+
(size, offset) = re.search(
|
57
|
+
b'Section {[^}]*Type: CODE[^}]*Size: (\d*)[^}]*Offset: (\d*)[^}]*}',
|
58
|
+
wasm_obj_headers).groups()
|
59
|
+
|
60
|
+
# readobj reports as offset the location of the first byte of the header.
|
61
|
+
# Our offsets are relative to the first byte of the section though, so
|
62
|
+
# calculate the offset manually. The header is composed of one byte for the
|
63
|
+
# section id, and an leb128 value for the length.
|
64
|
+
size = int(size)
|
65
|
+
leb_len = 0
|
66
|
+
while size > 0:
|
67
|
+
size >>= 7
|
68
|
+
leb_len += 1
|
69
|
+
offset = int(offset) + 1 + leb_len
|
70
|
+
|
71
|
+
node = path.realpath(path.join(REPO_DIR, 'third_party', 'node', 'node.py'))
|
72
|
+
sourcemap2json = path.realpath(
|
73
|
+
path.join(REPO_DIR, 'scripts', 'build', 'wasm_sourcemap.mjs'))
|
74
|
+
sourcemap_contents = subprocess.check_output([
|
75
|
+
sys.executable, node, '--output', sourcemap2json, sourcemap,
|
76
|
+
'%s' % (offset)
|
77
|
+
])
|
78
|
+
|
79
|
+
json_file = f'{options.output}.map.json'
|
80
|
+
with open(json_file, 'wb') as output:
|
81
|
+
output.write(sourcemap_contents)
|
82
|
+
|
83
|
+
return 0
|
84
|
+
|
85
|
+
|
86
|
+
if __name__ == '__main__':
|
87
|
+
sys.exit(script_main(sys.argv[1:]))
|
@@ -0,0 +1,22 @@
|
|
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 fs from 'fs';
|
6
|
+
import * as sourceMap from 'source-map';
|
7
|
+
|
8
|
+
if (process.argv.length !== 4) {
|
9
|
+
throw new Error(`usage: ${process.argv[1]} <input.map> <offset>`);
|
10
|
+
}
|
11
|
+
|
12
|
+
const offset = Number(process.argv[3] || 0);
|
13
|
+
const sourceMapContents = JSON.parse(fs.readFileSync(process.argv[2], 'utf-8'));
|
14
|
+
const sourceMapConsumer = new sourceMap.SourceMapConsumer(sourceMapContents);
|
15
|
+
|
16
|
+
const sourceMappings = [];
|
17
|
+
sourceMapConsumer.eachMapping(({source, generatedLine, generatedColumn, originalLine, originalColumn}) => {
|
18
|
+
const bytecodeOffset = generatedColumn - offset;
|
19
|
+
sourceMappings.push({source, generatedLine, generatedColumn, originalLine, originalColumn, bytecodeOffset});
|
20
|
+
});
|
21
|
+
|
22
|
+
console.log(JSON.stringify(sourceMappings));
|
@@ -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
|
};
|