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

Commit

Permalink
Fix microsoft/vscode#34615 - don't show error message for sending a m…
Browse files Browse the repository at this point in the history
…essage to the target after close. This can happen in lots of places, like anywhere that we do something asynchronously after sourcemaps load.
  • Loading branch information
roblourens committed Sep 25, 2017
1 parent cb111be commit 28d3ae7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/chrome/chromeConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,13 @@ class LoggingSocket extends WebSocket {
}

public send(data: any, opts?: any, cb?: (err: Error) => void): void {
super.send.apply(this, arguments);

const msgStr = JSON.stringify(data);
if (this.readyState !== WebSocket.OPEN) {
logger.log(`→ Warning: Target not open! Message: ${msgStr}`);
return;
}

super.send.apply(this, arguments);
logger.verbose('→ To target: ' + msgStr);
}
}
Expand Down
4 changes: 4 additions & 0 deletions src/chrome/chromeDebugAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,10 @@ export abstract class ChromeDebugAdapter implements IDebugAdapter {

const mappedUrl = this._pathTransformer.scriptParsed(script.url);
const sourceMapsP = this._sourceMapTransformer.scriptParsed(mappedUrl, script.sourceMapURL).then(sources => {
if (this._hasTerminated) {
return undefined;
}

if (sources) {
sources
.filter(source => source !== mappedUrl) // Tools like babel-register will produce sources with the same path as the generated script
Expand Down

0 comments on commit 28d3ae7

Please sign in to comment.