chrome-devtools-frontend 1.0.953165 → 1.0.954163

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 (64) hide show
  1. package/config/gni/devtools_grd_files.gni +4 -0
  2. package/config/gni/devtools_image_files.gni +1 -0
  3. package/front_end/Images/src/info-icon.svg +1 -0
  4. package/front_end/core/common/ParsedURL.ts +31 -0
  5. package/front_end/core/i18n/i18nImpl.ts +8 -30
  6. package/front_end/core/i18n/locales/en-US.json +48 -0
  7. package/front_end/core/i18n/locales/en-XL.json +48 -0
  8. package/front_end/core/platform/number-utilities.ts +5 -7
  9. package/front_end/core/platform/string-utilities.ts +45 -25
  10. package/front_end/core/sdk/PageResourceLoader.ts +1 -2
  11. package/front_end/core/sdk/ResourceTreeModel.ts +12 -2
  12. package/front_end/generated/InspectorBackendCommands.js +3 -1
  13. package/front_end/generated/protocol.d.ts +19 -0
  14. package/front_end/models/extensions/ExtensionServer.ts +2 -3
  15. package/front_end/panels/application/components/BackForwardCacheStrings.ts +93 -15
  16. package/front_end/panels/application/components/EndpointsGrid.ts +1 -1
  17. package/front_end/panels/application/storageView.css +1 -1
  18. package/front_end/panels/elements/components/AdornerSettingsPane.ts +2 -1
  19. package/front_end/panels/elements/components/LayoutPane.ts +2 -0
  20. package/front_end/panels/elements/components/elementsBreadcrumbs.css +2 -0
  21. package/front_end/panels/elements/elementStatePaneWidget.css +1 -1
  22. package/front_end/panels/elements/layoutPane.css +0 -4
  23. package/front_end/panels/emulation/components/DeviceSizeInputElement.ts +2 -0
  24. package/front_end/panels/network/NetworkDataGridNode.ts +0 -2
  25. package/front_end/panels/network/components/WebBundleInfoView.ts +1 -1
  26. package/front_end/panels/settings/emulation/components/UserAgentClientHintsForm.ts +2 -1
  27. package/front_end/panels/web_audio/webAudio.css +1 -1
  28. package/front_end/third_party/puppeteer/package/README.md +11 -11
  29. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/AriaQueryHandler.js +2 -2
  30. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/AriaQueryHandler.js.map +1 -1
  31. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DOMWorld.d.ts +2 -0
  32. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DOMWorld.d.ts.map +1 -1
  33. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DOMWorld.js +20 -11
  34. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DOMWorld.js.map +1 -1
  35. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/JSHandle.d.ts.map +1 -1
  36. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/JSHandle.js +13 -3
  37. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/JSHandle.js.map +1 -1
  38. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/AriaQueryHandler.js +2 -2
  39. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/AriaQueryHandler.js.map +1 -1
  40. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/DOMWorld.d.ts +2 -0
  41. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/DOMWorld.d.ts.map +1 -1
  42. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/DOMWorld.js +20 -11
  43. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/DOMWorld.js.map +1 -1
  44. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/JSHandle.d.ts.map +1 -1
  45. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/JSHandle.js +13 -3
  46. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/JSHandle.js.map +1 -1
  47. package/front_end/third_party/puppeteer/package/lib/types.d.ts +2 -0
  48. package/front_end/third_party/puppeteer/package/package.json +1 -1
  49. package/front_end/ui/components/input/checkbox.css +11 -0
  50. package/front_end/ui/components/input/input.ts +3 -3
  51. package/front_end/ui/components/linear_memory_inspector/ValueInterpreterSettings.ts +2 -1
  52. package/front_end/ui/components/markdown_view/MarkdownView.ts +1 -1
  53. package/front_end/ui/components/panel_feedback/PreviewToggle.ts +2 -1
  54. package/front_end/ui/components/settings/SettingCheckbox.ts +2 -1
  55. package/front_end/ui/components/settings/settingCheckbox.css +0 -5
  56. package/front_end/ui/legacy/RemoteDebuggingTerminatedScreen.ts +10 -3
  57. package/front_end/ui/legacy/UIUtils.ts +0 -12
  58. package/front_end/ui/legacy/themeColors.css +3 -2
  59. package/front_end/ui/legacy/treeoutline.css +1 -1
  60. package/inspector_overlay/main.ts +2 -16
  61. package/package.json +1 -1
  62. package/scripts/eslint_rules/lib/lit_html_host_this.js +1 -10
  63. package/scripts/eslint_rules/lib/utils.js +20 -1
  64. package/scripts/eslint_rules/tests/utils_test.js +30 -0
@@ -93,6 +93,7 @@ grd_files_release_sources = [
93
93
  "front_end/Images/ic_suggest_color.svg",
94
94
  "front_end/Images/ic_undo_16x16_icon.svg",
95
95
  "front_end/Images/ic_warning_black_18dp.svg",
96
+ "front_end/Images/info-icon.svg",
96
97
  "front_end/Images/issue-cross-icon.svg",
97
98
  "front_end/Images/issue-exclamation-icon.svg",
98
99
  "front_end/Images/issue-questionmark-icon.svg",
@@ -460,6 +461,7 @@ grd_files_release_sources = [
460
461
  "front_end/ui/components/expandable_list/expandable_list.js",
461
462
  "front_end/ui/components/helpers/helpers.js",
462
463
  "front_end/ui/components/icon_button/icon_button.js",
464
+ "front_end/ui/components/input/input.js",
463
465
  "front_end/ui/components/issue_counter/issue_counter.js",
464
466
  "front_end/ui/components/linear_memory_inspector/linear_memory_inspector-meta.js",
465
467
  "front_end/ui/components/linear_memory_inspector/linear_memory_inspector.js",
@@ -1321,6 +1323,8 @@ grd_files_debug_sources = [
1321
1323
  "front_end/ui/components/icon_button/IconButton.js",
1322
1324
  "front_end/ui/components/icon_button/icon.css.js",
1323
1325
  "front_end/ui/components/icon_button/iconButton.css.js",
1326
+ "front_end/ui/components/input/checkbox.css.js",
1327
+ "front_end/ui/components/input/textInput.css.js",
1324
1328
  "front_end/ui/components/issue_counter/IssueCounter.js",
1325
1329
  "front_end/ui/components/issue_counter/IssueLinkIcon.js",
1326
1330
  "front_end/ui/components/issue_counter/issueCounter.css.js",
@@ -103,6 +103,7 @@ devtools_svg_sources = [
103
103
  "ic_suggest_color.svg",
104
104
  "ic_undo_16x16_icon.svg",
105
105
  "ic_warning_black_18dp.svg",
106
+ "info-icon.svg",
106
107
  "issue-cross-icon.svg",
107
108
  "issue-exclamation-icon.svg",
108
109
  "issue-questionmark-icon.svg",
@@ -0,0 +1 @@
1
+ <svg width="11" height="12" fill="none" xmlns="http://www.w3.org/2000/svg"><circle cx="5.5" cy="6" r="5" stroke="#202124"/><path fill="#202124" d="M5 4.5h1v5H5zM5 2.5h1v1H5z"/></svg>
@@ -110,6 +110,30 @@ export class ParsedURL {
110
110
  return null;
111
111
  }
112
112
 
113
+ private static preEncodeSpecialCharactersInPath(path: string): string {
114
+ // Based on net::FilePathToFileURL. Ideally we would handle
115
+ // '\\' as well on non-Windows file systems.
116
+ for (const specialChar of ['%', ';', '#', '?']) {
117
+ (path as string) = path.replaceAll(specialChar, encodeURIComponent(specialChar));
118
+ }
119
+ return path;
120
+ }
121
+
122
+ static rawPathToEncodedPathString(path: Platform.DevToolsPath.RawPathString):
123
+ Platform.DevToolsPath.EncodedPathString {
124
+ const partiallyEncoded = ParsedURL.preEncodeSpecialCharactersInPath(path);
125
+ if (path.startsWith('/')) {
126
+ return new URL(partiallyEncoded, 'file:///').pathname as Platform.DevToolsPath.EncodedPathString;
127
+ }
128
+ // URL prepends a '/'
129
+ return new URL('/' + partiallyEncoded, 'file:///').pathname.substr(1) as Platform.DevToolsPath.EncodedPathString;
130
+ }
131
+
132
+ static encodedPathToRawPathString(encPath: Platform.DevToolsPath.EncodedPathString):
133
+ Platform.DevToolsPath.RawPathString {
134
+ return decodeURIComponent(encPath) as Platform.DevToolsPath.RawPathString;
135
+ }
136
+
113
137
  static rawPathToUrlString(fileSystemPath: Platform.DevToolsPath.RawPathString): Platform.DevToolsPath.UrlString {
114
138
  let rawPath: string = fileSystemPath;
115
139
  rawPath = rawPath.replace(/\\/g, '/');
@@ -123,6 +147,13 @@ export class ParsedURL {
123
147
  return rawPath as Platform.DevToolsPath.UrlString;
124
148
  }
125
149
 
150
+ static relativePathToUrlString(relativePath: string, baseURL: Platform.DevToolsPath.UrlString):
151
+ Platform.DevToolsPath.UrlString {
152
+ const preEncodedPath: string = ParsedURL.preEncodeSpecialCharactersInPath(
153
+ relativePath.replace(/\\/g, '/') as Platform.DevToolsPath.RawPathString);
154
+ return new URL(preEncodedPath, baseURL).toString() as Platform.DevToolsPath.UrlString;
155
+ }
156
+
126
157
  static capFilePrefix(fileURL: Platform.DevToolsPath.UrlString, isWindows?: boolean):
127
158
  Platform.DevToolsPath.RawPathString {
128
159
  console.assert(fileURL.startsWith('file://'), 'This must be a file URL.');
@@ -104,40 +104,18 @@ export function getFormatLocalizedString(
104
104
  const formatter =
105
105
  registeredStrings.getLocalizedStringSetFor(DevToolsLocale.instance().locale).getMessageFormatterFor(stringId);
106
106
 
107
- const icuElements = formatter.getAst();
108
- const args: Array<Object> = [];
109
- let formattedString = '';
110
- for (const element of icuElements) {
111
- if (element.type === /* argumentElement */ 1) {
112
- const placeholderValue = placeholders[element.value];
107
+ const element = document.createElement('span');
108
+ for (const icuElement of formatter.getAst()) {
109
+ if (icuElement.type === /* argumentElement */ 1) {
110
+ const placeholderValue = placeholders[icuElement.value];
113
111
  if (placeholderValue) {
114
- args.push(placeholderValue);
115
- element.value = '%s'; // convert the {PH} back to %s to use Platform.UIString
112
+ element.append(placeholderValue as Node | string);
116
113
  }
114
+ } else if ('value' in icuElement) {
115
+ element.append(String(icuElement.value));
117
116
  }
118
- if ('value' in element) {
119
- formattedString += element.value;
120
- }
121
- }
122
- return formatLocalized(formattedString, args);
123
- }
124
-
125
- export function formatLocalized(formattedString: string, args: Array<Object>): Element {
126
- const substitution: Platform.StringUtilities.FormatterFunction<Object> = substitution => {
127
- return substitution;
128
- };
129
-
130
- function append(a: Element, b: undefined|string|Node): Element {
131
- if (b) {
132
- a.appendChild(typeof b === 'string' ? document.createTextNode(b) : b);
133
- }
134
-
135
- return a;
136
117
  }
137
-
138
- const formatters = {s: substitution};
139
- return Platform.StringUtilities.format(formattedString, args, formatters, document.createElement('span'), append)
140
- .formattedResult;
118
+ return element;
141
119
  }
142
120
 
143
121
  export function serializeUIString(string: string, values: Record<string, Object> = {}): string {
@@ -2510,6 +2510,51 @@
2510
2510
  "panels/application/components/BackForwardCacheStrings.ts | documentLoaded": {
2511
2511
  "message": "The document did not finish loading before navigating away."
2512
2512
  },
2513
+ "panels/application/components/BackForwardCacheStrings.ts | embedderAppBannerManager": {
2514
+ "message": "App Banner was present upon navigating away."
2515
+ },
2516
+ "panels/application/components/BackForwardCacheStrings.ts | embedderChromePasswordManagerClientBindCredentialManager": {
2517
+ "message": "Chrome Password Manager was present upon navigating away."
2518
+ },
2519
+ "panels/application/components/BackForwardCacheStrings.ts | embedderDomDistillerSelfDeletingRequestDelegate": {
2520
+ "message": "DOM distillation was in progress upon navigating away."
2521
+ },
2522
+ "panels/application/components/BackForwardCacheStrings.ts | embedderDomDistillerViewerSource": {
2523
+ "message": "DOM Distiller Viewer was present upon navigating away."
2524
+ },
2525
+ "panels/application/components/BackForwardCacheStrings.ts | embedderExtensionMessaging": {
2526
+ "message": "Back/forward cache is disabled due to extensions using messaging API."
2527
+ },
2528
+ "panels/application/components/BackForwardCacheStrings.ts | embedderExtensionMessagingForOpenPort": {
2529
+ "message": "Extensions with long-lived connection should close the connection before entering back/forward cache."
2530
+ },
2531
+ "panels/application/components/BackForwardCacheStrings.ts | embedderExtensions": {
2532
+ "message": "Back/forward cache is disabled due to extensions."
2533
+ },
2534
+ "panels/application/components/BackForwardCacheStrings.ts | embedderExtensionSentMessageToCachedFrame": {
2535
+ "message": "Extensions with long-lived connection attempted to send messages to frames in back/forward cache."
2536
+ },
2537
+ "panels/application/components/BackForwardCacheStrings.ts | embedderModalDialog": {
2538
+ "message": "Modal dialog such as form resubmission or http password dialog was shown for the page upon navigating away."
2539
+ },
2540
+ "panels/application/components/BackForwardCacheStrings.ts | embedderOfflinePage": {
2541
+ "message": "The offline page was shown upon navigating away."
2542
+ },
2543
+ "panels/application/components/BackForwardCacheStrings.ts | embedderOomInterventionTabHelper": {
2544
+ "message": "Out-Of-Memory Intervention bar was present upon navigating away."
2545
+ },
2546
+ "panels/application/components/BackForwardCacheStrings.ts | embedderPermissionRequestManager": {
2547
+ "message": "There were permission requests upon navigating away."
2548
+ },
2549
+ "panels/application/components/BackForwardCacheStrings.ts | embedderPopupBlockerTabHelper": {
2550
+ "message": "Popup blocker was present upon navigating away."
2551
+ },
2552
+ "panels/application/components/BackForwardCacheStrings.ts | embedderSafeBrowsingThreatDetails": {
2553
+ "message": "Safe Browsing details were shown upon navigating away."
2554
+ },
2555
+ "panels/application/components/BackForwardCacheStrings.ts | embedderSafeBrowsingTriggeredPopupBlocker": {
2556
+ "message": "Safe Browsing considered this page to be abusive and blocked popup."
2557
+ },
2513
2558
  "panels/application/components/BackForwardCacheStrings.ts | enteredBackForwardCacheBeforeServiceWorkerHostAdded": {
2514
2559
  "message": "A service worker was activated while the page was in back/forward cache."
2515
2560
  },
@@ -12131,6 +12176,9 @@
12131
12176
  "ui/legacy/ListWidget.ts | saveString": {
12132
12177
  "message": "Save"
12133
12178
  },
12179
+ "ui/legacy/RemoteDebuggingTerminatedScreen.ts | debuggingConnectionWasClosed": {
12180
+ "message": "Debugging connection was closed. Reason: "
12181
+ },
12134
12182
  "ui/legacy/RemoteDebuggingTerminatedScreen.ts | reconnectDevtools": {
12135
12183
  "message": "Reconnect DevTools"
12136
12184
  },
@@ -2510,6 +2510,51 @@
2510
2510
  "panels/application/components/BackForwardCacheStrings.ts | documentLoaded": {
2511
2511
  "message": "T̂h́ê d́ôćûḿêńt̂ d́îd́ n̂ót̂ f́îńîśĥ ĺôád̂ín̂ǵ b̂éf̂ór̂é n̂áv̂íĝát̂ín̂ǵ âẃâý."
2512
2512
  },
2513
+ "panels/application/components/BackForwardCacheStrings.ts | embedderAppBannerManager": {
2514
+ "message": "Âṕp̂ B́âńn̂ér̂ ẃâś p̂ŕêśêńt̂ úp̂ón̂ ńâv́îǵât́îńĝ áŵáŷ."
2515
+ },
2516
+ "panels/application/components/BackForwardCacheStrings.ts | embedderChromePasswordManagerClientBindCredentialManager": {
2517
+ "message": "Ĉh́r̂óm̂é P̂áŝśŵór̂d́ M̂án̂áĝér̂ ẃâś p̂ŕêśêńt̂ úp̂ón̂ ńâv́îǵât́îńĝ áŵáŷ."
2518
+ },
2519
+ "panels/application/components/BackForwardCacheStrings.ts | embedderDomDistillerSelfDeletingRequestDelegate": {
2520
+ "message": "D̂ÓM̂ d́îśt̂íl̂ĺât́îón̂ ẃâś îń p̂ŕôǵr̂éŝś ûṕôń n̂áv̂íĝát̂ín̂ǵ âẃâý."
2521
+ },
2522
+ "panels/application/components/BackForwardCacheStrings.ts | embedderDomDistillerViewerSource": {
2523
+ "message": "D̂ÓM̂ D́îśt̂íl̂ĺêŕ V̂íêẃêŕ ŵáŝ ṕr̂éŝén̂t́ ûṕôń n̂áv̂íĝát̂ín̂ǵ âẃâý."
2524
+ },
2525
+ "panels/application/components/BackForwardCacheStrings.ts | embedderExtensionMessaging": {
2526
+ "message": "B̂áĉḱ/f̂ór̂ẃâŕd̂ ćâćĥé îś d̂íŝáb̂ĺêd́ d̂úê t́ô éx̂t́êńŝíôńŝ úŝín̂ǵ m̂éŝśâǵîńĝ ÁP̂Í."
2527
+ },
2528
+ "panels/application/components/BackForwardCacheStrings.ts | embedderExtensionMessagingForOpenPort": {
2529
+ "message": "Êx́t̂én̂śîón̂ś ŵít̂h́ l̂ón̂ǵ-l̂ív̂éd̂ ćôńn̂éĉt́îón̂ śĥóûĺd̂ ćl̂óŝé t̂h́ê ćôńn̂éĉt́îón̂ b́êf́ôŕê én̂t́êŕîńĝ b́âćk̂/f́ôŕŵár̂d́ ĉáĉh́ê."
2530
+ },
2531
+ "panels/application/components/BackForwardCacheStrings.ts | embedderExtensions": {
2532
+ "message": "B̂áĉḱ/f̂ór̂ẃâŕd̂ ćâćĥé îś d̂íŝáb̂ĺêd́ d̂úê t́ô éx̂t́êńŝíôńŝ."
2533
+ },
2534
+ "panels/application/components/BackForwardCacheStrings.ts | embedderExtensionSentMessageToCachedFrame": {
2535
+ "message": "Êx́t̂én̂śîón̂ś ŵít̂h́ l̂ón̂ǵ-l̂ív̂éd̂ ćôńn̂éĉt́îón̂ át̂t́êḿp̂t́êd́ t̂ó ŝén̂d́ m̂éŝśâǵêś t̂ó f̂ŕâḿêś îń b̂áĉḱ/f̂ór̂ẃâŕd̂ ćâćĥé."
2536
+ },
2537
+ "panels/application/components/BackForwardCacheStrings.ts | embedderModalDialog": {
2538
+ "message": "M̂ód̂ál̂ d́îál̂óĝ śûćĥ áŝ f́ôŕm̂ ŕêśûb́m̂íŝśîón̂ ór̂ h́t̂t́p̂ ṕâśŝẃôŕd̂ d́îál̂óĝ ẃâś ŝh́ôẃn̂ f́ôŕ t̂h́ê ṕâǵê úp̂ón̂ ńâv́îǵât́îńĝ áŵáŷ."
2539
+ },
2540
+ "panels/application/components/BackForwardCacheStrings.ts | embedderOfflinePage": {
2541
+ "message": "T̂h́ê óf̂f́l̂ín̂é p̂áĝé ŵáŝ śĥóŵń ûṕôń n̂áv̂íĝát̂ín̂ǵ âẃâý."
2542
+ },
2543
+ "panels/application/components/BackForwardCacheStrings.ts | embedderOomInterventionTabHelper": {
2544
+ "message": "Ôút̂-Óf̂-Ḿêḿôŕŷ Ín̂t́êŕv̂én̂t́îón̂ b́âŕ ŵáŝ ṕr̂éŝén̂t́ ûṕôń n̂áv̂íĝát̂ín̂ǵ âẃâý."
2545
+ },
2546
+ "panels/application/components/BackForwardCacheStrings.ts | embedderPermissionRequestManager": {
2547
+ "message": "T̂h́êŕê ẃêŕê ṕêŕm̂íŝśîón̂ ŕêq́ûéŝt́ŝ úp̂ón̂ ńâv́îǵât́îńĝ áŵáŷ."
2548
+ },
2549
+ "panels/application/components/BackForwardCacheStrings.ts | embedderPopupBlockerTabHelper": {
2550
+ "message": "P̂óp̂úp̂ b́l̂óĉḱêŕ ŵáŝ ṕr̂éŝén̂t́ ûṕôń n̂áv̂íĝát̂ín̂ǵ âẃâý."
2551
+ },
2552
+ "panels/application/components/BackForwardCacheStrings.ts | embedderSafeBrowsingThreatDetails": {
2553
+ "message": "Ŝáf̂é B̂ŕôẃŝín̂ǵ d̂ét̂áîĺŝ ẃêŕê śĥóŵń ûṕôń n̂áv̂íĝát̂ín̂ǵ âẃâý."
2554
+ },
2555
+ "panels/application/components/BackForwardCacheStrings.ts | embedderSafeBrowsingTriggeredPopupBlocker": {
2556
+ "message": "Ŝáf̂é B̂ŕôẃŝín̂ǵ ĉón̂śîd́êŕêd́ t̂h́îś p̂áĝé t̂ó b̂é âb́ûśîv́ê án̂d́ b̂ĺôćk̂éd̂ ṕôṕûṕ."
2557
+ },
2513
2558
  "panels/application/components/BackForwardCacheStrings.ts | enteredBackForwardCacheBeforeServiceWorkerHostAdded": {
2514
2559
  "message": "Â śêŕv̂íĉé ŵór̂ḱêŕ ŵáŝ áĉt́îv́ât́êd́ ŵh́îĺê t́ĥé p̂áĝé ŵáŝ ín̂ b́âćk̂/f́ôŕŵár̂d́ ĉáĉh́ê."
2515
2560
  },
@@ -12131,6 +12176,9 @@
12131
12176
  "ui/legacy/ListWidget.ts | saveString": {
12132
12177
  "message": "Ŝáv̂é"
12133
12178
  },
12179
+ "ui/legacy/RemoteDebuggingTerminatedScreen.ts | debuggingConnectionWasClosed": {
12180
+ "message": "D̂éb̂úĝǵîńĝ ćôńn̂éĉt́îón̂ ẃâś ĉĺôśêd́. R̂éâśôń: "
12181
+ },
12134
12182
  "ui/legacy/RemoteDebuggingTerminatedScreen.ts | reconnectDevtools": {
12135
12183
  "message": "R̂éĉón̂ńêćt̂ DevTools"
12136
12184
  },
@@ -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 StringUtilities.vsprintf('%.0f\xA0B', [bytes]);
21
+ return `${bytes.toFixed(0)}\xA0B`;
24
22
  }
25
23
 
26
24
  const kilobytes = bytes / 1000;
27
25
  if (kilobytes < 100) {
28
- return StringUtilities.vsprintf('%.1f\xA0kB', [kilobytes]);
26
+ return `${kilobytes.toFixed(1)}\xA0kB`;
29
27
  }
30
28
  if (kilobytes < 1000) {
31
- return StringUtilities.vsprintf('%.0f\xA0kB', [kilobytes]);
29
+ return `${kilobytes.toFixed(0)}\xA0kB`;
32
30
  }
33
31
 
34
32
  const megabytes = kilobytes / 1000;
35
33
  if (megabytes < 100) {
36
- return StringUtilities.vsprintf('%.1f\xA0MB', [megabytes]);
34
+ return `${megabytes.toFixed(1)}\xA0MB`;
37
35
  }
38
- return StringUtilities.vsprintf('%.0f\xA0MB', [megabytes]);
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
- export const vsprintf = function(formatString: string, substitutions: unknown[]): string {
289
- return format(formatString, substitutions, standardFormatters, '', (a, b) => a + b).formattedResult;
290
- };
291
-
292
- export const sprintf = function(format: string, ...varArg: unknown[]): string {
293
- return vsprintf(format, varArg);
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 => {
@@ -219,8 +219,7 @@ export class PageResourceLoader extends Common.ObjectWrapper.ObjectWrapper<Event
219
219
  return this.#loadOverride(url);
220
220
  }
221
221
  const parsedURL = new Common.ParsedURL.ParsedURL(url);
222
- const eligibleForLoadFromTarget =
223
- getLoadThroughTargetSetting().get() && parsedURL && parsedURL.scheme !== 'file' && parsedURL.scheme !== 'data';
222
+ const eligibleForLoadFromTarget = getLoadThroughTargetSetting().get() && parsedURL && parsedURL.isHttpOrHttps();
224
223
  Host.userMetrics.developerResourceScheme(this.getDeveloperResourceScheme(parsedURL));
225
224
  if (eligibleForLoadFromTarget) {
226
225
  try {
@@ -616,7 +616,12 @@ export class ResourceTreeFrame {
616
616
  backForwardCacheDetails: {
617
617
  restoredFromCache: boolean|undefined,
618
618
  explanations: Protocol.Page.BackForwardCacheNotRestoredExplanation[],
619
- } = {restoredFromCache: undefined, explanations: []};
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 = {restoredFromCache: undefined, explanations: []};
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('Page.backForwardCacheNotUsed', ['loaderId', 'frameId', 'notRestoredExplanations']);
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.vsprintf(description, details));
1152
+ console.error('Extension server error: ' + Platform.StringUtilities.sprintf(description, ...details));
1154
1153
  }
1155
1154
  return status;
1156
1155
  }
@@ -420,6 +420,84 @@ const UIStrings = {
420
420
  * @description Description text for not restored reason ContentMediaPlay.
421
421
  */
422
422
  contentMediaPlay: 'A media player was playing upon navigating away.',
423
+
424
+ /**
425
+ * @description Description text for not restored reason EmbedderPopupBlockerTabHelper.
426
+ */
427
+ embedderPopupBlockerTabHelper: 'Popup blocker was present upon navigating away.',
428
+
429
+ /**
430
+ * @description Description text for not restored reason EmbedderSafeBrowsingTriggeredPopupBlocker.
431
+ */
432
+ embedderSafeBrowsingTriggeredPopupBlocker: 'Safe Browsing considered this page to be abusive and blocked popup.',
433
+
434
+ /**
435
+ * @description Description text for not restored reason EmbedderSafeBrowsingThreatDetails.
436
+ */
437
+ embedderSafeBrowsingThreatDetails: 'Safe Browsing details were shown upon navigating away.',
438
+
439
+ /**
440
+ * @description Description text for not restored reason EmbedderAppBannerManager.
441
+ */
442
+ embedderAppBannerManager: 'App Banner was present upon navigating away.',
443
+
444
+ /**
445
+ * @description Description text for not restored reason EmbedderDomDistillerViewerSource.
446
+ */
447
+ embedderDomDistillerViewerSource: 'DOM Distiller Viewer was present upon navigating away.',
448
+
449
+ /**
450
+ * @description Description text for not restored reason EmbedderDomDistillerSelfDeletingRequestDelegate.
451
+ */
452
+ embedderDomDistillerSelfDeletingRequestDelegate: 'DOM distillation was in progress upon navigating away.',
453
+
454
+ /**
455
+ * @description Description text for not restored reason EmbedderOomInterventionTabHelper.
456
+ */
457
+ embedderOomInterventionTabHelper: 'Out-Of-Memory Intervention bar was present upon navigating away.',
458
+
459
+ /**
460
+ * @description Description text for not restored reason EmbedderOfflinePage.
461
+ */
462
+ embedderOfflinePage: 'The offline page was shown upon navigating away.',
463
+
464
+ /**
465
+ * @description Description text for not restored reason EmbedderChromePasswordManagerClientBindCredentialManager.
466
+ */
467
+ embedderChromePasswordManagerClientBindCredentialManager: 'Chrome Password Manager was present upon navigating away.',
468
+
469
+ /**
470
+ * @description Description text for not restored reason EmbedderPermissionRequestManager.
471
+ */
472
+ embedderPermissionRequestManager: 'There were permission requests upon navigating away.',
473
+
474
+ /**
475
+ * @description Description text for not restored reason EmbedderModalDialog.
476
+ */
477
+ embedderModalDialog:
478
+ 'Modal dialog such as form resubmission or http password dialog was shown for the page upon navigating away.',
479
+
480
+ /**
481
+ * @description Description text for not restored reason EmbedderExtensions.
482
+ */
483
+ embedderExtensions: 'Back/forward cache is disabled due to extensions.',
484
+
485
+ /**
486
+ * @description Description text for not restored reason EmbedderExtensionMessaging.
487
+ */
488
+ embedderExtensionMessaging: 'Back/forward cache is disabled due to extensions using messaging API.',
489
+
490
+ /**
491
+ * @description Description text for not restored reason EmbedderExtensionMessagingForOpenPort.
492
+ */
493
+ embedderExtensionMessagingForOpenPort:
494
+ 'Extensions with long-lived connection should close the connection before entering back/forward cache.',
495
+
496
+ /**
497
+ * @description Description text for not restored reason EmbedderExtensionSentMessageToCachedFrame.
498
+ */
499
+ embedderExtensionSentMessageToCachedFrame:
500
+ 'Extensions with long-lived connection attempted to send messages to frames in back/forward cache.',
423
501
  };
424
502
 
425
503
  const str_ = i18n.i18n.registerUIStrings('panels/application/components/BackForwardCacheStrings.ts', UIStrings);
@@ -538,23 +616,23 @@ export const NotRestoredReasonDescription = {
538
616
  'ContentMediaSessionService': {name: i18nLazyString(UIStrings.contentMediaSessionService)},
539
617
  'ContentMediaPlay': {name: i18nLazyString(UIStrings.contentMediaPlay)},
540
618
  'ContentScreenReader': {name: i18n.i18n.lockedLazyString('ContentScreenReader')},
541
- 'EmbedderPopupBlockerTabHelper': {name: i18n.i18n.lockedLazyString('EmbedderPopupBlockerTabHelper')},
619
+ 'EmbedderPopupBlockerTabHelper': {name: i18nLazyString(UIStrings.embedderPopupBlockerTabHelper)},
542
620
  'EmbedderSafeBrowsingTriggeredPopupBlocker':
543
- {name: i18n.i18n.lockedLazyString('EmbedderSafeBrowsingTriggeredPopupBlocker')},
544
- 'EmbedderSafeBrowsingThreatDetails': {name: i18n.i18n.lockedLazyString('EmbedderSafeBrowsingThreatDetails')},
545
- 'EmbedderAppBannerManager': {name: i18n.i18n.lockedLazyString('EmbedderAppBannerManager')},
546
- 'EmbedderDomDistillerViewerSource': {name: i18n.i18n.lockedLazyString('EmbedderDomDistillerViewerSource')},
621
+ {name: i18nLazyString(UIStrings.embedderSafeBrowsingTriggeredPopupBlocker)},
622
+ 'EmbedderSafeBrowsingThreatDetails': {name: i18nLazyString(UIStrings.embedderSafeBrowsingThreatDetails)},
623
+ 'EmbedderAppBannerManager': {name: i18nLazyString(UIStrings.embedderAppBannerManager)},
624
+ 'EmbedderDomDistillerViewerSource': {name: i18nLazyString(UIStrings.embedderDomDistillerViewerSource)},
547
625
  'EmbedderDomDistillerSelfDeletingRequestDelegate':
548
- {name: i18n.i18n.lockedLazyString('EmbedderDomDistillerSelfDeletingRequestDelegate')},
549
- 'EmbedderOomInterventionTabHelper': {name: i18n.i18n.lockedLazyString('EmbedderOomInterventionTabHelper')},
550
- 'EmbedderOfflinePage': {name: i18n.i18n.lockedLazyString('EmbedderOfflinePage')},
626
+ {name: i18nLazyString(UIStrings.embedderDomDistillerSelfDeletingRequestDelegate)},
627
+ 'EmbedderOomInterventionTabHelper': {name: i18nLazyString(UIStrings.embedderOomInterventionTabHelper)},
628
+ 'EmbedderOfflinePage': {name: i18nLazyString(UIStrings.embedderOfflinePage)},
551
629
  'EmbedderChromePasswordManagerClientBindCredentialManager':
552
- {name: i18n.i18n.lockedLazyString('EmbedderChromePasswordManagerClientBindCredentialManager')},
553
- 'EmbedderPermissionRequestManager': {name: i18n.i18n.lockedLazyString('EmbedderPermissionRequestManager')},
554
- 'EmbedderModalDialog': {name: i18n.i18n.lockedLazyString('EmbedderModalDialog')},
555
- 'EmbedderExtensions': {name: i18n.i18n.lockedLazyString('EmbedderExtensions')},
556
- 'EmbedderExtensionMessaging': {name: i18n.i18n.lockedLazyString('EmbedderExtensionMessaging')},
557
- 'EmbedderExtensionMessagingForOpenPort': {name: i18n.i18n.lockedLazyString('EmbedderExtensionMessagingForOpenPort')},
630
+ {name: i18nLazyString(UIStrings.embedderChromePasswordManagerClientBindCredentialManager)},
631
+ 'EmbedderPermissionRequestManager': {name: i18nLazyString(UIStrings.embedderPermissionRequestManager)},
632
+ 'EmbedderModalDialog': {name: i18nLazyString(UIStrings.embedderModalDialog)},
633
+ 'EmbedderExtensions': {name: i18nLazyString(UIStrings.embedderExtensions)},
634
+ 'EmbedderExtensionMessaging': {name: i18nLazyString(UIStrings.embedderExtensionMessaging)},
635
+ 'EmbedderExtensionMessagingForOpenPort': {name: i18nLazyString(UIStrings.embedderExtensionMessagingForOpenPort)},
558
636
  'EmbedderExtensionSentMessageToCachedFrame':
559
- {name: i18n.i18n.lockedLazyString('EmbedderExtensionSentMessageToCachedFrame')},
637
+ {name: i18nLazyString(UIStrings.embedderExtensionSentMessageToCachedFrame)},
560
638
  };
@@ -86,7 +86,7 @@ export class EndpointsGrid extends HTMLElement {
86
86
  </div>
87
87
  `}
88
88
  </div>
89
- `, this.#shadow);
89
+ `, this.#shadow, {host: this});
90
90
  // clang-format on
91
91
  }
92
92
 
@@ -30,7 +30,7 @@
30
30
  }
31
31
 
32
32
  .quota-override-notification-editor {
33
- border: solid 1px var(--color-background-highlight);
33
+ border: solid 1px var(--color-details-hairline);
34
34
  display: flex;
35
35
  flex: auto;
36
36
  margin-right: 4px;