Bug 1594941 - Remove unused Frame.environment field. r=bhackett

Differential Revision: https://phabricator.services.mozilla.com/D52282

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Jason Laster 2019-11-19 15:44:58 +00:00
Родитель fd90e130c9
Коммит 67ab86708e
33 изменённых файлов: 80 добавлений и 52 удалений

Просмотреть файл

@ -328,10 +328,6 @@ function getProperties(thread: string, grip: Grip): Promise<*> {
}
async function getFrameScopes(frame: Frame): Promise<*> {
if (frame.scope) {
return frame.scope;
}
const frameFront = lookupThreadFront(frame.thread).get(frame.id);
return frameFront.getEnvironment();
}

Просмотреть файл

@ -52,7 +52,6 @@ export function createFrame(
generatedLocation: location,
this: frame.this,
source: null,
scope: frame.environment,
index,
};
}

Просмотреть файл

@ -69,7 +69,6 @@ export type FramePacket = {|
+actor: ActorId,
+arguments: any[],
+displayName: string,
+environment: any,
+this: any,
+depth?: number,
+oldest?: boolean,
@ -92,7 +91,6 @@ export type FrameFront = {
actorID: string,
displayName: string,
this: any,
environment: any,
};
/**

Просмотреть файл

@ -249,7 +249,7 @@ export type Frame = {
location: SourceLocation,
generatedLocation: SourceLocation,
source: ?Source,
scope: Scope,
scope?: Scope,
// FIXME Define this type more clearly
this: Object,
framework?: string,

Просмотреть файл

@ -27,6 +27,10 @@ describe("scopes", () => {
const scope = makeMockScope("actor1");
const selectedFrame = makeMockFrame(undefined, undefined, scope);
if (!selectedFrame.scope) {
throw new Error("Frame must include scopes");
}
const frameScopes = convertScope(selectedFrame.scope);
const scopes = getScopes(pauseData, selectedFrame, frameScopes);
if (!scopes) {
@ -47,6 +51,10 @@ describe("scopes", () => {
const selectedFrame = makeMockFrame(undefined, undefined, scope1);
mockScopeAddVariable(scope0, "foo");
if (!selectedFrame.scope) {
throw new Error("Frame must include scopes");
}
const frameScopes = convertScope(selectedFrame.scope);
const scopes = getScopes(pauseData, selectedFrame, frameScopes);
if (!scopes) {
@ -65,6 +73,10 @@ describe("scopes", () => {
const scope = makeMockScope("actor1");
const selectedFrame = makeMockFrame(undefined, undefined, scope);
if (!selectedFrame.scope) {
throw new Error("Frame must include scopes");
}
const frameScopes = convertScope(selectedFrame.scope);
const scopes = getScopes(why, selectedFrame, frameScopes);
expect(scopes).toMatchObject([
@ -95,6 +107,10 @@ describe("scopes", () => {
const scope = makeMockScope("actor1");
const selectedFrame = makeMockFrame(undefined, undefined, scope);
if (!selectedFrame.scope) {
throw new Error("Frame must include scopes");
}
const frameScopes = convertScope(selectedFrame.scope);
const scopes = getScopes(why, selectedFrame, frameScopes);
expect(scopes).toMatchObject([

Просмотреть файл

@ -8,7 +8,6 @@ var Services = require("Services");
exports.defaultThreadOptions = function() {
return {
autoBlackBox: false,
ignoreFrameEnvironment: true,
pauseOnExceptions: Services.prefs.getBoolPref(
"devtools.debugger.pause-on-exceptions"
),

Просмотреть файл

@ -91,15 +91,6 @@ const FrameActor = ActorClassWithSpec(frameSpec, {
form.depth = this.depth;
}
// NOTE: ignoreFrameEnvironment lets the client explicitly avoid
// populating form environments on pause.
if (
!this.threadActor._options.ignoreFrameEnvironment &&
this.frame.environment
) {
form.environment = this.getEnvironment();
}
if (this.frame.type != "wasmcall") {
form.this = createValueGrip(
this.frame.this,

Просмотреть файл

@ -27,7 +27,13 @@ add_task(
while (timesBreakpointHit < 3) {
await resume(threadFront);
const packet = await waitForPause(threadFront);
testAssertions(packet, debuggee, source, location, timesBreakpointHit);
await testAssertions(
packet,
debuggee,
source,
location,
timesBreakpointHit
);
timesBreakpointHit++;
}
@ -47,7 +53,7 @@ function evaluateTestCode(debuggee) {
/* eslint-enable */
}
function testAssertions(
async function testAssertions(
packet,
debuggee,
source,
@ -60,8 +66,6 @@ function testAssertions(
Assert.equal(packet.frame.where.column, location.column);
Assert.equal(debuggee.acc, timesBreakpointHit);
Assert.equal(
packet.frame.environment.bindings.variables.i.value,
timesBreakpointHit
);
const environment = await packet.frame.getEnvironment();
Assert.equal(environment.bindings.variables.i.value, timesBreakpointHit);
}

Просмотреть файл

@ -23,7 +23,8 @@ add_task(
function test_pause_frame() {
gThreadFront.once("paused", async function(packet) {
const bindings = packet.frame.environment.bindings;
const environment = await packet.frame.getEnvironment();
const bindings = environment.bindings;
const args = bindings.arguments;
const vars = bindings.variables;

Просмотреть файл

@ -23,7 +23,8 @@ add_task(
function test_pause_frame() {
gThreadFront.once("paused", async function(packet) {
let parentEnv = packet.frame.environment.parent;
const environment = await packet.frame.getEnvironment();
let parentEnv = environment.parent;
const bindings = parentEnv.bindings;
const args = bindings.arguments;
const vars = bindings.variables;

Просмотреть файл

@ -24,7 +24,7 @@ add_task(
function test_pause_frame() {
gThreadFront.once("paused", async function(packet) {
const env = packet.frame.environment;
const env = await packet.frame.getEnvironment();
Assert.notEqual(env, undefined);
const parentEnv = env.parent;

Просмотреть файл

@ -25,7 +25,7 @@ add_task(
function test_pause_frame() {
gThreadFront.once("paused", async function(packet) {
const env = packet.frame.environment;
const env = await packet.frame.getEnvironment();
Assert.notEqual(env, undefined);
const objClient = gThreadFront.pauseGrip(env.object);

Просмотреть файл

@ -24,7 +24,7 @@ add_task(
function test_pause_frame() {
gThreadFront.once("paused", async function(packet) {
const env = packet.frame.environment;
const env = await packet.frame.getEnvironment();
Assert.notEqual(env, undefined);
const objClient = gThreadFront.pauseGrip(env.object);

Просмотреть файл

@ -19,7 +19,7 @@ add_task(
function test_banana_environment() {
gThreadFront.once("paused", async function(packet) {
const env = packet.frame.environment;
const env = await packet.frame.getEnvironment();
equal(env.type, "function");
equal(env.function.name, "banana3");
let parent = env.parent;

Просмотреть файл

@ -23,7 +23,7 @@ add_task(
function test_banana_environment() {
gThreadFront.once("paused", async function(packet) {
const environment = packet.frame.environment;
const environment = await packet.frame.getEnvironment();
Assert.equal(environment.type, "function");
const parent = environment.parent;

Просмотреть файл

@ -22,7 +22,8 @@ add_task(
function test_object_grip() {
gThreadFront.once("paused", async function(packet) {
const person = packet.frame.environment.bindings.variables.person;
const environment = await packet.frame.getEnvironment();
const person = environment.bindings.variables.person;
Assert.equal(person.value.class, "Object");

Просмотреть файл

@ -37,13 +37,15 @@ function evalCode() {
const testObjectGroup = async function() {
let packet = await executeOnNextTickAndWaitForPause(evalCode, gThreadFront);
const ugh = packet.frame.environment.parent.parent.bindings.variables.ugh;
const environment = await packet.frame.getEnvironment();
const ugh = environment.parent.parent.bindings.variables.ugh;
const ughClient = await gThreadFront.pauseGrip(ugh.value);
packet = await getPrototypeAndProperties(ughClient);
packet = await resumeAndWaitForPause(gThreadFront);
const ugh2 = packet.frame.environment.bindings.variables.ugh;
const environment2 = await packet.frame.getEnvironment();
const ugh2 = environment2.bindings.variables.ugh;
const ugh2Client = gThreadFront.pauseGrip(ugh2.value);
packet = await getPrototypeAndProperties(ugh2Client);

Просмотреть файл

@ -37,13 +37,15 @@ function evalCode() {
const testObjectGroup = async function() {
let packet = await executeOnNextTickAndWaitForPause(evalCode, gThreadFront);
const ugh = packet.frame.environment.parent.bindings.variables.ugh;
const environment = await packet.frame.getEnvironment();
const ugh = environment.parent.bindings.variables.ugh;
const ughClient = await gThreadFront.pauseGrip(ugh.value);
packet = await getPrototypeAndProperties(ughClient);
packet = await resumeAndWaitForPause(gThreadFront);
const ugh2 = packet.frame.environment.parent.bindings.variables.ugh;
const environment2 = await packet.frame.getEnvironment();
const ugh2 = environment2.parent.bindings.variables.ugh;
const ugh2Client = gThreadFront.pauseGrip(ugh2.value);
packet = await getPrototypeAndProperties(ugh2Client);

Просмотреть файл

@ -16,7 +16,9 @@ add_task(
threadFront
);
const grip = packet.frame.environment.bindings.variables.p;
const environment = await packet.frame.getEnvironment();
const grip = environment.bindings.variables.p;
ok(grip.value.preview);
equal(grip.value.class, "Promise");
equal(grip.value.promiseState.state, "pending");

Просмотреть файл

@ -16,7 +16,9 @@ add_task(
threadFront
);
const grip = packet.frame.environment.bindings.variables.p;
const environment = await packet.frame.getEnvironment();
const grip = environment.bindings.variables.p;
ok(grip.value.preview);
equal(grip.value.class, "Promise");
equal(grip.value.promiseState.state, "fulfilled");

Просмотреть файл

@ -16,7 +16,8 @@ add_task(
threadFront
);
const grip = packet.frame.environment.bindings.variables.p;
const environment = await packet.frame.getEnvironment();
const grip = environment.bindings.variables.p;
ok(grip.value.preview);
equal(grip.value.class, "Promise");
equal(grip.value.promiseState.state, "rejected");

Просмотреть файл

@ -28,7 +28,8 @@ add_task(
Assert.equal(where.line, location.line);
Assert.equal(where.column, 56);
const variables = frame.environment.bindings.variables;
const environment = await packet.frame.getEnvironment();
const variables = environment.bindings.variables;
Assert.equal(variables.a.value.type, "undefined");
Assert.equal(variables.b.value.type, "undefined");
Assert.equal(variables.c.value.type, "undefined");

Просмотреть файл

@ -28,7 +28,8 @@ add_task(
Assert.equal(where.line, location.line);
Assert.equal(where.column, 81);
const variables = frame.environment.bindings.variables;
const environment = await packet.frame.getEnvironment();
const variables = environment.bindings.variables;
Assert.equal(variables.a.value, 1);
Assert.equal(variables.b.value, 2);
Assert.equal(variables.c.value, 3);

Просмотреть файл

@ -27,6 +27,7 @@ add_task(
});
});
}, threadFront);
const environment = await packet.frame.getEnvironment();
const why = packet.why;
Assert.equal(why.type, "breakpoint");
Assert.equal(why.actors.length, 1);
@ -34,7 +35,7 @@ add_task(
const where = frame.where;
Assert.equal(where.line, location.line);
Assert.equal(where.column, location.column);
const variables = frame.environment.bindings.variables;
const variables = environment.bindings.variables;
Assert.equal(variables.a.value, 1);
Assert.equal(variables.b.value.type, "undefined");
Assert.equal(variables.c.value.type, "undefined");

Просмотреть файл

@ -15,6 +15,7 @@ add_task(
const packet = await executeOnNextTickAndWaitForPause(function() {
Cu.evalInSandbox("f()", debuggee);
}, threadFront);
const environment = await packet.frame.getEnvironment();
const why = packet.why;
Assert.equal(why.type, "breakpoint");
Assert.equal(why.actors.length, 1);
@ -23,7 +24,7 @@ add_task(
Assert.equal(where.actor, source.actor);
Assert.equal(where.line, location.line);
Assert.equal(where.column, location.column);
const variables = frame.environment.bindings.variables;
const variables = environment.bindings.variables;
Assert.equal(variables.a.value, 1);
Assert.equal(variables.b.value.type, "undefined");
Assert.equal(variables.c.value.type, "undefined");

Просмотреть файл

@ -28,12 +28,13 @@ add_task(
});
}, threadFront);
const why = packet.why;
const environment = await packet.frame.getEnvironment();
Assert.equal(why.type, "breakpoint");
Assert.equal(why.actors.length, 1);
const frame = packet.frame;
const where = frame.where;
Assert.equal(where.line, location.line);
const variables = frame.environment.bindings.variables;
const variables = environment.bindings.variables;
Assert.equal(variables.a.value, 1);
Assert.equal(variables.b.value.type, "undefined");
Assert.equal(variables.c.value.type, "undefined");

Просмотреть файл

@ -17,13 +17,14 @@ add_task(
Cu.evalInSandbox("f()", debuggee);
}, threadFront);
let why = packet.why;
let environment = await packet.frame.getEnvironment();
Assert.equal(why.type, "breakpoint");
Assert.equal(why.actors.length, 1);
let frame = packet.frame;
let where = frame.where;
Assert.equal(where.actor, source.actor);
Assert.equal(where.line, location.line);
let variables = frame.environment.bindings.variables;
let variables = environment.bindings.variables;
Assert.equal(variables.i.value.type, "undefined");
const location2 = { sourceUrl: sourceFront.url, line: 7 };
@ -33,6 +34,7 @@ add_task(
() => resume(threadFront),
threadFront
);
environment = await packet.frame.getEnvironment();
why = packet.why;
Assert.equal(why.type, "breakpoint");
Assert.equal(why.actors.length, 1);
@ -40,7 +42,7 @@ add_task(
where = frame.where;
Assert.equal(where.actor, source.actor);
Assert.equal(where.line, location2.line);
variables = frame.environment.bindings.variables;
variables = environment.bindings.variables;
Assert.equal(variables.i.value, 1);
await resume(threadFront);

Просмотреть файл

@ -19,13 +19,14 @@ add_task(
Cu.evalInSandbox("f()", debuggee);
}, threadFront);
const why = packet.why;
const environment = await packet.frame.getEnvironment();
Assert.equal(why.type, "breakpoint");
Assert.equal(why.actors.length, 1);
const frame = packet.frame;
const where = frame.where;
Assert.equal(where.actor, source.actor);
Assert.equal(where.line, location.line);
const variables = frame.environment.bindings.variables;
const variables = environment.bindings.variables;
Assert.equal(variables.a.value.type, "undefined");
Assert.equal(variables.b.value.type, "undefined");
Assert.equal(variables.c.value.type, "undefined");

Просмотреть файл

@ -35,6 +35,7 @@ add_task(
});
});
}, threadFront);
const environment = await packet.frame.getEnvironment();
Assert.equal(packet.type, "paused");
const why = packet.why;
Assert.equal(why.type, "breakpoint");
@ -44,7 +45,7 @@ add_task(
const where = frame.where;
Assert.equal(where.actor, source.actor);
Assert.equal(where.line, 8);
const variables = frame.environment.bindings.variables;
const variables = environment.bindings.variables;
Assert.equal(variables.a.value, 1);
Assert.equal(variables.c.value.type, "undefined");

Просмотреть файл

@ -23,6 +23,7 @@ add_task(
packet = await executeOnNextTickAndWaitForPause(function() {
Cu.evalInSandbox("f()", debuggee);
}, threadFront);
const environment = await packet.frame.getEnvironment();
Assert.equal(packet.type, "paused");
const why = packet.why;
Assert.equal(why.type, "breakpoint");
@ -32,7 +33,7 @@ add_task(
const where = frame.where;
Assert.equal(where.actor, source.actor);
Assert.equal(where.line, actualLocation.line);
const variables = frame.environment.bindings.variables;
const variables = environment.bindings.variables;
Assert.equal(variables.a.value, 1);
Assert.equal(variables.c.value.type, "undefined");

Просмотреть файл

@ -16,6 +16,7 @@ add_task(
const packet = await executeOnNextTickAndWaitForPause(function() {
Cu.evalInSandbox("f()", debuggee);
}, threadFront);
const environment = await packet.frame.getEnvironment();
const why = packet.why;
Assert.equal(why.type, "breakpoint");
Assert.equal(why.actors.length, 1);
@ -23,7 +24,7 @@ add_task(
const where = frame.where;
Assert.equal(where.actor, source.actor);
Assert.equal(where.line, location.line);
const variables = frame.environment.bindings.variables;
const variables = environment.bindings.variables;
Assert.equal(variables.a.value, 1);
Assert.equal(variables.b.value.type, "undefined");
Assert.equal(variables.c.value.type, "undefined");

Просмотреть файл

@ -34,11 +34,12 @@ async function testSymbols(threadFront, debuggee) {
};
const packet = await executeOnNextTickAndWaitForPause(evalCode, threadFront);
const environment = await packet.frame.getEnvironment();
const {
symbolWithName,
symbolWithoutName,
iteratorSymbol,
} = packet.frame.environment.bindings.variables;
} = environment.bindings.variables;
equal(symbolWithName.value.type, "symbol");
equal(symbolWithName.value.name, "Chris");

Просмотреть файл

@ -35,7 +35,8 @@ async function testSymbols(threadFront, debuggee) {
};
const packet = await executeOnNextTickAndWaitForPause(evalCode, threadFront);
const { sym } = packet.frame.environment.bindings.variables;
const environment = await packet.frame.getEnvironment();
const { sym } = environment.bindings.variables;
equal(sym.value.type, "symbol");
equal(sym.value.name, "le troll");