diff --git a/src/cdp-proxy/CDPMessageHandlers/CDPAPINames.ts b/src/cdp-proxy/CDPMessageHandlers/CDPAPINames.ts index b29a65c3f..e005635f9 100644 --- a/src/cdp-proxy/CDPMessageHandlers/CDPAPINames.ts +++ b/src/cdp-proxy/CDPMessageHandlers/CDPAPINames.ts @@ -10,4 +10,6 @@ export const CDP_API_NAMES = { RUNTIME_CONSOLE_API_CALLED: "Runtime.consoleAPICalled", EXECUTION_CONTEXT_CREATED: "Runtime.executionContextCreated", CLOSE: "close", + DEBUGGER_SCRIPT_PARSED: "Debugger.scriptParsed", + DEBUGGER_SET_BREAKPOINT_BY_URL: "Debugger.setBreakpointByUrl", }; diff --git a/src/cdp-proxy/CDPMessageHandlers/hermesCDPMessageHandler.ts b/src/cdp-proxy/CDPMessageHandlers/hermesCDPMessageHandler.ts index b6a71cb28..82314e4ec 100644 --- a/src/cdp-proxy/CDPMessageHandlers/hermesCDPMessageHandler.ts +++ b/src/cdp-proxy/CDPMessageHandlers/hermesCDPMessageHandler.ts @@ -42,6 +42,16 @@ export class HermesCDPMessageHandler extends BaseCDPMessageHandler { event = this.handleFunctionTypeResult(event); } + // Handle unused console log in cdp event + if ( + event.method === CDP_API_NAMES.RUNTIME_CONSOLE_API_CALLED && + String(event.params.args[0].value).includes( + "You are using an unsupported debugging client", + ) + ) { + event.params.args[0].value = ""; + } + return { event, sendBack, diff --git a/src/extension/commands/enableHermes.ts b/src/extension/commands/enableHermes.ts index 827e046a6..f21704f5d 100644 --- a/src/extension/commands/enableHermes.ts +++ b/src/extension/commands/enableHermes.ts @@ -2,16 +2,16 @@ // Licensed under the MIT license. See LICENSE file in the project root for details. import * as assert from "assert"; -import * as vscode from "vscode"; import * as path from "path"; import * as fs from "fs"; +import * as vscode from "vscode"; import { ErrorHelper } from "../../common/error/errorHelper"; import { InternalErrorCode } from "../../common/error/internalErrorCode"; -import { Command } from "./util/command"; import { FileSystem } from "../../common/node/fileSystem"; import { OutputChannelLogger } from "../log/OutputChannelLogger"; import { CommandExecutor } from "../../common/commandExecutor"; import { AppLauncher } from "../appLauncher"; +import { Command } from "./util/command"; const logger = OutputChannelLogger.getMainChannel(); @@ -58,19 +58,17 @@ export class EnableHermes extends Command { ); await this.nodeFileSystem.writeFile(podfilePath, updatedHermes); await commandExecutor.spawn("pod", ["install"]); - } else { - if (rnMatches) { - let content = rnMatches[1]; - const closing = rnMatches[2]; + } else if (rnMatches) { + let content = rnMatches[1]; + const closing = rnMatches[2]; - if (!content.trim().endsWith(",")) { - content += ","; - } - content += `\n :hermes_enabled => ${isHermesEnabled}`; - const newData = podfileContent.replace(regex, content + closing); - await this.nodeFileSystem.writeFile(podfilePath, newData); - await commandExecutor.spawn("pod", ["install"]); + if (!content.trim().endsWith(",")) { + content += ","; } + content += `\n :hermes_enabled => ${isHermesEnabled}`; + const newData = podfileContent.replace(regex, content + closing); + await this.nodeFileSystem.writeFile(podfilePath, newData); + await commandExecutor.spawn("pod", ["install"]); } } if (type === "Android") {