chrome-devtools-frontend 1.0.1012587 → 1.0.1013237
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 +2 -0
- package/front_end/core/host/UserMetrics.ts +2 -1
- package/front_end/core/i18n/locales/en-US.json +21 -0
- package/front_end/core/i18n/locales/en-XL.json +21 -0
- package/front_end/core/sdk/CSSFontFace.ts +6 -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/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/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/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
@@ -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
|
}
|
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));
|