chrome-devtools-frontend 1.0.953776 → 1.0.954086
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/front_end/core/platform/number-utilities.ts +5 -7
- package/front_end/core/platform/string-utilities.ts +45 -25
- package/front_end/core/sdk/ResourceTreeModel.ts +12 -2
- package/front_end/generated/InspectorBackendCommands.js +3 -1
- package/front_end/generated/protocol.d.ts +19 -0
- package/front_end/models/extensions/ExtensionServer.ts +2 -3
- package/front_end/panels/elements/components/AdornerSettingsPane.ts +2 -1
- package/front_end/panels/elements/components/LayoutPane.ts +2 -0
- package/front_end/panels/elements/layoutPane.css +0 -4
- package/front_end/panels/settings/emulation/components/UserAgentClientHintsForm.ts +2 -1
- package/front_end/ui/components/linear_memory_inspector/ValueInterpreterSettings.ts +2 -1
- package/package.json +1 -1
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
// Use of this source code is governed by a BSD-style license that can be
|
|
3
3
|
// found in the LICENSE file.
|
|
4
4
|
|
|
5
|
-
import * as StringUtilities from './string-utilities.js';
|
|
6
|
-
|
|
7
5
|
export const clamp = (num: number, min: number, max: number): number => {
|
|
8
6
|
let clampedNumber = num;
|
|
9
7
|
if (num < min) {
|
|
@@ -20,22 +18,22 @@ export const mod = (m: number, n: number): number => {
|
|
|
20
18
|
|
|
21
19
|
export const bytesToString = (bytes: number): string => {
|
|
22
20
|
if (bytes < 1000) {
|
|
23
|
-
return
|
|
21
|
+
return `${bytes.toFixed(0)}\xA0B`;
|
|
24
22
|
}
|
|
25
23
|
|
|
26
24
|
const kilobytes = bytes / 1000;
|
|
27
25
|
if (kilobytes < 100) {
|
|
28
|
-
return
|
|
26
|
+
return `${kilobytes.toFixed(1)}\xA0kB`;
|
|
29
27
|
}
|
|
30
28
|
if (kilobytes < 1000) {
|
|
31
|
-
return
|
|
29
|
+
return `${kilobytes.toFixed(0)}\xA0kB`;
|
|
32
30
|
}
|
|
33
31
|
|
|
34
32
|
const megabytes = kilobytes / 1000;
|
|
35
33
|
if (megabytes < 100) {
|
|
36
|
-
return
|
|
34
|
+
return `${megabytes.toFixed(1)}\xA0MB`;
|
|
37
35
|
}
|
|
38
|
-
return
|
|
36
|
+
return `${megabytes.toFixed(0)}\xA0MB`;
|
|
39
37
|
};
|
|
40
38
|
|
|
41
39
|
export const toFixedIfFloating = (value: string): string => {
|
|
@@ -206,25 +206,6 @@ export const format = function<T, U>(
|
|
|
206
206
|
return {formattedResult: result, unusedSubstitutions: unusedSubstitutions};
|
|
207
207
|
};
|
|
208
208
|
|
|
209
|
-
export const standardFormatters = {
|
|
210
|
-
d: function(substitution: unknown): number {
|
|
211
|
-
return (!isNaN(substitution as number) ? substitution as number : 0);
|
|
212
|
-
},
|
|
213
|
-
|
|
214
|
-
f: function(substitution: unknown, token: FormatterToken): string {
|
|
215
|
-
if (substitution && typeof substitution === 'number' && token.precision !== undefined && token.precision > -1) {
|
|
216
|
-
substitution = substitution.toFixed(token.precision);
|
|
217
|
-
}
|
|
218
|
-
const precision =
|
|
219
|
-
(token.precision !== undefined && token.precision > -1) ? Number(0).toFixed(token.precision) : '0';
|
|
220
|
-
return !isNaN(substitution as number) ? substitution as string : precision;
|
|
221
|
-
},
|
|
222
|
-
|
|
223
|
-
s: function(substitution: unknown): string {
|
|
224
|
-
return substitution as string;
|
|
225
|
-
},
|
|
226
|
-
};
|
|
227
|
-
|
|
228
209
|
const toHexadecimal = (charCode: number, padToLength: number): string => {
|
|
229
210
|
return charCode.toString(16).toUpperCase().padStart(padToLength, '0');
|
|
230
211
|
};
|
|
@@ -285,12 +266,51 @@ export const formatAsJSLiteral = (content: string): string => {
|
|
|
285
266
|
return `${quote}${escapedContent}${quote}`;
|
|
286
267
|
};
|
|
287
268
|
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
269
|
+
/**
|
|
270
|
+
* This implements a subset of the sprintf() function described in the Single UNIX
|
|
271
|
+
* Specification. It supports the %s, %f, %d, and %% formatting specifiers, and
|
|
272
|
+
* understands the %m$d notation to select the m-th parameter for this substitution,
|
|
273
|
+
* as well as the optional precision for %s, %f, and %d.
|
|
274
|
+
*
|
|
275
|
+
* @param fmt format string.
|
|
276
|
+
* @param args parameters to the format string.
|
|
277
|
+
* @returns the formatted output string.
|
|
278
|
+
*/
|
|
279
|
+
export const sprintf = (fmt: string, ...args: unknown[]): string => {
|
|
280
|
+
let argIndex = 0;
|
|
281
|
+
const RE = /%(?:(\d+)\$)?(?:\.(\d*))?([%dfs])/g;
|
|
282
|
+
return fmt.replaceAll(RE, (_: string, index?: string, precision?: string, specifier?: string): string => {
|
|
283
|
+
if (specifier === '%') {
|
|
284
|
+
return '%';
|
|
285
|
+
}
|
|
286
|
+
if (index !== undefined) {
|
|
287
|
+
argIndex = parseInt(index, 10) - 1;
|
|
288
|
+
if (argIndex < 0) {
|
|
289
|
+
throw new RangeError(`Invalid parameter index ${argIndex + 1}`);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
if (argIndex >= args.length) {
|
|
293
|
+
throw new RangeError(`Expected at least ${argIndex + 1} format parameters, but only ${args.length} where given.`);
|
|
294
|
+
}
|
|
295
|
+
if (specifier === 's') {
|
|
296
|
+
const argValue = String(args[argIndex++]);
|
|
297
|
+
if (precision !== undefined) {
|
|
298
|
+
return argValue.substring(0, Number(precision));
|
|
299
|
+
}
|
|
300
|
+
return argValue;
|
|
301
|
+
}
|
|
302
|
+
let argValue = Number(args[argIndex++]);
|
|
303
|
+
if (isNaN(argValue)) {
|
|
304
|
+
argValue = 0;
|
|
305
|
+
}
|
|
306
|
+
if (specifier === 'd') {
|
|
307
|
+
return String(Math.floor(argValue)).padStart(Number(precision), '0');
|
|
308
|
+
}
|
|
309
|
+
if (precision !== undefined) {
|
|
310
|
+
return argValue.toFixed(Number(precision));
|
|
311
|
+
}
|
|
312
|
+
return String(argValue);
|
|
313
|
+
});
|
|
294
314
|
};
|
|
295
315
|
|
|
296
316
|
export const toBase64 = (inputString: string): string => {
|
|
@@ -616,7 +616,12 @@ export class ResourceTreeFrame {
|
|
|
616
616
|
backForwardCacheDetails: {
|
|
617
617
|
restoredFromCache: boolean|undefined,
|
|
618
618
|
explanations: Protocol.Page.BackForwardCacheNotRestoredExplanation[],
|
|
619
|
-
|
|
619
|
+
explanationsTree: Protocol.Page.BackForwardCacheNotRestoredExplanationTree|undefined,
|
|
620
|
+
} = {
|
|
621
|
+
restoredFromCache: undefined,
|
|
622
|
+
explanations: [],
|
|
623
|
+
explanationsTree: undefined,
|
|
624
|
+
};
|
|
620
625
|
|
|
621
626
|
constructor(
|
|
622
627
|
model: ResourceTreeModel, parentFrame: ResourceTreeFrame|null, frameId: Protocol.Page.FrameId,
|
|
@@ -688,7 +693,11 @@ export class ResourceTreeFrame {
|
|
|
688
693
|
this.#secureContextType = framePayload.secureContextType;
|
|
689
694
|
this.#crossOriginIsolatedContextType = framePayload.crossOriginIsolatedContextType;
|
|
690
695
|
this.#gatedAPIFeatures = framePayload.gatedAPIFeatures;
|
|
691
|
-
this.backForwardCacheDetails = {
|
|
696
|
+
this.backForwardCacheDetails = {
|
|
697
|
+
restoredFromCache: undefined,
|
|
698
|
+
explanations: [],
|
|
699
|
+
explanationsTree: undefined,
|
|
700
|
+
};
|
|
692
701
|
|
|
693
702
|
const mainResource = this.resourcesMap.get(this.#urlInternal);
|
|
694
703
|
this.resourcesMap.clear();
|
|
@@ -963,6 +972,7 @@ export class ResourceTreeFrame {
|
|
|
963
972
|
setBackForwardCacheDetails(event: Protocol.Page.BackForwardCacheNotUsedEvent): void {
|
|
964
973
|
this.backForwardCacheDetails.restoredFromCache = false;
|
|
965
974
|
this.backForwardCacheDetails.explanations = event.notRestoredExplanations;
|
|
975
|
+
this.backForwardCacheDetails.explanationsTree = event.notRestoredExplanationsTree;
|
|
966
976
|
}
|
|
967
977
|
|
|
968
978
|
getResourcesMap(): Map<string, Resource> {
|
|
@@ -2262,7 +2262,9 @@ export function registerCommands(inspectorBackend) {
|
|
|
2262
2262
|
inspectorBackend.registerEvent(
|
|
2263
2263
|
'Page.javascriptDialogOpening', ['url', 'message', 'type', 'hasBrowserHandler', 'defaultPrompt']);
|
|
2264
2264
|
inspectorBackend.registerEvent('Page.lifecycleEvent', ['frameId', 'loaderId', 'name', 'timestamp']);
|
|
2265
|
-
inspectorBackend.registerEvent(
|
|
2265
|
+
inspectorBackend.registerEvent(
|
|
2266
|
+
'Page.backForwardCacheNotUsed',
|
|
2267
|
+
['loaderId', 'frameId', 'notRestoredExplanations', 'notRestoredExplanationsTree']);
|
|
2266
2268
|
inspectorBackend.registerEvent('Page.loadEventFired', ['timestamp']);
|
|
2267
2269
|
inspectorBackend.registerEvent('Page.navigatedWithinDocument', ['frameId', 'url']);
|
|
2268
2270
|
inspectorBackend.registerEvent('Page.screencastFrame', ['data', 'metadata', 'sessionId']);
|
|
@@ -10719,6 +10719,21 @@ declare namespace Protocol {
|
|
|
10719
10719
|
reason: BackForwardCacheNotRestoredReason;
|
|
10720
10720
|
}
|
|
10721
10721
|
|
|
10722
|
+
export interface BackForwardCacheNotRestoredExplanationTree {
|
|
10723
|
+
/**
|
|
10724
|
+
* URL of each frame
|
|
10725
|
+
*/
|
|
10726
|
+
url: string;
|
|
10727
|
+
/**
|
|
10728
|
+
* Not restored reasons of each frame
|
|
10729
|
+
*/
|
|
10730
|
+
explanations: BackForwardCacheNotRestoredExplanation[];
|
|
10731
|
+
/**
|
|
10732
|
+
* Array of children frame
|
|
10733
|
+
*/
|
|
10734
|
+
children: BackForwardCacheNotRestoredExplanationTree[];
|
|
10735
|
+
}
|
|
10736
|
+
|
|
10722
10737
|
export interface AddScriptToEvaluateOnLoadRequest {
|
|
10723
10738
|
scriptSource: string;
|
|
10724
10739
|
}
|
|
@@ -11708,6 +11723,10 @@ declare namespace Protocol {
|
|
|
11708
11723
|
* Array of reasons why the page could not be cached. This must not be empty.
|
|
11709
11724
|
*/
|
|
11710
11725
|
notRestoredExplanations: BackForwardCacheNotRestoredExplanation[];
|
|
11726
|
+
/**
|
|
11727
|
+
* Tree structure of reasons why the page could not be cached for each frame.
|
|
11728
|
+
*/
|
|
11729
|
+
notRestoredExplanationsTree?: BackForwardCacheNotRestoredExplanationTree;
|
|
11711
11730
|
}
|
|
11712
11731
|
|
|
11713
11732
|
export interface LoadEventFiredEvent {
|
|
@@ -1145,12 +1145,11 @@ export class ExtensionStatus {
|
|
|
1145
1145
|
E_FAILED: (...args: unknown[]) => Record;
|
|
1146
1146
|
|
|
1147
1147
|
constructor() {
|
|
1148
|
-
function makeStatus(code: string, description: string): Record {
|
|
1149
|
-
const details = Array.prototype.slice.call(arguments, 2);
|
|
1148
|
+
function makeStatus(code: string, description: string, ...details: unknown[]): Record {
|
|
1150
1149
|
const status: Record = {code, description, details};
|
|
1151
1150
|
if (code !== 'OK') {
|
|
1152
1151
|
status.isError = true;
|
|
1153
|
-
console.error('Extension server error: ' + Platform.StringUtilities.
|
|
1152
|
+
console.error('Extension server error: ' + Platform.StringUtilities.sprintf(description, ...details));
|
|
1154
1153
|
}
|
|
1155
1154
|
return status;
|
|
1156
1155
|
}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import * as i18n from '../../../core/i18n/i18n.js';
|
|
6
6
|
import * as ComponentHelpers from '../../../ui/components/helpers/helpers.js';
|
|
7
|
+
import * as Input from '../../../ui/components/input/input.js';
|
|
7
8
|
import * as LitHtml from '../../../ui/lit-html/lit-html.js';
|
|
8
9
|
import adornerSettingsPaneStyles from './adornerSettingsPane.css.js';
|
|
9
10
|
|
|
@@ -48,7 +49,7 @@ export class AdornerSettingsPane extends HTMLElement {
|
|
|
48
49
|
#settings: AdornerSettingsMap = new Map();
|
|
49
50
|
|
|
50
51
|
connectedCallback(): void {
|
|
51
|
-
this.#shadow.adoptedStyleSheets = [adornerSettingsPaneStyles];
|
|
52
|
+
this.#shadow.adoptedStyleSheets = [Input.checkboxStyles, adornerSettingsPaneStyles];
|
|
52
53
|
}
|
|
53
54
|
|
|
54
55
|
set data(data: AdornerSettingsPaneData) {
|
|
@@ -13,6 +13,7 @@ import {LayoutElement} from './LayoutPaneUtils.js';
|
|
|
13
13
|
import type {NodeTextData} from './NodeText.js';
|
|
14
14
|
import {NodeText} from './NodeText.js';
|
|
15
15
|
import layoutPaneStyles from '../layoutPane.css.js';
|
|
16
|
+
import * as Input from '../../../ui/components/input/input.js';
|
|
16
17
|
// eslint-disable-next-line rulesdir/es_modules_import
|
|
17
18
|
import inspectorCommonStyles from '../../../ui/legacy/inspectorCommon.css.js';
|
|
18
19
|
|
|
@@ -103,6 +104,7 @@ export class LayoutPane extends HTMLElement {
|
|
|
103
104
|
constructor() {
|
|
104
105
|
super();
|
|
105
106
|
this.#shadow.adoptedStyleSheets = [
|
|
107
|
+
Input.checkboxStyles,
|
|
106
108
|
layoutPaneStyles,
|
|
107
109
|
inspectorCommonStyles,
|
|
108
110
|
];
|
|
@@ -181,7 +181,3 @@ that uses the dimensions to draw an outline around the element. */
|
|
|
181
181
|
.node-text-container:hover {
|
|
182
182
|
background-color: var(--item-hover-color);
|
|
183
183
|
}
|
|
184
|
-
|
|
185
|
-
:host-context(.-theme-with-dark-background) input[type="checkbox"] {
|
|
186
|
-
filter: invert(80%);
|
|
187
|
-
}
|
|
@@ -10,6 +10,7 @@ import * as LitHtml from '../../../../ui/lit-html/lit-html.js';
|
|
|
10
10
|
import userAgentClientHintsFormStyles from './userAgentClientHintsForm.css.js';
|
|
11
11
|
|
|
12
12
|
import type * as Protocol from '../../../../generated/protocol.js';
|
|
13
|
+
import * as Input from '../../../../ui/components/input/input.js';
|
|
13
14
|
import * as IconButton from '../../../../ui/components/icon_button/icon_button.js';
|
|
14
15
|
import type * as UI from '../../../../ui/legacy/legacy.js';
|
|
15
16
|
import * as EmulationUtils from '../utils/utils.js';
|
|
@@ -193,7 +194,7 @@ export class UserAgentClientHintsForm extends HTMLElement {
|
|
|
193
194
|
#brandsModifiedAriaMessage: string = '';
|
|
194
195
|
|
|
195
196
|
connectedCallback(): void {
|
|
196
|
-
this.#shadow.adoptedStyleSheets = [userAgentClientHintsFormStyles];
|
|
197
|
+
this.#shadow.adoptedStyleSheets = [Input.checkboxStyles, userAgentClientHintsFormStyles];
|
|
197
198
|
}
|
|
198
199
|
|
|
199
200
|
set value(data: UserAgentClientHintsFormData) {
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import * as i18n from '../../../core/i18n/i18n.js';
|
|
6
6
|
import * as LitHtml from '../../lit-html/lit-html.js';
|
|
7
7
|
import * as ComponentHelpers from '../helpers/helpers.js';
|
|
8
|
+
import * as Input from '../input/input.js';
|
|
8
9
|
|
|
9
10
|
import {ValueType, valueTypeToLocalizedString} from './ValueInterpreterDisplayUtils.js';
|
|
10
11
|
import valueInterpreterSettingsStyles from './valueInterpreterSettings.css.js';
|
|
@@ -65,7 +66,7 @@ export class ValueInterpreterSettings extends HTMLElement {
|
|
|
65
66
|
#valueTypes: Set<ValueType> = new Set();
|
|
66
67
|
|
|
67
68
|
connectedCallback(): void {
|
|
68
|
-
this.#shadow.adoptedStyleSheets = [valueInterpreterSettingsStyles];
|
|
69
|
+
this.#shadow.adoptedStyleSheets = [Input.checkboxStyles, valueInterpreterSettingsStyles];
|
|
69
70
|
}
|
|
70
71
|
|
|
71
72
|
set data(data: ValueInterpreterSettingsData) {
|
package/package.json
CHANGED