Skip to content
This repository has been archived by the owner on Oct 2, 2021. It is now read-only.

Allow child-class to customize the creation of IVariableContainer . #279

Merged
merged 2 commits into from
Feb 7, 2018
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
8 changes: 6 additions & 2 deletions src/chrome/chromeDebugAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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 }) => (<DebugProtocol.Variable>{
name,
value,
Expand All @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -43,6 +44,7 @@ export {

utils,
telemetry,
variables,
NullLogger,

Crdp
Expand Down