chrome-devtools-frontend 1.0.978200 → 1.0.978673

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.
@@ -2,6 +2,7 @@
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 type * as Platform from '../platform/platform.js';
5
6
  import * as Protocol from '../../generated/protocol.js';
6
7
  import * as TextUtils from '../../models/text_utils/text_utils.js';
7
8
 
@@ -44,9 +45,9 @@ export class CSSRule {
44
45
  this.style.rebase(edit);
45
46
  }
46
47
 
47
- resourceURL(): string {
48
+ resourceURL(): Platform.DevToolsPath.UrlString {
48
49
  if (!this.styleSheetId) {
49
- return '';
50
+ return '' as Platform.DevToolsPath.UrlString;
50
51
  }
51
52
  const styleSheetHeader = this.getStyleSheetHeader(this.styleSheetId);
52
53
  return styleSheetHeader.resourceURL();
@@ -423,15 +423,15 @@ export class ResourceTreeModel extends SDKModel<EventTypes> {
423
423
  }
424
424
 
425
425
  async fetchAppManifest(): Promise<{
426
- url: string,
426
+ url: Platform.DevToolsPath.UrlString,
427
427
  data: string|null,
428
428
  errors: Array<Protocol.Page.AppManifestError>,
429
429
  }> {
430
430
  const response = await this.agent.invoke_getAppManifest();
431
431
  if (response.getError()) {
432
- return {url: response.url, data: null, errors: []};
432
+ return {url: response.url as Platform.DevToolsPath.UrlString, data: null, errors: []};
433
433
  }
434
- return {url: response.url, data: response.data || null, errors: response.errors};
434
+ return {url: response.url as Platform.DevToolsPath.UrlString, data: response.data || null, errors: response.errors};
435
435
  }
436
436
 
437
437
  async getInstallabilityErrors(): Promise<Protocol.Page.InstallabilityError[]> {
@@ -16,8 +16,6 @@ import * as UI from '../../ui/legacy/legacy.js';
16
16
  import type * as Protocol from '../../generated/protocol.js';
17
17
  import * as IconButton from '../../ui/components/icon_button/icon_button.js';
18
18
 
19
- // TODO(crbug.com/1253323): Casts to UrlString will be removed from this file when migration to branded types is complete.
20
-
21
19
  const UIStrings = {
22
20
  /**
23
21
  *@description Text in App Manifest View of the Application panel
@@ -543,7 +541,7 @@ export class AppManifestView extends UI.Widget.VBox implements SDK.TargetManager
543
541
  }
544
542
 
545
543
  private async renderManifest(
546
- url: string, data: string|null, errors: Protocol.Page.AppManifestError[],
544
+ url: Platform.DevToolsPath.UrlString, data: string|null, errors: Protocol.Page.AppManifestError[],
547
545
  installabilityErrors: Protocol.Page.InstallabilityError[], manifestIcons: {
548
546
  primaryIcon: string|null,
549
547
  },
@@ -642,12 +640,13 @@ export class AppManifestView extends UI.Widget.VBox implements SDK.TargetManager
642
640
 
643
641
  this.startURLField.removeChildren();
644
642
  if (startURL) {
645
- const completeURL =
646
- (Common.ParsedURL.ParsedURL.completeURL(url as Platform.DevToolsPath.UrlString, startURL) as string);
647
- const link = Components.Linkifier.Linkifier.linkifyURL(
648
- completeURL, ({text: startURL} as Components.Linkifier.LinkifyURLOptions));
649
- link.tabIndex = 0;
650
- this.startURLField.appendChild(link);
643
+ const completeURL = Common.ParsedURL.ParsedURL.completeURL(url, startURL);
644
+ if (completeURL) {
645
+ const link = Components.Linkifier.Linkifier.linkifyURL(
646
+ completeURL, ({text: startURL} as Components.Linkifier.LinkifyURLOptions));
647
+ link.tabIndex = 0;
648
+ this.startURLField.appendChild(link);
649
+ }
651
650
  }
652
651
 
653
652
  this.themeColorSwatch.classList.toggle('hidden', !stringProperty('theme_color'));
@@ -694,8 +693,7 @@ export class AppManifestView extends UI.Widget.VBox implements SDK.TargetManager
694
693
  this.newNoteUrlField.parentElement?.classList.toggle('hidden', !hasNewNoteUrl);
695
694
  this.newNoteUrlField.removeChildren();
696
695
  if (hasNewNoteUrl) {
697
- const completeURL =
698
- (Common.ParsedURL.ParsedURL.completeURL(url as Platform.DevToolsPath.UrlString, newNoteUrl) as string);
696
+ const completeURL = (Common.ParsedURL.ParsedURL.completeURL(url, newNoteUrl) as string);
699
697
  const link = Components.Linkifier.Linkifier.linkifyURL(
700
698
  completeURL, ({text: newNoteUrl} as Components.Linkifier.LinkifyURLOptions));
701
699
  link.tabIndex = 0;
@@ -765,8 +763,7 @@ export class AppManifestView extends UI.Widget.VBox implements SDK.TargetManager
765
763
  shortcutSection.appendFlexedField('Description', shortcut.description);
766
764
  }
767
765
  const urlField = shortcutSection.appendFlexedField('URL');
768
- const shortcutUrl =
769
- (Common.ParsedURL.ParsedURL.completeURL(url as Platform.DevToolsPath.UrlString, shortcut.url) as string);
766
+ const shortcutUrl = (Common.ParsedURL.ParsedURL.completeURL(url, shortcut.url) as string);
770
767
  const link = Components.Linkifier.Linkifier.linkifyURL(
771
768
  shortcutUrl, ({text: shortcut.url} as Components.Linkifier.LinkifyURLOptions));
772
769
  link.tabIndex = 0;
@@ -1018,7 +1015,8 @@ export class AppManifestView extends UI.Widget.VBox implements SDK.TargetManager
1018
1015
  private async appendImageResourceToSection(
1019
1016
  // TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration)
1020
1017
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
1021
- baseUrl: string, imageResource: any, section: UI.ReportView.Section, isScreenshot: boolean):
1018
+ baseUrl: Platform.DevToolsPath.UrlString, imageResource: any, section: UI.ReportView.Section,
1019
+ isScreenshot: boolean):
1022
1020
  Promise<{imageResourceErrors: Platform.UIString.LocalizedString[], squareSizedIconAvailable?: boolean}> {
1023
1021
  const imageResourceErrors: Platform.UIString.LocalizedString[] = [];
1024
1022
  const resourceName = isScreenshot ? i18nString(UIStrings.screenshot) : i18nString(UIStrings.icon);
@@ -1026,8 +1024,7 @@ export class AppManifestView extends UI.Widget.VBox implements SDK.TargetManager
1026
1024
  imageResourceErrors.push(i18nString(UIStrings.sSrcIsNotSet, {PH1: resourceName}));
1027
1025
  return {imageResourceErrors};
1028
1026
  }
1029
- const imageUrl =
1030
- Common.ParsedURL.ParsedURL.completeURL(baseUrl as Platform.DevToolsPath.UrlString, imageResource['src']);
1027
+ const imageUrl = Common.ParsedURL.ParsedURL.completeURL(baseUrl, imageResource['src']);
1031
1028
  if (!imageUrl) {
1032
1029
  imageResourceErrors.push(
1033
1030
  i18nString(UIStrings.sUrlSFailedToParse, {PH1: resourceName, PH2: imageResource['src']}));
@@ -3,7 +3,6 @@
3
3
  // found in the LICENSE file.
4
4
 
5
5
  import * as Common from '../../core/common/common.js';
6
- import type * as Platform from '../../core/platform/platform.js';
7
6
  import type * as SDK from '../../core/sdk/sdk.js';
8
7
  import type * as Protocol from '../../generated/protocol.js';
9
8
 
@@ -81,10 +80,7 @@ export function parseSourcePositionsFromErrorStack(
81
80
  }
82
81
  let url = parseOrScriptMatch(debuggerModel, splitResult.url);
83
82
  if (!url && Common.ParsedURL.ParsedURL.isRelativeURL(splitResult.url)) {
84
- // TODO(crbug.com/1253323): Cast to UrlString will be removed when migration to branded types is complete.
85
- url = parseOrScriptMatch(
86
- debuggerModel,
87
- Common.ParsedURL.ParsedURL.completeURL(baseURL as Platform.DevToolsPath.UrlString, splitResult.url));
83
+ url = parseOrScriptMatch(debuggerModel, Common.ParsedURL.ParsedURL.completeURL(baseURL, splitResult.url));
88
84
  }
89
85
  if (!url) {
90
86
  return null;
@@ -3461,8 +3461,7 @@ export class StylesSidebarPropertyRenderer {
3461
3461
  UI.UIUtils.createTextChild(container, 'url(');
3462
3462
  let hrefUrl: (string|null)|null = null;
3463
3463
  if (this.rule && this.rule.resourceURL()) {
3464
- // TODO(crbug.com/1253323): Cast to UrlString will be removed when migration to branded types is complete.
3465
- hrefUrl = Common.ParsedURL.ParsedURL.completeURL(this.rule.resourceURL() as Platform.DevToolsPath.UrlString, url);
3464
+ hrefUrl = Common.ParsedURL.ParsedURL.completeURL(this.rule.resourceURL(), url);
3466
3465
  } else if (this.node) {
3467
3466
  hrefUrl = this.node.resolveURL(url);
3468
3467
  }
@@ -13,6 +13,8 @@ import type * as TextUtils from '../../models/text_utils/text_utils.js';
13
13
  import * as UI from '../../ui/legacy/legacy.js';
14
14
  import * as Workspace from '../../models/workspace/workspace.js';
15
15
 
16
+ // TODO(crbug.com/1253323): Cast to EncodedPathString will be removed from this file when migration to branded types is complete.
17
+
16
18
  const UIStrings = {
17
19
  /**
18
20
  *@description Default snippet name when a new snippet is created in the Sources panel
@@ -40,7 +42,6 @@ export class SnippetFileSystem extends Persistence.PlatformFileSystem.PlatformFi
40
42
  private readonly lastSnippetIdentifierSetting: Common.Settings.Setting<number>;
41
43
  private readonly snippetsSetting: Common.Settings.Setting<Snippet[]>;
42
44
  constructor() {
43
- // TODO(crbug.com/1253323): Cast to UrlString will be removed when migration to branded types is complete.
44
45
  super('snippet://', 'snippets');
45
46
  this.lastSnippetIdentifierSetting =
46
47
  Common.Settings.Settings.instance().createSetting('scriptSnippets_lastIdentifier', 0);
@@ -178,7 +178,7 @@ export class ImagePreview {
178
178
 
179
179
  // TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration
180
180
  // @ts-expect-error
181
- const featuresObject = object.callFunctionJSON(features, undefined);
181
+ const featuresObject = await object.callFunctionJSON(features, undefined);
182
182
  object.release();
183
183
  return featuresObject;
184
184
 
package/package.json CHANGED
@@ -54,5 +54,5 @@
54
54
  "unittest": "scripts/test/run_unittests.py --no-text-coverage",
55
55
  "watch": "third_party/node/node.py --output scripts/watch_build.js"
56
56
  },
57
- "version": "1.0.978200"
57
+ "version": "1.0.978673"
58
58
  }