Skip to content

Commit b526468

Browse files
authored
Handle unused console log in new cdp event (#2220)
1 parent 29b51a5 commit b526468

File tree

3 files changed

+23
-13
lines changed

3 files changed

+23
-13
lines changed

src/cdp-proxy/CDPMessageHandlers/CDPAPINames.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,6 @@ export const CDP_API_NAMES = {
1010
RUNTIME_CONSOLE_API_CALLED: "Runtime.consoleAPICalled",
1111
EXECUTION_CONTEXT_CREATED: "Runtime.executionContextCreated",
1212
CLOSE: "close",
13+
DEBUGGER_SCRIPT_PARSED: "Debugger.scriptParsed",
14+
DEBUGGER_SET_BREAKPOINT_BY_URL: "Debugger.setBreakpointByUrl",
1315
};

src/cdp-proxy/CDPMessageHandlers/hermesCDPMessageHandler.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,16 @@ export class HermesCDPMessageHandler extends BaseCDPMessageHandler {
4242
event = this.handleFunctionTypeResult(event);
4343
}
4444

45+
// Handle unused console log in cdp event
46+
if (
47+
event.method === CDP_API_NAMES.RUNTIME_CONSOLE_API_CALLED &&
48+
String(event.params.args[0].value).includes(
49+
"You are using an unsupported debugging client",
50+
)
51+
) {
52+
event.params.args[0].value = "";
53+
}
54+
4555
return {
4656
event,
4757
sendBack,

src/extension/commands/enableHermes.ts

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22
// Licensed under the MIT license. See LICENSE file in the project root for details.
33

44
import * as assert from "assert";
5-
import * as vscode from "vscode";
65
import * as path from "path";
76
import * as fs from "fs";
7+
import * as vscode from "vscode";
88
import { ErrorHelper } from "../../common/error/errorHelper";
99
import { InternalErrorCode } from "../../common/error/internalErrorCode";
10-
import { Command } from "./util/command";
1110
import { FileSystem } from "../../common/node/fileSystem";
1211
import { OutputChannelLogger } from "../log/OutputChannelLogger";
1312
import { CommandExecutor } from "../../common/commandExecutor";
1413
import { AppLauncher } from "../appLauncher";
14+
import { Command } from "./util/command";
1515

1616
const logger = OutputChannelLogger.getMainChannel();
1717

@@ -58,19 +58,17 @@ export class EnableHermes extends Command {
5858
);
5959
await this.nodeFileSystem.writeFile(podfilePath, updatedHermes);
6060
await commandExecutor.spawn("pod", ["install"]);
61-
} else {
62-
if (rnMatches) {
63-
let content = rnMatches[1];
64-
const closing = rnMatches[2];
61+
} else if (rnMatches) {
62+
let content = rnMatches[1];
63+
const closing = rnMatches[2];
6564

66-
if (!content.trim().endsWith(",")) {
67-
content += ",";
68-
}
69-
content += `\n :hermes_enabled => ${isHermesEnabled}`;
70-
const newData = podfileContent.replace(regex, content + closing);
71-
await this.nodeFileSystem.writeFile(podfilePath, newData);
72-
await commandExecutor.spawn("pod", ["install"]);
65+
if (!content.trim().endsWith(",")) {
66+
content += ",";
7367
}
68+
content += `\n :hermes_enabled => ${isHermesEnabled}`;
69+
const newData = podfileContent.replace(regex, content + closing);
70+
await this.nodeFileSystem.writeFile(podfilePath, newData);
71+
await commandExecutor.spawn("pod", ["install"]);
7472
}
7573
}
7674
if (type === "Android") {

0 commit comments

Comments
 (0)