chrome-devtools-frontend 1.0.947377 → 1.0.948295

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 (97) hide show
  1. package/config/gni/all_devtools_files.gni +1 -6
  2. package/config/gni/devtools_grd_files.gni +5 -6
  3. package/config/gni/devtools_image_files.gni +1 -0
  4. package/front_end/.eslintrc.js +1 -0
  5. package/front_end/Images/src/circled_backslash_icon.svg +3 -0
  6. package/front_end/core/host/UserMetrics.ts +1 -1
  7. package/front_end/core/i18n/locales/en-US.json +17 -14
  8. package/front_end/core/i18n/locales/en-XL.json +17 -14
  9. package/front_end/core/platform/platform.ts +0 -2
  10. package/front_end/core/platform/string-utilities.ts +14 -1
  11. package/front_end/core/platform/utilities.ts +0 -29
  12. package/front_end/core/root/Runtime.ts +4 -207
  13. package/front_end/core/sdk/Cookie.ts +0 -21
  14. package/front_end/core/sdk/sdk-legacy.ts +0 -3
  15. package/front_end/entrypoints/devtools_app/{devtools_app-meta-files.ts → devtools_app.ts} +9 -2
  16. package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshot.ts +2 -1
  17. package/front_end/entrypoints/js_app/{JsMain.ts → js_app.ts} +5 -1
  18. package/front_end/entrypoints/main/MainImpl.ts +0 -1
  19. package/front_end/entrypoints/ndb_app/{ndb_app.js → ndb_app.ts} +0 -2
  20. package/front_end/entrypoints/node_app/node_app.ts +1 -3
  21. package/front_end/entrypoints/shell/{shell.js → shell.ts} +0 -2
  22. package/front_end/entrypoints/worker_app/worker_app.ts +1 -3
  23. package/front_end/legacy/legacy-defs.d.ts +0 -4
  24. package/front_end/legacy_test_runner/test_runner/TestRunner.js +35 -59
  25. package/front_end/models/issues_manager/CorsIssue.ts +15 -15
  26. package/front_end/models/issues_manager/descriptions/{corsInsecurePrivateNetworkPreflight.md → corsPreflightAllowPrivateNetworkError.md} +1 -1
  27. package/front_end/panels/accessibility/AccessibilitySidebarView.ts +3 -1
  28. package/front_end/panels/application/BackForwardCacheStrings.ts +1 -5
  29. package/front_end/panels/application/BackForwardCacheView.ts +150 -58
  30. package/front_end/panels/application/ResourcesPanel.ts +0 -42
  31. package/front_end/panels/application/application-legacy.ts +0 -3
  32. package/front_end/panels/application/application-meta.ts +0 -13
  33. package/front_end/panels/application/backForwardCacheView.css +44 -6
  34. package/front_end/panels/application/components/FrameDetailsView.ts +3 -3
  35. package/front_end/panels/application/components/OriginTrialTreeView.ts +3 -3
  36. package/front_end/panels/application/components/StackTrace.ts +1 -1
  37. package/front_end/panels/coverage/CoverageView.ts +1 -1
  38. package/front_end/panels/css_overview/components/cssOverviewStartView.css +1 -0
  39. package/front_end/panels/css_overview/cssOverviewCompletedView.css +1 -1
  40. package/front_end/panels/developer_resources/DeveloperResourcesView.ts +2 -1
  41. package/front_end/panels/elements/ElementsPanel.ts +9 -1
  42. package/front_end/panels/elements/ElementsTreeElement.ts +1 -1
  43. package/front_end/panels/elements/components/ElementsBreadcrumbs.ts +1 -1
  44. package/front_end/panels/issues/CorsIssueDetailsView.ts +20 -8
  45. package/front_end/panels/network/NetworkWaterfallColumn.ts +2 -0
  46. package/front_end/panels/profiler/CPUProfileFlameChart.ts +3 -1
  47. package/front_end/panels/profiler/ProfileDataGrid.ts +2 -1
  48. package/front_end/panels/settings/components/SyncSection.ts +2 -2
  49. package/front_end/panels/settings/emulation/components/UserAgentClientHintsForm.ts +46 -46
  50. package/front_end/panels/timeline/TimelineTreeView.ts +2 -1
  51. package/front_end/ui/components/diff_view/DiffView.ts +4 -4
  52. package/front_end/ui/components/helpers/component-server-setup.ts +1 -12
  53. package/front_end/ui/components/helpers/helpers.ts +0 -2
  54. package/front_end/ui/components/icon_button/IconButton.ts +1 -1
  55. package/front_end/ui/components/issue_counter/IssueCounter.ts +2 -2
  56. package/front_end/ui/components/linear_memory_inspector/LinearMemoryViewer.ts +3 -3
  57. package/front_end/ui/components/markdown_view/MarkdownView.ts +4 -4
  58. package/front_end/ui/components/panel_feedback/PreviewToggle.ts +98 -0
  59. package/front_end/ui/components/panel_feedback/panel_feedback.ts +1 -0
  60. package/front_end/ui/components/panel_feedback/previewToggle.css +24 -0
  61. package/front_end/ui/components/report_view/ReportView.ts +22 -0
  62. package/front_end/ui/components/report_view/reportSection.css +20 -0
  63. package/front_end/ui/components/request_link_icon/RequestLinkIcon.ts +1 -1
  64. package/front_end/ui/components/settings/SettingCheckbox.ts +2 -2
  65. package/front_end/ui/components/text_editor/config.ts +4 -3
  66. package/front_end/ui/components/text_editor/javascript.ts +8 -4
  67. package/front_end/ui/components/text_prompt/TextPrompt.ts +2 -2
  68. package/front_end/ui/legacy/GlassPane.ts +1 -1
  69. package/front_end/ui/legacy/SearchableView.ts +2 -1
  70. package/front_end/ui/legacy/Treeoutline.ts +1 -1
  71. package/front_end/ui/legacy/Widget.ts +1 -1
  72. package/front_end/ui/legacy/XWidget.ts +0 -5
  73. package/front_end/ui/legacy/components/inline_editor/CSSVarSwatch.ts +2 -2
  74. package/front_end/ui/legacy/components/inline_editor/ColorSwatch.ts +1 -1
  75. package/front_end/ui/legacy/utils/append-style.ts +2 -13
  76. package/front_end/ui/legacy/utils/create-shadow-root-with-core-styles.ts +7 -5
  77. package/package.json +2 -4
  78. package/scripts/build/build_inspector_overlay.py +15 -1
  79. package/scripts/build/rjsmin.py +84 -115
  80. package/scripts/eslint_rules/lib/lit_html_no_attribute_quotes.js +101 -0
  81. package/scripts/eslint_rules/lib/no_only_eslint_tests.js +53 -0
  82. package/scripts/eslint_rules/tests/.eslintrc.js +14 -0
  83. package/scripts/eslint_rules/tests/lit_html_no_attribute_quotes_test.js +45 -0
  84. package/scripts/eslint_rules/tests/no_only_eslint_tests_test.js +94 -0
  85. package/front_end/entrypoints/devtools_app/devtools_app.js +0 -11
  86. package/front_end/entrypoints/devtools_app/devtools_app.json +0 -4
  87. package/front_end/entrypoints/js_app/js_app.js +0 -12
  88. package/front_end/entrypoints/js_app/js_app.json +0 -3
  89. package/front_end/entrypoints/ndb_app/ndb_app.json +0 -4
  90. package/front_end/entrypoints/startup/RuntimeInstantiator.ts +0 -95
  91. package/front_end/entrypoints/startup/startup.ts +0 -9
  92. package/front_end/ui/components/helpers/get-stylesheet.ts +0 -45
  93. package/scripts/build/build_release_applications.py +0 -216
  94. package/scripts/build/modular_build.py +0 -184
  95. package/scripts/check_gn.js +0 -119
  96. package/scripts/json_validator/module.schema.json +0 -19
  97. package/scripts/json_validator/validate_module_json.js +0 -44
@@ -7,9 +7,6 @@ const originalAssert = console.assert;
7
7
 
8
8
  const queryParamsObject = new URLSearchParams(location.search);
9
9
 
10
- // The following variable are initialized all the way at the bottom of this file
11
- let importScriptPathPrefix: string;
12
-
13
10
  let runtimePlatform = '';
14
11
 
15
12
  let runtimeInstance: Runtime|undefined;
@@ -32,62 +29,16 @@ export function getRemoteBase(location: string = self.location.toString()): {
32
29
  return {base: `${url.origin}/remote/serve_file/${version[1]}/`, version: version[1]};
33
30
  }
34
31
 
35
- export const mappingForLayoutTests = new Map<string, string>([
36
- ['panels/animation', 'animation'],
37
- ['panels/browser_debugger', 'browser_debugger'],
38
- ['panels/changes', 'changes'],
39
- ['panels/console', 'console'],
40
- ['panels/elements', 'elements'],
41
- ['panels/emulation', 'emulation'],
42
- ['panels/mobile_throttling', 'mobile_throttling'],
43
- ['panels/network', 'network'],
44
- ['panels/profiler', 'profiler'],
45
- ['panels/application', 'resources'],
46
- ['panels/search', 'search'],
47
- ['panels/sources', 'sources'],
48
- ['panels/snippets', 'snippets'],
49
- ['panels/settings', 'settings'],
50
- ['panels/timeline', 'timeline'],
51
- ['panels/web_audio', 'web_audio'],
52
- ['models/persistence', 'persistence'],
53
- ['models/workspace_diff', 'workspace_diff'],
54
- ['entrypoints/main', 'main'],
55
- ['third_party/diff', 'diff'],
56
- ['ui/legacy/components/inline_editor', 'inline_editor'],
57
- ['ui/legacy/components/data_grid', 'data_grid'],
58
- ['ui/legacy/components/perf_ui', 'perf_ui'],
59
- ['ui/legacy/components/source_frame', 'source_frame'],
60
- ['ui/legacy/components/color_picker', 'color_picker'],
61
- ['ui/legacy/components/cookie_table', 'cookie_table'],
62
- ['ui/legacy/components/quick_open', 'quick_open'],
63
- ['ui/legacy/components/utils', 'components'],
64
- ]);
65
-
66
32
  export class Runtime {
67
- readonly #modules: Module[];
68
- modulesMap: {
69
- [x: string]: Module,
70
- };
71
- private constructor(descriptors: ModuleDescriptor[]) {
72
- this.#modules = [];
73
- this.modulesMap = {};
74
-
75
- for (const descriptor of descriptors) {
76
- this.registerModule(descriptor);
77
- }
33
+ private constructor() {
78
34
  }
79
35
 
80
36
  static instance(opts: {
81
37
  forceNew: boolean|null,
82
- moduleDescriptors: Array<ModuleDescriptor>|null,
83
- }|undefined = {forceNew: null, moduleDescriptors: null}): Runtime {
84
- const {forceNew, moduleDescriptors} = opts;
38
+ }|undefined = {forceNew: null}): Runtime {
39
+ const {forceNew} = opts;
85
40
  if (!runtimeInstance || forceNew) {
86
- if (!moduleDescriptors) {
87
- throw new Error(`Unable to create runtime: moduleDescriptors must be provided: ${new Error().stack}`);
88
- }
89
-
90
- runtimeInstance = new Runtime(moduleDescriptors);
41
+ runtimeInstance = new Runtime();
91
42
  }
92
43
 
93
44
  return runtimeInstance;
@@ -198,51 +149,11 @@ export class Runtime {
198
149
  return '\n/*# sourceURL=' + sourceURL + ' */';
199
150
  }
200
151
 
201
- module(moduleName: string): Module {
202
- return this.modulesMap[moduleName];
203
- }
204
-
205
- private registerModule(descriptor: ModuleDescriptor): void {
206
- const module = new Module(this, descriptor);
207
- this.#modules.push(module);
208
- this.modulesMap[descriptor['name']] = module;
209
- const mappedName = mappingForLayoutTests.get(descriptor['name']);
210
- if (mappedName !== undefined) {
211
- this.modulesMap[mappedName] = module;
212
- }
213
- }
214
-
215
- loadModulePromise(moduleName: string): Promise<boolean> {
216
- return this.modulesMap[moduleName].loadPromise();
217
- }
218
-
219
- loadAutoStartModules(moduleNames: string[]): Promise<boolean[]> {
220
- const promises = [];
221
- for (const moduleName of moduleNames) {
222
- promises.push(this.loadModulePromise(moduleName));
223
- }
224
- return Promise.all(promises);
225
- }
226
-
227
- getModulesMap(): {[x: string]: Module} {
228
- return this.modulesMap;
229
- }
230
-
231
152
  loadLegacyModule(modulePath: string): Promise<void> {
232
153
  return import(`../../${modulePath}`);
233
154
  }
234
155
  }
235
156
 
236
- export class ModuleDescriptor {
237
- name!: string;
238
- dependencies!: string[]|undefined;
239
- modules!: string[];
240
- resources!: string[];
241
- condition!: string|undefined;
242
- experiment!: string|null;
243
- constructor() {
244
- }
245
- }
246
157
  export interface Option {
247
158
  title: string;
248
159
  value: string|boolean;
@@ -250,92 +161,6 @@ export interface Option {
250
161
  text?: string;
251
162
  }
252
163
 
253
- function computeContainingFolderName(name: string): string {
254
- if (name.includes('/')) {
255
- return name.substring(name.lastIndexOf('/') + 1, name.length);
256
- }
257
- return name;
258
- }
259
-
260
- export class Module {
261
- readonly #manager: Runtime;
262
- readonly descriptor: ModuleDescriptor;
263
- readonly #nameInternal: string;
264
- #loadedForTest: boolean;
265
- #pendingLoadPromise?: Promise<boolean>;
266
- constructor(manager: Runtime, descriptor: ModuleDescriptor) {
267
- this.#manager = manager;
268
- this.descriptor = descriptor;
269
- this.#nameInternal = descriptor.name;
270
- this.#loadedForTest = false;
271
- }
272
-
273
- name(): string {
274
- return this.#nameInternal;
275
- }
276
-
277
- enabled(): boolean {
278
- return Runtime.isDescriptorEnabled(this.descriptor);
279
- }
280
-
281
- resource(name: string): string {
282
- const fullName = this.#nameInternal + '/' + name;
283
- const content = cachedResources.get(fullName);
284
- if (!content) {
285
- throw new Error(fullName + ' not preloaded. Check module.json');
286
- }
287
- return content;
288
- }
289
-
290
- loadPromise(): Promise<boolean> {
291
- if (!this.enabled()) {
292
- return Promise.reject(new Error('Module ' + this.#nameInternal + ' is not enabled'));
293
- }
294
-
295
- if (this.#pendingLoadPromise) {
296
- return this.#pendingLoadPromise;
297
- }
298
-
299
- const dependencies = this.descriptor.dependencies;
300
- const dependencyPromises = [];
301
- for (let i = 0; dependencies && i < dependencies.length; ++i) {
302
- dependencyPromises.push(this.#manager.getModulesMap()[dependencies[i]].loadPromise());
303
- }
304
-
305
- this.#pendingLoadPromise = Promise.all(dependencyPromises).then(this.loadModules.bind(this)).then(() => {
306
- this.#loadedForTest = true;
307
- return this.#loadedForTest;
308
- });
309
-
310
- return this.#pendingLoadPromise;
311
- }
312
-
313
- private async loadModules(): Promise<void> {
314
- const containingFolderName = computeContainingFolderName(this.#nameInternal);
315
-
316
- const moduleFileName = `${containingFolderName}_module.js`;
317
- const entrypointFileName = `${containingFolderName}.js`;
318
-
319
- // If a module has resources, they are part of the `_module.js` files that are generated
320
- // by `build_release_applications`. These need to be loaded before any other code is
321
- // loaded, to make sure that the resource content is properly cached in `cachedResources`.
322
- if (this.descriptor.modules && this.descriptor.modules.includes(moduleFileName)) {
323
- await import(`../../${this.#nameInternal}/${moduleFileName}`);
324
- }
325
-
326
- await import(`../../${this.#nameInternal}/${entrypointFileName}`);
327
- }
328
-
329
- private modularizeURL(resourceName: string): string {
330
- return Runtime.normalizePath(this.#nameInternal + '/' + resourceName);
331
- }
332
-
333
- fetchResource(resourceName: string): Promise<string> {
334
- const sourceURL = getResourceURL(this.modularizeURL(resourceName));
335
- return loadResourcePromise(sourceURL);
336
- }
337
- }
338
-
339
164
  export class ExperimentsSupport {
340
165
  #experiments: Experiment[];
341
166
  #experimentNames: Set<string>;
@@ -509,37 +334,9 @@ export function loadResourcePromise(url: string): Promise<string> {
509
334
  }
510
335
  }
511
336
 
512
- function getResourceURL(scriptName: string, base?: string): string {
513
- const sourceURL = (base || importScriptPathPrefix) + scriptName;
514
- const schemaIndex = sourceURL.indexOf('://') + 3;
515
- let pathIndex = sourceURL.indexOf('/', schemaIndex);
516
- if (pathIndex === -1) {
517
- pathIndex = sourceURL.length;
518
- }
519
- return sourceURL.substring(0, pathIndex) + Runtime.normalizePath(sourceURL.substring(pathIndex));
520
- }
521
-
522
- (function(): void {
523
- const baseUrl = self.location ? self.location.origin + self.location.pathname : '';
524
- importScriptPathPrefix = baseUrl.substring(0, baseUrl.lastIndexOf('/') + 1);
525
- })();
526
-
527
337
  // This must be constructed after the query parameters have been parsed.
528
338
  export const experiments = new ExperimentsSupport();
529
339
 
530
- export const cachedResources = new Map<string, string>();
531
-
532
- // Only exported for LightHouse, which uses it in `report-generator.js`.
533
- // Do not use this global in DevTools' implementation.
534
- // TODO(crbug.com/1127292): remove this global
535
- // @ts-ignore
536
- globalThis.EXPORTED_CACHED_RESOURCES_ONLY_FOR_LIGHTHOUSE = cachedResources;
537
-
538
- export let appStartedPromiseCallback: () => void;
539
- export const appStarted = new Promise<void>(fulfill => {
540
- appStartedPromiseCallback = fulfill;
541
- });
542
-
543
340
  // TODO(crbug.com/1167717): Make this a const enum again
544
341
  // eslint-disable-next-line rulesdir/const_enum
545
342
  export enum ExperimentName {
@@ -263,24 +263,3 @@ export enum Attributes {
263
263
  Priority = 'priority',
264
264
  PartitionKey = 'partitionKey',
265
265
  }
266
-
267
- /**
268
- * A `CookieReference` uniquely identifies a cookie by the triple (#name,domain,#path). Additionally, a context may be
269
- * included to make it clear which site under Application>Cookies should be opened when revealing a `CookieReference`.
270
- */
271
- export class CookieReference {
272
- readonly #domainInternal: string;
273
- readonly #contextUrlInternal: string|undefined;
274
- constructor(_name: string, domain: string, _path: string, contextUrl: string|undefined) {
275
- this.#domainInternal = domain;
276
- this.#contextUrlInternal = contextUrl;
277
- }
278
-
279
- domain(): string {
280
- return this.#domainInternal;
281
- }
282
-
283
- contextUrl(): string|undefined {
284
- return this.#contextUrlInternal;
285
- }
286
- }
@@ -73,9 +73,6 @@ SDK.ConsoleMessage.FrontendMessageSource = SDKModule.ConsoleModel.FrontendMessag
73
73
  /** @constructor */
74
74
  SDK.Cookie = SDKModule.Cookie.Cookie;
75
75
 
76
- /** @constructor */
77
- SDK.CookieReference = SDKModule.Cookie.CookieReference;
78
-
79
76
  /** @constructor */
80
77
  SDK.CookieParser = SDKModule.CookieParser.CookieParser;
81
78
 
@@ -1,7 +1,7 @@
1
- // Copyright 2021 The Chromium Authors. All rights reserved.
1
+ // Copyright 2018 The Chromium Authors. All rights reserved.
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
+ import '../shell/shell.js';
5
5
  import '../../panels/css_overview/css_overview-meta.js';
6
6
  import '../../panels/elements/elements-meta.js';
7
7
  import '../../panels/browser_debugger/browser_debugger-meta.js';
@@ -25,3 +25,10 @@ import '../../panels/timeline/timeline-meta.js';
25
25
  import '../../panels/web_audio/web_audio-meta.js';
26
26
  import '../../panels/webauthn/webauthn-meta.js';
27
27
  import '../../panels/layer_viewer/layer_viewer-meta.js';
28
+
29
+ import * as Root from '../../core/root/root.js';
30
+ import * as Main from '../main/main.js';
31
+
32
+ // @ts-ignore Exposed for legacy layout tests
33
+ self.runtime = Root.Runtime.Runtime.instance({forceNew: true});
34
+ new Main.MainImpl.MainImpl();
@@ -909,7 +909,8 @@ export abstract class HeapSnapshot {
909
909
  return matchedStringIndexes;
910
910
  }
911
911
 
912
- const regexp = searchConfig.isRegex ? new RegExp(query) : createPlainTextSearchRegex(query, 'i');
912
+ const regexp =
913
+ searchConfig.isRegex ? new RegExp(query) : Platform.StringUtilities.createPlainTextSearchRegex(query, 'i');
913
914
 
914
915
  function filterRegexp(matchedStringIndexes: Set<number>, string: string, index: number): Set<number> {
915
916
  if (regexp.test(string)) {
@@ -1,12 +1,15 @@
1
1
  // Copyright 2018 The Chromium Authors. All rights reserved.
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
+ import '../shell/shell.js';
5
+ import '../../panels/js_profiler/js_profiler-meta.js';
4
6
 
5
7
  import * as Common from '../../core/common/common.js';
6
8
  import * as Host from '../../core/host/host.js';
7
9
  import * as i18n from '../../core/i18n/i18n.js';
8
10
  import * as SDK from '../../core/sdk/sdk.js';
9
11
  import * as Components from '../../ui/legacy/components/utils/utils.js';
12
+ import * as Main from '../main/main.js';
10
13
 
11
14
  const UIStrings = {
12
15
  /**
@@ -15,7 +18,7 @@ const UIStrings = {
15
18
  main: 'Main',
16
19
  };
17
20
 
18
- const str_ = i18n.i18n.registerUIStrings('entrypoints/js_app/JsMain.ts', UIStrings);
21
+ const str_ = i18n.i18n.registerUIStrings('entrypoints/js_app/js_app.ts', UIStrings);
19
22
  const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
20
23
 
21
24
  let jsMainImplInstance: JsMainImpl;
@@ -41,3 +44,4 @@ export class JsMainImpl implements Common.Runnable.Runnable {
41
44
  }
42
45
 
43
46
  Common.Runnable.registerEarlyInitializationRunnable(JsMainImpl.instance);
47
+ new Main.MainImpl.MainImpl();
@@ -139,7 +139,6 @@ export class MainImpl {
139
139
 
140
140
  private async loaded(): Promise<void> {
141
141
  console.timeStamp('Main._loaded');
142
- await Root.Runtime.appStarted;
143
142
  Root.Runtime.Runtime.setPlatform(Host.Platform.platform());
144
143
  const prefs = await new Promise<{[key: string]: string}>(resolve => {
145
144
  Host.InspectorFrontendHost.InspectorFrontendHostInstance.getPreferences(resolve);
@@ -4,7 +4,5 @@
4
4
  import '../shell/shell.js';
5
5
 
6
6
  import * as Main from '../main/main.js';
7
- import * as Startup from '../startup/startup.js';
8
7
 
9
8
  new Main.MainImpl.MainImpl();
10
- Startup.RuntimeInstantiator.startApplication('ndb_app');
@@ -73,9 +73,7 @@ UI.ViewManager.registerViewExtension({
73
73
  },
74
74
  });
75
75
 
76
- const runtimeInstance = Root.Runtime.Runtime.instance({forceNew: true, moduleDescriptors: []});
77
76
  // @ts-ignore Exposed for legacy layout tests
78
- self.runtime = runtimeInstance;
77
+ self.runtime = Root.Runtime.Runtime.instance({forceNew: true});
79
78
  Common.Runnable.registerEarlyInitializationRunnable(NodeMainImpl.instance);
80
79
  new Main.MainImpl.MainImpl();
81
- Root.Runtime.appStartedPromiseCallback();
@@ -3,9 +3,7 @@
3
3
  // found in the LICENSE file.
4
4
 
5
5
  import '../../Images/Images.js';
6
- import '../startup/startup.js';
7
6
  import '../../core/root/root-legacy.js';
8
- import '../../core/platform/platform.js';
9
7
  import '../../core/dom_extension/dom_extension.js';
10
8
 
11
9
  import '../../panels/sources/sources-meta.js';
@@ -17,8 +17,6 @@ import './WorkerMain.js';
17
17
  import * as Root from '../../core/root/root.js';
18
18
  import * as Main from '../main/main.js';
19
19
 
20
- const runtimeInstance = Root.Runtime.Runtime.instance({forceNew: true, moduleDescriptors: []});
21
20
  // @ts-ignore Exposed for legacy layout tests
22
- self.runtime = runtimeInstance;
21
+ self.runtime = Root.Runtime.Runtime.instance({forceNew: true});
23
22
  new Main.MainImpl.MainImpl();
24
- Root.Runtime.appStartedPromiseCallback();
@@ -1,9 +1,6 @@
1
1
  // Copyright 2020 The Chromium Authors. All rights reserved.
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
- interface StringConstructor {
5
- sprintf(format: string, ...var_arg: any): string;
6
- }
7
4
 
8
5
  interface Window {
9
6
  UI: {themeSupport: unknown}
@@ -124,7 +121,6 @@ interface Node {
124
121
 
125
122
  declare function isEnterOrSpaceKey(event: Event): boolean;
126
123
  declare function isEscKey(event: Event): boolean;
127
- declare function createPlainTextSearchRegex(query: string, flags?: string): RegExp;
128
124
  declare function onInvokeElement(element: Element, callback: (event: Event) => void): void;
129
125
 
130
126
  interface ServicePort {
@@ -23,6 +23,10 @@ self.Platform = self.Platform || {};
23
23
  self.Platform.StringUtilities = Platform.StringUtilities;
24
24
  self.Platform.MapUtilities = Platform.MapUtilities;
25
25
  self.Platform.ArrayUtilities = Platform.ArrayUtilities;
26
+ self.createPlainTextSearchRegex = Platform.StringUtilities.createPlainTextSearchRegex;
27
+ String.sprintf = Platform.StringUtilities.sprintf;
28
+ String.regexSpecialCharacters = Platform.StringUtilities.regexSpecialCharacters;
29
+ String.caseInsensetiveComparator = Platform.StringUtilities.caseInsensetiveComparator;
26
30
 
27
31
  /**
28
32
  * @return {boolean}
@@ -229,23 +233,36 @@ export function addSnifferPromise(receiver, methodName) {
229
233
  });
230
234
  }
231
235
 
232
- /** @type {function():void} */
233
- let _resolveOnFinishInits;
234
-
235
- /**
236
- * @param {string} module
237
- * @return {!Promise<undefined>}
238
- */
239
- export async function loadModule(module) {
240
- const promise = new Promise(resolve => {
241
- _resolveOnFinishInits = resolve;
242
- });
243
- await self.runtime.loadModulePromise(module);
244
- if (!_pendingInits) {
245
- return;
246
- }
247
- return promise;
248
- }
236
+ const mappingForLayoutTests = new Map([
237
+ ['panels/animation', 'animation'],
238
+ ['panels/browser_debugger', 'browser_debugger'],
239
+ ['panels/changes', 'changes'],
240
+ ['panels/console', 'console'],
241
+ ['panels/elements', 'elements'],
242
+ ['panels/emulation', 'emulation'],
243
+ ['panels/mobile_throttling', 'mobile_throttling'],
244
+ ['panels/network', 'network'],
245
+ ['panels/profiler', 'profiler'],
246
+ ['panels/application', 'resources'],
247
+ ['panels/search', 'search'],
248
+ ['panels/sources', 'sources'],
249
+ ['panels/snippets', 'snippets'],
250
+ ['panels/settings', 'settings'],
251
+ ['panels/timeline', 'timeline'],
252
+ ['panels/web_audio', 'web_audio'],
253
+ ['models/persistence', 'persistence'],
254
+ ['models/workspace_diff', 'workspace_diff'],
255
+ ['entrypoints/main', 'main'],
256
+ ['third_party/diff', 'diff'],
257
+ ['ui/legacy/components/inline_editor', 'inline_editor'],
258
+ ['ui/legacy/components/data_grid', 'data_grid'],
259
+ ['ui/legacy/components/perf_ui', 'perf_ui'],
260
+ ['ui/legacy/components/source_frame', 'source_frame'],
261
+ ['ui/legacy/components/color_picker', 'color_picker'],
262
+ ['ui/legacy/components/cookie_table', 'cookie_table'],
263
+ ['ui/legacy/components/quick_open', 'quick_open'],
264
+ ['ui/legacy/components/utils', 'components'],
265
+ ]);
249
266
 
250
267
  /**
251
268
  * @param {string} module
@@ -253,7 +270,7 @@ export async function loadModule(module) {
253
270
  */
254
271
  export async function loadLegacyModule(module) {
255
272
  let containingFolder = module;
256
- for (const [remappedFolder, originalFolder] of Root.Runtime.mappingForLayoutTests.entries()) {
273
+ for (const [remappedFolder, originalFolder] of mappingForLayoutTests.entries()) {
257
274
  if (originalFolder === module) {
258
275
  containingFolder = remappedFolder;
259
276
  }
@@ -667,9 +684,6 @@ export function addIframe(path, options = {}) {
667
684
  `);
668
685
  }
669
686
 
670
- /** @type {number} */
671
- let _pendingInits = 0;
672
-
673
687
  /**
674
688
  * The old test framework executed certain snippets in the inspected page
675
689
  * context as part of loading a test helper file.
@@ -685,12 +699,7 @@ let _pendingInits = 0;
685
699
  * @param {string} code
686
700
  */
687
701
  export async function deprecatedInitAsync(code) {
688
- _pendingInits++;
689
702
  await TestRunner.RuntimeAgent.invoke_evaluate({expression: code, objectGroup: 'console'});
690
- _pendingInits--;
691
- if (!_pendingInits && _resolveOnFinishInits !== undefined) {
692
- _resolveOnFinishInits();
693
- }
694
703
  }
695
704
 
696
705
  /**
@@ -1290,36 +1299,6 @@ export class MockSetting {
1290
1299
  }
1291
1300
  }
1292
1301
 
1293
- /**
1294
- * @return {!Array<!Root.Runtime.Module>}
1295
- */
1296
- export function loadedModules() {
1297
- return self.runtime.modules.filter(module => module.loadedForTest)
1298
- .filter(module => module.name() !== 'help')
1299
- .filter(module => module.name().indexOf('test_runner') === -1);
1300
- }
1301
-
1302
- /**
1303
- * @param {!Array<!Root.Runtime.Module>} relativeTo
1304
- * @return {!Array<!Root.Runtime.Module>}
1305
- */
1306
- export function dumpLoadedModules(relativeTo) {
1307
- const previous = new Set(relativeTo || []);
1308
- function moduleSorter(left, right) {
1309
- return Platform.StringUtilities.naturalOrderComparator(left.descriptor.name, right.descriptor.name);
1310
- }
1311
-
1312
- addResult('Loaded modules:');
1313
- const sortedLoadedModules = loadedModules().sort(moduleSorter);
1314
- for (const module of sortedLoadedModules) {
1315
- if (previous.has(module)) {
1316
- continue;
1317
- }
1318
- addResult(' ' + module.descriptor.name);
1319
- }
1320
- return sortedLoadedModules;
1321
- }
1322
-
1323
1302
  /**
1324
1303
  * @param {string} urlSuffix
1325
1304
  * @param {!Workspace.Workspace.projectTypes=} projectType
@@ -1511,13 +1490,10 @@ TestRunner.override = override;
1511
1490
  TestRunner.clearSpecificInfoFromStackFrames = clearSpecificInfoFromStackFrames;
1512
1491
  TestRunner.hideInspectorView = hideInspectorView;
1513
1492
  TestRunner.mainFrame = mainFrame;
1514
- TestRunner.loadedModules = loadedModules;
1515
- TestRunner.dumpLoadedModules = dumpLoadedModules;
1516
1493
  TestRunner.waitForUISourceCode = waitForUISourceCode;
1517
1494
  TestRunner.waitForUISourceCodeRemoved = waitForUISourceCodeRemoved;
1518
1495
  TestRunner.url = url;
1519
1496
  TestRunner.dumpSyntaxHighlight = dumpSyntaxHighlight;
1520
- TestRunner.loadModule = loadModule;
1521
1497
  TestRunner.loadLegacyModule = loadLegacyModule;
1522
1498
  TestRunner.loadTestModule = loadTestModule;
1523
1499
  TestRunner.evaluateInPageRemoteObject = evaluateInPageRemoteObject;
@@ -13,7 +13,7 @@ const UIStrings = {
13
13
  /**
14
14
  *@description Label for the link for CORS private network issues
15
15
  */
16
- corsForPrivateNetworksRfc: 'CORS for private networks (RFC1918)',
16
+ corsPrivateNetworkAccess: 'Private Network Access',
17
17
  /**
18
18
  *@description Label for the link for CORS network issues
19
19
  */
@@ -26,7 +26,6 @@ const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
26
26
  // eslint-disable-next-line rulesdir/const_enum
27
27
  export enum IssueCode {
28
28
  InsecurePrivateNetwork = 'CorsIssue::InsecurePrivateNetwork',
29
- InsecurePrivateNetworkPreflight = 'CorsIssue::InsecurePrivateNetworkPreflight',
30
29
  InvalidHeaderValues = 'CorsIssue::InvalidHeaders',
31
30
  WildcardOriginNotAllowed = 'CorsIssue::WildcardOriginWithCredentials',
32
31
  PreflightResponseInvalid = 'CorsIssue::PreflightResponseInvalid',
@@ -37,14 +36,15 @@ export enum IssueCode {
37
36
  RedirectContainsCredentials = 'CorsIssue::RedirectContainsCredentials',
38
37
  DisallowedByMode = 'CorsIssue::DisallowedByMode',
39
38
  CorsDisabledScheme = 'CorsIssue::CorsDisabledScheme',
39
+ // TODO(https://crbug.com/1263483): Remove this once it's removed from CDP.
40
40
  PreflightMissingAllowExternal = 'CorsIssue::PreflightMissingAllowExternal',
41
+ // TODO(https://crbug.com/1263483): Remove this once it's removed from CDP.
41
42
  PreflightInvalidAllowExternal = 'CorsIssue::PreflightInvalidAllowExternal',
42
43
  InvalidResponse = 'CorsIssue::InvalidResponse',
43
44
  NoCorsRedirectModeNotFollow = 'CorsIssue::NoCorsRedirectModeNotFollow',
44
45
  InvalidPrivateNetworkAccess = 'CorsIssue::InvalidPrivateNetworkAccess',
45
46
  UnexpectedPrivateNetworkAccess = 'CorsIssue::UnexpectedPrivateNetworkAccess',
46
- PreflightMissingAllowPrivateNetwork = 'CorsIssue::PreflightMissingAllowPrivateNetwork',
47
- PreflightInvalidAllowPrivateNetwork = 'CorsIssue::PreflightInvalidAllowPrivateNetwork',
47
+ PreflightAllowPrivateNetworkError = 'CorsIssue::PreflightAllowPrivateNetworkError',
48
48
  }
49
49
 
50
50
  function getIssueCode(details: Protocol.Audits.CorsIssueDetails): IssueCode {
@@ -87,8 +87,7 @@ function getIssueCode(details: Protocol.Audits.CorsIssueDetails): IssueCode {
87
87
  case Protocol.Network.CorsError.InvalidResponse:
88
88
  return IssueCode.InvalidResponse;
89
89
  case Protocol.Network.CorsError.InsecurePrivateNetwork:
90
- return details.clientSecurityState?.initiatorIsSecureContext ? IssueCode.InsecurePrivateNetworkPreflight :
91
- IssueCode.InsecurePrivateNetwork;
90
+ return IssueCode.InsecurePrivateNetwork;
92
91
  case Protocol.Network.CorsError.NoCorsRedirectModeNotFollow:
93
92
  return IssueCode.NoCorsRedirectModeNotFollow;
94
93
  case Protocol.Network.CorsError.InvalidPrivateNetworkAccess:
@@ -96,9 +95,8 @@ function getIssueCode(details: Protocol.Audits.CorsIssueDetails): IssueCode {
96
95
  case Protocol.Network.CorsError.UnexpectedPrivateNetworkAccess:
97
96
  return IssueCode.UnexpectedPrivateNetworkAccess;
98
97
  case Protocol.Network.CorsError.PreflightMissingAllowPrivateNetwork:
99
- return IssueCode.PreflightMissingAllowPrivateNetwork;
100
98
  case Protocol.Network.CorsError.PreflightInvalidAllowPrivateNetwork:
101
- return IssueCode.PreflightInvalidAllowPrivateNetwork;
99
+ return IssueCode.PreflightAllowPrivateNetworkError;
102
100
  }
103
101
  }
104
102
 
@@ -127,15 +125,15 @@ export class CorsIssue extends Issue<IssueCode> {
127
125
  file: 'corsInsecurePrivateNetwork.md',
128
126
  links: [{
129
127
  link: 'https://developer.chrome.com/blog/private-network-access-update',
130
- linkTitle: i18nString(UIStrings.corsForPrivateNetworksRfc),
128
+ linkTitle: i18nString(UIStrings.corsPrivateNetworkAccess),
131
129
  }],
132
130
  };
133
- case IssueCode.InsecurePrivateNetworkPreflight:
131
+ case IssueCode.PreflightAllowPrivateNetworkError:
134
132
  return {
135
- file: 'corsInsecurePrivateNetworkPreflight.md',
133
+ file: 'corsPreflightAllowPrivateNetworkError.md',
136
134
  links: [{
137
135
  link: 'https://developer.chrome.com/blog/private-network-access-update',
138
- linkTitle: i18nString(UIStrings.corsForPrivateNetworksRfc),
136
+ linkTitle: i18nString(UIStrings.corsPrivateNetworkAccess),
139
137
  }],
140
138
  };
141
139
  case IssueCode.InvalidHeaderValues:
@@ -231,8 +229,6 @@ export class CorsIssue extends Issue<IssueCode> {
231
229
  case IssueCode.InvalidResponse:
232
230
  case IssueCode.InvalidPrivateNetworkAccess:
233
231
  case IssueCode.UnexpectedPrivateNetworkAccess:
234
- case IssueCode.PreflightMissingAllowPrivateNetwork:
235
- case IssueCode.PreflightInvalidAllowPrivateNetwork:
236
232
  return null;
237
233
  }
238
234
  }
@@ -243,7 +239,11 @@ export class CorsIssue extends Issue<IssueCode> {
243
239
 
244
240
  getKind(): IssueKind {
245
241
  if (this.issueDetails.isWarning &&
246
- this.issueDetails.corsErrorStatus.corsError === Protocol.Network.CorsError.InsecurePrivateNetwork) {
242
+ (this.issueDetails.corsErrorStatus.corsError === Protocol.Network.CorsError.InsecurePrivateNetwork ||
243
+ this.issueDetails.corsErrorStatus.corsError ===
244
+ Protocol.Network.CorsError.PreflightMissingAllowPrivateNetwork ||
245
+ this.issueDetails.corsErrorStatus.corsError ===
246
+ Protocol.Network.CorsError.PreflightInvalidAllowPrivateNetwork)) {
247
247
  return IssueKind.BreakingChange;
248
248
  }
249
249
  return IssueKind.PageError;