Skip to content

Commit 788ac88

Browse files
authored
fix(chrome): new debug url with chrome (#5319)
1 parent 4c005ca commit 788ac88

File tree

5 files changed

+33
-32
lines changed

5 files changed

+33
-32
lines changed

lib/controllers/debug-controller.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ export class DebugController extends EventEmitter implements IDebugController {
157157
this.emit(DEBUGGER_ATTACHED_EVENT_NAME, debugInformation);
158158
}
159159

160-
this.$logger.info(`To start debugging, open the following URL in Chrome:${EOL}${debugInformation.url}${EOL}`.cyan);
160+
this.$logger.info(`To start debugging, open the following URL in Chrome:${EOL}${debugInformation.url}${EOL}`.green);
161161
}
162162

163163
return debugInformation;

lib/services/debug-service-base.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,18 @@ export abstract class DebugServiceBase extends EventEmitter implements IDeviceDe
3939
// Using the actual commit will result in 404 error in the remote serve.
4040
const commitSHA = debugOptions.devToolsCommit || "02e6bde1bbe34e43b309d4ef774b1168d25fd024";
4141

42-
let chromeDevToolsPrefix = `chrome-devtools://devtools/remote/serve_file/@${commitSHA}`;
42+
const devToolsProtocol = `devtools`;
43+
let chromeDevToolsPrefix = `${devToolsProtocol}://devtools/remote/serve_file/@${commitSHA}`;
4344

4445
if (debugOptions.useBundledDevTools === undefined || debugOptions.useBundledDevTools) {
45-
chromeDevToolsPrefix = "chrome-devtools://devtools/bundled";
46+
chromeDevToolsPrefix = `${devToolsProtocol}://devtools/bundled`;
4647
}
4748

4849
if (debugOptions.useHttpUrl) {
4950
chromeDevToolsPrefix = `https://chrome-devtools-frontend.appspot.com/serve_file/@${commitSHA}`;
5051
}
5152

52-
const chromeUrl = `${chromeDevToolsPrefix}/inspector.html?experiments=true&ws=localhost:${port}`;
53+
const chromeUrl = `${chromeDevToolsPrefix}/inspector.html?ws=localhost:${port}`;
5354
return chromeUrl;
5455
}
5556
}

lib/services/ios-device-debug-service.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ export class IOSDeviceDebugService extends DebugServiceBase implements IDeviceDe
3232

3333
@performanceLog()
3434
public async debug(debugData: IDebugData, debugOptions: IDebugOptions): Promise<IDebugResultInfo> {
35-
const result: IDebugResultInfo = { debugUrl: null };
3635
await this.validateOptions(debugOptions);
36+
const result: IDebugResultInfo = { debugUrl: null };
3737

3838
result.debugUrl = await this.wireDebuggerClient(debugData, debugOptions);
3939

test/services/android-device-debug-service.ts

+13-13
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ describe("androidDeviceDebugService", () => {
5555
{
5656
scenarioName: "useBundledDevTools and useHttpUrl are not passed",
5757
debugOptions: {},
58-
expectedChromeUrl: `chrome-devtools://devtools/bundled/inspector.html?experiments=true&ws=localhost:${expectedPort}`,
58+
expectedChromeUrl: `devtools://devtools/bundled/inspector.html?ws=localhost:${expectedPort}`,
5959
},
6060

6161
// When useBundledDevTools is true
@@ -64,23 +64,23 @@ describe("androidDeviceDebugService", () => {
6464
debugOptions: {
6565
useBundledDevTools: true
6666
},
67-
expectedChromeUrl: `chrome-devtools://devtools/bundled/inspector.html?experiments=true&ws=localhost:${expectedPort}`,
67+
expectedChromeUrl: `devtools://devtools/bundled/inspector.html?ws=localhost:${expectedPort}`,
6868
},
6969
{
7070
scenarioName: "useBundledDevTools is true and useHttpUrl is false",
7171
debugOptions: {
7272
useBundledDevTools: true,
7373
useHttpUrl: false
7474
},
75-
expectedChromeUrl: `chrome-devtools://devtools/bundled/inspector.html?experiments=true&ws=localhost:${expectedPort}`,
75+
expectedChromeUrl: `devtools://devtools/bundled/inspector.html?ws=localhost:${expectedPort}`,
7676
},
7777
{
7878
scenarioName: "useBundledDevTools is true and useHttpUrl is true",
7979
debugOptions: {
8080
useBundledDevTools: true,
8181
useHttpUrl: true
8282
},
83-
expectedChromeUrl: `https://chrome-devtools-frontend.appspot.com/serve_file/@${expectedDevToolsCommitSha}/inspector.html?experiments=true&ws=localhost:${expectedPort}`,
83+
expectedChromeUrl: `https://chrome-devtools-frontend.appspot.com/serve_file/@${expectedDevToolsCommitSha}/inspector.html?ws=localhost:${expectedPort}`,
8484
},
8585

8686
// When useBundledDevTools is false
@@ -89,23 +89,23 @@ describe("androidDeviceDebugService", () => {
8989
debugOptions: {
9090
useBundledDevTools: false
9191
},
92-
expectedChromeUrl: `chrome-devtools://devtools/remote/serve_file/@${expectedDevToolsCommitSha}/inspector.html?experiments=true&ws=localhost:${expectedPort}`,
92+
expectedChromeUrl: `devtools://devtools/remote/serve_file/@${expectedDevToolsCommitSha}/inspector.html?ws=localhost:${expectedPort}`,
9393
},
9494
{
9595
scenarioName: "useBundledDevTools is false and useHttpUrl is false",
9696
debugOptions: {
9797
useBundledDevTools: false,
9898
useHttpUrl: false
9999
},
100-
expectedChromeUrl: `chrome-devtools://devtools/remote/serve_file/@${expectedDevToolsCommitSha}/inspector.html?experiments=true&ws=localhost:${expectedPort}`,
100+
expectedChromeUrl: `devtools://devtools/remote/serve_file/@${expectedDevToolsCommitSha}/inspector.html?ws=localhost:${expectedPort}`,
101101
},
102102
{
103103
scenarioName: "useBundledDevTools is false and useHttpUrl is true",
104104
debugOptions: {
105105
useBundledDevTools: false,
106106
useHttpUrl: true
107107
},
108-
expectedChromeUrl: `https://chrome-devtools-frontend.appspot.com/serve_file/@${expectedDevToolsCommitSha}/inspector.html?experiments=true&ws=localhost:${expectedPort}`,
108+
expectedChromeUrl: `https://chrome-devtools-frontend.appspot.com/serve_file/@${expectedDevToolsCommitSha}/inspector.html?ws=localhost:${expectedPort}`,
109109
},
110110

111111
// When useBundledDevTools is not passed
@@ -114,14 +114,14 @@ describe("androidDeviceDebugService", () => {
114114
debugOptions: {
115115
useHttpUrl: false
116116
},
117-
expectedChromeUrl: `chrome-devtools://devtools/bundled/inspector.html?experiments=true&ws=localhost:${expectedPort}`,
117+
expectedChromeUrl: `devtools://devtools/bundled/inspector.html?ws=localhost:${expectedPort}`,
118118
},
119119
{
120120
scenarioName: "useBundledDevTools is not passed and useHttpUrl is true",
121121
debugOptions: {
122122
useHttpUrl: true
123123
},
124-
expectedChromeUrl: `https://chrome-devtools-frontend.appspot.com/serve_file/@${expectedDevToolsCommitSha}/inspector.html?experiments=true&ws=localhost:${expectedPort}`,
124+
expectedChromeUrl: `https://chrome-devtools-frontend.appspot.com/serve_file/@${expectedDevToolsCommitSha}/inspector.html?ws=localhost:${expectedPort}`,
125125
},
126126

127127
// devToolsCommit tests
@@ -130,28 +130,28 @@ describe("androidDeviceDebugService", () => {
130130
debugOptions: {
131131
useBundledDevTools: false
132132
},
133-
expectedChromeUrl: `chrome-devtools://devtools/remote/serve_file/@${expectedDevToolsCommitSha}/inspector.html?experiments=true&ws=localhost:${expectedPort}`,
133+
expectedChromeUrl: `devtools://devtools/remote/serve_file/@${expectedDevToolsCommitSha}/inspector.html?ws=localhost:${expectedPort}`,
134134
},
135135
{
136136
scenarioName: "devToolsCommit is disregarded when useBundledDevTools is not passed",
137137
debugOptions: {},
138-
expectedChromeUrl: `chrome-devtools://devtools/bundled/inspector.html?experiments=true&ws=localhost:${expectedPort}`,
138+
expectedChromeUrl: `devtools://devtools/bundled/inspector.html?ws=localhost:${expectedPort}`,
139139
},
140140
{
141141
scenarioName: "devToolsCommit is set to passed value when useBundledDevTools is set to false",
142142
debugOptions: {
143143
useBundledDevTools: false,
144144
devToolsCommit: customDevToolsCommit
145145
},
146-
expectedChromeUrl: `chrome-devtools://devtools/remote/serve_file/@${customDevToolsCommit}/inspector.html?experiments=true&ws=localhost:${expectedPort}`,
146+
expectedChromeUrl: `devtools://devtools/remote/serve_file/@${customDevToolsCommit}/inspector.html?ws=localhost:${expectedPort}`,
147147
},
148148
{
149149
scenarioName: "devToolsCommit is set to passed value when useHttpUrl is set to true",
150150
debugOptions: {
151151
useHttpUrl: true,
152152
devToolsCommit: customDevToolsCommit
153153
},
154-
expectedChromeUrl: `https://chrome-devtools-frontend.appspot.com/serve_file/@${customDevToolsCommit}/inspector.html?experiments=true&ws=localhost:${expectedPort}`,
154+
expectedChromeUrl: `https://chrome-devtools-frontend.appspot.com/serve_file/@${customDevToolsCommit}/inspector.html?ws=localhost:${expectedPort}`,
155155
}
156156
];
157157

test/services/ios-device-debug-service.ts

+14-14
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ describe("iOSDeviceDebugService", () => {
6767
{
6868
scenarioName: "useBundledDevTools and useHttpUrl are not passed",
6969
debugOptions: {},
70-
expectedChromeUrl: `chrome-devtools://devtools/bundled/inspector.html?experiments=true&ws=localhost:${expectedPort}`,
70+
expectedChromeUrl: `devtools://devtools/bundled/inspector.html?ws=localhost:${expectedPort}`,
7171
},
7272

7373
// When useBundledDevTools is true
@@ -76,23 +76,23 @@ describe("iOSDeviceDebugService", () => {
7676
debugOptions: {
7777
useBundledDevTools: true
7878
},
79-
expectedChromeUrl: `chrome-devtools://devtools/bundled/inspector.html?experiments=true&ws=localhost:${expectedPort}`,
79+
expectedChromeUrl: `devtools://devtools/bundled/inspector.html?ws=localhost:${expectedPort}`,
8080
},
8181
{
8282
scenarioName: "useBundledDevTools is true and useHttpUrl is false",
8383
debugOptions: {
8484
useBundledDevTools: true,
8585
useHttpUrl: false
8686
},
87-
expectedChromeUrl: `chrome-devtools://devtools/bundled/inspector.html?experiments=true&ws=localhost:${expectedPort}`,
87+
expectedChromeUrl: `devtools://devtools/bundled/inspector.html?ws=localhost:${expectedPort}`,
8888
},
8989
{
9090
scenarioName: "useBundledDevTools is true and useHttpUrl is true",
9191
debugOptions: {
9292
useBundledDevTools: true,
9393
useHttpUrl: true
9494
},
95-
expectedChromeUrl: `https://chrome-devtools-frontend.appspot.com/serve_file/@${expectedDevToolsCommitSha}/inspector.html?experiments=true&ws=localhost:${expectedPort}`,
95+
expectedChromeUrl: `https://chrome-devtools-frontend.appspot.com/serve_file/@${expectedDevToolsCommitSha}/inspector.html?ws=localhost:${expectedPort}`,
9696
},
9797

9898
// When useBundledDevTools is false
@@ -101,23 +101,23 @@ describe("iOSDeviceDebugService", () => {
101101
debugOptions: {
102102
useBundledDevTools: false
103103
},
104-
expectedChromeUrl: `chrome-devtools://devtools/remote/serve_file/@${expectedDevToolsCommitSha}/inspector.html?experiments=true&ws=localhost:${expectedPort}`,
104+
expectedChromeUrl: `devtools://devtools/remote/serve_file/@${expectedDevToolsCommitSha}/inspector.html?ws=localhost:${expectedPort}`,
105105
},
106106
{
107107
scenarioName: "useBundledDevTools is false and useHttpUrl is false",
108108
debugOptions: {
109109
useBundledDevTools: false,
110110
useHttpUrl: false
111111
},
112-
expectedChromeUrl: `chrome-devtools://devtools/remote/serve_file/@${expectedDevToolsCommitSha}/inspector.html?experiments=true&ws=localhost:${expectedPort}`,
112+
expectedChromeUrl: `devtools://devtools/remote/serve_file/@${expectedDevToolsCommitSha}/inspector.html?ws=localhost:${expectedPort}`,
113113
},
114114
{
115115
scenarioName: "useBundledDevTools is false and useHttpUrl is true",
116116
debugOptions: {
117117
useBundledDevTools: false,
118118
useHttpUrl: true
119119
},
120-
expectedChromeUrl: `https://chrome-devtools-frontend.appspot.com/serve_file/@${expectedDevToolsCommitSha}/inspector.html?experiments=true&ws=localhost:${expectedPort}`,
120+
expectedChromeUrl: `https://chrome-devtools-frontend.appspot.com/serve_file/@${expectedDevToolsCommitSha}/inspector.html?ws=localhost:${expectedPort}`,
121121
},
122122

123123
// When useBundledDevTools is not passed
@@ -126,14 +126,14 @@ describe("iOSDeviceDebugService", () => {
126126
debugOptions: {
127127
useHttpUrl: false
128128
},
129-
expectedChromeUrl: `chrome-devtools://devtools/bundled/inspector.html?experiments=true&ws=localhost:${expectedPort}`,
129+
expectedChromeUrl: `devtools://devtools/bundled/inspector.html?ws=localhost:${expectedPort}`,
130130
},
131131
{
132132
scenarioName: "useBundledDevTools is not passed and useHttpUrl is true",
133133
debugOptions: {
134134
useHttpUrl: true
135135
},
136-
expectedChromeUrl: `https://chrome-devtools-frontend.appspot.com/serve_file/@${expectedDevToolsCommitSha}/inspector.html?experiments=true&ws=localhost:${expectedPort}`,
136+
expectedChromeUrl: `https://chrome-devtools-frontend.appspot.com/serve_file/@${expectedDevToolsCommitSha}/inspector.html?ws=localhost:${expectedPort}`,
137137
},
138138

139139
// devToolsCommit tests
@@ -142,38 +142,38 @@ describe("iOSDeviceDebugService", () => {
142142
debugOptions: {
143143
useBundledDevTools: false
144144
},
145-
expectedChromeUrl: `chrome-devtools://devtools/remote/serve_file/@${expectedDevToolsCommitSha}/inspector.html?experiments=true&ws=localhost:${expectedPort}`,
145+
expectedChromeUrl: `devtools://devtools/remote/serve_file/@${expectedDevToolsCommitSha}/inspector.html?ws=localhost:${expectedPort}`,
146146
},
147147
{
148148
scenarioName: "devToolsCommit is disregarded when useBundledDevTools is not passed",
149149
debugOptions: {
150150
devToolsCommit: customDevToolsCommit
151151
},
152-
expectedChromeUrl: `chrome-devtools://devtools/bundled/inspector.html?experiments=true&ws=localhost:${expectedPort}`,
152+
expectedChromeUrl: `devtools://devtools/bundled/inspector.html?ws=localhost:${expectedPort}`,
153153
},
154154
{
155155
scenarioName: "devToolsCommit is set to passed value when useBundledDevTools is set to false",
156156
debugOptions: {
157157
useBundledDevTools: false,
158158
devToolsCommit: customDevToolsCommit
159159
},
160-
expectedChromeUrl: `chrome-devtools://devtools/remote/serve_file/@${customDevToolsCommit}/inspector.html?experiments=true&ws=localhost:${expectedPort}`,
160+
expectedChromeUrl: `devtools://devtools/remote/serve_file/@${customDevToolsCommit}/inspector.html?ws=localhost:${expectedPort}`,
161161
},
162162
{
163163
scenarioName: "devToolsCommit is set to passed value when useHttpUrl is set to true",
164164
debugOptions: {
165165
useHttpUrl: true,
166166
devToolsCommit: customDevToolsCommit
167167
},
168-
expectedChromeUrl: `https://chrome-devtools-frontend.appspot.com/serve_file/@${customDevToolsCommit}/inspector.html?experiments=true&ws=localhost:${expectedPort}`,
168+
expectedChromeUrl: `https://chrome-devtools-frontend.appspot.com/serve_file/@${customDevToolsCommit}/inspector.html?ws=localhost:${expectedPort}`,
169169
},
170170
{
171171
scenarioName: "devToolsCommit is disregarded when useBundledDevTools is set to true",
172172
debugOptions: {
173173
useBundledDevTools: true,
174174
devToolsCommit: customDevToolsCommit
175175
},
176-
expectedChromeUrl: `chrome-devtools://devtools/bundled/inspector.html?experiments=true&ws=localhost:${expectedPort}`,
176+
expectedChromeUrl: `devtools://devtools/bundled/inspector.html?ws=localhost:${expectedPort}`,
177177
}
178178

179179
];

0 commit comments

Comments
 (0)