From ba5bb2a1958a6d0abbf2bc67f775e0eaae99c680 Mon Sep 17 00:00:00 2001 From: Chance An Date: Mon, 5 Feb 2018 15:17:22 -0800 Subject: [PATCH] Allows the child debug adapter to override some variable handling logic. --- src/chrome/chromeDebugAdapter.ts | 8 ++++++-- src/index.ts | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/chrome/chromeDebugAdapter.ts b/src/chrome/chromeDebugAdapter.ts index 17ad0380b..d20909066 100644 --- a/src/chrome/chromeDebugAdapter.ts +++ b/src/chrome/chromeDebugAdapter.ts @@ -14,7 +14,7 @@ import {IChromeDebugAdapterOpts, ChromeDebugSession} from './chromeDebugSession' import {ChromeConnection} from './chromeConnection'; import * as ChromeUtils from './chromeUtils'; import Crdp from '../../crdp/crdp'; -import {PropertyContainer, ScopeContainer, ExceptionContainer, isIndexedPropName} from './variables'; +import {PropertyContainer, ScopeContainer, ExceptionContainer, isIndexedPropName, IVariableContainer} from './variables'; import * as variables from './variables'; import {formatConsoleArguments, formatExceptionDetails} from './consoleHelper'; import {StoppedEvent2, ReasonType} from './stoppedEvent'; @@ -2236,7 +2236,7 @@ export abstract class ChromeDebugAdapter implements IDebugAdapter { } const evaluateName = ChromeUtils.getEvaluateName(parentEvaluateName, name); - const variablesReference = this._variableHandles.create(new PropertyContainer(object.objectId, evaluateName), context); + const variablesReference = this._variableHandles.create(this.createPropertyContainer(object, evaluateName), context); return propCountP.then(({ indexedVariables, namedVariables }) => ({ name, value, @@ -2248,6 +2248,10 @@ export abstract class ChromeDebugAdapter implements IDebugAdapter { })); } + protected createPropertyContainer(object: Crdp.Runtime.RemoteObject, evaluateName: string): IVariableContainer { + return new PropertyContainer(object.objectId, evaluateName); + } + public createPrimitiveVariable(name: string, object: Crdp.Runtime.RemoteObject, parentEvaluateName?: string, stringify?: boolean): DebugProtocol.Variable { const value = variables.getRemoteObjectPreview_primitive(object, stringify); const variable = this.createPrimitiveVariableWithValue(name, value, parentEvaluateName); diff --git a/src/index.ts b/src/index.ts index e8aa479d7..70d3f0de8 100644 --- a/src/index.ts +++ b/src/index.ts @@ -21,6 +21,7 @@ export * from './debugAdapterInterfaces'; import * as utils from './utils'; import * as telemetry from './telemetry'; +import * as variables from './chrome/variables'; import {NullLogger} from './nullLogger'; import Crdp from '../crdp/crdp'; @@ -43,6 +44,7 @@ export { utils, telemetry, + variables, NullLogger, Crdp