Skip to content

Commit 184ae11

Browse files
committed
chore: cleanup
1 parent 639615d commit 184ae11

8 files changed

+18
-42
lines changed

lib/controllers/debug-controller.ts

-2
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,6 @@ export class DebugController extends EventEmitter implements IDebugController {
158158
}
159159

160160
this.$logger.info(`To start debugging, open the following URL in Chrome:${EOL}${debugInformation.url}${EOL}`.green);
161-
162-
this.$logger.info(`If you're using an older Chrome version 82 and below, use this instead:${EOL}${debugInformation.legacyUrl}${EOL}`.cyan);
163161
}
164162

165163
return debugInformation;

lib/declarations.d.ts

-1
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,6 @@ interface IGenerateOptions {
494494

495495
interface IDebugInformation extends IPort, Mobile.IDeviceIdentifier {
496496
url: string;
497-
legacyUrl?: string;
498497
}
499498

500499
interface IPort {

lib/definitions/debug.d.ts

-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@ interface IDeviceDebugService extends IPlatform, NodeJS.EventEmitter {
116116

117117
interface IDebugResultInfo {
118118
debugUrl: string;
119-
legacyDebugUrl?: string;
120119
}
121120

122121
interface IAppDebugData extends IProjectDir {

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

-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@ export class AndroidDeviceDebugService extends DebugServiceBase implements IDevi
9999
await this.printDebugPort(this.deviceIdentifier, debugPort);
100100

101101
result.debugUrl = this.getChromeDebugUrl(debugOptions, debugPort);
102-
result.legacyDebugUrl = this.getChromeDebugUrl(debugOptions, debugPort, true);
103102

104103
return result;
105104
}

lib/services/debug-service-base.ts

+4-6
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export abstract class DebugServiceBase extends EventEmitter implements IDeviceDe
3030
};
3131
}
3232

33-
protected getChromeDebugUrl(debugOptions: IDebugOptions, port: number, legacy?: boolean): string {
33+
protected getChromeDebugUrl(debugOptions: IDebugOptions, port: number): string {
3434
// corresponds to 55.0.2883 Chrome version
3535
// SHA is taken from https://chromium.googlesource.com/chromium/src/+/55.0.2883.100
3636
// This SHA is old and does not support debugging with HMR.
@@ -39,19 +39,17 @@ 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-
const devToolsProtocol = `${legacy ? 'chrome-' : ''}devtools`;
43-
44-
let chromeDevToolsPrefix = `${devToolsProtocol}://devtools/remote/serve_file/@${commitSHA}`;
42+
let chromeDevToolsPrefix = `devtools://devtools/remote/serve_file/@${commitSHA}`;
4543

4644
if (debugOptions.useBundledDevTools === undefined || debugOptions.useBundledDevTools) {
47-
chromeDevToolsPrefix = `${devToolsProtocol}://devtools/bundled`;
45+
chromeDevToolsPrefix = `devtools://devtools/bundled`;
4846
}
4947

5048
if (debugOptions.useHttpUrl) {
5149
chromeDevToolsPrefix = `https://chrome-devtools-frontend.appspot.com/serve_file/@${commitSHA}`;
5250
}
5351

54-
const chromeUrl = `${chromeDevToolsPrefix}/inspector.html?ws=localhost:${port}${legacy ? '&experiments=true' : ''}`;
52+
const chromeUrl = `${chromeDevToolsPrefix}/inspector.html?ws=localhost:${port}`;
5553
return chromeUrl;
5654
}
5755
}

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

+8-8
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,11 @@ export class IOSDeviceDebugService extends DebugServiceBase implements IDeviceDe
3333
@performanceLog()
3434
public async debug(debugData: IDebugData, debugOptions: IDebugOptions): Promise<IDebugResultInfo> {
3535
await this.validateOptions(debugOptions);
36+
const result: IDebugResultInfo = { debugUrl: null };
3637

37-
return await this.wireDebuggerClient(debugData, debugOptions);
38+
result.debugUrl = await this.wireDebuggerClient(debugData, debugOptions);
39+
40+
return result;
3841
}
3942

4043
public async debugStop(): Promise<void> {
@@ -81,28 +84,25 @@ export class IOSDeviceDebugService extends DebugServiceBase implements IDeviceDe
8184
}
8285

8386
@performanceLog()
84-
private async wireDebuggerClient(debugData: IDebugData, debugOptions: IDebugOptions): Promise<IDebugResultInfo> {
87+
private async wireDebuggerClient(debugData: IDebugData, debugOptions: IDebugOptions): Promise<string> {
8588
if ((debugOptions.inspector || !debugOptions.client) && this.$hostInfo.isDarwin) {
8689
return await this.setupTcpAppDebugProxy(debugData, debugOptions);
8790
} else {
8891
return await this.setupWebAppDebugProxy(debugOptions, debugData);
8992
}
9093
}
9194

92-
private async setupWebAppDebugProxy(debugOptions: IDebugOptions, debugData: IDebugData): Promise<IDebugResultInfo> {
95+
private async setupWebAppDebugProxy(debugOptions: IDebugOptions, debugData: IDebugData): Promise<string> {
9396
if (debugOptions.chrome) {
9497
this.$logger.info("'--chrome' is the default behavior. Use --inspector to debug iOS applications using the Safari Web Inspector.");
9598
}
9699
const projectName = this.getProjectName(debugData);
97100
const webSocketProxy = await this.$appDebugSocketProxyFactory.ensureWebSocketProxy(this.device, debugData.applicationIdentifier, projectName, debugData.projectDir);
98101

99-
return {
100-
debugUrl: this.getChromeDebugUrl(debugOptions, webSocketProxy.options.port),
101-
legacyDebugUrl: this.getChromeDebugUrl(debugOptions, webSocketProxy.options.port, true)
102-
};
102+
return this.getChromeDebugUrl(debugOptions, webSocketProxy.options.port);
103103
}
104104

105-
private async setupTcpAppDebugProxy(debugData: IDebugData, debugOptions: IDebugOptions): Promise<IDebugResultInfo> {
105+
private async setupTcpAppDebugProxy(debugData: IDebugData, debugOptions: IDebugOptions): Promise<string> {
106106
const projectName = this.getProjectName(debugData);
107107
const existingTcpProxy = this.$appDebugSocketProxyFactory.getTCPSocketProxy(this.deviceIdentifier, debugData.applicationIdentifier);
108108
const tcpSocketProxy = existingTcpProxy || await this.$appDebugSocketProxyFactory.addTCPSocketProxy(this.device, debugData.applicationIdentifier, projectName, debugData.projectDir);

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

+3-11
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ class AndroidDeviceDebugServiceInheritor extends AndroidDeviceDebugService {
1717
super(<any>{ deviceInfo: { identifier: "123" } }, $devicesService, $cleanupService, $errors, $logger, $androidProcessService, $staticConfig, $net, $deviceLogProvider);
1818
}
1919

20-
public getChromeDebugUrl(debugOptions: IDebugOptions, port: number, legacy?: boolean): string {
21-
return super.getChromeDebugUrl(debugOptions, port, legacy);
20+
public getChromeDebugUrl(debugOptions: IDebugOptions, port: number): string {
21+
return super.getChromeDebugUrl(debugOptions, port);
2222
}
2323
}
2424

@@ -43,7 +43,6 @@ interface IChromeUrlTestCase {
4343
debugOptions: IDebugOptions;
4444
expectedChromeUrl: string;
4545
scenarioName: string;
46-
legacy?: boolean;
4746
}
4847

4948
describe("androidDeviceDebugService", () => {
@@ -58,13 +57,6 @@ describe("androidDeviceDebugService", () => {
5857
debugOptions: {},
5958
expectedChromeUrl: `devtools://devtools/bundled/inspector.html?ws=localhost:${expectedPort}`,
6059
},
61-
// legacy chrome debug url
62-
{
63-
scenarioName: "useBundledDevTools and useHttpUrl are not passed and using legacy chrome debug url",
64-
debugOptions: {},
65-
expectedChromeUrl: `chrome-devtools://devtools/bundled/inspector.html?ws=localhost:${expectedPort}&experiments=true`,
66-
legacy: true
67-
},
6860

6961
// When useBundledDevTools is true
7062
{
@@ -167,7 +159,7 @@ describe("androidDeviceDebugService", () => {
167159
it(`returns correct url when ${testCase.scenarioName}`, () => {
168160
const testInjector = createTestInjector();
169161
const androidDeviceDebugService = testInjector.resolve<AndroidDeviceDebugServiceInheritor>(AndroidDeviceDebugServiceInheritor);
170-
const actualChromeUrl = androidDeviceDebugService.getChromeDebugUrl(testCase.debugOptions, expectedPort, testCase.legacy);
162+
const actualChromeUrl = androidDeviceDebugService.getChromeDebugUrl(testCase.debugOptions, expectedPort);
171163
assert.equal(actualChromeUrl, testCase.expectedChromeUrl);
172164
});
173165
}

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

+3-12
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ class IOSDeviceDebugServiceInheritor extends IOSDeviceDebugService {
1818
$packageInstallationManager, $appDebugSocketProxyFactory, $projectDataService);
1919
}
2020

21-
public getChromeDebugUrl(debugOptions: IDebugOptions, port: number, legacy?: boolean): string {
22-
return super.getChromeDebugUrl(debugOptions, port, legacy);
21+
public getChromeDebugUrl(debugOptions: IDebugOptions, port: number): string {
22+
return super.getChromeDebugUrl(debugOptions, port);
2323
}
2424
}
2525

@@ -55,7 +55,6 @@ interface IChromeUrlTestCase {
5555
debugOptions: IDebugOptions;
5656
expectedChromeUrl: string;
5757
scenarioName: string;
58-
legacy?: boolean;
5958
}
6059

6160
describe("iOSDeviceDebugService", () => {
@@ -71,14 +70,6 @@ describe("iOSDeviceDebugService", () => {
7170
expectedChromeUrl: `devtools://devtools/bundled/inspector.html?ws=localhost:${expectedPort}`,
7271
},
7372

74-
// legacy chrome debug url
75-
{
76-
scenarioName: "useBundledDevTools and useHttpUrl are not passed and using legacy chrome debug url",
77-
debugOptions: {},
78-
expectedChromeUrl: `chrome-devtools://devtools/bundled/inspector.html?ws=localhost:${expectedPort}&experiments=true`,
79-
legacy: true
80-
},
81-
8273
// When useBundledDevTools is true
8374
{
8475
scenarioName: "useBundledDevTools is true and useHttpUrl is not passed",
@@ -191,7 +182,7 @@ describe("iOSDeviceDebugService", () => {
191182
it(`returns correct url when ${testCase.scenarioName}`, () => {
192183
const testInjector = createTestInjector();
193184
const iOSDeviceDebugService = testInjector.resolve<IOSDeviceDebugServiceInheritor>(IOSDeviceDebugServiceInheritor);
194-
const actualChromeUrl = iOSDeviceDebugService.getChromeDebugUrl(testCase.debugOptions, expectedPort, testCase.legacy);
185+
const actualChromeUrl = iOSDeviceDebugService.getChromeDebugUrl(testCase.debugOptions, expectedPort);
195186
assert.equal(actualChromeUrl, testCase.expectedChromeUrl);
196187
});
197188
}

0 commit comments

Comments
 (0)