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

Commit

Permalink
Merge pull request #279 from changsi-an/master
Browse files Browse the repository at this point in the history
Allow child-class to customize the creation of IVariableContainer .
  • Loading branch information
roblourens authored Feb 7, 2018
2 parents f5dd65e + 3d48a2c commit c9e6070
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
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 @@ -2242,7 +2242,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 @@ -2254,6 +2254,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

0 comments on commit c9e6070

Please sign in to comment.