diff --git a/src/adapter/breakpoints/breakpointBase.ts b/src/adapter/breakpoints/breakpointBase.ts index 42b972b6f..19471805d 100644 --- a/src/adapter/breakpoints/breakpointBase.ts +++ b/src/adapter/breakpoints/breakpointBase.ts @@ -518,6 +518,7 @@ export abstract class Breakpoint { bp.args.location.scriptId === script.scriptId && lcEqual(bp.args.location, lineColumn)) || (script.url && + !script.hasSourceURL && isSetByUrl(bp.args) && (bp.args.urlRegex ? new RegExp(bp.args.urlRegex).test(script.url) @@ -560,8 +561,9 @@ export abstract class Breakpoint { protected async _setForSpecific(thread: Thread, script: ISourceScript, lineColumn: LineColumn) { // prefer to set on script URL for non-anonymous scripts, since url breakpoints - // will survive and be hit on reload. - if (script.url) { + // will survive and be hit on reload. But don't set if the script has + // a source URL, since V8 doesn't resolve these + if (script.url && !script.hasSourceURL) { return this._setByUrl(thread, script.url, lineColumn); } else { return this._setByScriptId(thread, script, lineColumn); diff --git a/src/adapter/source.ts b/src/adapter/source.ts index 77c4f3f9d..74776eea3 100644 --- a/src/adapter/source.ts +++ b/src/adapter/source.ts @@ -384,6 +384,7 @@ export interface IWasmLocationProvider extends ISourceLocationProvider { export interface ISourceScript { executionContextId: Cdp.Runtime.ExecutionContextId; scriptId: Cdp.Runtime.ScriptId; + hasSourceURL: boolean; url: string; } diff --git a/src/adapter/threads.ts b/src/adapter/threads.ts index 08d0f2fdd..eb1272238 100644 --- a/src/adapter/threads.ts +++ b/src/adapter/threads.ts @@ -36,7 +36,14 @@ import * as objectPreview from './objectPreview'; import { PreviewContextType, getContextForType } from './objectPreview/contexts'; import { ExpectedPauseReason, IPausedDetails, StepDirection } from './pause'; import { SmartStepper } from './smartStepping'; -import { ISourceWithMap, IUiLocation, Source, base1To0, isSourceWithWasm } from './source'; +import { + ISourceScript, + ISourceWithMap, + IUiLocation, + Source, + base1To0, + isSourceWithWasm, +} from './source'; import { IPreferredUiLocation, SourceContainer } from './sourceContainer'; import { InlinedFrame, StackFrame, StackTrace, isStackFrameElement } from './stackTrace'; import { @@ -69,10 +76,7 @@ export class ExecutionContext { } } -export type Script = { - url: string; - scriptId: string; - executionContextId: number; +export type Script = ISourceScript & { source: Promise; resolvedSource?: Source; }; @@ -1515,6 +1519,7 @@ export class Thread implements IVariableStoreLocationProvider { prevSource.addScript({ scriptId: event.scriptId, url: event.url, + hasSourceURL: !!event.hasSourceURL, executionContextId: event.executionContextId, }); return prevSource; @@ -1565,6 +1570,7 @@ export class Thread implements IVariableStoreLocationProvider { source.addScript({ scriptId: event.scriptId, url: event.url, + hasSourceURL: !!event.hasSourceURL, executionContextId: event.executionContextId, }); @@ -1573,6 +1579,7 @@ export class Thread implements IVariableStoreLocationProvider { const script: Script = { url: event.url, + hasSourceURL: !!event.hasSourceURL, scriptId: event.scriptId, executionContextId: event.executionContextId, source: createSource(),