Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update devtools patches #6959

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -229,3 +229,9 @@ runtime-versions.md
.e2e-test-report/

.dev.vars

# Devtools build artefacts
.gclient
.gclient_entries
.gclient_previous_sync_commits
.gcs_entries
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,5 @@ templates/*/dist

# This file intentionally has a syntax error
fixtures/interactive-dev-tests/src/startup-error.ts

packages/wrangler-devtools/devtools-frontend
2 changes: 1 addition & 1 deletion packages/wrangler-devtools/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ROOT = $(realpath .)
PATH_WITH_DEPOT = $(PATH):$(ROOT)/depot/
# The upstream devtools commit upon which our patches are based
HEAD = 64208f10b3efe06a92c58d345bd828832d09c4a7
HEAD = 314f0473c9074ebb1c63328d3044440e5f49913b
PATCHES = $(shell ls ${PWD}/patches/*.patch)
depot:
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git depot
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 24644cc732ec4bf8589715e853067eadd1b52e29 Mon Sep 17 00:00:00 2001
From 9c08db34087cad21bdcef72128bb23be9846ddb0 Mon Sep 17 00:00:00 2001
From: Workers DevProd <workers-devprod@cloudflare.com>
Date: Mon, 2 Oct 2023 18:13:34 +0100
Subject: [PATCH 01/15] Support viewing files over the network
Subject: [PATCH 01/14] Support viewing files over the network

---
front_end/core/sdk/Target.ts | 4 ++++
Expand All @@ -11,45 +11,45 @@ Subject: [PATCH 01/15] Support viewing files over the network
4 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/front_end/core/sdk/Target.ts b/front_end/core/sdk/Target.ts
index eed909ea64..5e1778885d 100644
index f5f812b001..07072175b7 100644
--- a/front_end/core/sdk/Target.ts
+++ b/front_end/core/sdk/Target.ts
@@ -82,6 +82,9 @@ export class Target extends ProtocolClient.InspectorBackend.TargetBase {
case Type.Tab:
this.#capabilitiesMask = Capability.Target | Capability.Tracing;
@@ -85,6 +85,9 @@ export class Target extends ProtocolClient.InspectorBackend.TargetBase {
case Type.TAB:
this.#capabilitiesMask = Capability.TARGET | Capability.TRACING;
break;
+ case Type.Cloudflare:
+ this.#capabilitiesMask = Capability.JS | Capability.Network;
+ case Type.CLOUDFLARE:
+ this.#capabilitiesMask = Capability.JS | Capability.NETWORK;
+ break;
}
this.#typeInternal = type;
this.#parentTargetInternal = parentTarget;
@@ -255,6 +258,7 @@ export enum Type {
Browser = 'browser',
AuctionWorklet = 'auction-worklet',
Tab = 'tab',
+ Cloudflare = 'cloudflare',
@@ -259,6 +262,7 @@ export enum Type {
AUCTION_WORKLET = 'auction-worklet',
WORKLET = 'worklet',
TAB = 'tab',
+ CLOUDFLARE = 'cloudflare',
}

// TODO(crbug.com/1167717): Make this a const enum again
export const enum Capability {
diff --git a/front_end/entrypoints/js_app/js_app.ts b/front_end/entrypoints/js_app/js_app.ts
index cafecfa4ba..213ca7fecd 100644
index 45028f436a..39a4b237b7 100644
--- a/front_end/entrypoints/js_app/js_app.ts
+++ b/front_end/entrypoints/js_app/js_app.ts
@@ -38,7 +38,7 @@ export class JsMainImpl implements Common.Runnable.Runnable {
@@ -57,7 +57,7 @@ export class JsMainImpl implements Common.Runnable.Runnable {
Host.userMetrics.actionTaken(Host.UserMetrics.Action.ConnectToNodeJSDirectly);
void SDK.Connections.initMainConnection(async () => {
const target = SDK.TargetManager.TargetManager.instance().createTarget(
- 'main', i18nString(UIStrings.main), SDK.Target.Type.Node, null);
+ 'main', i18nString(UIStrings.main), SDK.Target.Type.Cloudflare, null);
- 'main', i18nString(UIStrings.main), SDK.Target.Type.NODE, null);
+ 'main', i18nString(UIStrings.main), SDK.Target.Type.CLOUDFLARE, null);
void target.runtimeAgent().invoke_runIfWaitingForDebugger();
}, Components.TargetDetachedDialog.TargetDetachedDialog.webSocketConnectionLost);
}
diff --git a/front_end/panels/sources/sources-meta.ts b/front_end/panels/sources/sources-meta.ts
index a0c126df12..4b8244ea69 100644
index 42a2e17f07..9713c169a0 100644
--- a/front_end/panels/sources/sources-meta.ts
+++ b/front_end/panels/sources/sources-meta.ts
@@ -41,6 +41,11 @@ const UIStrings = {
@@ -40,6 +40,11 @@ const UIStrings = {
*@description Title of the 'Snippets' tool in the Snippets Navigator View, which is part of the Sources tool
*/
snippets: 'Snippets',
Expand All @@ -61,7 +61,7 @@ index a0c126df12..4b8244ea69 100644
/**
*@description Command for showing the 'Search' tool
*/
@@ -454,14 +459,14 @@ UI.ViewManager.registerViewExtension({
@@ -497,14 +502,14 @@ UI.ViewManager.registerViewExtension({

UI.ViewManager.registerViewExtension({
location: UI.ViewManager.ViewLocationValues.NAVIGATOR_VIEW,
Expand All @@ -74,16 +74,16 @@ index a0c126df12..4b8244ea69 100644
persistence: UI.ViewManager.ViewPersistence.PERMANENT,
async loadView() {
const Sources = await loadSourcesModule();
- return Sources.SourcesNavigator.FilesNavigatorView.instance();
- return new Sources.SourcesNavigator.FilesNavigatorView();
+ return Sources.SourcesNavigator.NetworkNavigatorView.instance();
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need a new?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, good spot 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, apparently not. It uses the static method to instantiate.

});

diff --git a/tsconfig.json b/tsconfig.json
index ac0d4aaf68..29c726e185 100644
index b3be02e26b..811051314d 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -16,6 +16,7 @@
@@ -17,6 +17,7 @@
"inspector_overlay"
],
"exclude": [
Expand All @@ -93,5 +93,5 @@ index ac0d4aaf68..29c726e185 100644
]
}
--
2.39.3 (Apple Git-145)
2.39.5 (Apple Git-154)

Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
From 0ccfb994361f1fa467f7ea441131f4a079cea607 Mon Sep 17 00:00:00 2001
From 139a1d5f797fba311b5d6c2082b2e3b2b49c584d Mon Sep 17 00:00:00 2001
From: Workers DevProd <workers-devprod@cloudflare.com>
Date: Mon, 2 Oct 2023 18:18:45 +0100
Subject: [PATCH 02/15] Show fallback image on Safari
Subject: [PATCH 02/14] Show fallback image on Safari

---
config/gni/devtools_grd_files.gni | 1 +
config/gni/devtools_image_files.gni | 1 +
front_end/Images/fake.png | Bin 0 -> 100371 bytes
front_end/entrypoint_template.html | 27 +++++++++++++++++++++++++--
4 files changed, 27 insertions(+), 2 deletions(-)
front_end/entrypoint_template.html | 31 +++++++++++++++++++++++++---
4 files changed, 30 insertions(+), 3 deletions(-)
create mode 100644 front_end/Images/fake.png

diff --git a/config/gni/devtools_grd_files.gni b/config/gni/devtools_grd_files.gni
index f0007ac34b..5e2281b2e7 100644
index 1f503a9343..4fee3aaee1 100644
--- a/config/gni/devtools_grd_files.gni
+++ b/config/gni/devtools_grd_files.gni
@@ -58,6 +58,7 @@ grd_files_release_sources = [
@@ -63,6 +63,7 @@ grd_files_release_sources = [
"front_end/Images/check-circle.svg",
"front_end/Images/check-double.svg",
"front_end/Images/checker.svg",
Expand All @@ -24,7 +24,7 @@ index f0007ac34b..5e2281b2e7 100644
"front_end/Images/chevron-double-right.svg",
"front_end/Images/chevron-down.svg",
diff --git a/config/gni/devtools_image_files.gni b/config/gni/devtools_image_files.gni
index 042be12dfd..7439a30ab7 100644
index 1a58c672f7..c0d3fe22b6 100644
--- a/config/gni/devtools_image_files.gni
+++ b/config/gni/devtools_image_files.gni
@@ -8,6 +8,7 @@ devtools_image_files = [
Expand Down Expand Up @@ -1778,17 +1778,19 @@ literal 0
HcmV?d00001

diff --git a/front_end/entrypoint_template.html b/front_end/entrypoint_template.html
index 1edaec9604..945aa6d816 100644
index 8e0e11ca35..545f701684 100644
--- a/front_end/entrypoint_template.html
+++ b/front_end/entrypoint_template.html
@@ -14,7 +14,30 @@
@@ -14,7 +14,32 @@
}
}
</style>
-<meta http-equiv="Content-Security-Policy" content="object-src 'none'; script-src 'self' 'unsafe-eval' https://chrome-devtools-frontend.appspot.com">
+<meta http-equiv="Content-Security-Policy" content="object-src 'none'; script-src 'sha256-7cSoIgLSn2W/Jf+ovCaVMDQtS5K1xhtFhl5WQtvvAaQ=' 'self' 'unsafe-eval' https://chrome-devtools-frontend.appspot.com">
-<meta http-equiv="Content-Security-Policy" content="object-src 'none'; script-src 'self' https://chrome-devtools-frontend.appspot.com">
+<meta http-equiv="Content-Security-Policy"
+ content="object-src 'none'; script-src 'sha256-7cSoIgLSn2W/Jf+ovCaVMDQtS5K1xhtFhl5WQtvvAaQ=' 'self' 'unsafe-eval' https://chrome-devtools-frontend.appspot.com">
<meta name="referrer" content="no-referrer">
-<script type="module" src="./entrypoints/%ENTRYPOINT_NAME%/%ENTRYPOINT_NAME%.js"></script>
-<body class="undocked" id="-blink-dev-tools">
+<script>
+ var supportsCustomElements = false;
+
Expand All @@ -1813,7 +1815,9 @@ index 1edaec9604..945aa6d816 100644
+ document.head.append(script)
+ }
+</script>
<body class="undocked" id="-blink-dev-tools">
+
+<body class="undocked" id="-blink-dev-tools">
\ No newline at end of file
--
2.39.3 (Apple Git-145)
2.39.5 (Apple Git-154)

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 95b2dc1f6cf0f02c3c52da17c0cec1f6fdbf6035 Mon Sep 17 00:00:00 2001
From c70d702b20aefb940d7108b348265123403ef7d0 Mon Sep 17 00:00:00 2001
From: Workers DevProd <workers-devprod@cloudflare.com>
Date: Mon, 2 Oct 2023 18:22:08 +0100
Subject: [PATCH 03/15] Support previewing subrequest responses
Subject: [PATCH 03/14] Support previewing subrequest responses

---
front_end/core/sdk/NetworkManager.ts | 7 ++++++-
Expand All @@ -10,10 +10,10 @@ Subject: [PATCH 03/15] Support previewing subrequest responses
3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/front_end/core/sdk/NetworkManager.ts b/front_end/core/sdk/NetworkManager.ts
index c8aa624961..6201d73bba 100644
index e9d60c5b49..734a39f9bc 100644
--- a/front_end/core/sdk/NetworkManager.ts
+++ b/front_end/core/sdk/NetworkManager.ts
@@ -705,7 +705,7 @@ export class NetworkDispatcher implements ProtocolProxyApi.NetworkDispatcher {
@@ -794,7 +794,7 @@ export class NetworkDispatcher implements ProtocolProxyApi.NetworkDispatcher {
this.updateNetworkRequest(networkRequest);
}

Expand All @@ -22,42 +22,42 @@ index c8aa624961..6201d73bba 100644
let networkRequest: NetworkRequest|null|undefined = this.#requestsById.get(requestId);
if (!networkRequest) {
networkRequest = this.maybeAdoptMainResourceRequest(requestId);
@@ -714,6 +714,11 @@ export class NetworkDispatcher implements ProtocolProxyApi.NetworkDispatcher {
@@ -803,6 +803,11 @@ export class NetworkDispatcher implements ProtocolProxyApi.NetworkDispatcher {
return;
}
this.getExtraInfoBuilder(requestId).finished();
+ if (cfResponse !== undefined) {
+ networkRequest.setContentDataProvider(async () => {
+ return { error: null, content: cfResponse.body, encoded: cfResponse.base64Encoded };
+ return { error: '', content: cfResponse.body, encoded: cfResponse.base64Encoded };
+ });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a new type constraint in the frontend-devtools application.

+ }
this.finishNetworkRequest(networkRequest, finishTime, encodedDataLength);
this.#manager.dispatchEventToListeners(Events.LoadingFinished, networkRequest);
}
diff --git a/front_end/entrypoints/js_app/BUILD.gn b/front_end/entrypoints/js_app/BUILD.gn
index a917511e25..f811d117b1 100644
index c44a7a352b..2ee6e03a03 100644
--- a/front_end/entrypoints/js_app/BUILD.gn
+++ b/front_end/entrypoints/js_app/BUILD.gn
@@ -15,6 +15,7 @@ devtools_entrypoint("entrypoint") {
"../../generated:protocol",
"../../panels/js_profiler:meta",
"../../panels/js_timeline:meta",
"../../panels/mobile_throttling:meta",
+ "../../panels/network:meta",
"../../ui/legacy/components/utils:bundle",
"../main:bundle",
"../shell",
diff --git a/front_end/entrypoints/js_app/js_app.ts b/front_end/entrypoints/js_app/js_app.ts
index 213ca7fecd..ef5c568e96 100644
index 39a4b237b7..64fa67a316 100644
--- a/front_end/entrypoints/js_app/js_app.ts
+++ b/front_end/entrypoints/js_app/js_app.ts
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -4,6 +4,7 @@

import '../shell/shell.js';
import '../../panels/js_timeline/js_timeline-meta.js';
+import '../../panels/network/network-meta.js';
import '../../panels/mobile_throttling/mobile_throttling-meta.js';
import '../../panels/js_profiler/js_profiler-meta.js';

import * as Common from '../../core/common/common.js';
--
2.39.3 (Apple Git-145)
2.39.5 (Apple Git-154)

Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
From 83b63469d06e2318f880c417c168f5494edf89fa Mon Sep 17 00:00:00 2001
From 2932b512ce27c800e5f3bf956d8c920ca1839221 Mon Sep 17 00:00:00 2001
From: Samuel Macleod <smacleod@cloudflare.com>
Date: Thu, 19 Jan 2023 15:47:52 +0000
Subject: [PATCH 04/15] Better Firefox support for network tab
Subject: [PATCH 04/14] Better Firefox support for network tab

---
front_end/entrypoints/js_app/js_app.ts | 2 ++
front_end/ui/legacy/components/data_grid/DataGrid.ts | 5 +++++
2 files changed, 7 insertions(+)

diff --git a/front_end/entrypoints/js_app/js_app.ts b/front_end/entrypoints/js_app/js_app.ts
index ef5c568e96..f6a3a1641f 100644
index 64fa67a316..25a459f122 100644
--- a/front_end/entrypoints/js_app/js_app.ts
+++ b/front_end/entrypoints/js_app/js_app.ts
@@ -25,6 +25,8 @@ const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);

let jsMainImplInstance: JsMainImpl;

@@ -44,6 +44,8 @@ async function loadSourcesModule(): Promise<typeof Sources> {
}
return loadedSourcesModule;
}
+// This is not supported in Firefox: https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView
+Element.prototype.scrollIntoViewIfNeeded = Element.prototype.scrollIntoView;
export class JsMainImpl implements Common.Runnable.Runnable {
static instance(opts: {forceNew: boolean|null} = {forceNew: null}): JsMainImpl {
const {forceNew} = opts;
diff --git a/front_end/ui/legacy/components/data_grid/DataGrid.ts b/front_end/ui/legacy/components/data_grid/DataGrid.ts
index 88c258f54f..0648649ccf 100644
index 93a117e746..5c667b6b77 100644
--- a/front_end/ui/legacy/components/data_grid/DataGrid.ts
+++ b/front_end/ui/legacy/components/data_grid/DataGrid.ts
@@ -218,6 +218,8 @@ export class DataGridImpl<T> extends Common.ObjectWrapper.ObjectWrapper<EventTyp
@@ -217,6 +217,8 @@ export class DataGridImpl<T> extends Common.ObjectWrapper.ObjectWrapper<EventTyp
this.headerRow = this.dataTableHeadInternal.createChild('tr');

this.dataTableBody = this.dataTable.createChild('tbody');
Expand All @@ -34,7 +34,7 @@ index 88c258f54f..0648649ccf 100644
this.topFillerRow = (this.dataTableBody.createChild('tr', 'data-grid-filler-row revealed') as HTMLElement);
UI.ARIAUtils.setHidden(this.topFillerRow, true);
this.bottomFillerRow = (this.dataTableBody.createChild('tr', 'data-grid-filler-row revealed') as HTMLElement);
@@ -500,6 +502,9 @@ export class DataGridImpl<T> extends Common.ObjectWrapper.ObjectWrapper<EventTyp
@@ -505,6 +507,9 @@ export class DataGridImpl<T> extends Common.ObjectWrapper.ObjectWrapper<EventTyp
protected setVerticalPadding(top: number, bottom: number, isConstructorTime: boolean = false): void {
const topPx = top + 'px';
const bottomPx = (top || bottom) ? bottom + 'px' : 'auto';
Expand All @@ -45,5 +45,5 @@ index 88c258f54f..0648649ccf 100644
return;
}
--
2.39.3 (Apple Git-145)
2.39.5 (Apple Git-154)

Loading
Loading