Skip to content

Commit f24a4ed

Browse files
committed
fix: webview debugging
Update to the new CDN URL, and make sure the right path resolver is used Fixes #1344
1 parent b768361 commit f24a4ed

File tree

5 files changed

+15
-4
lines changed

5 files changed

+15
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ This changelog records changes to stable releases since 1.50.2. "TBA" changes he
77
- feat: make Deno easier to configure
88
- fix: allow overriding resolution of workspaceFolder in pathMapping ([#1308](https://github.com/microsoft/vscode-js-debug/issues/1308))
99
- fix: extraneous warnings when restarting debugging ([vscode#156432](https://github.com/microsoft/vscode/issues/156432))
10+
- fix: webview debugging ([#1344](https://github.com/microsoft/vscode-js-debug/issues/1344))
1011

1112
## v1.70 (July 2022)
1213

src/common/urlUtils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ export function stripTrailingSlash(aPath: string): string {
235235
}
236236

237237
const vscodeWebviewResourceSchemeRe =
238-
/^https:\/\/([a-z0-9\-]+)\+\.vscode-resource\.vscode-webview\.net\/(.+)/i;
238+
/^https:\/\/([a-z0-9\-]+)\+\.vscode-resource\.vscode-(?:webview|cdn)\.net\/(.+)/i;
239239

240240
/**
241241
* If urlOrPath is a file URL, removes the 'file:///', adjusting for platform differences

src/ioc.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,10 @@ export const createTargetContainer = (
151151
container.bind(IBreakpointConditionFactory).to(BreakpointConditionFactory).inSingletonScope();
152152
container.bind(LogPointCompiler).toSelf().inSingletonScope();
153153

154+
if (target.sourcePathResolver) {
155+
container.bind(ISourcePathResolver).toConstantValue(target.sourcePathResolver);
156+
}
157+
154158
container.bind(PerformanceProviderFactory).toSelf();
155159
container
156160
.bind(IPerformanceProvider)

src/targets/browser/browserTargets.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ export type PauseOnExceptionsState = 'none' | 'uncaught' | 'all';
5555

5656
export class BrowserTarget implements ITarget {
5757
readonly parentTarget: BrowserTarget | undefined;
58-
private _manager: BrowserTargetManager;
5958
private _cdp: Cdp.Api;
6059
private _ondispose: (t: BrowserTarget) => void;
6160
private _waitingForDebugger: boolean;
@@ -94,8 +93,10 @@ export class BrowserTarget implements ITarget {
9493

9594
_children: Map<Cdp.Target.TargetID, BrowserTarget> = new Map();
9695

96+
public readonly sourcePathResolver = this._manager._sourcePathResolver;
97+
9798
constructor(
98-
targetManager: BrowserTargetManager,
99+
private readonly _manager: BrowserTargetManager,
99100
private _targetInfo: Cdp.Target.TargetInfo,
100101
cdp: Cdp.Api,
101102
parentTarget: BrowserTarget | undefined,
@@ -108,7 +109,6 @@ export class BrowserTarget implements ITarget {
108109
this._cdp = cdp;
109110
cdp.pause();
110111

111-
this._manager = targetManager;
112112
this.parentTarget = parentTarget;
113113
this._waitingForDebugger = waitingForDebugger;
114114
this._updateFromInfo(_targetInfo);

src/targets/targets.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { CancellationToken } from 'vscode';
66
import Cdp from '../cdp/api';
77
import { IDisposable, IEvent } from '../common/events';
88
import { ILogger } from '../common/logging';
9+
import { ISourcePathResolver } from '../common/sourcePathResolver';
910
import { AnyLaunchConfiguration } from '../configuration';
1011
import Dap from '../dap/api';
1112
import { ITelemetryReporter } from '../telemetry/telemetryReporter';
@@ -43,6 +44,11 @@ export interface ITarget {
4344
*/
4445
readonly independentLifeycle?: boolean;
4546

47+
/**
48+
* Source path resolver, if a custom one should be used for this target.
49+
*/
50+
readonly sourcePathResolver?: ISourcePathResolver;
51+
4652
id(): string;
4753
name(): string;
4854
onNameChanged: IEvent<void>;

0 commit comments

Comments
 (0)