From 5715d40b52d3970c84485934757099c98c050195 Mon Sep 17 00:00:00 2001 From: roblou Date: Fri, 20 Jan 2017 11:12:02 -0800 Subject: [PATCH] Object logging in all cases - Fix #145 --- src/chrome/chromeDebugAdapter.ts | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/chrome/chromeDebugAdapter.ts b/src/chrome/chromeDebugAdapter.ts index 9e54da971..d63d2f0fc 100644 --- a/src/chrome/chromeDebugAdapter.ts +++ b/src/chrome/chromeDebugAdapter.ts @@ -697,12 +697,7 @@ export abstract class ChromeDebugAdapter implements IDebugAdapter { protected onConsoleAPICalled(params: Crdp.Runtime.ConsoleAPICalledEvent): void { const result = formatConsoleArguments(params); const category = result.isError ? 'stderr' : 'stdout'; - if (result.args.length === 1 && result.args[0].type === 'string') { - const e = new OutputEvent(result.args[0].value, category); - this._session.sendEvent(e); - } else { - this.logObjects(result.args, category); - } + this.logObjects(result.args, category); } protected onExceptionThrown(params: Crdp.Runtime.ExceptionThrownEvent): void { @@ -710,7 +705,7 @@ export abstract class ChromeDebugAdapter implements IDebugAdapter { } private logObjects(objs: Crdp.Runtime.RemoteObject[], category: string): void { - const e: DebugProtocol.OutputEvent = new OutputEvent('foo', category); + const e: DebugProtocol.OutputEvent = new OutputEvent('', category); e.body.variablesReference = this._variableHandles.create(new Variables.LoggedObjects(objs), 'repl'); this._session.sendEvent(e); } @@ -1161,6 +1156,10 @@ export abstract class ChromeDebugAdapter implements IDebugAdapter { } public variables(args: DebugProtocol.VariablesArguments): Promise { + if (!this.chrome) { + return utils.errP(errors.runtimeNotConnectedMsg); + } + const handle = this._variableHandles.get(args.variablesReference); if (!handle) { return Promise.resolve(undefined);