Bug 1548256 - Blank debugger when hovering variables. r=davidwalsh

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Jason Laster 2019-05-08 13:08:24 +00:00
Родитель 982857ca95
Коммит 72aecadbca
4 изменённых файлов: 52 добавлений и 8 удалений

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

@ -118,6 +118,12 @@ export function setPreview(
return;
}
// Handle cases where the result is invisible to the debugger
// and not possible to preview. Bug 1548256
if (result.class && result.class.includes("InvisibleToDebugger")) {
return;
}
const root = {
name: expression,
path: expression,

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

@ -264,7 +264,7 @@ type EvaluateParam = { thread: string, frameId: ?FrameId };
function evaluate(
script: ?Script,
{ thread, frameId }: EvaluateParam = {}
): Promise<{ result: ?Object }> {
): Promise<{ result: Grip | null }> {
const params = { thread, frameActor: frameId };
if (!tabTarget || !script) {
return Promise.resolve({ result: null });

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

@ -24,6 +24,27 @@ function makeDependencies() {
};
}
function makeGrip(actor = "") {
return {
actor,
class: "",
displayClass: "",
name: "",
extensible: true,
location: {
url: "",
line: 2,
column: 34
},
frozen: false,
ownPropertyLength: 1,
preview: {},
sealed: false,
optimizedOut: false,
type: ""
};
}
describe("firefox commands", () => {
describe("getProperties", () => {
it("empty response", async () => {
@ -34,7 +55,7 @@ describe("firefox commands", () => {
});
setupCommands({ ...makeDependencies(), threadClient });
const props = await getProperties("", { actor: "" });
const props = await getProperties("", makeGrip());
expect(props).toMatchSnapshot();
});
@ -49,7 +70,7 @@ describe("firefox commands", () => {
});
setupCommands({ ...makeDependencies(), threadClient });
const props = await getProperties("", { actor: "" });
const props = await getProperties("", makeGrip());
expect(props).toMatchSnapshot();
});
@ -66,7 +87,7 @@ describe("firefox commands", () => {
});
setupCommands({ ...makeDependencies(), threadClient });
const props = await getProperties("", { actor: "" });
const props = await getProperties("", makeGrip());
expect(props).toMatchSnapshot();
});
@ -82,7 +103,7 @@ describe("firefox commands", () => {
});
setupCommands({ ...makeDependencies(), threadClient });
const props = await getProperties("", { actor: "" });
const props = await getProperties("", makeGrip());
expect(props).toMatchSnapshot();
});
});

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

@ -209,7 +209,7 @@ export type TabTarget = {
script: Script,
func: Function,
params?: { frameActor: ?FrameId }
) => Promise<{ result: ?Object }>,
) => Promise<{ result: Grip | null }>,
autocomplete: (
input: string,
cursor: number,
@ -277,9 +277,26 @@ export type TabClient = {
* @memberof firefox
* @static
*/
// FIXME: need Grip definition
export type Grip = {
actor: string
actor: string,
class: string,
displayClass: string,
displayName?: string,
parameterNames?: string[],
userDisplayName?: string,
name: string,
extensible: boolean,
location: {
url: string,
line: number,
column: number
},
frozen: boolean,
ownPropertyLength: number,
preview: Object,
sealed: boolean,
optimizedOut: boolean,
type: string
};
export type FunctionGrip = {|