[cleanup] Remove Debugger.setBreakpoint fallback.

V8 versions before 6.3.275 aren't in use anymore these days (Node.js
v14, which is currently LTS, has V8 8.1+), so this is effectively
dead code.

Bug: chromium:1357506
Fixed: chromium:1361883
Change-Id: I2f2c8f14d9e33c58d4eba2aeed700286084c9e07
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3883949
Auto-Submit: Benedikt Meurer <bmeurer@chromium.org>
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: Yang Guo <yangguo@chromium.org>
Commit-Queue: Yang Guo <yangguo@chromium.org>
This commit is contained in:
Benedikt Meurer
2022-09-09 12:03:56 +00:00
committed by Devtools-frontend LUCI CQ
parent e45f5588dd
commit 93639bdfdc
3 changed files with 6 additions and 34 deletions
+3 -25
View File
@@ -471,17 +471,11 @@ export class DebuggerModel extends SDKModel<EventTypes> {
}
async setBreakpointInAnonymousScript(
scriptId: Protocol.Runtime.ScriptId, scriptHash: string, lineNumber: number, columnNumber?: number,
condition?: string): Promise<SetBreakpointResult> {
scriptHash: string, lineNumber: number, columnNumber?: number, condition?: string): Promise<SetBreakpointResult> {
const response = await this.agent.invoke_setBreakpointByUrl(
{lineNumber: lineNumber, scriptHash: scriptHash, columnNumber: columnNumber, condition: condition});
const error = response.getError();
if (error) {
// Old V8 backend doesn't support scriptHash argument.
if (error !== 'Either url or urlRegex must be specified.') {
return {locations: [], breakpointId: null};
}
return this.setBreakpointBySourceId(scriptId, lineNumber, columnNumber, condition);
if (response.getError()) {
return {locations: [], breakpointId: null};
}
let locations: Location[] = [];
if (response.locations) {
@@ -490,22 +484,6 @@ export class DebuggerModel extends SDKModel<EventTypes> {
return {locations, breakpointId: response.breakpointId};
}
private async setBreakpointBySourceId(
scriptId: Protocol.Runtime.ScriptId, lineNumber: number, columnNumber?: number,
condition?: string): Promise<SetBreakpointResult> {
// This method is required for backward compatibility with V8 before 6.3.275.
const response = await this.agent.invoke_setBreakpoint(
{location: {scriptId: scriptId, lineNumber: lineNumber, columnNumber: columnNumber}, condition: condition});
if (response.getError()) {
return {breakpointId: null, locations: []};
}
let actualLocation: Location[] = [];
if (response.actualLocation) {
actualLocation = [Location.fromPayload(this, response.actualLocation)];
}
return {locations: actualLocation, breakpointId: response.breakpointId};
}
async removeBreakpoint(breakpointId: Protocol.Debugger.BreakpointId): Promise<void> {
const response = await this.agent.invoke_removeBreakpoint({breakpointId});
if (response.getError()) {
@@ -793,7 +793,6 @@ export class ModelBreakpoint {
const script = loc.script() as SDK.Script.Script;
return {
url: script.sourceURL,
scriptId: script.scriptId,
scriptHash: script.hash,
lineNumber: loc.lineNumber,
columnNumber: loc.columnNumber,
@@ -811,7 +810,6 @@ export class ModelBreakpoint {
// really resolved.
const position = {
url: this.#breakpoint.url(),
scriptId: '' as Protocol.Runtime.ScriptId,
scriptHash: '',
lineNumber,
columnNumber,
@@ -894,7 +892,7 @@ export class ModelBreakpoint {
return this.#debuggerModel.setBreakpointByURL(pos.url, pos.lineNumber, pos.columnNumber, condition);
}
return this.#debuggerModel.setBreakpointInAnonymousScript(
pos.scriptId, pos.scriptHash as string, pos.lineNumber, pos.columnNumber, condition);
pos.scriptHash as string, pos.lineNumber, pos.columnNumber, condition);
}));
const breakpointIds: Protocol.Debugger.BreakpointId[] = [];
let locations: SDK.DebuggerModel.Location[] = [];
@@ -983,7 +981,6 @@ export class ModelBreakpoint {
interface Position {
url: Platform.DevToolsPath.UrlString;
scriptId: Protocol.Runtime.ScriptId;
scriptHash: string;
lineNumber: number;
columnNumber?: number;
@@ -1015,9 +1012,6 @@ export namespace Breakpoint {
if (positionA.url !== positionB.url) {
return false;
}
if (positionA.scriptId !== positionB.scriptId) {
return false;
}
if (positionA.scriptHash !== positionB.scriptHash) {
return false;
}
@@ -158,7 +158,7 @@ describeWithRealConnection('BreakpointManager', () => {
await breakpointManager.restoreBreakpointsForScript(script);
assertNotNullOrUndefined(modelBreakpoint.currentState);
assert.lengthOf(modelBreakpoint.currentState.positions, 1);
assert.strictEqual(modelBreakpoint.currentState.positions[0].scriptId, SCRIPT_ID);
assert.strictEqual(modelBreakpoint.currentState.positions[0].url, URL);
// Clean up.
await breakpoint.remove(false);
@@ -228,7 +228,7 @@ describeWithRealConnection('BreakpointManager', () => {
await breakpointManager.restoreBreakpointsForScript(script);
assertNotNullOrUndefined(modelBreakpoint.currentState);
assert.lengthOf(modelBreakpoint.currentState.positions, 1);
assert.strictEqual(modelBreakpoint.currentState.positions[0].scriptId, SCRIPT_ID);
assert.strictEqual(modelBreakpoint.currentState.positions[0].url, URL);
// Clean up.
await breakpoint.remove(false);