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

Commit

Permalink
Fix #180 - correctly handle inline sources
Browse files Browse the repository at this point in the history
  • Loading branch information
roblourens committed Apr 17, 2017
1 parent 12e60de commit a329b6f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/chrome/chromeDebugAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -759,12 +759,19 @@ export abstract class ChromeDebugAdapter implements IDebugAdapter {
this._sourceMapTransformer.setBreakpoints(args, requestSeq);
this._pathTransformer.setBreakpoints(args);

// Get the target url of the script
let targetScriptUrl: string;
if (args.source.sourceReference) {
const handle = this._sourceHandles.get(args.source.sourceReference);
const targetScript = this._scriptsById.get(handle.scriptId);
if (targetScript) {
targetScriptUrl = targetScript.url;
if (!handle.scriptId && args.source.path) {
// A sourcemapped script with inline sources won't have a scriptId here, but the
// source.path has been fixed.
targetScriptUrl = args.source.path;
} else {
const targetScript = this._scriptsById.get(handle.scriptId);
if (targetScript) {
targetScriptUrl = targetScript.url;
}
}
} else if (args.source.path) {
targetScriptUrl = args.source.path;
Expand Down
1 change: 1 addition & 0 deletions src/transformers/baseSourceMapTransformer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ export class BaseSourceMapTransformer {
// Clear the path and set the sourceReference - the client will ask for
// the source later and it will be returned from the sourcemap
stackFrame.source.name = path.basename(mapped.source);
stackFrame.source.path = mapped.source;
stackFrame.source.sourceReference = this.getSourceReferenceForScriptPath(mapped.source, inlinedSource);
stackFrame.source.origin = utils.localize('origin.inlined.source.map', "read-only inlined content from source map");
stackFrame.line = mapped.line;
Expand Down

0 comments on commit a329b6f

Please sign in to comment.