Migrate network/ to import cross-module
Bug: 1006759
Change-Id: I3fc6be48f30ca087b6396cb046c0fbc0f43e018f
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2035946
Reviewed-by: Paul Lewis <[email protected]>
Commit-Queue: Tim van der Lippe <[email protected]>
diff --git a/front_end/network/SignedExchangeInfoView.js b/front_end/network/SignedExchangeInfoView.js
index 07df234..f968681 100644
--- a/front_end/network/SignedExchangeInfoView.js
+++ b/front_end/network/SignedExchangeInfoView.js
@@ -2,9 +2,15 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-export class SignedExchangeInfoView extends UI.VBox {
+import * as Common from '../common/common.js';
+import * as Components from '../components/components.js';
+import * as Host from '../host/host.js';
+import * as SDK from '../sdk/sdk.js'; // eslint-disable-line no-unused-vars
+import * as UI from '../ui/ui.js';
+
+export class SignedExchangeInfoView extends UI.Widget.VBox {
/**
- * @param {!SDK.NetworkRequest} request
+ * @param {!SDK.NetworkRequest.NetworkRequest} request
*/
constructor(request) {
super();
@@ -14,7 +20,7 @@
this.registerRequiredCSS('network/signedExchangeInfoView.css');
this.element.classList.add('signed-exchange-info-view');
- const root = new UI.TreeOutlineInShadow();
+ const root = new UI.TreeOutline.TreeOutlineInShadow();
root.registerRequiredCSS('network/signedExchangeInfoTree.css');
root.element.classList.add('signed-exchange-info-tree');
root.setFocusable(false);
@@ -26,10 +32,10 @@
const errorFieldSetMap = new Map();
if (signedExchangeInfo.errors && signedExchangeInfo.errors.length) {
- const errorMessagesCategory = new Category(root, Common.UIString('Errors'));
+ const errorMessagesCategory = new Category(root, Common.UIString.UIString('Errors'));
for (const error of signedExchangeInfo.errors) {
const fragment = createDocumentFragment();
- fragment.appendChild(UI.Icon.create('smallicon-error', 'prompt-icon'));
+ fragment.appendChild(UI.Icon.Icon.create('smallicon-error', 'prompt-icon'));
fragment.createChild('div', 'error-log').textContent = error.message;
errorMessagesCategory.createLeaf(fragment);
if (error.errorField) {
@@ -44,29 +50,31 @@
}
const titleElement = createDocumentFragment();
- titleElement.createChild('div', 'header-name').textContent = Common.UIString('Signed HTTP exchange');
- const learnMoreNode =
- UI.XLink.create('https://github.com/WICG/webpackage', Common.UIString('Learn\xa0more'), 'header-toggle');
+ titleElement.createChild('div', 'header-name').textContent = Common.UIString.UIString('Signed HTTP exchange');
+ const learnMoreNode = UI.XLink.XLink.create(
+ 'https://github.com/WICG/webpackage', Common.UIString.UIString('Learn\xa0more'), 'header-toggle');
titleElement.appendChild(learnMoreNode);
const headerCategory = new Category(root, titleElement);
if (signedExchangeInfo.header) {
const header = signedExchangeInfo.header;
const redirectDestination = request.redirectDestination();
- const requestURLElement = this._formatHeader(Common.UIString('Request URL'), header.requestUrl);
+ const requestURLElement = this._formatHeader(Common.UIString.UIString('Request URL'), header.requestUrl);
if (redirectDestination) {
- const viewRequestLink = Components.Linkifier.linkifyRevealable(redirectDestination, 'View request');
+ const viewRequestLink = Components.Linkifier.Linkifier.linkifyRevealable(redirectDestination, 'View request');
viewRequestLink.classList.add('header-toggle');
requestURLElement.appendChild(viewRequestLink);
}
headerCategory.createLeaf(requestURLElement);
- headerCategory.createLeaf(this._formatHeader(Common.UIString('Response code'), header.responseCode + ''));
- headerCategory.createLeaf(this._formatHeader(Common.UIString('Header integrity hash'), header.headerIntegrity));
+ headerCategory.createLeaf(
+ this._formatHeader(Common.UIString.UIString('Response code'), header.responseCode + ''));
+ headerCategory.createLeaf(
+ this._formatHeader(Common.UIString.UIString('Header integrity hash'), header.headerIntegrity));
this._responseHeadersItem =
- headerCategory.createLeaf(this._formatHeader(Common.UIString('Response headers'), ''));
+ headerCategory.createLeaf(this._formatHeader(Common.UIString.UIString('Response headers'), ''));
const responseHeaders = header.responseHeaders;
for (const name in responseHeaders) {
- const headerTreeElement = new UI.TreeElement(this._formatHeader(name, responseHeaders[name]));
+ const headerTreeElement = new UI.TreeOutline.TreeElement(this._formatHeader(name, responseHeaders[name]));
headerTreeElement.selectable = false;
this._responseHeadersItem.appendChild(headerTreeElement);
}
@@ -75,52 +83,55 @@
for (let i = 0; i < header.signatures.length; ++i) {
const errorFieldSet = errorFieldSetMap.get(i) || new Set();
const signature = header.signatures[i];
- const signatureCategory = new Category(root, Common.UIString('Signature'));
- signatureCategory.createLeaf(this._formatHeader(Common.UIString('Label'), signature.label));
+ const signatureCategory = new Category(root, Common.UIString.UIString('Signature'));
+ signatureCategory.createLeaf(this._formatHeader(Common.UIString.UIString('Label'), signature.label));
signatureCategory.createLeaf(this._formatHeaderForHexData(
- Common.UIString('Signature'), signature.signature,
+ Common.UIString.UIString('Signature'), signature.signature,
errorFieldSet.has(Protocol.Network.SignedExchangeErrorField.SignatureSig)));
if (signature.certUrl) {
const certURLElement = this._formatHeader(
- Common.UIString('Certificate URL'), signature.certUrl,
+ Common.UIString.UIString('Certificate URL'), signature.certUrl,
errorFieldSet.has(Protocol.Network.SignedExchangeErrorField.SignatureCertUrl));
if (signature.certificates) {
const viewCertLink = certURLElement.createChild('span', 'devtools-link header-toggle');
- viewCertLink.textContent = Common.UIString('View certificate');
+ viewCertLink.textContent = Common.UIString.UIString('View certificate');
viewCertLink.addEventListener(
- 'click', Host.InspectorFrontendHost.showCertificateViewer.bind(null, signature.certificates), false);
+ 'click',
+ Host.InspectorFrontendHost.InspectorFrontendHostInstance.showCertificateViewer.bind(
+ null, signature.certificates),
+ false);
}
signatureCategory.createLeaf(certURLElement);
}
signatureCategory.createLeaf(this._formatHeader(
- Common.UIString('Integrity'), signature.integrity,
+ Common.UIString.UIString('Integrity'), signature.integrity,
errorFieldSet.has(Protocol.Network.SignedExchangeErrorField.SignatureIntegrity)));
if (signature.certSha256) {
signatureCategory.createLeaf(this._formatHeaderForHexData(
- Common.UIString('Certificate SHA256'), signature.certSha256,
+ Common.UIString.UIString('Certificate SHA256'), signature.certSha256,
errorFieldSet.has(Protocol.Network.SignedExchangeErrorField.SignatureCertSha256)));
}
signatureCategory.createLeaf(this._formatHeader(
- Common.UIString('Validity URL'), signature.validityUrl,
+ Common.UIString.UIString('Validity URL'), signature.validityUrl,
errorFieldSet.has(Protocol.Network.SignedExchangeErrorField.SignatureValidityUrl)));
signatureCategory.createLeaf().title = this._formatHeader(
- Common.UIString('Date'), new Date(1000 * signature.date).toUTCString(),
+ Common.UIString.UIString('Date'), new Date(1000 * signature.date).toUTCString(),
errorFieldSet.has(Protocol.Network.SignedExchangeErrorField.SignatureTimestamps));
signatureCategory.createLeaf().title = this._formatHeader(
- Common.UIString('Expires'), new Date(1000 * signature.expires).toUTCString(),
+ Common.UIString.UIString('Expires'), new Date(1000 * signature.expires).toUTCString(),
errorFieldSet.has(Protocol.Network.SignedExchangeErrorField.SignatureTimestamps));
}
}
if (signedExchangeInfo.securityDetails) {
const securityDetails = signedExchangeInfo.securityDetails;
- const securityCategory = new Category(root, Common.UIString('Certificate'));
- securityCategory.createLeaf(this._formatHeader(Common.UIString('Subject'), securityDetails.subjectName));
- securityCategory.createLeaf(
- this._formatHeader(Common.UIString('Valid from'), new Date(1000 * securityDetails.validFrom).toUTCString()));
- securityCategory.createLeaf(
- this._formatHeader(Common.UIString('Valid until'), new Date(1000 * securityDetails.validTo).toUTCString()));
- securityCategory.createLeaf(this._formatHeader(Common.UIString('Issuer'), securityDetails.issuer));
+ const securityCategory = new Category(root, Common.UIString.UIString('Certificate'));
+ securityCategory.createLeaf(this._formatHeader(Common.UIString.UIString('Subject'), securityDetails.subjectName));
+ securityCategory.createLeaf(this._formatHeader(
+ Common.UIString.UIString('Valid from'), new Date(1000 * securityDetails.validFrom).toUTCString()));
+ securityCategory.createLeaf(this._formatHeader(
+ Common.UIString.UIString('Valid until'), new Date(1000 * securityDetails.validTo).toUTCString()));
+ securityCategory.createLeaf(this._formatHeader(Common.UIString.UIString('Issuer'), securityDetails.issuer));
}
}
@@ -168,9 +179,9 @@
/**
* @unrestricted
*/
-export class Category extends UI.TreeElement {
+export class Category extends UI.TreeOutline.TreeElement {
/**
- * @param {!UI.TreeOutline} root
+ * @param {!UI.TreeOutline.TreeOutline} root
* @param {(string|!Node)=} title
*/
constructor(root, title) {
@@ -185,7 +196,7 @@
* @param {(string|!Node)=} title
*/
createLeaf(title) {
- const leaf = new UI.TreeElement(title);
+ const leaf = new UI.TreeOutline.TreeElement(title);
leaf.selectable = false;
this.appendChild(leaf);
return leaf;