Skip to content

fix(chrome): new debug url with latest chrome 83+ versions #5319

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

Merged
merged 3 commits into from
May 30, 2020
Merged
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
2 changes: 1 addition & 1 deletion lib/controllers/debug-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ export class DebugController extends EventEmitter implements IDebugController {
this.emit(DEBUGGER_ATTACHED_EVENT_NAME, debugInformation);
}

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

return debugInformation;
Expand Down
7 changes: 4 additions & 3 deletions lib/services/debug-service-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,18 @@ export abstract class DebugServiceBase extends EventEmitter implements IDeviceDe
// Using the actual commit will result in 404 error in the remote serve.
const commitSHA = debugOptions.devToolsCommit || "02e6bde1bbe34e43b309d4ef774b1168d25fd024";

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

if (debugOptions.useBundledDevTools === undefined || debugOptions.useBundledDevTools) {
chromeDevToolsPrefix = "chrome-devtools://devtools/bundled";
chromeDevToolsPrefix = `${devToolsProtocol}://devtools/bundled`;
}

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

const chromeUrl = `${chromeDevToolsPrefix}/inspector.html?experiments=true&ws=localhost:${port}`;
const chromeUrl = `${chromeDevToolsPrefix}/inspector.html?ws=localhost:${port}`;
return chromeUrl;
}
}
2 changes: 1 addition & 1 deletion lib/services/ios-device-debug-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ export class IOSDeviceDebugService extends DebugServiceBase implements IDeviceDe

@performanceLog()
public async debug(debugData: IDebugData, debugOptions: IDebugOptions): Promise<IDebugResultInfo> {
const result: IDebugResultInfo = { debugUrl: null };
await this.validateOptions(debugOptions);
const result: IDebugResultInfo = { debugUrl: null };

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

Expand Down
26 changes: 13 additions & 13 deletions test/services/android-device-debug-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ describe("androidDeviceDebugService", () => {
{
scenarioName: "useBundledDevTools and useHttpUrl are not passed",
debugOptions: {},
expectedChromeUrl: `chrome-devtools://devtools/bundled/inspector.html?experiments=true&ws=localhost:${expectedPort}`,
expectedChromeUrl: `devtools://devtools/bundled/inspector.html?ws=localhost:${expectedPort}`,
},

// When useBundledDevTools is true
Expand All @@ -64,23 +64,23 @@ describe("androidDeviceDebugService", () => {
debugOptions: {
useBundledDevTools: true
},
expectedChromeUrl: `chrome-devtools://devtools/bundled/inspector.html?experiments=true&ws=localhost:${expectedPort}`,
expectedChromeUrl: `devtools://devtools/bundled/inspector.html?ws=localhost:${expectedPort}`,
},
{
scenarioName: "useBundledDevTools is true and useHttpUrl is false",
debugOptions: {
useBundledDevTools: true,
useHttpUrl: false
},
expectedChromeUrl: `chrome-devtools://devtools/bundled/inspector.html?experiments=true&ws=localhost:${expectedPort}`,
expectedChromeUrl: `devtools://devtools/bundled/inspector.html?ws=localhost:${expectedPort}`,
},
{
scenarioName: "useBundledDevTools is true and useHttpUrl is true",
debugOptions: {
useBundledDevTools: true,
useHttpUrl: true
},
expectedChromeUrl: `https://chrome-devtools-frontend.appspot.com/serve_file/@${expectedDevToolsCommitSha}/inspector.html?experiments=true&ws=localhost:${expectedPort}`,
expectedChromeUrl: `https://chrome-devtools-frontend.appspot.com/serve_file/@${expectedDevToolsCommitSha}/inspector.html?ws=localhost:${expectedPort}`,
},

// When useBundledDevTools is false
Expand All @@ -89,23 +89,23 @@ describe("androidDeviceDebugService", () => {
debugOptions: {
useBundledDevTools: false
},
expectedChromeUrl: `chrome-devtools://devtools/remote/serve_file/@${expectedDevToolsCommitSha}/inspector.html?experiments=true&ws=localhost:${expectedPort}`,
expectedChromeUrl: `devtools://devtools/remote/serve_file/@${expectedDevToolsCommitSha}/inspector.html?ws=localhost:${expectedPort}`,
},
{
scenarioName: "useBundledDevTools is false and useHttpUrl is false",
debugOptions: {
useBundledDevTools: false,
useHttpUrl: false
},
expectedChromeUrl: `chrome-devtools://devtools/remote/serve_file/@${expectedDevToolsCommitSha}/inspector.html?experiments=true&ws=localhost:${expectedPort}`,
expectedChromeUrl: `devtools://devtools/remote/serve_file/@${expectedDevToolsCommitSha}/inspector.html?ws=localhost:${expectedPort}`,
},
{
scenarioName: "useBundledDevTools is false and useHttpUrl is true",
debugOptions: {
useBundledDevTools: false,
useHttpUrl: true
},
expectedChromeUrl: `https://chrome-devtools-frontend.appspot.com/serve_file/@${expectedDevToolsCommitSha}/inspector.html?experiments=true&ws=localhost:${expectedPort}`,
expectedChromeUrl: `https://chrome-devtools-frontend.appspot.com/serve_file/@${expectedDevToolsCommitSha}/inspector.html?ws=localhost:${expectedPort}`,
},

// When useBundledDevTools is not passed
Expand All @@ -114,14 +114,14 @@ describe("androidDeviceDebugService", () => {
debugOptions: {
useHttpUrl: false
},
expectedChromeUrl: `chrome-devtools://devtools/bundled/inspector.html?experiments=true&ws=localhost:${expectedPort}`,
expectedChromeUrl: `devtools://devtools/bundled/inspector.html?ws=localhost:${expectedPort}`,
},
{
scenarioName: "useBundledDevTools is not passed and useHttpUrl is true",
debugOptions: {
useHttpUrl: true
},
expectedChromeUrl: `https://chrome-devtools-frontend.appspot.com/serve_file/@${expectedDevToolsCommitSha}/inspector.html?experiments=true&ws=localhost:${expectedPort}`,
expectedChromeUrl: `https://chrome-devtools-frontend.appspot.com/serve_file/@${expectedDevToolsCommitSha}/inspector.html?ws=localhost:${expectedPort}`,
},

// devToolsCommit tests
Expand All @@ -130,28 +130,28 @@ describe("androidDeviceDebugService", () => {
debugOptions: {
useBundledDevTools: false
},
expectedChromeUrl: `chrome-devtools://devtools/remote/serve_file/@${expectedDevToolsCommitSha}/inspector.html?experiments=true&ws=localhost:${expectedPort}`,
expectedChromeUrl: `devtools://devtools/remote/serve_file/@${expectedDevToolsCommitSha}/inspector.html?ws=localhost:${expectedPort}`,
},
{
scenarioName: "devToolsCommit is disregarded when useBundledDevTools is not passed",
debugOptions: {},
expectedChromeUrl: `chrome-devtools://devtools/bundled/inspector.html?experiments=true&ws=localhost:${expectedPort}`,
expectedChromeUrl: `devtools://devtools/bundled/inspector.html?ws=localhost:${expectedPort}`,
},
{
scenarioName: "devToolsCommit is set to passed value when useBundledDevTools is set to false",
debugOptions: {
useBundledDevTools: false,
devToolsCommit: customDevToolsCommit
},
expectedChromeUrl: `chrome-devtools://devtools/remote/serve_file/@${customDevToolsCommit}/inspector.html?experiments=true&ws=localhost:${expectedPort}`,
expectedChromeUrl: `devtools://devtools/remote/serve_file/@${customDevToolsCommit}/inspector.html?ws=localhost:${expectedPort}`,
},
{
scenarioName: "devToolsCommit is set to passed value when useHttpUrl is set to true",
debugOptions: {
useHttpUrl: true,
devToolsCommit: customDevToolsCommit
},
expectedChromeUrl: `https://chrome-devtools-frontend.appspot.com/serve_file/@${customDevToolsCommit}/inspector.html?experiments=true&ws=localhost:${expectedPort}`,
expectedChromeUrl: `https://chrome-devtools-frontend.appspot.com/serve_file/@${customDevToolsCommit}/inspector.html?ws=localhost:${expectedPort}`,
}
];

Expand Down
28 changes: 14 additions & 14 deletions test/services/ios-device-debug-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ describe("iOSDeviceDebugService", () => {
{
scenarioName: "useBundledDevTools and useHttpUrl are not passed",
debugOptions: {},
expectedChromeUrl: `chrome-devtools://devtools/bundled/inspector.html?experiments=true&ws=localhost:${expectedPort}`,
expectedChromeUrl: `devtools://devtools/bundled/inspector.html?ws=localhost:${expectedPort}`,
},

// When useBundledDevTools is true
Expand All @@ -76,23 +76,23 @@ describe("iOSDeviceDebugService", () => {
debugOptions: {
useBundledDevTools: true
},
expectedChromeUrl: `chrome-devtools://devtools/bundled/inspector.html?experiments=true&ws=localhost:${expectedPort}`,
expectedChromeUrl: `devtools://devtools/bundled/inspector.html?ws=localhost:${expectedPort}`,
},
{
scenarioName: "useBundledDevTools is true and useHttpUrl is false",
debugOptions: {
useBundledDevTools: true,
useHttpUrl: false
},
expectedChromeUrl: `chrome-devtools://devtools/bundled/inspector.html?experiments=true&ws=localhost:${expectedPort}`,
expectedChromeUrl: `devtools://devtools/bundled/inspector.html?ws=localhost:${expectedPort}`,
},
{
scenarioName: "useBundledDevTools is true and useHttpUrl is true",
debugOptions: {
useBundledDevTools: true,
useHttpUrl: true
},
expectedChromeUrl: `https://chrome-devtools-frontend.appspot.com/serve_file/@${expectedDevToolsCommitSha}/inspector.html?experiments=true&ws=localhost:${expectedPort}`,
expectedChromeUrl: `https://chrome-devtools-frontend.appspot.com/serve_file/@${expectedDevToolsCommitSha}/inspector.html?ws=localhost:${expectedPort}`,
},

// When useBundledDevTools is false
Expand All @@ -101,23 +101,23 @@ describe("iOSDeviceDebugService", () => {
debugOptions: {
useBundledDevTools: false
},
expectedChromeUrl: `chrome-devtools://devtools/remote/serve_file/@${expectedDevToolsCommitSha}/inspector.html?experiments=true&ws=localhost:${expectedPort}`,
expectedChromeUrl: `devtools://devtools/remote/serve_file/@${expectedDevToolsCommitSha}/inspector.html?ws=localhost:${expectedPort}`,
},
{
scenarioName: "useBundledDevTools is false and useHttpUrl is false",
debugOptions: {
useBundledDevTools: false,
useHttpUrl: false
},
expectedChromeUrl: `chrome-devtools://devtools/remote/serve_file/@${expectedDevToolsCommitSha}/inspector.html?experiments=true&ws=localhost:${expectedPort}`,
expectedChromeUrl: `devtools://devtools/remote/serve_file/@${expectedDevToolsCommitSha}/inspector.html?ws=localhost:${expectedPort}`,
},
{
scenarioName: "useBundledDevTools is false and useHttpUrl is true",
debugOptions: {
useBundledDevTools: false,
useHttpUrl: true
},
expectedChromeUrl: `https://chrome-devtools-frontend.appspot.com/serve_file/@${expectedDevToolsCommitSha}/inspector.html?experiments=true&ws=localhost:${expectedPort}`,
expectedChromeUrl: `https://chrome-devtools-frontend.appspot.com/serve_file/@${expectedDevToolsCommitSha}/inspector.html?ws=localhost:${expectedPort}`,
},

// When useBundledDevTools is not passed
Expand All @@ -126,14 +126,14 @@ describe("iOSDeviceDebugService", () => {
debugOptions: {
useHttpUrl: false
},
expectedChromeUrl: `chrome-devtools://devtools/bundled/inspector.html?experiments=true&ws=localhost:${expectedPort}`,
expectedChromeUrl: `devtools://devtools/bundled/inspector.html?ws=localhost:${expectedPort}`,
},
{
scenarioName: "useBundledDevTools is not passed and useHttpUrl is true",
debugOptions: {
useHttpUrl: true
},
expectedChromeUrl: `https://chrome-devtools-frontend.appspot.com/serve_file/@${expectedDevToolsCommitSha}/inspector.html?experiments=true&ws=localhost:${expectedPort}`,
expectedChromeUrl: `https://chrome-devtools-frontend.appspot.com/serve_file/@${expectedDevToolsCommitSha}/inspector.html?ws=localhost:${expectedPort}`,
},

// devToolsCommit tests
Expand All @@ -142,38 +142,38 @@ describe("iOSDeviceDebugService", () => {
debugOptions: {
useBundledDevTools: false
},
expectedChromeUrl: `chrome-devtools://devtools/remote/serve_file/@${expectedDevToolsCommitSha}/inspector.html?experiments=true&ws=localhost:${expectedPort}`,
expectedChromeUrl: `devtools://devtools/remote/serve_file/@${expectedDevToolsCommitSha}/inspector.html?ws=localhost:${expectedPort}`,
},
{
scenarioName: "devToolsCommit is disregarded when useBundledDevTools is not passed",
debugOptions: {
devToolsCommit: customDevToolsCommit
},
expectedChromeUrl: `chrome-devtools://devtools/bundled/inspector.html?experiments=true&ws=localhost:${expectedPort}`,
expectedChromeUrl: `devtools://devtools/bundled/inspector.html?ws=localhost:${expectedPort}`,
},
{
scenarioName: "devToolsCommit is set to passed value when useBundledDevTools is set to false",
debugOptions: {
useBundledDevTools: false,
devToolsCommit: customDevToolsCommit
},
expectedChromeUrl: `chrome-devtools://devtools/remote/serve_file/@${customDevToolsCommit}/inspector.html?experiments=true&ws=localhost:${expectedPort}`,
expectedChromeUrl: `devtools://devtools/remote/serve_file/@${customDevToolsCommit}/inspector.html?ws=localhost:${expectedPort}`,
},
{
scenarioName: "devToolsCommit is set to passed value when useHttpUrl is set to true",
debugOptions: {
useHttpUrl: true,
devToolsCommit: customDevToolsCommit
},
expectedChromeUrl: `https://chrome-devtools-frontend.appspot.com/serve_file/@${customDevToolsCommit}/inspector.html?experiments=true&ws=localhost:${expectedPort}`,
expectedChromeUrl: `https://chrome-devtools-frontend.appspot.com/serve_file/@${customDevToolsCommit}/inspector.html?ws=localhost:${expectedPort}`,
},
{
scenarioName: "devToolsCommit is disregarded when useBundledDevTools is set to true",
debugOptions: {
useBundledDevTools: true,
devToolsCommit: customDevToolsCommit
},
expectedChromeUrl: `chrome-devtools://devtools/bundled/inspector.html?experiments=true&ws=localhost:${expectedPort}`,
expectedChromeUrl: `devtools://devtools/bundled/inspector.html?ws=localhost:${expectedPort}`,
}

];
Expand Down