mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-19 08:15:31 +00:00
Bug 1559819 - rename threadClient to threadFront; r=jdescottes
Differential Revision: https://phabricator.services.mozilla.com/D32848 --HG-- rename : devtools/client/debugger/src/actions/tests/helpers/threadClient.js => devtools/client/debugger/src/actions/tests/helpers/threadFront.js rename : devtools/shared/client/thread-client.js => devtools/shared/fronts/thread.js extra : moz-landing-system : lando
This commit is contained in:
parent
7b91f43ece
commit
cc00bf541b
@ -129,7 +129,7 @@ Greenkeeper
|
||||
headlessly
|
||||
natively
|
||||
outputed
|
||||
threadClient
|
||||
threadFront
|
||||
tabTarget
|
||||
bpClients
|
||||
originalToGeneratedId
|
||||
|
@ -28,7 +28,7 @@ function onConnect(connection) {
|
||||
},
|
||||
|
||||
createObjectClient: function(grip) {
|
||||
return connection.tabConnection.threadClient.pauseGrip(grip);
|
||||
return connection.tabConnection.threadFront.pauseGrip(grip);
|
||||
},
|
||||
createLongStringClient: function(grip) {
|
||||
return connection.tabConnection.tabTarget.activeConsole.longString(grip);
|
||||
|
@ -30,7 +30,7 @@ DebuggerPanel.prototype = {
|
||||
selectors,
|
||||
client,
|
||||
} = await this.panelWin.Debugger.bootstrap({
|
||||
threadClient: this.toolbox.threadClient,
|
||||
threadFront: this.toolbox.threadFront,
|
||||
tabTarget: this.toolbox.target,
|
||||
debuggerClient: this.toolbox.target.client,
|
||||
workers: {
|
||||
|
@ -21,7 +21,7 @@ const sourceTexts = {
|
||||
"scopes.js": readFixture("scopes.js"),
|
||||
};
|
||||
|
||||
const threadClient = {
|
||||
const threadFront = {
|
||||
sourceContents: async ({ source }) => ({
|
||||
source: sourceTexts[source],
|
||||
contentType: "text/javascript",
|
||||
@ -34,7 +34,7 @@ const threadClient = {
|
||||
|
||||
describe("getInScopeLine", () => {
|
||||
it("with selected line", async () => {
|
||||
const store = createStore(threadClient);
|
||||
const store = createStore(threadFront);
|
||||
const { dispatch, getState } = store;
|
||||
const source = makeMockSource("scopes.js", "scopes.js");
|
||||
|
||||
|
@ -11,7 +11,7 @@ import {
|
||||
makeSource,
|
||||
waitForState,
|
||||
} from "../../../utils/test-head";
|
||||
import { createSource } from "../../tests/helpers/threadClient";
|
||||
import { createSource } from "../../tests/helpers/threadFront";
|
||||
|
||||
describe("breakpointPositions", () => {
|
||||
it("fetches positions", async () => {
|
||||
|
@ -12,11 +12,11 @@ import {
|
||||
getTelemetryEvents,
|
||||
} from "../../../utils/test-head";
|
||||
|
||||
import { simpleMockThreadClient } from "../../tests/helpers/threadClient.js";
|
||||
import { simpleMockThreadFront } from "../../tests/helpers/threadFront.js";
|
||||
|
||||
function mockClient(positionsResponse = {}) {
|
||||
return {
|
||||
...simpleMockThreadClient,
|
||||
...simpleMockThreadFront,
|
||||
getBreakpointPositions: async () => positionsResponse,
|
||||
getBreakableLines: async () => [],
|
||||
};
|
||||
|
@ -21,7 +21,7 @@ import { parserWorker } from "../../../test/tests-setup";
|
||||
const { isStepping } = selectors;
|
||||
|
||||
let stepInResolve = null;
|
||||
const mockThreadClient = {
|
||||
const mockThreadFront = {
|
||||
stepIn: () =>
|
||||
new Promise(_resolve => {
|
||||
stepInResolve = _resolve;
|
||||
@ -103,7 +103,7 @@ function createPauseInfo(
|
||||
describe("pause", () => {
|
||||
describe("stepping", () => {
|
||||
it("should set and clear the command", async () => {
|
||||
const { dispatch, getState } = createStore(mockThreadClient);
|
||||
const { dispatch, getState } = createStore(mockThreadFront);
|
||||
const mockPauseInfo = createPauseInfo();
|
||||
|
||||
await dispatch(actions.newGeneratedSource(makeSource("foo1")));
|
||||
@ -128,7 +128,7 @@ describe("pause", () => {
|
||||
});
|
||||
|
||||
it("should step when paused", async () => {
|
||||
const { dispatch, getState } = createStore(mockThreadClient);
|
||||
const { dispatch, getState } = createStore(mockThreadFront);
|
||||
const mockPauseInfo = createPauseInfo();
|
||||
|
||||
await dispatch(actions.newGeneratedSource(makeSource("foo1")));
|
||||
@ -139,7 +139,7 @@ describe("pause", () => {
|
||||
});
|
||||
|
||||
it("should step over when paused", async () => {
|
||||
const store = createStore(mockThreadClient);
|
||||
const store = createStore(mockThreadFront);
|
||||
const { dispatch, getState } = store;
|
||||
const mockPauseInfo = createPauseInfo();
|
||||
|
||||
@ -153,7 +153,7 @@ describe("pause", () => {
|
||||
});
|
||||
|
||||
it("should step over when paused before an await", async () => {
|
||||
const store = createStore(mockThreadClient);
|
||||
const store = createStore(mockThreadFront);
|
||||
const { dispatch, getState } = store;
|
||||
const mockPauseInfo = createPauseInfo({
|
||||
sourceId: "await",
|
||||
@ -173,7 +173,7 @@ describe("pause", () => {
|
||||
|
||||
it("should step over when paused after an await", async () => {
|
||||
const store = createStore({
|
||||
...mockThreadClient,
|
||||
...mockThreadFront,
|
||||
getBreakpointPositions: async () => ({ [2]: [1] }),
|
||||
});
|
||||
const { dispatch, getState } = store;
|
||||
@ -200,7 +200,7 @@ describe("pause", () => {
|
||||
column: 0,
|
||||
};
|
||||
|
||||
const store = createStore(mockThreadClient, {});
|
||||
const store = createStore(mockThreadFront, {});
|
||||
const { dispatch, getState } = store;
|
||||
const mockPauseInfo = createPauseInfo(generatedLocation, {
|
||||
scope: {
|
||||
@ -268,7 +268,7 @@ describe("pause", () => {
|
||||
getGeneratedLocation: async location => location,
|
||||
};
|
||||
|
||||
const store = createStore(mockThreadClient, {}, sourceMapsMock);
|
||||
const store = createStore(mockThreadFront, {}, sourceMapsMock);
|
||||
const { dispatch, getState } = store;
|
||||
const mockPauseInfo = createPauseInfo(generatedLocation);
|
||||
|
||||
@ -329,7 +329,7 @@ describe("pause", () => {
|
||||
getGeneratedRangesForOriginal: async () => [],
|
||||
};
|
||||
|
||||
const store = createStore(mockThreadClient, {}, sourceMapsMock);
|
||||
const store = createStore(mockThreadFront, {}, sourceMapsMock);
|
||||
const { dispatch, getState } = store;
|
||||
const mockPauseInfo = createPauseInfo(generatedLocation);
|
||||
|
||||
@ -372,7 +372,7 @@ describe("pause", () => {
|
||||
|
||||
describe("resumed", () => {
|
||||
it("should not evaluate expression while stepping", async () => {
|
||||
const client = { ...mockThreadClient, evaluateExpressions: jest.fn() };
|
||||
const client = { ...mockThreadFront, evaluateExpressions: jest.fn() };
|
||||
const { dispatch, getState } = createStore(client);
|
||||
const mockPauseInfo = createPauseInfo();
|
||||
|
||||
@ -381,12 +381,12 @@ describe("pause", () => {
|
||||
|
||||
const cx = selectors.getThreadContext(getState());
|
||||
dispatch(actions.stepIn(cx));
|
||||
await dispatch(actions.resumed(mockThreadClient.actorID));
|
||||
await dispatch(actions.resumed(mockThreadFront.actorID));
|
||||
expect(client.evaluateExpressions.mock.calls).toHaveLength(1);
|
||||
});
|
||||
|
||||
it("resuming - will re-evaluate watch expressions", async () => {
|
||||
const client = { ...mockThreadClient, evaluateExpressions: jest.fn() };
|
||||
const client = { ...mockThreadFront, evaluateExpressions: jest.fn() };
|
||||
const store = createStore(client);
|
||||
const { dispatch, getState, cx } = store;
|
||||
const mockPauseInfo = createPauseInfo();
|
||||
@ -399,7 +399,7 @@ describe("pause", () => {
|
||||
client.evaluateExpressions.mockReturnValue(Promise.resolve(["YAY"]));
|
||||
await dispatch(actions.paused(mockPauseInfo));
|
||||
|
||||
await dispatch(actions.resumed(mockThreadClient.actorID));
|
||||
await dispatch(actions.resumed(mockThreadFront.actorID));
|
||||
const expression = selectors.getExpression(getState(), "foo");
|
||||
expect(expression && expression.value).toEqual("YAY");
|
||||
});
|
||||
|
@ -14,14 +14,14 @@ import {
|
||||
} from "../../../utils/test-head";
|
||||
import {
|
||||
createSource,
|
||||
sourceThreadClient,
|
||||
} from "../../tests/helpers/threadClient.js";
|
||||
sourceThreadFront,
|
||||
} from "../../tests/helpers/threadFront.js";
|
||||
import { getBreakpointsList } from "../../../selectors";
|
||||
import { isFulfilled, isRejected } from "../../../utils/async-value";
|
||||
|
||||
describe("loadSourceText", () => {
|
||||
it("should load source text", async () => {
|
||||
const store = createStore(sourceThreadClient);
|
||||
const store = createStore(sourceThreadFront);
|
||||
const { dispatch, getState, cx } = store;
|
||||
|
||||
const foo1Source = await dispatch(
|
||||
@ -59,7 +59,7 @@ describe("loadSourceText", () => {
|
||||
|
||||
const store = createStore(
|
||||
{
|
||||
...sourceThreadClient,
|
||||
...sourceThreadFront,
|
||||
sourceContents: async () => fooGenContent,
|
||||
getBreakpointPositions: async () => ({ "1": [0] }),
|
||||
getBreakableLines: async () => [],
|
||||
@ -223,7 +223,7 @@ describe("loadSourceText", () => {
|
||||
});
|
||||
|
||||
it("should cache subsequent source text loads", async () => {
|
||||
const { dispatch, getState, cx } = createStore(sourceThreadClient);
|
||||
const { dispatch, getState, cx } = createStore(sourceThreadFront);
|
||||
|
||||
const source = await dispatch(
|
||||
actions.newGeneratedSource(makeSource("foo1"))
|
||||
@ -238,7 +238,7 @@ describe("loadSourceText", () => {
|
||||
});
|
||||
|
||||
it("should indicate a loading source", async () => {
|
||||
const store = createStore(sourceThreadClient);
|
||||
const store = createStore(sourceThreadFront);
|
||||
const { dispatch, cx } = store;
|
||||
|
||||
const source = await dispatch(
|
||||
@ -255,7 +255,7 @@ describe("loadSourceText", () => {
|
||||
});
|
||||
|
||||
it("should indicate an errored source text", async () => {
|
||||
const { dispatch, getState, cx } = createStore(sourceThreadClient);
|
||||
const { dispatch, getState, cx } = createStore(sourceThreadFront);
|
||||
|
||||
const source = await dispatch(
|
||||
actions.newGeneratedSource(makeSource("bad-id"))
|
||||
|
@ -21,11 +21,11 @@ const {
|
||||
import sourceQueue from "../../../utils/source-queue";
|
||||
|
||||
// eslint-disable-next-line max-len
|
||||
import { sourceThreadClient as threadClient } from "../../tests/helpers/threadClient.js";
|
||||
import { sourceThreadFront as threadFront } from "../../tests/helpers/threadFront.js";
|
||||
|
||||
describe("sources - new sources", () => {
|
||||
it("should add sources to state", async () => {
|
||||
const { dispatch, getState } = createStore(threadClient);
|
||||
const { dispatch, getState } = createStore(threadFront);
|
||||
await dispatch(actions.newGeneratedSource(makeSource("base.js")));
|
||||
await dispatch(actions.newGeneratedSource(makeSource("jquery.js")));
|
||||
|
||||
@ -37,7 +37,7 @@ describe("sources - new sources", () => {
|
||||
});
|
||||
|
||||
it("should not add multiple identical sources", async () => {
|
||||
const { dispatch, getState } = createStore(threadClient);
|
||||
const { dispatch, getState } = createStore(threadFront);
|
||||
|
||||
await dispatch(actions.newGeneratedSource(makeSource("base.js")));
|
||||
await dispatch(actions.newGeneratedSource(makeSource("base.js")));
|
||||
@ -46,7 +46,7 @@ describe("sources - new sources", () => {
|
||||
});
|
||||
|
||||
it("should automatically select a pending source", async () => {
|
||||
const { dispatch, getState, cx } = createStore(threadClient);
|
||||
const { dispatch, getState, cx } = createStore(threadFront);
|
||||
const baseSourceURL = makeSourceURL("base.js");
|
||||
await dispatch(actions.selectSourceURL(cx, baseSourceURL));
|
||||
|
||||
@ -61,7 +61,7 @@ describe("sources - new sources", () => {
|
||||
|
||||
it("should add original sources", async () => {
|
||||
const { dispatch, getState } = createStore(
|
||||
threadClient,
|
||||
threadFront,
|
||||
{},
|
||||
{
|
||||
getOriginalURLs: async () => ["magic.js"],
|
||||
@ -82,7 +82,7 @@ describe("sources - new sources", () => {
|
||||
it("should not attempt to fetch original sources if it's missing a source map url", async () => {
|
||||
const getOriginalURLs = jest.fn();
|
||||
const { dispatch } = createStore(
|
||||
threadClient,
|
||||
threadFront,
|
||||
{},
|
||||
{
|
||||
getOriginalURLs,
|
||||
@ -97,7 +97,7 @@ describe("sources - new sources", () => {
|
||||
// eslint-disable-next-line
|
||||
it("should process new sources immediately, without waiting for source maps to be fetched first", async () => {
|
||||
const { dispatch, getState } = createStore(
|
||||
threadClient,
|
||||
threadFront,
|
||||
{},
|
||||
{
|
||||
getOriginalURLs: async () => new Promise(_ => {}),
|
||||
@ -117,7 +117,7 @@ describe("sources - new sources", () => {
|
||||
// eslint-disable-next-line
|
||||
it("shouldn't let one slow loading source map delay all the other source maps", async () => {
|
||||
const dbg = createStore(
|
||||
threadClient,
|
||||
threadFront,
|
||||
{},
|
||||
{
|
||||
getOriginalURLs: async source => {
|
||||
@ -153,7 +153,7 @@ describe("sources - new sources", () => {
|
||||
it(`should find two sources when same source with
|
||||
querystring`, async () => {
|
||||
const { getSourcesUrlsInSources } = selectors;
|
||||
const { dispatch, getState } = createStore(threadClient);
|
||||
const { dispatch, getState } = createStore(threadFront);
|
||||
await dispatch(actions.newGeneratedSource(makeSource("base.js?v=1")));
|
||||
await dispatch(actions.newGeneratedSource(makeSource("base.js?v=2")));
|
||||
await dispatch(actions.newGeneratedSource(makeSource("diff.js?v=1")));
|
||||
|
@ -11,12 +11,12 @@ import {
|
||||
makeSource,
|
||||
} from "../../../utils/test-head";
|
||||
import { createPrettySource } from "../prettyPrint";
|
||||
import { sourceThreadClient } from "../../tests/helpers/threadClient.js";
|
||||
import { sourceThreadFront } from "../../tests/helpers/threadFront.js";
|
||||
import { isFulfilled } from "../../../utils/async-value";
|
||||
|
||||
describe("sources - pretty print", () => {
|
||||
it("returns a pretty source for a minified file", async () => {
|
||||
const { dispatch, getState, cx } = createStore(sourceThreadClient);
|
||||
const { dispatch, getState, cx } = createStore(sourceThreadFront);
|
||||
|
||||
const url = "base.js";
|
||||
const source = await dispatch(actions.newGeneratedSource(makeSource(url)));
|
||||
@ -42,7 +42,7 @@ describe("sources - pretty print", () => {
|
||||
});
|
||||
|
||||
it("should create a source when first toggling pretty print", async () => {
|
||||
const { dispatch, getState, cx } = createStore(sourceThreadClient);
|
||||
const { dispatch, getState, cx } = createStore(sourceThreadFront);
|
||||
|
||||
const source = await dispatch(
|
||||
actions.newGeneratedSource(makeSource("foobar.js"))
|
||||
@ -54,7 +54,7 @@ describe("sources - pretty print", () => {
|
||||
});
|
||||
|
||||
it("should not make a second source when toggling pretty print", async () => {
|
||||
const { dispatch, getState, cx } = createStore(sourceThreadClient);
|
||||
const { dispatch, getState, cx } = createStore(sourceThreadFront);
|
||||
|
||||
const source = await dispatch(
|
||||
actions.newGeneratedSource(makeSource("foobar.js"))
|
||||
|
@ -13,11 +13,11 @@ import {
|
||||
const { getSourcesUrlsInSources } = selectors;
|
||||
|
||||
// eslint-disable-next-line max-len
|
||||
import { sourceThreadClient as threadClient } from "../../tests/helpers/threadClient.js";
|
||||
import { sourceThreadFront as threadFront } from "../../tests/helpers/threadFront.js";
|
||||
|
||||
describe("sources - sources with querystrings", () => {
|
||||
it("should find two sources when same source with querystring", async () => {
|
||||
const { dispatch, getState } = createStore(threadClient);
|
||||
const { dispatch, getState } = createStore(threadFront);
|
||||
await dispatch(actions.newGeneratedSource(makeSource("base.js?v=1")));
|
||||
await dispatch(actions.newGeneratedSource(makeSource("base.js?v=2")));
|
||||
await dispatch(actions.newGeneratedSource(makeSource("diff.js?v=1")));
|
||||
|
@ -23,7 +23,7 @@ const {
|
||||
getSelectedLocation,
|
||||
} = selectors;
|
||||
|
||||
import { sourceThreadClient } from "../../tests/helpers/threadClient.js";
|
||||
import { sourceThreadFront } from "../../tests/helpers/threadFront.js";
|
||||
|
||||
process.on("unhandledRejection", (reason, p) => {});
|
||||
|
||||
@ -35,7 +35,7 @@ describe("sources", () => {
|
||||
it("should select a source", async () => {
|
||||
// Note that we pass an empty client in because the action checks
|
||||
// if it exists.
|
||||
const store = createStore(sourceThreadClient);
|
||||
const store = createStore(sourceThreadFront);
|
||||
const { dispatch, getState } = store;
|
||||
|
||||
const frame = makeFrame({ id: "1", sourceId: "foo1" });
|
||||
@ -69,7 +69,7 @@ describe("sources", () => {
|
||||
});
|
||||
|
||||
it("should select next tab on tab closed if no previous tab", async () => {
|
||||
const { dispatch, getState, cx } = createStore(sourceThreadClient);
|
||||
const { dispatch, getState, cx } = createStore(sourceThreadFront);
|
||||
|
||||
const fooSource = await dispatch(
|
||||
actions.newGeneratedSource(makeSource("foo.js"))
|
||||
@ -98,7 +98,7 @@ describe("sources", () => {
|
||||
});
|
||||
|
||||
it("should open a tab for the source", async () => {
|
||||
const { dispatch, getState, cx } = createStore(sourceThreadClient);
|
||||
const { dispatch, getState, cx } = createStore(sourceThreadFront);
|
||||
await dispatch(actions.newGeneratedSource(makeSource("foo.js")));
|
||||
dispatch(actions.selectLocation(cx, initialLocation("foo.js")));
|
||||
|
||||
@ -108,7 +108,7 @@ describe("sources", () => {
|
||||
});
|
||||
|
||||
it("should select previous tab on tab closed", async () => {
|
||||
const { dispatch, getState, cx } = createStore(sourceThreadClient);
|
||||
const { dispatch, getState, cx } = createStore(sourceThreadFront);
|
||||
await dispatch(actions.newGeneratedSource(makeSource("foo.js")));
|
||||
await dispatch(actions.newGeneratedSource(makeSource("bar.js")));
|
||||
|
||||
@ -127,7 +127,7 @@ describe("sources", () => {
|
||||
});
|
||||
|
||||
it("should keep the selected source when other tab closed", async () => {
|
||||
const { dispatch, getState, cx } = createStore(sourceThreadClient);
|
||||
const { dispatch, getState, cx } = createStore(sourceThreadFront);
|
||||
|
||||
await dispatch(actions.newGeneratedSource(makeSource("foo.js")));
|
||||
await dispatch(actions.newGeneratedSource(makeSource("bar.js")));
|
||||
@ -154,7 +154,7 @@ describe("sources", () => {
|
||||
});
|
||||
|
||||
it("should not select new sources that lack a URL", async () => {
|
||||
const { dispatch, getState } = createStore(sourceThreadClient);
|
||||
const { dispatch, getState } = createStore(sourceThreadFront);
|
||||
|
||||
await dispatch(
|
||||
actions.newGeneratedSource({
|
||||
@ -169,7 +169,7 @@ describe("sources", () => {
|
||||
});
|
||||
|
||||
it("sets and clears selected location correctly", async () => {
|
||||
const { dispatch, getState, cx } = createStore(sourceThreadClient);
|
||||
const { dispatch, getState, cx } = createStore(sourceThreadFront);
|
||||
const source = await dispatch(
|
||||
actions.newGeneratedSource(makeSource("testSource"))
|
||||
);
|
||||
@ -188,7 +188,7 @@ describe("sources", () => {
|
||||
});
|
||||
|
||||
it("sets and clears pending selected location correctly", () => {
|
||||
const { dispatch, getState, cx } = createStore(sourceThreadClient);
|
||||
const { dispatch, getState, cx } = createStore(sourceThreadFront);
|
||||
const url = "testURL";
|
||||
const options = { location: { line: "testLine" } };
|
||||
|
||||
@ -207,7 +207,7 @@ describe("sources", () => {
|
||||
});
|
||||
|
||||
it("should keep the generated the viewing context", async () => {
|
||||
const store = createStore(sourceThreadClient);
|
||||
const store = createStore(sourceThreadFront);
|
||||
const { dispatch, getState, cx } = store;
|
||||
const baseSource = await dispatch(
|
||||
actions.newGeneratedSource(makeSource("base.js"))
|
||||
@ -224,7 +224,7 @@ describe("sources", () => {
|
||||
|
||||
it("should keep the original the viewing context", async () => {
|
||||
const { dispatch, getState, cx } = createStore(
|
||||
sourceThreadClient,
|
||||
sourceThreadFront,
|
||||
{},
|
||||
{
|
||||
getOriginalLocation: async location => ({ ...location, line: 12 }),
|
||||
@ -258,7 +258,7 @@ describe("sources", () => {
|
||||
|
||||
it("should change the original the viewing context", async () => {
|
||||
const { dispatch, getState, cx } = createStore(
|
||||
sourceThreadClient,
|
||||
sourceThreadFront,
|
||||
{},
|
||||
{
|
||||
getOriginalLocation: async location => ({ ...location, line: 12 }),
|
||||
@ -290,7 +290,7 @@ describe("sources", () => {
|
||||
|
||||
describe("selectSourceURL", () => {
|
||||
it("should automatically select a pending source", async () => {
|
||||
const { dispatch, getState, cx } = createStore(sourceThreadClient);
|
||||
const { dispatch, getState, cx } = createStore(sourceThreadFront);
|
||||
const baseSourceURL = makeSourceURL("base.js");
|
||||
await dispatch(actions.selectSourceURL(cx, baseSourceURL));
|
||||
|
||||
|
@ -17,7 +17,7 @@ import {
|
||||
import readFixture from "./helpers/readFixture";
|
||||
const { getSymbols, isSymbolsLoading, getFramework } = selectors;
|
||||
|
||||
const threadClient = {
|
||||
const threadFront = {
|
||||
sourceContents: async ({ source }) => ({
|
||||
source: sourceTexts[source],
|
||||
contentType: "text/javascript",
|
||||
@ -56,7 +56,7 @@ describe("ast", () => {
|
||||
describe("setSymbols", () => {
|
||||
describe("when the source is loaded", () => {
|
||||
it("should be able to set symbols", async () => {
|
||||
const store = createStore(threadClient);
|
||||
const store = createStore(threadFront);
|
||||
const { dispatch, getState, cx } = store;
|
||||
const base = await dispatch(
|
||||
actions.newGeneratedSource(makeSource("base.js"))
|
||||
@ -74,7 +74,7 @@ describe("ast", () => {
|
||||
|
||||
describe("when the source is not loaded", () => {
|
||||
it("should return null", async () => {
|
||||
const { getState, dispatch } = createStore(threadClient);
|
||||
const { getState, dispatch } = createStore(threadFront);
|
||||
const base = await dispatch(
|
||||
actions.newGeneratedSource(makeSource("base.js"))
|
||||
);
|
||||
@ -86,7 +86,7 @@ describe("ast", () => {
|
||||
|
||||
describe("when there is no source", () => {
|
||||
it("should return null", async () => {
|
||||
const { getState } = createStore(threadClient);
|
||||
const { getState } = createStore(threadFront);
|
||||
const baseSymbols = getSymbols(getState());
|
||||
expect(baseSymbols).toEqual(null);
|
||||
});
|
||||
@ -94,7 +94,7 @@ describe("ast", () => {
|
||||
|
||||
describe("frameworks", () => {
|
||||
it("should detect react components", async () => {
|
||||
const store = createStore(threadClient, {}, sourceMaps);
|
||||
const store = createStore(threadFront, {}, sourceMaps);
|
||||
const { cx, dispatch, getState } = store;
|
||||
|
||||
const genSource = await dispatch(
|
||||
@ -113,7 +113,7 @@ describe("ast", () => {
|
||||
});
|
||||
|
||||
it("should not give false positive on non react components", async () => {
|
||||
const store = createStore(threadClient);
|
||||
const store = createStore(threadFront);
|
||||
const { cx, dispatch, getState } = store;
|
||||
const base = await dispatch(
|
||||
actions.newGeneratedSource(makeSource("base.js"))
|
||||
|
@ -13,7 +13,7 @@ import {
|
||||
|
||||
import { makeMockFrame } from "../../utils/test-mockup";
|
||||
|
||||
const mockThreadClient = {
|
||||
const mockThreadFront = {
|
||||
evaluateInFrame: (script, { frameId }) =>
|
||||
new Promise((resolve, reject) => {
|
||||
if (!frameId) {
|
||||
@ -52,14 +52,14 @@ const mockThreadClient = {
|
||||
|
||||
describe("expressions", () => {
|
||||
it("should add an expression", async () => {
|
||||
const { dispatch, getState, cx } = createStore(mockThreadClient);
|
||||
const { dispatch, getState, cx } = createStore(mockThreadFront);
|
||||
|
||||
await dispatch(actions.addExpression(cx, "foo"));
|
||||
expect(selectors.getExpressions(getState())).toHaveLength(1);
|
||||
});
|
||||
|
||||
it("should not add empty expressions", () => {
|
||||
const { dispatch, getState, cx } = createStore(mockThreadClient);
|
||||
const { dispatch, getState, cx } = createStore(mockThreadFront);
|
||||
|
||||
dispatch(actions.addExpression(cx, (undefined: any)));
|
||||
dispatch(actions.addExpression(cx, ""));
|
||||
@ -67,7 +67,7 @@ describe("expressions", () => {
|
||||
});
|
||||
|
||||
it("should not add invalid expressions", async () => {
|
||||
const { dispatch, getState, cx } = createStore(mockThreadClient);
|
||||
const { dispatch, getState, cx } = createStore(mockThreadFront);
|
||||
await dispatch(actions.addExpression(cx, "foo#"));
|
||||
const state = getState();
|
||||
expect(selectors.getExpressions(state)).toHaveLength(0);
|
||||
@ -75,7 +75,7 @@ describe("expressions", () => {
|
||||
});
|
||||
|
||||
it("should update an expression", async () => {
|
||||
const { dispatch, getState, cx } = createStore(mockThreadClient);
|
||||
const { dispatch, getState, cx } = createStore(mockThreadFront);
|
||||
|
||||
await dispatch(actions.addExpression(cx, "foo"));
|
||||
const expression = selectors.getExpression(getState(), "foo");
|
||||
@ -90,7 +90,7 @@ describe("expressions", () => {
|
||||
});
|
||||
|
||||
it("should not update an expression w/ invalid code", async () => {
|
||||
const { dispatch, getState, cx } = createStore(mockThreadClient);
|
||||
const { dispatch, getState, cx } = createStore(mockThreadFront);
|
||||
|
||||
await dispatch(actions.addExpression(cx, "foo"));
|
||||
const expression = selectors.getExpression(getState(), "foo");
|
||||
@ -102,7 +102,7 @@ describe("expressions", () => {
|
||||
});
|
||||
|
||||
it("should delete an expression", async () => {
|
||||
const { dispatch, getState, cx } = createStore(mockThreadClient);
|
||||
const { dispatch, getState, cx } = createStore(mockThreadFront);
|
||||
|
||||
await dispatch(actions.addExpression(cx, "foo"));
|
||||
await dispatch(actions.addExpression(cx, "bar"));
|
||||
@ -121,7 +121,7 @@ describe("expressions", () => {
|
||||
});
|
||||
|
||||
it("should evaluate expressions global scope", async () => {
|
||||
const { dispatch, getState, cx } = createStore(mockThreadClient);
|
||||
const { dispatch, getState, cx } = createStore(mockThreadFront);
|
||||
await dispatch(actions.addExpression(cx, "foo"));
|
||||
await dispatch(actions.addExpression(cx, "bar"));
|
||||
|
||||
@ -138,7 +138,7 @@ describe("expressions", () => {
|
||||
});
|
||||
|
||||
it("should evaluate expressions in specific scope", async () => {
|
||||
const { dispatch, getState } = createStore(mockThreadClient);
|
||||
const { dispatch, getState } = createStore(mockThreadFront);
|
||||
await createFrames(getState, dispatch);
|
||||
|
||||
const cx = selectors.getThreadContext(getState());
|
||||
@ -159,7 +159,7 @@ describe("expressions", () => {
|
||||
});
|
||||
|
||||
it("should get the autocomplete matches for the input", async () => {
|
||||
const { cx, dispatch, getState } = createStore(mockThreadClient);
|
||||
const { cx, dispatch, getState } = createStore(mockThreadFront);
|
||||
await dispatch(actions.autocomplete(cx, "to", 2));
|
||||
expect(selectors.getAutocompleteMatchset(getState())).toMatchSnapshot();
|
||||
});
|
||||
|
@ -36,7 +36,7 @@ const sources = [
|
||||
"jquery.js",
|
||||
];
|
||||
|
||||
export const simpleMockThreadClient = {
|
||||
export const simpleMockThreadFront = {
|
||||
getBreakpointByLocation: (jest.fn(): any),
|
||||
setBreakpoint: (location: SourceActorLocation, _condition: string) =>
|
||||
Promise.resolve({ id: "hi", actualLocation: location }),
|
||||
@ -62,7 +62,7 @@ export const simpleMockThreadClient = {
|
||||
};
|
||||
|
||||
// sources and tabs
|
||||
export const sourceThreadClient = {
|
||||
export const sourceThreadFront = {
|
||||
sourceContents: function({
|
||||
source,
|
||||
}: SourceActor): Promise<{| source: any, contentType: ?string |}> {
|
||||
@ -75,7 +75,7 @@ export const sourceThreadClient = {
|
||||
});
|
||||
},
|
||||
setBreakpoint: async () => {},
|
||||
threadClient: async () => {},
|
||||
threadFront: async () => {},
|
||||
getFrameScopes: async () => {},
|
||||
evaluateExpressions: async () => {},
|
||||
getBreakpointPositions: async () => ({}),
|
@ -22,7 +22,7 @@ const {
|
||||
getFileSearchResults,
|
||||
} = selectors;
|
||||
|
||||
const threadClient = {
|
||||
const threadFront = {
|
||||
sourceContents: async () => ({
|
||||
source: "function foo1() {\n const foo = 5; return foo;\n}",
|
||||
contentType: "text/javascript",
|
||||
@ -45,7 +45,7 @@ describe("navigation", () => {
|
||||
});
|
||||
|
||||
it("navigation closes project-search", async () => {
|
||||
const { dispatch, getState, cx } = createStore(threadClient);
|
||||
const { dispatch, getState, cx } = createStore(threadFront);
|
||||
const mockQuery = "foo";
|
||||
|
||||
await dispatch(actions.newGeneratedSource(makeSource("foo1")));
|
||||
@ -65,7 +65,7 @@ describe("navigation", () => {
|
||||
});
|
||||
|
||||
it("navigation removes activeSearch 'project' value", async () => {
|
||||
const { dispatch, getState } = createStore(threadClient);
|
||||
const { dispatch, getState } = createStore(threadFront);
|
||||
dispatch(actions.setActiveSearch("project"));
|
||||
expect(getActiveSearch(getState())).toBe("project");
|
||||
|
||||
@ -74,7 +74,7 @@ describe("navigation", () => {
|
||||
});
|
||||
|
||||
it("navigation clears the file-search query", async () => {
|
||||
const { dispatch, getState, cx } = createStore(threadClient);
|
||||
const { dispatch, getState, cx } = createStore(threadFront);
|
||||
|
||||
dispatch(actions.setFileSearchQuery(cx, "foobar"));
|
||||
expect(getFileSearchQuery(getState())).toBe("foobar");
|
||||
@ -85,7 +85,7 @@ describe("navigation", () => {
|
||||
});
|
||||
|
||||
it("navigation clears the file-search results", async () => {
|
||||
const { dispatch, getState, cx } = createStore(threadClient);
|
||||
const { dispatch, getState, cx } = createStore(threadFront);
|
||||
|
||||
const searchResults = [{ line: 1, ch: 3 }, { line: 3, ch: 2 }];
|
||||
dispatch(actions.updateSearchResults(cx, 2, 3, searchResults));
|
||||
@ -107,7 +107,7 @@ describe("navigation", () => {
|
||||
});
|
||||
|
||||
it("navigation removes activeSearch 'file' value", async () => {
|
||||
const { dispatch, getState } = createStore(threadClient);
|
||||
const { dispatch, getState } = createStore(threadFront);
|
||||
dispatch(actions.setActiveSearch("file"));
|
||||
expect(getActiveSearch(getState())).toBe("file");
|
||||
|
||||
|
@ -10,7 +10,7 @@ import {
|
||||
mockPendingBreakpoint,
|
||||
} from "./helpers/breakpoints.js";
|
||||
|
||||
import { simpleMockThreadClient } from "./helpers/threadClient.js";
|
||||
import { simpleMockThreadFront } from "./helpers/threadFront.js";
|
||||
|
||||
import { asyncStore } from "../../utils/prefs";
|
||||
|
||||
@ -47,7 +47,7 @@ import sourceMaps from "devtools-source-map";
|
||||
import { makePendingLocationId } from "../../utils/breakpoint";
|
||||
function mockClient(bpPos = {}) {
|
||||
return {
|
||||
...simpleMockThreadClient,
|
||||
...simpleMockThreadFront,
|
||||
|
||||
getBreakpointPositions: async () => bpPos,
|
||||
getBreakableLines: async () => [],
|
||||
|
@ -23,7 +23,7 @@ function waitForPreview(store, expression) {
|
||||
});
|
||||
}
|
||||
|
||||
function mockThreadClient(overrides) {
|
||||
function mockThreadFront(overrides) {
|
||||
return {
|
||||
evaluateInFrame: async () => ({ result: {} }),
|
||||
getFrameScopes: async () => {},
|
||||
@ -76,7 +76,7 @@ async function pause({ dispatch, cx }) {
|
||||
|
||||
describe("preview", () => {
|
||||
it("should generate previews", async () => {
|
||||
const store = createStore(mockThreadClient());
|
||||
const store = createStore(mockThreadFront());
|
||||
const { dispatch, getState, cx } = store;
|
||||
const base = await dispatch(
|
||||
actions.newGeneratedSource(makeSource("base.js"))
|
||||
@ -112,7 +112,7 @@ describe("preview", () => {
|
||||
const promises = [firstSetPreview, secondSetPreview];
|
||||
|
||||
const store = createStore(
|
||||
mockThreadClient({
|
||||
mockThreadFront({
|
||||
loadObjectProperties: () => promises.shift().promise,
|
||||
})
|
||||
);
|
||||
@ -156,7 +156,7 @@ describe("preview", () => {
|
||||
const promises = [firstSetPreview, secondSetPreview];
|
||||
|
||||
const store = createStore(
|
||||
mockThreadClient({
|
||||
mockThreadFront({
|
||||
loadObjectProperties: () => promises.shift().promise,
|
||||
})
|
||||
);
|
||||
|
@ -37,7 +37,7 @@ const sources = {
|
||||
},
|
||||
};
|
||||
|
||||
const threadClient = {
|
||||
const threadFront = {
|
||||
sourceContents: async ({ source }) => sources[source],
|
||||
getBreakpointPositions: async () => ({}),
|
||||
getBreakableLines: async () => [],
|
||||
@ -54,7 +54,7 @@ describe("project text search", () => {
|
||||
});
|
||||
|
||||
it("should search all the loaded sources based on the query", async () => {
|
||||
const { dispatch, getState, cx } = createStore(threadClient);
|
||||
const { dispatch, getState, cx } = createStore(threadFront);
|
||||
const mockQuery = "foo";
|
||||
|
||||
await dispatch(actions.newGeneratedSource(makeSource("foo1")));
|
||||
@ -78,7 +78,7 @@ describe("project text search", () => {
|
||||
getOriginalLocation: async loc => loc,
|
||||
};
|
||||
|
||||
const { dispatch, getState, cx } = createStore(threadClient, {}, mockMaps);
|
||||
const { dispatch, getState, cx } = createStore(threadFront, {}, mockMaps);
|
||||
|
||||
const source1 = await dispatch(
|
||||
actions.newGeneratedSource(makeSource("bar"))
|
||||
@ -94,7 +94,7 @@ describe("project text search", () => {
|
||||
});
|
||||
|
||||
it("should search a specific source", async () => {
|
||||
const { dispatch, getState, cx } = createStore(threadClient);
|
||||
const { dispatch, getState, cx } = createStore(threadFront);
|
||||
|
||||
const source = await dispatch(
|
||||
actions.newGeneratedSource(makeSource("bar"))
|
||||
@ -118,7 +118,7 @@ describe("project text search", () => {
|
||||
});
|
||||
|
||||
it("should clear all the search results", async () => {
|
||||
const { dispatch, getState, cx } = createStore(threadClient);
|
||||
const { dispatch, getState, cx } = createStore(threadFront);
|
||||
const mockQuery = "foo";
|
||||
|
||||
await dispatch(actions.newGeneratedSource(makeSource("foo1")));
|
||||
@ -139,7 +139,7 @@ describe("project text search", () => {
|
||||
});
|
||||
|
||||
it("should close project search", async () => {
|
||||
const { dispatch, getState, cx } = createStore(threadClient);
|
||||
const { dispatch, getState, cx } = createStore(threadFront);
|
||||
const mockQuery = "foo";
|
||||
|
||||
await dispatch(actions.newGeneratedSource(makeSource("foo1")));
|
||||
|
@ -12,11 +12,11 @@ import {
|
||||
} from "../../utils/test-head";
|
||||
const { getSelectedSource, getSourceTabs } = selectors;
|
||||
|
||||
import { sourceThreadClient as threadClient } from "./helpers/threadClient.js";
|
||||
import { sourceThreadFront as threadFront } from "./helpers/threadFront.js";
|
||||
|
||||
describe("closing tabs", () => {
|
||||
it("closing a tab", async () => {
|
||||
const { dispatch, getState, cx } = createStore(threadClient);
|
||||
const { dispatch, getState, cx } = createStore(threadFront);
|
||||
|
||||
const fooSource = await dispatch(
|
||||
actions.newGeneratedSource(makeSource("foo.js"))
|
||||
@ -29,7 +29,7 @@ describe("closing tabs", () => {
|
||||
});
|
||||
|
||||
it("closing the inactive tab", async () => {
|
||||
const { dispatch, getState, cx } = createStore(threadClient);
|
||||
const { dispatch, getState, cx } = createStore(threadFront);
|
||||
|
||||
const fooSource = await dispatch(
|
||||
actions.newGeneratedSource(makeSource("foo.js"))
|
||||
@ -45,7 +45,7 @@ describe("closing tabs", () => {
|
||||
});
|
||||
|
||||
it("closing the only tab", async () => {
|
||||
const { dispatch, getState, cx } = createStore(threadClient);
|
||||
const { dispatch, getState, cx } = createStore(threadFront);
|
||||
|
||||
const fooSource = await dispatch(
|
||||
actions.newGeneratedSource(makeSource("foo.js"))
|
||||
@ -58,7 +58,7 @@ describe("closing tabs", () => {
|
||||
});
|
||||
|
||||
it("closing the active tab", async () => {
|
||||
const { dispatch, getState, cx } = createStore(threadClient);
|
||||
const { dispatch, getState, cx } = createStore(threadFront);
|
||||
|
||||
await dispatch(actions.newGeneratedSource(makeSource("foo.js")));
|
||||
const barSource = await dispatch(
|
||||
@ -74,7 +74,7 @@ describe("closing tabs", () => {
|
||||
});
|
||||
|
||||
it("closing many inactive tabs", async () => {
|
||||
const { dispatch, getState, cx } = createStore(threadClient);
|
||||
const { dispatch, getState, cx } = createStore(threadFront);
|
||||
|
||||
await dispatch(actions.newGeneratedSource(makeSource("foo.js")));
|
||||
await dispatch(actions.newGeneratedSource(makeSource("bar.js")));
|
||||
@ -97,7 +97,7 @@ describe("closing tabs", () => {
|
||||
});
|
||||
|
||||
it("closing many tabs including the active tab", async () => {
|
||||
const { dispatch, getState, cx } = createStore(threadClient);
|
||||
const { dispatch, getState, cx } = createStore(threadFront);
|
||||
|
||||
await dispatch(actions.newGeneratedSource(makeSource("foo.js")));
|
||||
await dispatch(actions.newGeneratedSource(makeSource("bar.js")));
|
||||
@ -119,7 +119,7 @@ describe("closing tabs", () => {
|
||||
});
|
||||
|
||||
it("closing all the tabs", async () => {
|
||||
const { dispatch, getState, cx } = createStore(threadClient);
|
||||
const { dispatch, getState, cx } = createStore(threadFront);
|
||||
|
||||
await dispatch(actions.newGeneratedSource(makeSource("foo.js")));
|
||||
await dispatch(actions.newGeneratedSource(makeSource("bar.js")));
|
||||
|
@ -16,12 +16,12 @@ function createObjectClient(grip: Grip) {
|
||||
|
||||
export async function onConnect(connection: any, actions: Object) {
|
||||
const {
|
||||
tabConnection: { tabTarget, threadClient, debuggerClient },
|
||||
tabConnection: { tabTarget, threadFront, debuggerClient },
|
||||
} = connection;
|
||||
|
||||
DebuggerClient = debuggerClient;
|
||||
|
||||
if (!tabTarget || !threadClient || !debuggerClient) {
|
||||
if (!tabTarget || !threadFront || !debuggerClient) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -29,18 +29,18 @@ export async function onConnect(connection: any, actions: Object) {
|
||||
features.wasm && !!debuggerClient.mainRoot.traits.wasmBinarySource;
|
||||
|
||||
setupCommands({
|
||||
threadClient,
|
||||
threadFront,
|
||||
tabTarget,
|
||||
debuggerClient,
|
||||
supportsWasm,
|
||||
});
|
||||
|
||||
setupEvents({ threadClient, tabTarget, actions, supportsWasm });
|
||||
setupEvents({ threadFront, tabTarget, actions, supportsWasm });
|
||||
|
||||
tabTarget.on("will-navigate", actions.willNavigate);
|
||||
tabTarget.on("navigate", actions.navigated);
|
||||
|
||||
await threadClient.reconfigure({
|
||||
await threadFront.reconfigure({
|
||||
observeAsmJS: true,
|
||||
pauseWorkersUntilAttach: true,
|
||||
wasmBinarySource: supportsWasm,
|
||||
@ -63,7 +63,7 @@ export async function onConnect(connection: any, actions: Object) {
|
||||
const traits = tabTarget.traits;
|
||||
await actions.connect(
|
||||
tabTarget.url,
|
||||
threadClient.actor,
|
||||
threadFront.actor,
|
||||
traits && traits.canRewind,
|
||||
tabTarget.isWebExtension
|
||||
);
|
||||
@ -72,11 +72,11 @@ export async function onConnect(connection: any, actions: Object) {
|
||||
.fetchSources()
|
||||
.then(sources => actions.newGeneratedSources(sources));
|
||||
|
||||
// If the threadClient is already paused, make sure to show a
|
||||
// If the threadFront is already paused, make sure to show a
|
||||
// paused state.
|
||||
const pausedPacket = threadClient.getLastPausePacket();
|
||||
const pausedPacket = threadFront.getLastPausePacket();
|
||||
if (pausedPacket) {
|
||||
clientEvents.paused(threadClient, pausedPacket);
|
||||
clientEvents.paused(threadFront, pausedPacket);
|
||||
}
|
||||
|
||||
return fetched;
|
||||
|
@ -30,7 +30,7 @@ import type {
|
||||
TabTarget,
|
||||
DebuggerClient,
|
||||
Grip,
|
||||
ThreadClient,
|
||||
ThreadFront,
|
||||
ObjectClient,
|
||||
SourcesPacket,
|
||||
} from "./types";
|
||||
@ -41,7 +41,7 @@ import type {
|
||||
} from "../../actions/types";
|
||||
|
||||
let workerClients: Object;
|
||||
let threadClient: ThreadClient;
|
||||
let threadFront: ThreadFront;
|
||||
let tabTarget: TabTarget;
|
||||
let debuggerClient: DebuggerClient;
|
||||
let sourceActors: { [ActorId]: SourceId };
|
||||
@ -52,14 +52,14 @@ let supportsWasm: boolean;
|
||||
let shouldWaitForWorkers = false;
|
||||
|
||||
type Dependencies = {
|
||||
threadClient: ThreadClient,
|
||||
threadFront: ThreadFront,
|
||||
tabTarget: TabTarget,
|
||||
debuggerClient: DebuggerClient,
|
||||
supportsWasm: boolean,
|
||||
};
|
||||
|
||||
function setupCommands(dependencies: Dependencies) {
|
||||
threadClient = dependencies.threadClient;
|
||||
threadFront = dependencies.threadFront;
|
||||
tabTarget = dependencies.tabTarget;
|
||||
debuggerClient = dependencies.debuggerClient;
|
||||
supportsWasm = dependencies.supportsWasm;
|
||||
@ -100,9 +100,9 @@ function sendPacket(packet: Object) {
|
||||
return debuggerClient.request(packet);
|
||||
}
|
||||
|
||||
function lookupThreadClient(thread: string) {
|
||||
if (thread == threadClient.actor) {
|
||||
return threadClient;
|
||||
function lookupThreadFront(thread: string) {
|
||||
if (thread == threadFront.actor) {
|
||||
return threadFront;
|
||||
}
|
||||
if (!workerClients[thread]) {
|
||||
throw new Error(`Unknown thread client: ${thread}`);
|
||||
@ -111,18 +111,18 @@ function lookupThreadClient(thread: string) {
|
||||
}
|
||||
|
||||
function lookupConsoleClient(thread: string) {
|
||||
if (thread == threadClient.actor) {
|
||||
if (thread == threadFront.actor) {
|
||||
return tabTarget.activeConsole;
|
||||
}
|
||||
return workerClients[thread].console;
|
||||
}
|
||||
|
||||
function listWorkerThreadClients() {
|
||||
function listWorkerThreadFronts() {
|
||||
return (Object.values(workerClients): any).map(({ thread }) => thread);
|
||||
}
|
||||
|
||||
function forEachWorkerThread(iteratee) {
|
||||
const promises = listWorkerThreadClients().map(thread => iteratee(thread));
|
||||
const promises = listWorkerThreadFronts().map(thread => iteratee(thread));
|
||||
|
||||
// Do not return promises for the caller to wait on unless a flag is set.
|
||||
// Currently, worker threads are not guaranteed to respond to all requests,
|
||||
@ -133,49 +133,49 @@ function forEachWorkerThread(iteratee) {
|
||||
}
|
||||
|
||||
function resume(thread: string): Promise<*> {
|
||||
return lookupThreadClient(thread).resume();
|
||||
return lookupThreadFront(thread).resume();
|
||||
}
|
||||
|
||||
function stepIn(thread: string): Promise<*> {
|
||||
return lookupThreadClient(thread).stepIn();
|
||||
return lookupThreadFront(thread).stepIn();
|
||||
}
|
||||
|
||||
function stepOver(thread: string): Promise<*> {
|
||||
return lookupThreadClient(thread).stepOver();
|
||||
return lookupThreadFront(thread).stepOver();
|
||||
}
|
||||
|
||||
function stepOut(thread: string): Promise<*> {
|
||||
return lookupThreadClient(thread).stepOut();
|
||||
return lookupThreadFront(thread).stepOut();
|
||||
}
|
||||
|
||||
function rewind(thread: string): Promise<*> {
|
||||
return lookupThreadClient(thread).rewind();
|
||||
return lookupThreadFront(thread).rewind();
|
||||
}
|
||||
|
||||
function reverseStepOver(thread: string): Promise<*> {
|
||||
return lookupThreadClient(thread).reverseStepOver();
|
||||
return lookupThreadFront(thread).reverseStepOver();
|
||||
}
|
||||
|
||||
function breakOnNext(thread: string): Promise<*> {
|
||||
return lookupThreadClient(thread).breakOnNext();
|
||||
return lookupThreadFront(thread).breakOnNext();
|
||||
}
|
||||
|
||||
async function sourceContents({
|
||||
actor,
|
||||
thread,
|
||||
}: SourceActor): Promise<{| source: any, contentType: ?string |}> {
|
||||
const sourceThreadClient = lookupThreadClient(thread);
|
||||
const sourceFront = sourceThreadClient.source({ actor });
|
||||
const sourceThreadFront = lookupThreadFront(thread);
|
||||
const sourceFront = sourceThreadFront.source({ actor });
|
||||
const { source, contentType } = await sourceFront.source();
|
||||
return { source, contentType };
|
||||
}
|
||||
|
||||
function setXHRBreakpoint(path: string, method: string) {
|
||||
return threadClient.setXHRBreakpoint(path, method);
|
||||
return threadFront.setXHRBreakpoint(path, method);
|
||||
}
|
||||
|
||||
function removeXHRBreakpoint(path: string, method: string) {
|
||||
return threadClient.removeXHRBreakpoint(path, method);
|
||||
return threadFront.removeXHRBreakpoint(path, method);
|
||||
}
|
||||
|
||||
// Get the string key to use for a breakpoint location.
|
||||
@ -191,7 +191,7 @@ function waitForWorkers(shouldWait: boolean) {
|
||||
}
|
||||
|
||||
function detachWorkers() {
|
||||
for (const thread of listWorkerThreadClients()) {
|
||||
for (const thread of listWorkerThreadFronts()) {
|
||||
thread.detach();
|
||||
}
|
||||
}
|
||||
@ -231,7 +231,7 @@ async function setBreakpoint(
|
||||
// on all threads. Requests on server threads will resolve in FIFO order, and
|
||||
// this could result in the breakpoint state here being out of sync with the
|
||||
// breakpoints that are installed in the server.
|
||||
const mainThreadPromise = threadClient.setBreakpoint(location, options);
|
||||
const mainThreadPromise = threadFront.setBreakpoint(location, options);
|
||||
|
||||
await forEachWorkerThread(thread => thread.setBreakpoint(location, options));
|
||||
await mainThreadPromise;
|
||||
@ -242,7 +242,7 @@ async function removeBreakpoint(location: PendingLocation) {
|
||||
delete breakpoints[locationKey((location: any))];
|
||||
|
||||
// Delay waiting on this promise, for the same reason as in setBreakpoint.
|
||||
const mainThreadPromise = threadClient.removeBreakpoint(location);
|
||||
const mainThreadPromise = threadFront.removeBreakpoint(location);
|
||||
|
||||
await forEachWorkerThread(thread => thread.removeBreakpoint(location));
|
||||
await mainThreadPromise;
|
||||
@ -304,7 +304,7 @@ function reload(): Promise<*> {
|
||||
}
|
||||
|
||||
function getProperties(thread: string, grip: Grip): Promise<*> {
|
||||
const objClient = lookupThreadClient(thread).pauseGrip(grip);
|
||||
const objClient = lookupThreadFront(thread).pauseGrip(grip);
|
||||
|
||||
return objClient.getPrototypeAndProperties().then(resp => {
|
||||
const { ownProperties, safeGetterValues } = resp;
|
||||
@ -321,15 +321,15 @@ async function getFrameScopes(frame: Frame): Promise<*> {
|
||||
return frame.scope;
|
||||
}
|
||||
|
||||
const sourceThreadClient = lookupThreadClient(frame.thread);
|
||||
return sourceThreadClient.getEnvironment(frame.id);
|
||||
const sourceThreadFront = lookupThreadFront(frame.thread);
|
||||
return sourceThreadFront.getEnvironment(frame.id);
|
||||
}
|
||||
|
||||
async function pauseOnExceptions(
|
||||
shouldPauseOnExceptions: boolean,
|
||||
shouldPauseOnCaughtExceptions: boolean
|
||||
): Promise<*> {
|
||||
await threadClient.pauseOnExceptions(
|
||||
await threadFront.pauseOnExceptions(
|
||||
shouldPauseOnExceptions,
|
||||
// Providing opposite value because server
|
||||
// uses "shouldIgnoreCaughtExceptions"
|
||||
@ -349,7 +349,7 @@ async function blackBox(
|
||||
isBlackBoxed: boolean,
|
||||
range?: Range
|
||||
): Promise<*> {
|
||||
const sourceFront = threadClient.source({ actor: sourceActor.actor });
|
||||
const sourceFront = threadFront.source({ actor: sourceActor.actor });
|
||||
if (isBlackBoxed) {
|
||||
await sourceFront.unblackBox(range);
|
||||
} else {
|
||||
@ -358,18 +358,18 @@ async function blackBox(
|
||||
}
|
||||
|
||||
async function setSkipPausing(shouldSkip: boolean) {
|
||||
await threadClient.skipBreakpoints(shouldSkip);
|
||||
await threadFront.skipBreakpoints(shouldSkip);
|
||||
await forEachWorkerThread(thread => thread.skipBreakpoints(shouldSkip));
|
||||
}
|
||||
|
||||
function interrupt(thread: string): Promise<*> {
|
||||
return lookupThreadClient(thread).interrupt();
|
||||
return lookupThreadFront(thread).interrupt();
|
||||
}
|
||||
|
||||
async function setEventListenerBreakpoints(ids: string[]) {
|
||||
eventBreakpoints = ids;
|
||||
|
||||
await threadClient.setActiveEventBreakpoints(ids);
|
||||
await threadFront.setActiveEventBreakpoints(ids);
|
||||
await forEachWorkerThread(thread => thread.setActiveEventBreakpoints(ids));
|
||||
}
|
||||
|
||||
@ -379,7 +379,7 @@ async function getEventListenerBreakpointTypes(): Promise<
|
||||
> {
|
||||
let categories;
|
||||
try {
|
||||
categories = await threadClient.getAvailableEventBreakpoints();
|
||||
categories = await threadFront.getAvailableEventBreakpoints();
|
||||
|
||||
if (!Array.isArray(categories)) {
|
||||
// When connecting to older browser that had our placeholder
|
||||
@ -397,7 +397,7 @@ async function getEventListenerBreakpointTypes(): Promise<
|
||||
}
|
||||
|
||||
function pauseGrip(thread: string, func: Function): ObjectClient {
|
||||
return lookupThreadClient(thread).pauseGrip(func);
|
||||
return lookupThreadFront(thread).pauseGrip(func);
|
||||
}
|
||||
|
||||
function registerSourceActor(sourceActorId: string, sourceId: SourceId) {
|
||||
@ -405,7 +405,7 @@ function registerSourceActor(sourceActorId: string, sourceId: SourceId) {
|
||||
}
|
||||
|
||||
async function getSources(
|
||||
client: ThreadClient
|
||||
client: ThreadFront
|
||||
): Promise<Array<GeneratedSourceData>> {
|
||||
const { sources }: SourcesPacket = await client.getSources();
|
||||
|
||||
@ -413,7 +413,7 @@ async function getSources(
|
||||
}
|
||||
|
||||
async function fetchSources(): Promise<Array<GeneratedSourceData>> {
|
||||
return getSources(threadClient);
|
||||
return getSources(threadFront);
|
||||
}
|
||||
|
||||
function getSourceForActor(actor: ActorId) {
|
||||
@ -434,7 +434,7 @@ async function fetchWorkers(): Promise<Worker[]> {
|
||||
const newWorkerClients = await updateWorkerClients({
|
||||
tabTarget,
|
||||
debuggerClient,
|
||||
threadClient,
|
||||
threadFront,
|
||||
workerClients,
|
||||
options,
|
||||
});
|
||||
@ -469,7 +469,7 @@ async function fetchWorkers(): Promise<Worker[]> {
|
||||
}
|
||||
|
||||
function getMainThread() {
|
||||
return threadClient.actor;
|
||||
return threadFront.actor;
|
||||
}
|
||||
|
||||
async function getBreakpointPositions(
|
||||
@ -479,8 +479,8 @@ async function getBreakpointPositions(
|
||||
const sourcePositions = {};
|
||||
|
||||
for (const { thread, actor } of actors) {
|
||||
const sourceThreadClient = lookupThreadClient(thread);
|
||||
const sourceFront = sourceThreadClient.source({ actor });
|
||||
const sourceThreadFront = lookupThreadFront(thread);
|
||||
const sourceFront = sourceThreadFront.source({ actor });
|
||||
const positions = await sourceFront.getBreakpointPositionsCompressed(range);
|
||||
|
||||
for (const line of Object.keys(positions)) {
|
||||
@ -499,8 +499,8 @@ async function getBreakpointPositions(
|
||||
async function getBreakableLines(actors: Array<SourceActor>) {
|
||||
let lines = [];
|
||||
for (const { thread, actor } of actors) {
|
||||
const sourceThreadClient = lookupThreadClient(thread);
|
||||
const sourceFront = sourceThreadClient.source({ actor });
|
||||
const sourceThreadFront = lookupThreadFront(thread);
|
||||
const sourceFront = sourceThreadFront.source({ actor });
|
||||
let actorLines = [];
|
||||
try {
|
||||
actorLines = await sourceFront.getBreakableLines();
|
||||
|
@ -11,13 +11,13 @@ import type {
|
||||
FramesResponse,
|
||||
FramePacket,
|
||||
SourcePayload,
|
||||
ThreadClient,
|
||||
ThreadFront,
|
||||
} from "./types";
|
||||
|
||||
import { clientCommands } from "./commands";
|
||||
|
||||
export function prepareSourcePayload(
|
||||
client: ThreadClient,
|
||||
client: ThreadFront,
|
||||
source: SourcePayload
|
||||
): GeneratedSourceData {
|
||||
// We populate the set of sources as soon as we hear about them. Note that
|
||||
|
@ -7,7 +7,7 @@
|
||||
import type {
|
||||
SourcePacket,
|
||||
PausedPacket,
|
||||
ThreadClient,
|
||||
ThreadFront,
|
||||
Actions,
|
||||
TabTarget,
|
||||
} from "./types";
|
||||
@ -18,7 +18,7 @@ import sourceQueue from "../../utils/source-queue";
|
||||
const CALL_STACK_PAGE_SIZE = 1000;
|
||||
|
||||
type Dependencies = {
|
||||
threadClient: ThreadClient,
|
||||
threadFront: ThreadFront,
|
||||
tabTarget: TabTarget,
|
||||
actions: Actions,
|
||||
};
|
||||
@ -26,23 +26,23 @@ type Dependencies = {
|
||||
let actions: Actions;
|
||||
let isInterrupted: boolean;
|
||||
|
||||
function addThreadEventListeners(client: ThreadClient) {
|
||||
function addThreadEventListeners(thread: ThreadFront) {
|
||||
Object.keys(clientEvents).forEach(eventName => {
|
||||
client.on(eventName, clientEvents[eventName].bind(null, client));
|
||||
thread.on(eventName, clientEvents[eventName].bind(null, thread));
|
||||
});
|
||||
}
|
||||
|
||||
function setupEvents(dependencies: Dependencies) {
|
||||
const threadClient = dependencies.threadClient;
|
||||
const threadFront = dependencies.threadFront;
|
||||
const tabTarget = dependencies.tabTarget;
|
||||
actions = dependencies.actions;
|
||||
sourceQueue.initialize(actions);
|
||||
|
||||
addThreadEventListeners(threadClient);
|
||||
addThreadEventListeners(threadFront);
|
||||
tabTarget.on("workerListChanged", workerListChanged);
|
||||
}
|
||||
|
||||
async function paused(threadClient: ThreadClient, packet: PausedPacket) {
|
||||
async function paused(threadFront: ThreadFront, packet: PausedPacket) {
|
||||
// If paused by an explicit interrupt, which are generated by the
|
||||
// slow script dialog and internal events such as setting
|
||||
// breakpoints, ignore the event.
|
||||
@ -55,7 +55,7 @@ async function paused(threadClient: ThreadClient, packet: PausedPacket) {
|
||||
let response;
|
||||
try {
|
||||
// Eagerly fetch the frames
|
||||
response = await threadClient.getFrames(0, CALL_STACK_PAGE_SIZE);
|
||||
response = await threadFront.getFrames(0, CALL_STACK_PAGE_SIZE);
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
return;
|
||||
@ -67,13 +67,13 @@ async function paused(threadClient: ThreadClient, packet: PausedPacket) {
|
||||
}
|
||||
|
||||
if (why.type != "alreadyPaused") {
|
||||
const pause = createPause(threadClient.actor, packet, response);
|
||||
const pause = createPause(threadFront.actor, packet, response);
|
||||
await sourceQueue.flush();
|
||||
actions.paused(pause);
|
||||
}
|
||||
}
|
||||
|
||||
function resumed(threadClient: ThreadClient) {
|
||||
function resumed(threadFront: ThreadFront) {
|
||||
// NOTE: the client suppresses resumed events while interrupted
|
||||
// to prevent unintentional behavior.
|
||||
// see [client docs](../README.md#interrupted) for more information.
|
||||
@ -82,13 +82,13 @@ function resumed(threadClient: ThreadClient) {
|
||||
return;
|
||||
}
|
||||
|
||||
actions.resumed(threadClient.actorID);
|
||||
actions.resumed(threadFront.actorID);
|
||||
}
|
||||
|
||||
function newSource(threadClient: ThreadClient, { source }: SourcePacket) {
|
||||
function newSource(threadFront: ThreadFront, { source }: SourcePacket) {
|
||||
sourceQueue.queue({
|
||||
type: "generated",
|
||||
data: prepareSourcePayload(threadClient, source),
|
||||
data: prepareSourcePayload(threadFront, source),
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@ import { setupCommands, clientCommands } from "../commands";
|
||||
|
||||
function makeThreadCLient(resp) {
|
||||
// Coerce this to any to avoid supplying the additional members needed in a
|
||||
// thread client.
|
||||
// thread front.
|
||||
return ({
|
||||
pauseGrip: () => ({
|
||||
getPrototypeAndProperties: async () => resp,
|
||||
@ -49,19 +49,19 @@ describe("firefox commands", () => {
|
||||
describe("getProperties", () => {
|
||||
it("empty response", async () => {
|
||||
const { getProperties } = clientCommands;
|
||||
const threadClient = makeThreadCLient({
|
||||
const threadFront = makeThreadCLient({
|
||||
ownProperties: {},
|
||||
safeGetterValues: {},
|
||||
});
|
||||
|
||||
setupCommands({ ...makeDependencies(), threadClient });
|
||||
setupCommands({ ...makeDependencies(), threadFront });
|
||||
const props = await getProperties("", makeGrip());
|
||||
expect(props).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it("simple properties", async () => {
|
||||
const { getProperties } = clientCommands;
|
||||
const threadClient = makeThreadCLient({
|
||||
const threadFront = makeThreadCLient({
|
||||
ownProperties: {
|
||||
obj: { value: "obj" },
|
||||
foo: { value: "foo" },
|
||||
@ -69,14 +69,14 @@ describe("firefox commands", () => {
|
||||
safeGetterValues: {},
|
||||
});
|
||||
|
||||
setupCommands({ ...makeDependencies(), threadClient });
|
||||
setupCommands({ ...makeDependencies(), threadFront });
|
||||
const props = await getProperties("", makeGrip());
|
||||
expect(props).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it("getter values", async () => {
|
||||
const { getProperties } = clientCommands;
|
||||
const threadClient = makeThreadCLient({
|
||||
const threadFront = makeThreadCLient({
|
||||
ownProperties: {
|
||||
obj: { value: "obj" },
|
||||
foo: { value: "foo" },
|
||||
@ -86,14 +86,14 @@ describe("firefox commands", () => {
|
||||
},
|
||||
});
|
||||
|
||||
setupCommands({ ...makeDependencies(), threadClient });
|
||||
setupCommands({ ...makeDependencies(), threadFront });
|
||||
const props = await getProperties("", makeGrip());
|
||||
expect(props).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it("new getter values", async () => {
|
||||
const { getProperties } = clientCommands;
|
||||
const threadClient = makeThreadCLient({
|
||||
const threadFront = makeThreadCLient({
|
||||
ownProperties: {
|
||||
foo: { value: "foo" },
|
||||
},
|
||||
@ -102,7 +102,7 @@ describe("firefox commands", () => {
|
||||
},
|
||||
});
|
||||
|
||||
setupCommands({ ...makeDependencies(), threadClient });
|
||||
setupCommands({ ...makeDependencies(), threadFront });
|
||||
const props = await getProperties("", makeGrip());
|
||||
expect(props).toMatchSnapshot();
|
||||
});
|
||||
|
@ -13,7 +13,7 @@ const tabTarget = {
|
||||
},
|
||||
};
|
||||
|
||||
const threadClient = {
|
||||
const threadFront = {
|
||||
on: () => {},
|
||||
reconfigure: () => {},
|
||||
getSources: () => {
|
||||
@ -59,7 +59,7 @@ describe("firefox onConnect", () => {
|
||||
{
|
||||
tabConnection: {
|
||||
tabTarget,
|
||||
threadClient,
|
||||
threadFront,
|
||||
debuggerClient,
|
||||
},
|
||||
},
|
||||
|
@ -112,7 +112,7 @@ export type SourcePacket = {
|
||||
};
|
||||
|
||||
/**
|
||||
* Sources Packet from calling threadClient.getSources();
|
||||
* Sources Packet from calling threadFront.getSources();
|
||||
* @memberof firefox/packets
|
||||
* @static
|
||||
*/
|
||||
@ -315,7 +315,7 @@ export type FunctionGrip = {|
|
||||
*/
|
||||
export type SourceClient = {
|
||||
source: () => { source: any, contentType?: string },
|
||||
_activeThread: ThreadClient,
|
||||
_activeThread: ThreadFront,
|
||||
actor: string,
|
||||
getBreakpointPositionsCompressed: (range: ?Range) => Promise<any>,
|
||||
prettyPrint: number => Promise<*>,
|
||||
@ -335,11 +335,11 @@ export type ObjectClient = {
|
||||
};
|
||||
|
||||
/**
|
||||
* ThreadClient
|
||||
* ThreadFront
|
||||
* @memberof firefox
|
||||
* @static
|
||||
*/
|
||||
export type ThreadClient = {
|
||||
export type ThreadFront = {
|
||||
resume: Function => Promise<*>,
|
||||
stepIn: Function => Promise<*>,
|
||||
stepOver: Function => Promise<*>,
|
||||
|
@ -14,7 +14,7 @@ export function supportsWorkers(tabTarget: TabTarget) {
|
||||
export async function updateWorkerClients({
|
||||
tabTarget,
|
||||
debuggerClient,
|
||||
threadClient,
|
||||
threadFront,
|
||||
workerClients,
|
||||
options,
|
||||
}: Object) {
|
||||
|
@ -16,7 +16,7 @@ function unmountRoot() {
|
||||
|
||||
module.exports = {
|
||||
bootstrap: ({
|
||||
threadClient,
|
||||
threadFront,
|
||||
tabTarget,
|
||||
debuggerClient,
|
||||
workers,
|
||||
@ -27,7 +27,7 @@ module.exports = {
|
||||
tab: { clientType: "firefox" },
|
||||
tabConnection: {
|
||||
tabTarget,
|
||||
threadClient,
|
||||
threadFront,
|
||||
debuggerClient,
|
||||
},
|
||||
},
|
||||
|
@ -25,7 +25,7 @@ function sendPacket(dbg: any, packet: any) {
|
||||
|
||||
function sendPacketToThread(dbg: Object, packet: any) {
|
||||
return sendPacket(dbg, {
|
||||
to: dbg.connection.tabConnection.threadClient.actor,
|
||||
to: dbg.connection.tabConnection.threadFront.actor,
|
||||
...packet,
|
||||
});
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ add_task(async function() {
|
||||
|
||||
// Wait for the debugger to be selected and make sure it's paused
|
||||
await waitOnToolbox(toolbox, "jsdebugger-selected");
|
||||
is(toolbox.threadClient.state, "paused");
|
||||
is(toolbox.threadFront.state, "paused");
|
||||
|
||||
// Create a dbg context
|
||||
const dbg = createDebuggerContext(toolbox);
|
||||
|
@ -7,7 +7,7 @@
|
||||
* Tests that chrome debugging works.
|
||||
*/
|
||||
|
||||
var gClient, gThreadClient;
|
||||
var gClient, gThreadFront;
|
||||
var gNewChromeSource = promise.defer();
|
||||
|
||||
var { DevToolsLoader } = ChromeUtils.import("resource://devtools/shared/Loader.jsm");
|
||||
@ -28,19 +28,19 @@ function initDebuggerClient() {
|
||||
function onNewSource(packet) {
|
||||
if (packet.source.url.startsWith("chrome:")) {
|
||||
ok(true, "Received a new chrome source: " + packet.source.url);
|
||||
gThreadClient.off("newSource", onNewSource);
|
||||
gThreadFront.off("newSource", onNewSource);
|
||||
gNewChromeSource.resolve();
|
||||
}
|
||||
}
|
||||
|
||||
async function resumeAndCloseConnection() {
|
||||
await gThreadClient.resume();
|
||||
await gThreadFront.resume();
|
||||
return gClient.close();
|
||||
}
|
||||
|
||||
registerCleanupFunction(function() {
|
||||
gClient = null;
|
||||
gThreadClient = null;
|
||||
gThreadFront = null;
|
||||
gNewChromeSource = null;
|
||||
|
||||
customLoader = null;
|
||||
@ -55,12 +55,12 @@ add_task(async function() {
|
||||
|
||||
const front = await gClient.mainRoot.getMainProcess();
|
||||
await front.attach();
|
||||
const [, threadClient] = await front.attachThread();
|
||||
gThreadClient = threadClient;
|
||||
const [, threadFront] = await front.attachThread();
|
||||
gThreadFront = threadFront;
|
||||
gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser, "about:mozilla");
|
||||
|
||||
// listen for a new source and global
|
||||
gThreadClient.on("newSource", onNewSource);
|
||||
gThreadFront.on("newSource", onNewSource);
|
||||
await gNewChromeSource.promise;
|
||||
|
||||
await resumeAndCloseConnection();
|
||||
|
@ -42,7 +42,7 @@ add_task(async function() {
|
||||
await pushPref("devtools.debugger.features.windowless-workers", true);
|
||||
|
||||
const dbg = await initDebugger("doc-windowless-workers.html");
|
||||
const mainThread = dbg.toolbox.threadClient.actor;
|
||||
const mainThread = dbg.toolbox.threadFront.actor;
|
||||
|
||||
// NOTE: by default we do not wait on worker
|
||||
// commands to complete because the thread could be
|
||||
|
@ -27,7 +27,7 @@ function log(msg, data) {
|
||||
}
|
||||
|
||||
function logThreadEvents(dbg, event) {
|
||||
const thread = dbg.toolbox.threadClient;
|
||||
const thread = dbg.toolbox.threadFront;
|
||||
|
||||
thread.on(event, function onEvent(...args) {
|
||||
info(`Thread event '${event}' fired.`);
|
||||
@ -1727,11 +1727,11 @@ function hideConsoleContextMenu(hud) {
|
||||
// Return a promise that resolves with the result of a thread evaluating a
|
||||
// string in the topmost frame.
|
||||
async function evaluateInTopFrame(target, text) {
|
||||
const threadClient = target.threadClient;
|
||||
const threadFront = target.threadFront;
|
||||
const consoleFront = await target.getFront("console");
|
||||
const { frames } = await threadClient.getFrames(0, 1);
|
||||
const { frames } = await threadFront.getFrames(0, 1);
|
||||
ok(frames.length == 1, "Got one frame");
|
||||
const options = { thread: threadClient.actor, frameActor: frames[0].actor };
|
||||
const options = { thread: threadFront.actor, frameActor: frames[0].actor };
|
||||
const response = await consoleFront.evaluateJS(text, options);
|
||||
return response.result.type == "undefined" ? undefined : response.result;
|
||||
}
|
||||
|
@ -542,36 +542,36 @@ var gDevToolsBrowser = (exports.gDevToolsBrowser = {
|
||||
const target = await TargetFactory.forTab(tab);
|
||||
|
||||
gDevTools.showToolbox(target, "jsdebugger").then(toolbox => {
|
||||
const threadClient = toolbox.threadClient;
|
||||
const threadFront = toolbox.threadFront;
|
||||
|
||||
// Break in place, which means resuming the debuggee thread and pausing
|
||||
// right before the next step happens.
|
||||
switch (threadClient.state) {
|
||||
switch (threadFront.state) {
|
||||
case "paused":
|
||||
// When the debugger is already paused.
|
||||
threadClient.resumeThenPause();
|
||||
threadFront.resumeThenPause();
|
||||
callback();
|
||||
break;
|
||||
case "attached":
|
||||
// When the debugger is already open.
|
||||
threadClient.interrupt().then(() => {
|
||||
threadClient.resumeThenPause();
|
||||
threadFront.interrupt().then(() => {
|
||||
threadFront.resumeThenPause();
|
||||
callback();
|
||||
});
|
||||
break;
|
||||
case "resuming":
|
||||
// The debugger is newly opened.
|
||||
threadClient.once("resumed", () => {
|
||||
threadClient.interrupt().then(() => {
|
||||
threadClient.resumeThenPause();
|
||||
threadFront.once("resumed", () => {
|
||||
threadFront.interrupt().then(() => {
|
||||
threadFront.resumeThenPause();
|
||||
callback();
|
||||
});
|
||||
});
|
||||
break;
|
||||
default:
|
||||
throw Error(
|
||||
"invalid thread client state in slow script debug handler: " +
|
||||
threadClient.state
|
||||
"invalid thread front state in slow script debug handler: " +
|
||||
threadFront.state
|
||||
);
|
||||
}
|
||||
});
|
||||
|
@ -71,7 +71,7 @@ SourceMapURLService.prototype._getLoadingPromise = function() {
|
||||
);
|
||||
|
||||
// Start fetching the sources now.
|
||||
const loadingPromise = this._toolbox.threadClient.getSources().then(
|
||||
const loadingPromise = this._toolbox.threadFront.getSources().then(
|
||||
({ sources }) => {
|
||||
// Ignore errors. Register the sources we got; we can't rely on
|
||||
// an event to arrive if the source actor already existed.
|
||||
|
@ -41,10 +41,10 @@ async function testChromeTab() {
|
||||
const target = await TargetFactory.forTab(tab);
|
||||
await target.attach();
|
||||
|
||||
const [, threadClient] = await target.attachThread();
|
||||
await threadClient.resume();
|
||||
const [, threadFront] = await target.attachThread();
|
||||
await threadFront.resume();
|
||||
|
||||
const { sources } = await threadClient.getSources();
|
||||
const { sources } = await threadFront.getSources();
|
||||
ok(
|
||||
sources.find(s => s.url == CHROME_PAGE),
|
||||
"The thread actor is able to attach to the chrome page and its sources"
|
||||
@ -107,9 +107,9 @@ async function testMainProcess() {
|
||||
const target = await client.mainRoot.getMainProcess();
|
||||
await target.attach();
|
||||
|
||||
const [, threadClient] = await target.attachThread();
|
||||
await threadClient.resume();
|
||||
const { sources } = await threadClient.getSources();
|
||||
const [, threadFront] = await target.attachThread();
|
||||
await threadFront.resume();
|
||||
const { sources } = await threadFront.getSources();
|
||||
ok(
|
||||
sources.find(
|
||||
s => s.url == "resource://devtools/client/framework/devtools.js"
|
||||
|
@ -11,7 +11,7 @@ add_task(async function() {
|
||||
|
||||
const toolbox = await gDevTools.showToolbox(target, "webconsole");
|
||||
ok(toolbox.isReady, "toolbox isReady is set");
|
||||
ok(toolbox.threadClient, "toolbox has a thread client");
|
||||
ok(toolbox.threadFront, "toolbox has a thread front");
|
||||
|
||||
const toolbox2 = await gDevTools.showToolbox(toolbox.target, toolbox.toolId);
|
||||
is(toolbox2, toolbox, "same toolbox");
|
||||
|
@ -241,13 +241,13 @@ function setupThreadListeners(panel) {
|
||||
updateBadgeText(true);
|
||||
};
|
||||
const onResumed = updateBadgeText.bind(null, false);
|
||||
const threadClient = gToolbox.target.threadClient;
|
||||
threadClient.on("paused", onPaused);
|
||||
threadClient.on("resumed", onResumed);
|
||||
const threadFront = gToolbox.target.threadFront;
|
||||
threadFront.on("paused", onPaused);
|
||||
threadFront.on("resumed", onResumed);
|
||||
|
||||
panel.once("destroyed", () => {
|
||||
threadClient.off("paused", onPaused);
|
||||
threadClient.off("resumed", onResumed);
|
||||
threadFront.off("paused", onPaused);
|
||||
threadFront.off("resumed", onResumed);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -445,8 +445,8 @@ Toolbox.prototype = {
|
||||
return this._target;
|
||||
},
|
||||
|
||||
get threadClient() {
|
||||
return this._threadClient;
|
||||
get threadFront() {
|
||||
return this._threadFront;
|
||||
},
|
||||
|
||||
/**
|
||||
@ -563,14 +563,14 @@ Toolbox.prototype = {
|
||||
this.unhighlightTool("jsdebugger");
|
||||
},
|
||||
|
||||
_startThreadClientListeners: function() {
|
||||
this.threadClient.on("paused", this._onPausedState);
|
||||
this.threadClient.on("resumed", this._onResumedState);
|
||||
_startThreadFrontListeners: function() {
|
||||
this.threadFront.on("paused", this._onPausedState);
|
||||
this.threadFront.on("resumed", this._onResumedState);
|
||||
},
|
||||
|
||||
_stopThreadClientListeners: function() {
|
||||
this.threadClient.off("paused", this._onPausedState);
|
||||
this.threadClient.off("resumed", this._onResumedState);
|
||||
_stopThreadFrontListeners: function() {
|
||||
this.threadFront.off("paused", this._onPausedState);
|
||||
this.threadFront.off("resumed", this._onResumedState);
|
||||
},
|
||||
|
||||
_attachAndResumeThread: async function() {
|
||||
@ -587,10 +587,10 @@ Toolbox.prototype = {
|
||||
"devtools.debugger.features.overlay-step-buttons"
|
||||
),
|
||||
};
|
||||
const [, threadClient] = await this._target.attachThread(threadOptions);
|
||||
const [, threadFront] = await this._target.attachThread(threadOptions);
|
||||
|
||||
try {
|
||||
await threadClient.resume();
|
||||
await threadFront.resume();
|
||||
} catch (ex) {
|
||||
// Interpret a possible error thrown by ThreadActor.resume
|
||||
if (ex.error === "wrongOrder") {
|
||||
@ -606,7 +606,7 @@ Toolbox.prototype = {
|
||||
}
|
||||
}
|
||||
|
||||
return threadClient;
|
||||
return threadFront;
|
||||
},
|
||||
|
||||
/**
|
||||
@ -646,8 +646,8 @@ Toolbox.prototype = {
|
||||
await this._target.activeConsole.startListeners(["NetworkActivity"]);
|
||||
}
|
||||
|
||||
this._threadClient = await this._attachAndResumeThread();
|
||||
this._startThreadClientListeners();
|
||||
this._threadFront = await this._attachAndResumeThread();
|
||||
this._startThreadFrontListeners();
|
||||
|
||||
await domReady;
|
||||
|
||||
@ -1377,7 +1377,7 @@ Toolbox.prototype = {
|
||||
// If the debugger is paused, don't let the ESC key stop any pending navigation.
|
||||
// If the host is page, don't let the ESC stop the load of the webconsole frame.
|
||||
if (
|
||||
this._threadClient.state == "paused" ||
|
||||
this._threadFront.state == "paused" ||
|
||||
this.hostType === Toolbox.HostType.PAGE
|
||||
) {
|
||||
e.preventDefault();
|
||||
@ -3539,8 +3539,8 @@ Toolbox.prototype = {
|
||||
outstanding.push(this.resetPreference());
|
||||
|
||||
// Detach the thread
|
||||
this._stopThreadClientListeners();
|
||||
this._threadClient = null;
|
||||
this._stopThreadFrontListeners();
|
||||
this._threadFront = null;
|
||||
|
||||
// Unregister buttons listeners
|
||||
this.toolbarButtons.forEach(button => {
|
||||
|
@ -208,8 +208,8 @@ Inspector.prototype = {
|
||||
}
|
||||
this._replayResumed = !dbg.isPaused();
|
||||
|
||||
this._target.threadClient.on("paused", this.handleThreadPaused);
|
||||
this._target.threadClient.on("resumed", this.handleThreadResumed);
|
||||
this._target.threadFront.on("paused", this.handleThreadPaused);
|
||||
this._target.threadFront.on("resumed", this.handleThreadResumed);
|
||||
}
|
||||
|
||||
await Promise.all([
|
||||
@ -1567,8 +1567,8 @@ Inspector.prototype = {
|
||||
return this._panelDestroyer;
|
||||
}
|
||||
|
||||
this._target.threadClient.off("paused", this.handleThreadPaused);
|
||||
this._target.threadClient.off("resumed", this.handleThreadResumed);
|
||||
this._target.threadFront.off("paused", this.handleThreadPaused);
|
||||
this._target.threadFront.off("resumed", this.handleThreadResumed);
|
||||
|
||||
if (this.walker) {
|
||||
this.walker.off("new-root", this.onNewRoot);
|
||||
|
@ -24,8 +24,8 @@ add_task(async () => {
|
||||
await target.attach();
|
||||
const { client } = target;
|
||||
|
||||
const threadClient = await testEarlyDebuggerStatement(client, tab, target);
|
||||
await testDebuggerStatement(client, tab, threadClient);
|
||||
const threadFront = await testEarlyDebuggerStatement(client, tab, target);
|
||||
await testDebuggerStatement(client, tab, threadFront);
|
||||
|
||||
await target.destroy();
|
||||
});
|
||||
@ -36,7 +36,7 @@ async function testEarlyDebuggerStatement(client, tab, targetFront) {
|
||||
};
|
||||
|
||||
// using the DebuggerClient to listen to the pause packet, as the
|
||||
// threadClient is not yet attached.
|
||||
// threadFront is not yet attached.
|
||||
client.on("paused", onPaused);
|
||||
|
||||
// This should continue without nesting an event loop and calling
|
||||
@ -46,17 +46,17 @@ async function testEarlyDebuggerStatement(client, tab, targetFront) {
|
||||
client.off("paused", onPaused);
|
||||
|
||||
// Now attach and resume...
|
||||
const [, threadClient] = await targetFront.attachThread();
|
||||
await threadClient.resume();
|
||||
const [, threadFront] = await targetFront.attachThread();
|
||||
await threadFront.resume();
|
||||
ok(true, "Pause wasn't called before we've attached.");
|
||||
|
||||
return threadClient;
|
||||
return threadFront;
|
||||
}
|
||||
|
||||
async function testDebuggerStatement(client, tab, threadClient) {
|
||||
async function testDebuggerStatement(client, tab, threadFront) {
|
||||
const onPaused = new Promise(resolve => {
|
||||
threadClient.on("paused", async packet => {
|
||||
await threadClient.resume();
|
||||
threadFront.on("paused", async packet => {
|
||||
await threadFront.resume();
|
||||
ok(true, "The pause handler was triggered on a debugger statement.");
|
||||
resolve();
|
||||
});
|
||||
|
@ -21,7 +21,7 @@ var WORKER_URL = "code_WorkerTargetActor.attachThread-worker.js";
|
||||
add_task(async function testWhilePaused() {
|
||||
const dbg = await initWorkerDebugger(TAB_URL, WORKER_URL);
|
||||
const { client, tab, workerTargetFront, toolbox } = dbg;
|
||||
const workerThreadClient = await workerTargetFront.getFront("context");
|
||||
const workerThreadFront = await workerTargetFront.getFront("context");
|
||||
|
||||
// Execute some basic math to make sure evaluations are working.
|
||||
const jsterm = await getSplitConsole(toolbox);
|
||||
@ -32,7 +32,7 @@ add_task(async function testWhilePaused() {
|
||||
);
|
||||
|
||||
await clickElement(dbg, "pause");
|
||||
workerThreadClient.once("willInterrupt").then(() => {
|
||||
workerThreadFront.once("willInterrupt").then(() => {
|
||||
info("Posting message to worker, then waiting for a pause");
|
||||
postMessageToWorkerInTab(tab, WORKER_URL, "ping");
|
||||
});
|
||||
|
@ -245,9 +245,9 @@ this.removeTab = function removeTab(tab, win) {
|
||||
async function attachThreadActorForTab(tab) {
|
||||
const target = await TargetFactory.forTab(tab);
|
||||
await target.attach();
|
||||
const [, threadClient] = await target.attachThread();
|
||||
await threadClient.resume();
|
||||
return { client: target.client, threadClient };
|
||||
const [, threadFront] = await target.attachThread();
|
||||
await threadFront.resume();
|
||||
return { client: target.client, threadFront };
|
||||
}
|
||||
|
||||
function pushPrefs(...aPrefs) {
|
||||
|
@ -733,7 +733,7 @@ async function openDebugger(options = {}) {
|
||||
await panel.panelWin.DebuggerController.waitForSourcesLoaded();
|
||||
} else {
|
||||
// New debugger
|
||||
await toolbox.threadClient.getSources();
|
||||
await toolbox.threadFront.getSources();
|
||||
}
|
||||
return { target, toolbox, panel };
|
||||
}
|
||||
|
@ -302,8 +302,8 @@ function createContextMenu(
|
||||
label: l10n.getStr("webconsole.menu.timeWarp.label"),
|
||||
disabled: false,
|
||||
click: () => {
|
||||
const threadClient = toolbox.threadClient;
|
||||
threadClient.timeWarp(executionPoint);
|
||||
const threadFront = toolbox.threadFront;
|
||||
threadFront.timeWarp(executionPoint);
|
||||
},
|
||||
})
|
||||
);
|
||||
|
@ -311,8 +311,8 @@ class WebConsoleWrapper {
|
||||
};
|
||||
|
||||
if (this.toolbox) {
|
||||
this.toolbox.threadClient.on("paused", this.dispatchPaused);
|
||||
this.toolbox.threadClient.on("progress", this.dispatchProgress);
|
||||
this.toolbox.threadFront.on("paused", this.dispatchPaused);
|
||||
this.toolbox.threadFront.on("progress", this.dispatchProgress);
|
||||
|
||||
const { highlight, unhighlight } = this.toolbox.getHighlighter(true);
|
||||
|
||||
@ -392,7 +392,7 @@ class WebConsoleWrapper {
|
||||
return Promise.all([onNodeFrontSet, onInspectorUpdated]);
|
||||
},
|
||||
jumpToExecutionPoint: executionPoint =>
|
||||
this.toolbox.threadClient.timeWarp(executionPoint),
|
||||
this.toolbox.threadFront.timeWarp(executionPoint),
|
||||
|
||||
onMessageHover: (type, messageId) => {
|
||||
const message = getMessage(store.getState(), messageId);
|
||||
|
@ -270,7 +270,7 @@ class WebConsole {
|
||||
*
|
||||
* @return object|null
|
||||
* An object which holds:
|
||||
* - frames: the active ThreadClient.cachedFrames array.
|
||||
* - frames: the active ThreadFront.cachedFrames array.
|
||||
* - selected: depth/index of the selected stackframe in the debugger
|
||||
* UI.
|
||||
* If the debugger is not open or if it's not paused, then |null| is
|
||||
|
@ -116,9 +116,9 @@ class WebReplayPlayer extends Component {
|
||||
|
||||
componentDidMount() {
|
||||
this.overlayWidth = this.updateOverlayWidth();
|
||||
this.threadClient.on("paused", this.onPaused.bind(this));
|
||||
this.threadClient.on("resumed", this.onResumed.bind(this));
|
||||
this.threadClient.on("progress", this.onProgress.bind(this));
|
||||
this.threadFront.on("paused", this.onPaused.bind(this));
|
||||
this.threadFront.on("resumed", this.onResumed.bind(this));
|
||||
this.threadFront.on("progress", this.onProgress.bind(this));
|
||||
|
||||
this.toolbox.getPanelWhenReady("webconsole").then(panel => {
|
||||
const consoleFrame = panel.hud.ui;
|
||||
@ -143,8 +143,8 @@ class WebReplayPlayer extends Component {
|
||||
return this.toolbox.getPanel("webconsole");
|
||||
}
|
||||
|
||||
get threadClient() {
|
||||
return this.toolbox.threadClient;
|
||||
get threadFront() {
|
||||
return this.toolbox.threadFront;
|
||||
}
|
||||
|
||||
isRecording() {
|
||||
@ -296,7 +296,7 @@ class WebReplayPlayer extends Component {
|
||||
|
||||
// set seeking to the current execution point to avoid a progress bar jump
|
||||
this.setState({ seeking: true });
|
||||
return this.threadClient.timeWarp(executionPoint);
|
||||
return this.threadFront.timeWarp(executionPoint);
|
||||
}
|
||||
|
||||
next() {
|
||||
@ -319,7 +319,7 @@ class WebReplayPlayer extends Component {
|
||||
|
||||
async previous() {
|
||||
if (this.isRecording()) {
|
||||
await this.threadClient.interrupt();
|
||||
await this.threadFront.interrupt();
|
||||
}
|
||||
|
||||
if (!this.isPaused()) {
|
||||
@ -341,19 +341,19 @@ class WebReplayPlayer extends Component {
|
||||
return null;
|
||||
}
|
||||
|
||||
return this.threadClient.resume();
|
||||
return this.threadFront.resume();
|
||||
}
|
||||
|
||||
async rewind() {
|
||||
if (this.isRecording()) {
|
||||
await this.threadClient.interrupt();
|
||||
await this.threadFront.interrupt();
|
||||
}
|
||||
|
||||
if (!this.isPaused()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return this.threadClient.rewind();
|
||||
return this.threadFront.rewind();
|
||||
}
|
||||
|
||||
pause() {
|
||||
@ -361,7 +361,7 @@ class WebReplayPlayer extends Component {
|
||||
return null;
|
||||
}
|
||||
|
||||
return this.threadClient.interrupt();
|
||||
return this.threadFront.interrupt();
|
||||
}
|
||||
|
||||
renderCommands() {
|
||||
|
@ -11,32 +11,32 @@ add_task(async function() {
|
||||
const dbg = await attachRecordingDebugger("doc_rr_basic.html", {
|
||||
waitForRecording: true,
|
||||
});
|
||||
const { threadClient, tab, toolbox, target } = dbg;
|
||||
const { threadFront, tab, toolbox, target } = dbg;
|
||||
|
||||
const bp = await setBreakpoint(threadClient, "doc_rr_basic.html", 21);
|
||||
const bp = await setBreakpoint(threadFront, "doc_rr_basic.html", 21);
|
||||
|
||||
// Visit a lot of breakpoints so that we are sure we have crossed major
|
||||
// checkpoint boundaries.
|
||||
await rewindToLine(threadClient, 21);
|
||||
await rewindToLine(threadFront, 21);
|
||||
await checkEvaluateInTopFrame(target, "number", 10);
|
||||
await rewindToLine(threadClient, 21);
|
||||
await rewindToLine(threadFront, 21);
|
||||
await checkEvaluateInTopFrame(target, "number", 9);
|
||||
await rewindToLine(threadClient, 21);
|
||||
await rewindToLine(threadFront, 21);
|
||||
await checkEvaluateInTopFrame(target, "number", 8);
|
||||
await rewindToLine(threadClient, 21);
|
||||
await rewindToLine(threadFront, 21);
|
||||
await checkEvaluateInTopFrame(target, "number", 7);
|
||||
await rewindToLine(threadClient, 21);
|
||||
await rewindToLine(threadFront, 21);
|
||||
await checkEvaluateInTopFrame(target, "number", 6);
|
||||
await resumeToLine(threadClient, 21);
|
||||
await resumeToLine(threadFront, 21);
|
||||
await checkEvaluateInTopFrame(target, "number", 7);
|
||||
await resumeToLine(threadClient, 21);
|
||||
await resumeToLine(threadFront, 21);
|
||||
await checkEvaluateInTopFrame(target, "number", 8);
|
||||
await resumeToLine(threadClient, 21);
|
||||
await resumeToLine(threadFront, 21);
|
||||
await checkEvaluateInTopFrame(target, "number", 9);
|
||||
await resumeToLine(threadClient, 21);
|
||||
await resumeToLine(threadFront, 21);
|
||||
await checkEvaluateInTopFrame(target, "number", 10);
|
||||
|
||||
await threadClient.removeBreakpoint(bp);
|
||||
await threadFront.removeBreakpoint(bp);
|
||||
await toolbox.closeToolbox();
|
||||
await gBrowser.removeTab(tab);
|
||||
});
|
||||
|
@ -11,10 +11,10 @@ add_task(async function() {
|
||||
const dbg = await attachRecordingDebugger("doc_rr_basic.html", {
|
||||
waitForRecording: true,
|
||||
});
|
||||
const { threadClient, tab, toolbox, target } = dbg;
|
||||
const { threadFront, tab, toolbox, target } = dbg;
|
||||
|
||||
const bp = await setBreakpoint(threadClient, "doc_rr_basic.html", 21);
|
||||
await rewindToLine(threadClient, 21);
|
||||
const bp = await setBreakpoint(threadFront, "doc_rr_basic.html", 21);
|
||||
await rewindToLine(threadFront, 21);
|
||||
await checkEvaluateInTopFrame(target, "number", 10);
|
||||
await checkEvaluateInTopFrameThrows(target, "window.alert(3)");
|
||||
await checkEvaluateInTopFrame(target, "number", 10);
|
||||
@ -22,7 +22,7 @@ add_task(async function() {
|
||||
await checkEvaluateInTopFrame(target, "number", 10);
|
||||
await checkEvaluateInTopFrame(target, "testStepping2()", undefined);
|
||||
|
||||
await threadClient.removeBreakpoint(bp);
|
||||
await threadFront.removeBreakpoint(bp);
|
||||
await toolbox.destroy();
|
||||
await gBrowser.removeTab(tab);
|
||||
});
|
||||
|
@ -9,21 +9,21 @@
|
||||
// Test some issues when stepping around after hitting a breakpoint while recording.
|
||||
add_task(async function() {
|
||||
const dbg = await attachRecordingDebugger("doc_rr_continuous.html");
|
||||
const { threadClient, tab, toolbox } = dbg;
|
||||
const { threadFront, tab, toolbox } = dbg;
|
||||
|
||||
await threadClient.interrupt();
|
||||
const bp1 = await setBreakpoint(threadClient, "doc_rr_continuous.html", 19);
|
||||
await resumeToLine(threadClient, 19);
|
||||
await reverseStepOverToLine(threadClient, 18);
|
||||
await stepInToLine(threadClient, 22);
|
||||
const bp2 = await setBreakpoint(threadClient, "doc_rr_continuous.html", 24);
|
||||
await resumeToLine(threadClient, 24);
|
||||
const bp3 = await setBreakpoint(threadClient, "doc_rr_continuous.html", 22);
|
||||
await rewindToLine(threadClient, 22);
|
||||
await threadFront.interrupt();
|
||||
const bp1 = await setBreakpoint(threadFront, "doc_rr_continuous.html", 19);
|
||||
await resumeToLine(threadFront, 19);
|
||||
await reverseStepOverToLine(threadFront, 18);
|
||||
await stepInToLine(threadFront, 22);
|
||||
const bp2 = await setBreakpoint(threadFront, "doc_rr_continuous.html", 24);
|
||||
await resumeToLine(threadFront, 24);
|
||||
const bp3 = await setBreakpoint(threadFront, "doc_rr_continuous.html", 22);
|
||||
await rewindToLine(threadFront, 22);
|
||||
|
||||
await threadClient.removeBreakpoint(bp1);
|
||||
await threadClient.removeBreakpoint(bp2);
|
||||
await threadClient.removeBreakpoint(bp3);
|
||||
await threadFront.removeBreakpoint(bp1);
|
||||
await threadFront.removeBreakpoint(bp2);
|
||||
await threadFront.removeBreakpoint(bp3);
|
||||
await toolbox.destroy();
|
||||
await gBrowser.removeTab(tab);
|
||||
});
|
||||
|
@ -10,25 +10,25 @@
|
||||
// recording.
|
||||
add_task(async function() {
|
||||
const dbg = await attachRecordingDebugger("doc_rr_continuous.html");
|
||||
const { threadClient, tab, toolbox, target } = dbg;
|
||||
const { threadFront, tab, toolbox, target } = dbg;
|
||||
|
||||
const bp = await setBreakpoint(threadClient, "doc_rr_continuous.html", 14);
|
||||
await resumeToLine(threadClient, 14);
|
||||
const bp = await setBreakpoint(threadFront, "doc_rr_continuous.html", 14);
|
||||
await resumeToLine(threadFront, 14);
|
||||
const value = await evaluateInTopFrame(target, "number");
|
||||
await resumeToLine(threadClient, 14);
|
||||
await resumeToLine(threadFront, 14);
|
||||
await checkEvaluateInTopFrame(target, "number", value + 1);
|
||||
await rewindToLine(threadClient, 14);
|
||||
await rewindToLine(threadFront, 14);
|
||||
await checkEvaluateInTopFrame(target, "number", value);
|
||||
await resumeToLine(threadClient, 14);
|
||||
await resumeToLine(threadFront, 14);
|
||||
await checkEvaluateInTopFrame(target, "number", value + 1);
|
||||
await resumeToLine(threadClient, 14);
|
||||
await resumeToLine(threadFront, 14);
|
||||
await checkEvaluateInTopFrame(target, "number", value + 2);
|
||||
await resumeToLine(threadClient, 14);
|
||||
await resumeToLine(threadFront, 14);
|
||||
await checkEvaluateInTopFrame(target, "number", value + 3);
|
||||
await rewindToLine(threadClient, 14);
|
||||
await rewindToLine(threadFront, 14);
|
||||
await checkEvaluateInTopFrame(target, "number", value + 2);
|
||||
|
||||
await threadClient.removeBreakpoint(bp);
|
||||
await threadFront.removeBreakpoint(bp);
|
||||
await toolbox.destroy();
|
||||
await gBrowser.removeTab(tab);
|
||||
});
|
||||
|
@ -13,20 +13,20 @@ add_task(async function() {
|
||||
waitForRecording: true,
|
||||
});
|
||||
|
||||
const { threadClient, tab, toolbox, target } = dbg;
|
||||
const { threadFront, tab, toolbox, target } = dbg;
|
||||
|
||||
await threadClient.interrupt();
|
||||
await threadFront.interrupt();
|
||||
|
||||
// Rewind to the beginning of the recording.
|
||||
await rewindToLine(threadClient, undefined);
|
||||
await rewindToLine(threadFront, undefined);
|
||||
|
||||
const bp = await setBreakpoint(threadClient, "doc_rr_basic.html", 21);
|
||||
await resumeToLine(threadClient, 21);
|
||||
const bp = await setBreakpoint(threadFront, "doc_rr_basic.html", 21);
|
||||
await resumeToLine(threadFront, 21);
|
||||
await checkEvaluateInTopFrame(target, "number", 1);
|
||||
await resumeToLine(threadClient, 21);
|
||||
await resumeToLine(threadFront, 21);
|
||||
await checkEvaluateInTopFrame(target, "number", 2);
|
||||
|
||||
await threadClient.removeBreakpoint(bp);
|
||||
await threadFront.removeBreakpoint(bp);
|
||||
await toolbox.destroy();
|
||||
await gBrowser.removeTab(tab);
|
||||
});
|
||||
|
@ -12,26 +12,26 @@ add_task(async function() {
|
||||
waitForRecording: true,
|
||||
});
|
||||
|
||||
const { tab, toolbox, threadClient, target } = dbg;
|
||||
const { tab, toolbox, threadFront, target } = dbg;
|
||||
const console = await getDebuggerSplitConsole(dbg);
|
||||
const hud = console.hud;
|
||||
|
||||
await warpToMessage(hud, dbg, "Number 5");
|
||||
await threadClient.interrupt();
|
||||
await threadFront.interrupt();
|
||||
|
||||
await checkEvaluateInTopFrame(target, "number", 5);
|
||||
|
||||
// Initially we are paused inside the 'new Error()' call on line 19. The
|
||||
// first reverse step takes us to the start of that line.
|
||||
await reverseStepOverToLine(threadClient, 19);
|
||||
await reverseStepOverToLine(threadClient, 18);
|
||||
const bp = await setBreakpoint(threadClient, "doc_rr_error.html", 12);
|
||||
await rewindToLine(threadClient, 12);
|
||||
await reverseStepOverToLine(threadFront, 19);
|
||||
await reverseStepOverToLine(threadFront, 18);
|
||||
const bp = await setBreakpoint(threadFront, "doc_rr_error.html", 12);
|
||||
await rewindToLine(threadFront, 12);
|
||||
await checkEvaluateInTopFrame(target, "number", 4);
|
||||
await resumeToLine(threadClient, 12);
|
||||
await resumeToLine(threadFront, 12);
|
||||
await checkEvaluateInTopFrame(target, "number", 5);
|
||||
|
||||
await threadClient.removeBreakpoint(bp);
|
||||
await threadFront.removeBreakpoint(bp);
|
||||
await toolbox.destroy();
|
||||
await gBrowser.removeTab(tab);
|
||||
});
|
||||
|
@ -12,15 +12,15 @@ add_task(async function() {
|
||||
waitForRecording: true,
|
||||
});
|
||||
|
||||
const { tab, toolbox, threadClient } = dbg;
|
||||
const { tab, toolbox, threadFront } = dbg;
|
||||
const console = await getDebuggerSplitConsole(dbg);
|
||||
const hud = console.hud;
|
||||
|
||||
let message = await warpToMessage(hud, dbg, "number: 1");
|
||||
// ok(message.classList.contains("paused-before"), "paused before message is shown");
|
||||
|
||||
await stepOverToLine(threadClient, 18);
|
||||
await reverseStepOverToLine(threadClient, 17);
|
||||
await stepOverToLine(threadFront, 18);
|
||||
await reverseStepOverToLine(threadFront, 17);
|
||||
|
||||
message = findMessage(hud, "number: 1");
|
||||
// ok(message.classList.contains("paused-before"), "paused before message is shown");
|
||||
|
@ -13,17 +13,17 @@ add_task(async function() {
|
||||
waitForRecording: true,
|
||||
});
|
||||
|
||||
const { tab, toolbox, threadClient, target } = dbg;
|
||||
const { tab, toolbox, threadFront, target } = dbg;
|
||||
const console = await getDebuggerSplitConsole(dbg);
|
||||
const hud = console.hud;
|
||||
|
||||
const bp1 = await setBreakpoint(threadClient, "doc_rr_basic.html", 21, {
|
||||
const bp1 = await setBreakpoint(threadFront, "doc_rr_basic.html", 21, {
|
||||
logValue: `"Logpoint Number " + number`,
|
||||
});
|
||||
const bp2 = await setBreakpoint(threadClient, "doc_rr_basic.html", 6, {
|
||||
const bp2 = await setBreakpoint(threadFront, "doc_rr_basic.html", 6, {
|
||||
logValue: `"Logpoint Beginning"`,
|
||||
});
|
||||
const bp3 = await setBreakpoint(threadClient, "doc_rr_basic.html", 8, {
|
||||
const bp3 = await setBreakpoint(threadFront, "doc_rr_basic.html", 8, {
|
||||
logValue: `"Logpoint Ending"`,
|
||||
});
|
||||
|
||||
@ -35,14 +35,14 @@ add_task(async function() {
|
||||
ok(messages[11].textContent.includes("Ending"));
|
||||
|
||||
await warpToMessage(hud, dbg, "Number 5");
|
||||
await threadClient.interrupt();
|
||||
await threadFront.interrupt();
|
||||
|
||||
await checkEvaluateInTopFrame(target, "number", 5);
|
||||
await reverseStepOverToLine(threadClient, 20);
|
||||
await reverseStepOverToLine(threadFront, 20);
|
||||
|
||||
await threadClient.removeBreakpoint(bp1);
|
||||
await threadClient.removeBreakpoint(bp2);
|
||||
await threadClient.removeBreakpoint(bp3);
|
||||
await threadFront.removeBreakpoint(bp1);
|
||||
await threadFront.removeBreakpoint(bp2);
|
||||
await threadFront.removeBreakpoint(bp3);
|
||||
await toolbox.destroy();
|
||||
await gBrowser.removeTab(tab);
|
||||
});
|
||||
|
@ -28,7 +28,7 @@ add_task(async function() {
|
||||
await once(Services.ppmm, "HitRecordingEndpoint");
|
||||
|
||||
const { target, toolbox } = await attachDebugger(replayingTab);
|
||||
const client = toolbox.threadClient;
|
||||
const client = toolbox.threadFront;
|
||||
await client.interrupt();
|
||||
const bp = await setBreakpoint(client, "doc_rr_basic.html", 21);
|
||||
await rewindToLine(client, 21);
|
||||
|
@ -20,7 +20,7 @@ add_task(async function() {
|
||||
const firstTab = await attachDebugger(recordingTab);
|
||||
let toolbox = firstTab.toolbox;
|
||||
let target = firstTab.target;
|
||||
let client = toolbox.threadClient;
|
||||
let client = toolbox.threadFront;
|
||||
await client.interrupt();
|
||||
let bp = await setBreakpoint(client, "doc_rr_continuous.html", 14);
|
||||
await resumeToLine(client, 14);
|
||||
@ -46,7 +46,7 @@ add_task(async function() {
|
||||
const rplyTab = await attachDebugger(replayingTab);
|
||||
toolbox = rplyTab.toolbox;
|
||||
target = rplyTab.target;
|
||||
client = toolbox.threadClient;
|
||||
client = toolbox.threadFront;
|
||||
await client.interrupt();
|
||||
|
||||
// The recording does not actually end at the point where we saved it, but
|
||||
|
@ -14,7 +14,7 @@ add_task(async function() {
|
||||
await once(Services.ppmm, "RecordingFinished");
|
||||
|
||||
const { target, toolbox } = await attachDebugger(tab);
|
||||
const client = toolbox.threadClient;
|
||||
const client = toolbox.threadFront;
|
||||
await client.interrupt();
|
||||
const bp = await setBreakpoint(client, "doc_rr_basic.html", 21);
|
||||
await rewindToLine(client, 21);
|
||||
|
@ -14,24 +14,24 @@ add_task(async function() {
|
||||
await once(Services.ppmm, "RecordingFinished");
|
||||
|
||||
const { toolbox } = await attachDebugger(tab),
|
||||
client = toolbox.threadClient;
|
||||
front = toolbox.threadFront;
|
||||
await client.interrupt();
|
||||
const bp = await setBreakpoint(client, "doc_rr_basic.html", 22);
|
||||
await rewindToLine(client, 22);
|
||||
await stepInToLine(client, 25);
|
||||
await stepOverToLine(client, 26);
|
||||
await stepOverToLine(client, 27);
|
||||
await reverseStepOverToLine(client, 26);
|
||||
await stepInToLine(client, 30);
|
||||
await stepOverToLine(client, 31);
|
||||
await stepOverToLine(client, 32);
|
||||
await stepOverToLine(client, 33);
|
||||
await reverseStepOverToLine(client, 32);
|
||||
await stepOutToLine(client, 27);
|
||||
await reverseStepOverToLine(client, 26);
|
||||
await reverseStepOverToLine(client, 25);
|
||||
const bp = await setBreakpoint(front, "doc_rr_basic.html", 22);
|
||||
await rewindToLine(front, 22);
|
||||
await stepInToLine(front, 25);
|
||||
await stepOverToLine(front, 26);
|
||||
await stepOverToLine(front, 27);
|
||||
await reverseStepOverToLine(front, 26);
|
||||
await stepInToLine(front, 30);
|
||||
await stepOverToLine(front, 31);
|
||||
await stepOverToLine(front, 32);
|
||||
await stepOverToLine(front, 33);
|
||||
await reverseStepOverToLine(front, 32);
|
||||
await stepOutToLine(front, 27);
|
||||
await reverseStepOverToLine(front, 26);
|
||||
await reverseStepOverToLine(front, 25);
|
||||
|
||||
await client.removeBreakpoint(bp);
|
||||
await front.removeBreakpoint(bp);
|
||||
await toolbox.destroy();
|
||||
await gBrowser.removeTab(tab);
|
||||
});
|
||||
|
@ -13,7 +13,7 @@ add_task(async function() {
|
||||
openTrustedLinkIn(EXAMPLE_URL + "doc_rr_continuous.html", "current");
|
||||
|
||||
const { toolbox, target } = await attachDebugger(tab);
|
||||
const client = toolbox.threadClient;
|
||||
const client = toolbox.threadFront;
|
||||
await client.interrupt();
|
||||
const bp = await setBreakpoint(client, "doc_rr_continuous.html", 13);
|
||||
await resumeToLine(client, 13);
|
||||
|
@ -14,7 +14,7 @@ add_task(async function() {
|
||||
await once(Services.ppmm, "RecordingFinished");
|
||||
|
||||
const { target, toolbox } = await attachDebugger(tab);
|
||||
const client = toolbox.threadClient;
|
||||
const client = toolbox.threadFront;
|
||||
await client.interrupt();
|
||||
const bp = await setBreakpoint(client, "doc_rr_basic.html", 21);
|
||||
await rewindToLine(client, 21);
|
||||
|
@ -21,10 +21,10 @@ add_task(async function() {
|
||||
const dbg = await attachRecordingDebugger("doc_inspector_basic.html", {
|
||||
waitForRecording: true,
|
||||
});
|
||||
const { threadClient, tab, toolbox } = dbg;
|
||||
const { threadFront, tab, toolbox } = dbg;
|
||||
|
||||
await threadClient.interrupt();
|
||||
await threadClient.resume();
|
||||
await threadFront.interrupt();
|
||||
await threadFront.resume();
|
||||
|
||||
const { inspector } = await openInspector();
|
||||
|
||||
@ -32,7 +32,7 @@ add_task(async function() {
|
||||
let container = getContainerForNodeFront(nodeFront, inspector);
|
||||
ok(!container, "No node container while unpaused");
|
||||
|
||||
await threadClient.interrupt();
|
||||
await threadFront.interrupt();
|
||||
|
||||
nodeFront = await getNodeFront("#maindiv", inspector);
|
||||
await waitFor(
|
||||
@ -44,9 +44,9 @@ add_task(async function() {
|
||||
"Correct late element text"
|
||||
);
|
||||
|
||||
const bp = await setBreakpoint(threadClient, "doc_inspector_basic.html", 9);
|
||||
const bp = await setBreakpoint(threadFront, "doc_inspector_basic.html", 9);
|
||||
|
||||
await rewindToLine(threadClient, 9);
|
||||
await rewindToLine(threadFront, 9);
|
||||
|
||||
nodeFront = await getNodeFront("#maindiv", inspector);
|
||||
await waitFor(
|
||||
@ -58,7 +58,7 @@ add_task(async function() {
|
||||
"Correct early element text"
|
||||
);
|
||||
|
||||
await threadClient.removeBreakpoint(bp);
|
||||
await threadFront.removeBreakpoint(bp);
|
||||
await toolbox.closeToolbox();
|
||||
await gBrowser.removeTab(tab);
|
||||
});
|
||||
|
@ -15,14 +15,14 @@ add_task(async function() {
|
||||
const dbg = await attachRecordingDebugger("doc_inspector_basic.html", {
|
||||
waitForRecording: true,
|
||||
});
|
||||
const { threadClient, tab, toolbox } = dbg;
|
||||
const { threadFront, tab, toolbox } = dbg;
|
||||
|
||||
await threadClient.interrupt();
|
||||
await threadClient.resume();
|
||||
await threadFront.interrupt();
|
||||
await threadFront.resume();
|
||||
|
||||
await threadClient.interrupt();
|
||||
const bp = await setBreakpoint(threadClient, "doc_inspector_basic.html", 9);
|
||||
await rewindToLine(threadClient, 9);
|
||||
await threadFront.interrupt();
|
||||
const bp = await setBreakpoint(threadFront, "doc_inspector_basic.html", 9);
|
||||
await rewindToLine(threadFront, 9);
|
||||
|
||||
const { inspector, testActor } = await openInspector();
|
||||
|
||||
@ -38,7 +38,7 @@ add_task(async function() {
|
||||
info("Performing checks");
|
||||
await testActor.isNodeCorrectlyHighlighted("#maindiv", is);
|
||||
|
||||
await threadClient.removeBreakpoint(bp);
|
||||
await threadFront.removeBreakpoint(bp);
|
||||
await toolbox.closeToolbox();
|
||||
await gBrowser.removeTab(tab);
|
||||
|
||||
|
@ -32,23 +32,23 @@ add_task(async function() {
|
||||
const dbg = await attachRecordingDebugger("doc_inspector_styles.html", {
|
||||
waitForRecording: true,
|
||||
});
|
||||
const { threadClient, tab, toolbox } = dbg;
|
||||
const { threadFront, tab, toolbox } = dbg;
|
||||
|
||||
await threadClient.interrupt();
|
||||
await threadClient.resume();
|
||||
await threadFront.interrupt();
|
||||
await threadFront.resume();
|
||||
|
||||
await threadClient.interrupt();
|
||||
await threadFront.interrupt();
|
||||
|
||||
const { inspector, view } = await openComputedView();
|
||||
await checkBackgroundColor("body", "rgb(0, 128, 0)");
|
||||
await checkBackgroundColor("#maindiv", "rgb(0, 0, 255)");
|
||||
|
||||
const bp = await setBreakpoint(threadClient, "doc_inspector_styles.html", 11);
|
||||
const bp = await setBreakpoint(threadFront, "doc_inspector_styles.html", 11);
|
||||
|
||||
await rewindToLine(threadClient, 11);
|
||||
await rewindToLine(threadFront, 11);
|
||||
await checkBackgroundColor("#maindiv", "rgb(255, 0, 0)");
|
||||
|
||||
await threadClient.removeBreakpoint(bp);
|
||||
await threadFront.removeBreakpoint(bp);
|
||||
await toolbox.closeToolbox();
|
||||
await gBrowser.removeTab(tab);
|
||||
|
||||
|
@ -40,27 +40,27 @@ async function attachRecordingDebugger(
|
||||
}
|
||||
const { target, toolbox } = await attachDebugger(tab);
|
||||
const dbg = createDebuggerContext(toolbox);
|
||||
const threadClient = dbg.toolbox.threadClient;
|
||||
const threadFront = dbg.toolbox.threadFront;
|
||||
|
||||
await threadClient.interrupt();
|
||||
return { ...dbg, tab, threadClient, target };
|
||||
await threadFront.interrupt();
|
||||
return { ...dbg, tab, threadFront, target };
|
||||
}
|
||||
|
||||
// Return a promise that resolves when a breakpoint has been set.
|
||||
async function setBreakpoint(threadClient, expectedFile, lineno, options = {}) {
|
||||
const { sources } = await threadClient.getSources();
|
||||
async function setBreakpoint(threadFront, expectedFile, lineno, options = {}) {
|
||||
const { sources } = await threadFront.getSources();
|
||||
ok(sources.length == 1, "Got one source");
|
||||
ok(RegExp(expectedFile).test(sources[0].url), "Source is " + expectedFile);
|
||||
const location = { sourceUrl: sources[0].url, line: lineno };
|
||||
await threadClient.setBreakpoint(location, options);
|
||||
await threadFront.setBreakpoint(location, options);
|
||||
return location;
|
||||
}
|
||||
|
||||
function resumeThenPauseAtLineFunctionFactory(method) {
|
||||
return async function(threadClient, lineno) {
|
||||
threadClient[method]();
|
||||
await threadClient.once("paused", async function(packet) {
|
||||
const { frames } = await threadClient.getFrames(0, 1);
|
||||
return async function(threadFront, lineno) {
|
||||
threadFront[method]();
|
||||
await threadFront.once("paused", async function(packet) {
|
||||
const { frames } = await threadFront.getFrames(0, 1);
|
||||
const frameLine = frames[0] ? frames[0].where.line : undefined;
|
||||
ok(
|
||||
frameLine == lineno,
|
||||
@ -84,11 +84,11 @@ var stepOutToLine = resumeThenPauseAtLineFunctionFactory("stepOut");
|
||||
// Return a promise that resolves when a thread evaluates a string in the
|
||||
// topmost frame, with the result throwing an exception.
|
||||
async function checkEvaluateInTopFrameThrows(target, text) {
|
||||
const threadClient = target.threadClient;
|
||||
const threadFront = target.threadFront;
|
||||
const consoleFront = await target.getFront("console");
|
||||
const { frames } = await threadClient.getFrames(0, 1);
|
||||
const { frames } = await threadFront.getFrames(0, 1);
|
||||
ok(frames.length == 1, "Got one frame");
|
||||
const options = { thread: threadClient.actor, frameActor: frames[0].actor };
|
||||
const options = { thread: threadFront.actor, frameActor: frames[0].actor };
|
||||
const response = await consoleFront.evaluateJS(text, options);
|
||||
ok(response.exception, "Eval threw an exception");
|
||||
}
|
||||
|
@ -113,18 +113,18 @@ Once the application is attached to a tab, it can attach to its thread in order
|
||||
// Assuming the application is already attached to the tab, and response is the first
|
||||
// argument of the attachTarget callback.
|
||||
|
||||
client.attachThread(response.threadActor).then(function([response, threadClient]) {
|
||||
if (!threadClient) {
|
||||
client.attachThread(response.threadActor).then(function([response, threadFront]) {
|
||||
if (!threadFront) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Attach listeners for thread events.
|
||||
threadClient.on("paused", onPause);
|
||||
threadClient.on("resumed", fooListener);
|
||||
threadClient.on("detached", fooListener);
|
||||
threadFront.on("paused", onPause);
|
||||
threadFront.on("resumed", fooListener);
|
||||
threadFront.on("detached", fooListener);
|
||||
|
||||
// Resume the thread.
|
||||
threadClient.resume();
|
||||
threadFront.resume();
|
||||
|
||||
// Debugger is now ready and debuggee is running.
|
||||
});
|
||||
@ -144,7 +144,7 @@ Components.utils.import("resource://gre/modules/devtools/dbg-server.jsm");
|
||||
Components.utils.import("resource://gre/modules/devtools/dbg-client.jsm");
|
||||
|
||||
let client;
|
||||
let threadClient;
|
||||
let threadFront;
|
||||
|
||||
function startDebugger() {
|
||||
// Start the server.
|
||||
@ -180,14 +180,14 @@ function debugTab() {
|
||||
// Attach to the tab.
|
||||
targetFront.attach().then(() => {
|
||||
// Attach to the thread (context).
|
||||
targetFront.attachThread().then(([response, threadClient]) => {
|
||||
targetFront.attachThread().then(([response, threadFront]) => {
|
||||
// Attach listeners for thread events.
|
||||
threadClient.on("paused", onPause);
|
||||
threadClient.on("resumed", fooListener);
|
||||
threadClient.on("detached", fooListener);
|
||||
threadFront.on("paused", onPause);
|
||||
threadFront.on("resumed", fooListener);
|
||||
threadFront.on("detached", fooListener);
|
||||
|
||||
// Resume the thread.
|
||||
threadClient.resume();
|
||||
threadFront.resume();
|
||||
// Debugger is now ready and debuggee is running.
|
||||
});
|
||||
});
|
||||
|
@ -221,9 +221,9 @@ function findTab(tabs, title) {
|
||||
return null;
|
||||
}
|
||||
|
||||
function waitForNewSource(threadClient, url) {
|
||||
function waitForNewSource(threadFront, url) {
|
||||
dump("Waiting for new source with url '" + url + "'.\n");
|
||||
return waitForEvent(threadClient, "newSource", function(packet) {
|
||||
return waitForEvent(threadFront, "newSource", function(packet) {
|
||||
return packet.source.url === url;
|
||||
});
|
||||
}
|
||||
@ -233,14 +233,14 @@ function attachThread(targetFront, options = {}) {
|
||||
return targetFront.attachThread(options);
|
||||
}
|
||||
|
||||
function resume(threadClient) {
|
||||
function resume(threadFront) {
|
||||
dump("Resuming thread.\n");
|
||||
return threadClient.resume();
|
||||
return threadFront.resume();
|
||||
}
|
||||
|
||||
function getSources(threadClient) {
|
||||
function getSources(threadFront) {
|
||||
dump("Getting sources.\n");
|
||||
return threadClient.getSources();
|
||||
return threadFront.getSources();
|
||||
}
|
||||
|
||||
function findSource(sources, url) {
|
||||
@ -253,9 +253,9 @@ function findSource(sources, url) {
|
||||
return null;
|
||||
}
|
||||
|
||||
function waitForPause(threadClient) {
|
||||
function waitForPause(threadFront) {
|
||||
dump("Waiting for pause.\n");
|
||||
return waitForEvent(threadClient, "paused");
|
||||
return waitForEvent(threadFront, "paused");
|
||||
}
|
||||
|
||||
function waitForProperty(dbg, property) {
|
||||
@ -268,9 +268,9 @@ function waitForProperty(dbg, property) {
|
||||
});
|
||||
}
|
||||
|
||||
function setBreakpoint(threadClient, location) {
|
||||
function setBreakpoint(threadFront, location) {
|
||||
dump("Setting breakpoint.\n");
|
||||
return threadClient.setBreakpoint(location, {});
|
||||
return threadFront.setBreakpoint(location, {});
|
||||
}
|
||||
|
||||
function getPrototypeAndProperties(objClient) {
|
||||
@ -409,32 +409,32 @@ async function attachTestTab(client, title) {
|
||||
|
||||
// Attach to |client|'s tab whose title is |title|, and then attach to
|
||||
// that tab's thread. Pass |callback| the thread attach response packet, a
|
||||
// TargetFront referring to the tab, and a ThreadClient referring to the
|
||||
// TargetFront referring to the tab, and a ThreadFront referring to the
|
||||
// thread.
|
||||
async function attachTestThread(client, title, callback = () => {}) {
|
||||
const targetFront = await attachTestTab(client, title);
|
||||
const threadClient = await targetFront.getFront("context");
|
||||
const onPaused = threadClient.once("paused");
|
||||
const threadFront = await targetFront.getFront("context");
|
||||
const onPaused = threadFront.once("paused");
|
||||
await targetFront.attachThread({
|
||||
autoBlackBox: true,
|
||||
});
|
||||
const response = await onPaused;
|
||||
Assert.equal(threadClient.state, "paused", "Thread client is paused");
|
||||
Assert.equal(threadFront.state, "paused", "Thread client is paused");
|
||||
Assert.ok("why" in response);
|
||||
Assert.equal(response.why.type, "attached");
|
||||
callback(response, targetFront, threadClient);
|
||||
return { targetFront, threadClient };
|
||||
callback(response, targetFront, threadFront);
|
||||
return { targetFront, threadFront };
|
||||
}
|
||||
|
||||
// Attach to |client|'s tab whose title is |title|, attach to the tab's
|
||||
// thread, and then resume it. Pass |callback| the thread's response to
|
||||
// the 'resume' packet, a TargetFront for the tab, and a ThreadClient for the
|
||||
// the 'resume' packet, a TargetFront for the tab, and a ThreadFront for the
|
||||
// thread.
|
||||
async function attachTestTabAndResume(client, title, callback = () => {}) {
|
||||
const { targetFront, threadClient } = await attachTestThread(client, title);
|
||||
const response = await threadClient.resume();
|
||||
callback(response, targetFront, threadClient);
|
||||
return { targetFront, threadClient };
|
||||
const { targetFront, threadFront } = await attachTestThread(client, title);
|
||||
const response = await threadFront.resume();
|
||||
callback(response, targetFront, threadFront);
|
||||
return { targetFront, threadFront };
|
||||
}
|
||||
|
||||
/**
|
||||
@ -645,14 +645,14 @@ const assert = Assert.ok.bind(Assert);
|
||||
/**
|
||||
* Create a promise that is resolved on the next occurence of the given event.
|
||||
*
|
||||
* @param ThreadClient threadClient
|
||||
* @param ThreadFront threadFront
|
||||
* @param String event
|
||||
* @param Function predicate
|
||||
* @returns Promise
|
||||
*/
|
||||
function waitForEvent(threadClient, type, predicate) {
|
||||
function waitForEvent(threadFront, type, predicate) {
|
||||
if (!predicate) {
|
||||
return threadClient.once(type);
|
||||
return threadFront.once(type);
|
||||
}
|
||||
|
||||
return new Promise(function(resolve) {
|
||||
@ -660,10 +660,10 @@ function waitForEvent(threadClient, type, predicate) {
|
||||
if (!predicate(packet)) {
|
||||
return;
|
||||
}
|
||||
threadClient.off(type, listener);
|
||||
threadFront.off(type, listener);
|
||||
resolve(packet);
|
||||
}
|
||||
threadClient.on(type, listener);
|
||||
threadFront.on(type, listener);
|
||||
});
|
||||
}
|
||||
|
||||
@ -680,11 +680,11 @@ function waitForEvent(threadClient, type, predicate) {
|
||||
* and finally yield the promise.
|
||||
*
|
||||
* @param Function action
|
||||
* @param ThreadClient threadClient
|
||||
* @param ThreadFront threadFront
|
||||
* @returns Promise
|
||||
*/
|
||||
function executeOnNextTickAndWaitForPause(action, threadClient) {
|
||||
const paused = waitForPause(threadClient);
|
||||
function executeOnNextTickAndWaitForPause(action, threadFront) {
|
||||
const paused = waitForPause(threadFront);
|
||||
executeSoon(action);
|
||||
return paused;
|
||||
}
|
||||
@ -696,12 +696,12 @@ function evalCallback(debuggeeGlobal, func) {
|
||||
/**
|
||||
* Interrupt JS execution for the specified thread.
|
||||
*
|
||||
* @param ThreadClient threadClient
|
||||
* @param ThreadFront threadFront
|
||||
* @returns Promise
|
||||
*/
|
||||
function interrupt(threadClient) {
|
||||
function interrupt(threadFront) {
|
||||
dumpn("Interrupting.");
|
||||
return threadClient.interrupt();
|
||||
return threadFront.interrupt();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -709,37 +709,37 @@ function interrupt(threadClient) {
|
||||
* event.
|
||||
*
|
||||
* @param DebuggerClient client
|
||||
* @param ThreadClient threadClient
|
||||
* @param ThreadFront threadFront
|
||||
* @returns Promise
|
||||
*/
|
||||
function resumeAndWaitForPause(threadClient) {
|
||||
const paused = waitForPause(threadClient);
|
||||
return resume(threadClient).then(() => paused);
|
||||
function resumeAndWaitForPause(threadFront) {
|
||||
const paused = waitForPause(threadFront);
|
||||
return resume(threadFront).then(() => paused);
|
||||
}
|
||||
|
||||
/**
|
||||
* Resume JS execution for a single step and wait for the pause after the step
|
||||
* has been taken.
|
||||
*
|
||||
* @param ThreadClient threadClient
|
||||
* @param ThreadFront threadFront
|
||||
* @returns Promise
|
||||
*/
|
||||
function stepIn(threadClient) {
|
||||
function stepIn(threadFront) {
|
||||
dumpn("Stepping in.");
|
||||
const paused = waitForPause(threadClient);
|
||||
return threadClient.stepIn().then(() => paused);
|
||||
const paused = waitForPause(threadFront);
|
||||
return threadFront.stepIn().then(() => paused);
|
||||
}
|
||||
|
||||
/**
|
||||
* Resume JS execution for a step over and wait for the pause after the step
|
||||
* has been taken.
|
||||
*
|
||||
* @param ThreadClient threadClient
|
||||
* @param ThreadFront threadFront
|
||||
* @returns Promise
|
||||
*/
|
||||
function stepOver(threadClient) {
|
||||
function stepOver(threadFront) {
|
||||
dumpn("Stepping over.");
|
||||
return threadClient.stepOver().then(() => waitForPause(threadClient));
|
||||
return threadFront.stepOver().then(() => waitForPause(threadFront));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -747,26 +747,26 @@ function stepOver(threadClient) {
|
||||
* has been taken.
|
||||
*
|
||||
* @param DebuggerClient client
|
||||
* @param ThreadClient threadClient
|
||||
* @param ThreadFront threadFront
|
||||
* @returns Promise
|
||||
*/
|
||||
function stepOut(threadClient) {
|
||||
function stepOut(threadFront) {
|
||||
dumpn("Stepping out.");
|
||||
return threadClient.stepOut().then(() => waitForPause(threadClient));
|
||||
return threadFront.stepOut().then(() => waitForPause(threadFront));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the list of `count` frames currently on stack, starting at the index
|
||||
* `first` for the specified thread.
|
||||
*
|
||||
* @param ThreadClient threadClient
|
||||
* @param ThreadFront threadFront
|
||||
* @param Number first
|
||||
* @param Number count
|
||||
* @returns Promise
|
||||
*/
|
||||
function getFrames(threadClient, first, count) {
|
||||
function getFrames(threadFront, first, count) {
|
||||
dumpn("Getting frames.");
|
||||
return threadClient.getFrames(first, count);
|
||||
return threadFront.getFrames(first, count);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -809,31 +809,31 @@ function getSourceContent(sourceFront) {
|
||||
/**
|
||||
* Get a source at the specified url.
|
||||
*
|
||||
* @param ThreadClient threadClient
|
||||
* @param ThreadFront threadFront
|
||||
* @param string url
|
||||
* @returns Promise<SourceFront>
|
||||
*/
|
||||
async function getSource(threadClient, url) {
|
||||
const source = await getSourceForm(threadClient, url);
|
||||
async function getSource(threadFront, url) {
|
||||
const source = await getSourceForm(threadFront, url);
|
||||
if (source) {
|
||||
return threadClient.source(source);
|
||||
return threadFront.source(source);
|
||||
}
|
||||
|
||||
throw new Error("source not found");
|
||||
}
|
||||
|
||||
async function getSourceById(threadClient, id) {
|
||||
const form = await getSourceFormById(threadClient, id);
|
||||
return threadClient.source(form);
|
||||
async function getSourceById(threadFront, id) {
|
||||
const form = await getSourceFormById(threadFront, id);
|
||||
return threadFront.source(form);
|
||||
}
|
||||
|
||||
async function getSourceForm(threadClient, url) {
|
||||
const { sources } = await threadClient.getSources();
|
||||
async function getSourceForm(threadFront, url) {
|
||||
const { sources } = await threadFront.getSources();
|
||||
return sources.find(s => s.url === url);
|
||||
}
|
||||
|
||||
async function getSourceFormById(threadClient, id) {
|
||||
const { sources } = await threadClient.getSources();
|
||||
async function getSourceFormById(threadFront, id) {
|
||||
const { sources } = await threadFront.getSources();
|
||||
return sources.find(source => source.actor == id);
|
||||
}
|
||||
|
||||
@ -895,16 +895,16 @@ async function setupTestFromUrl(url) {
|
||||
const targetFront = findTab(tabs, "test");
|
||||
await targetFront.attach();
|
||||
|
||||
const [, threadClient] = await attachThread(targetFront);
|
||||
await resume(threadClient);
|
||||
const [, threadFront] = await attachThread(targetFront);
|
||||
await resume(threadFront);
|
||||
|
||||
const sourceUrl = getFileUrl(url);
|
||||
const promise = waitForNewSource(threadClient, sourceUrl);
|
||||
const promise = waitForNewSource(threadFront, sourceUrl);
|
||||
loadSubScript(sourceUrl, global);
|
||||
const { source } = await promise;
|
||||
|
||||
const sourceFront = threadClient.source(source);
|
||||
return { global, debuggerClient, threadClient, sourceFront };
|
||||
const sourceFront = threadFront.source(source);
|
||||
return { global, debuggerClient, threadFront, sourceFront };
|
||||
}
|
||||
|
||||
/**
|
||||
@ -918,8 +918,8 @@ async function setupTestFromUrl(url) {
|
||||
* - Sandbox debuggee
|
||||
* The custom JS debuggee created for this test. This is a Sandbox using system
|
||||
* principals by default.
|
||||
* - ThreadClient threadClient
|
||||
* A reference to a ThreadClient instance that is attached to the debuggee.
|
||||
* - ThreadFront threadFront
|
||||
* A reference to a ThreadFront instance that is attached to the debuggee.
|
||||
* - DebuggerClient client
|
||||
* A reference to the DebuggerClient used to communicated with the RDP server.
|
||||
* @param Object options
|
||||
@ -929,13 +929,13 @@ async function setupTestFromUrl(url) {
|
||||
* - boolean doNotRunWorker
|
||||
* If true, do not run this tests in worker debugger context.
|
||||
*/
|
||||
function threadClientTest(test, options = {}) {
|
||||
function threadFrontTest(test, options = {}) {
|
||||
let { principal, doNotRunWorker } = options;
|
||||
if (!principal) {
|
||||
principal = systemPrincipal;
|
||||
}
|
||||
|
||||
async function runThreadClientTestWithServer(server, test) {
|
||||
async function runThreadFrontTestWithServer(server, test) {
|
||||
// Setup a server and connect a client to it.
|
||||
initTestDebuggerServer(server);
|
||||
|
||||
@ -950,15 +950,15 @@ function threadClientTest(test, options = {}) {
|
||||
const client = new DebuggerClient(server.connectPipe());
|
||||
await client.connect();
|
||||
|
||||
// Attach to the fake tab target and retrieve the ThreadClient instance.
|
||||
// Attach to the fake tab target and retrieve the ThreadFront instance.
|
||||
// Automatically resume as the thread is paused by default after attach.
|
||||
const { targetFront, threadClient } = await attachTestTabAndResume(
|
||||
const { targetFront, threadFront } = await attachTestTabAndResume(
|
||||
client,
|
||||
scriptName
|
||||
);
|
||||
|
||||
// Run the test function
|
||||
await test({ threadClient, debuggee, client, server, targetFront });
|
||||
await test({ threadFront, debuggee, client, server, targetFront });
|
||||
|
||||
// Cleanup the client after the test ran
|
||||
await client.close();
|
||||
@ -970,13 +970,13 @@ function threadClientTest(test, options = {}) {
|
||||
}
|
||||
|
||||
return async () => {
|
||||
dump(">>> Run thread client test against a regular DebuggerServer\n");
|
||||
await runThreadClientTestWithServer(DebuggerServer, test);
|
||||
dump(">>> Run thread front test against a regular DebuggerServer\n");
|
||||
await runThreadFrontTestWithServer(DebuggerServer, test);
|
||||
|
||||
// Skip tests that fail in the worker context
|
||||
if (!doNotRunWorker) {
|
||||
dump(">>> Run thread client test against a worker DebuggerServer\n");
|
||||
await runThreadClientTestWithServer(WorkerDebuggerServer, test);
|
||||
dump(">>> Run thread front test against a worker DebuggerServer\n");
|
||||
await runThreadFrontTestWithServer(WorkerDebuggerServer, test);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -3,20 +3,20 @@
|
||||
|
||||
"use strict";
|
||||
|
||||
const { ThreadClient } = require("devtools/shared/client/thread-client");
|
||||
const { ThreadFront } = require("devtools/shared/fronts/thread");
|
||||
const {
|
||||
BrowsingContextTargetFront,
|
||||
} = require("devtools/shared/fronts/targets/browsing-context");
|
||||
|
||||
/**
|
||||
* Very naive test that checks threadClearTest helper.
|
||||
* It ensures that the thread client is correctly attached.
|
||||
* It ensures that the thread front is correctly attached.
|
||||
*/
|
||||
add_task(
|
||||
threadClientTest(({ threadClient, debuggee, client, targetFront }) => {
|
||||
threadFrontTest(({ threadFront, debuggee, client, targetFront }) => {
|
||||
ok(true, "Thread actor was able to attach");
|
||||
ok(threadClient instanceof ThreadClient, "Thread client is valid");
|
||||
Assert.equal(threadClient.state, "attached", "Thread client is resumed");
|
||||
ok(threadFront instanceof ThreadFront, "Thread Front is valid");
|
||||
Assert.equal(threadFront.state, "attached", "Thread Front is resumed");
|
||||
Assert.equal(
|
||||
String(debuggee),
|
||||
"[object Sandbox]",
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
var gDebuggee;
|
||||
var gClient;
|
||||
var gThreadClient;
|
||||
var gThreadFront;
|
||||
|
||||
function run_test() {
|
||||
initTestDebuggerServer();
|
||||
@ -19,9 +19,9 @@ function run_test() {
|
||||
attachTestTabAndResume(gClient, "test-black-box", function(
|
||||
response,
|
||||
targetFront,
|
||||
threadClient
|
||||
threadFront
|
||||
) {
|
||||
gThreadClient = threadClient;
|
||||
gThreadFront = threadFront;
|
||||
testBlackBox();
|
||||
});
|
||||
});
|
||||
@ -32,17 +32,14 @@ const BLACK_BOXED_URL = "http://example.com/blackboxme.js";
|
||||
const SOURCE_URL = "http://example.com/source.js";
|
||||
|
||||
const testBlackBox = async function() {
|
||||
const packet = await executeOnNextTickAndWaitForPause(
|
||||
evalCode,
|
||||
gThreadClient
|
||||
);
|
||||
const packet = await executeOnNextTickAndWaitForPause(evalCode, gThreadFront);
|
||||
|
||||
const bpSource = await getSourceById(gThreadClient, packet.frame.where.actor);
|
||||
const bpSource = await getSourceById(gThreadFront, packet.frame.where.actor);
|
||||
|
||||
await setBreakpoint(gThreadClient, { sourceUrl: bpSource.url, line: 2 });
|
||||
await resume(gThreadClient);
|
||||
await setBreakpoint(gThreadFront, { sourceUrl: bpSource.url, line: 2 });
|
||||
await resume(gThreadFront);
|
||||
|
||||
let sourceForm = await getSourceForm(gThreadClient, BLACK_BOXED_URL);
|
||||
let sourceForm = await getSourceForm(gThreadFront, BLACK_BOXED_URL);
|
||||
|
||||
Assert.ok(
|
||||
!sourceForm.isBlackBoxed,
|
||||
@ -52,40 +49,34 @@ const testBlackBox = async function() {
|
||||
// Test that we can step into `doStuff` when we are not black boxed.
|
||||
await runTest(
|
||||
async function onSteppedLocation(location) {
|
||||
const source = await getSourceFormById(gThreadClient, location.actor);
|
||||
const source = await getSourceFormById(gThreadFront, location.actor);
|
||||
Assert.equal(source.url, BLACK_BOXED_URL);
|
||||
Assert.equal(location.line, 2);
|
||||
},
|
||||
async function onDebuggerStatementFrames(frames) {
|
||||
for (const frame of frames) {
|
||||
const source = await getSourceFormById(
|
||||
gThreadClient,
|
||||
frame.where.actor
|
||||
);
|
||||
const source = await getSourceFormById(gThreadFront, frame.where.actor);
|
||||
Assert.ok(!source.isBlackBoxed);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
const blackboxedSource = await getSource(gThreadClient, BLACK_BOXED_URL);
|
||||
const blackboxedSource = await getSource(gThreadFront, BLACK_BOXED_URL);
|
||||
await blackBox(blackboxedSource);
|
||||
sourceForm = await getSourceForm(gThreadClient, BLACK_BOXED_URL);
|
||||
sourceForm = await getSourceForm(gThreadFront, BLACK_BOXED_URL);
|
||||
Assert.ok(sourceForm.isBlackBoxed);
|
||||
|
||||
// Test that we step through `doStuff` when we are black boxed and its frame
|
||||
// doesn't show up.
|
||||
await runTest(
|
||||
async function onSteppedLocation(location) {
|
||||
const source = await getSourceFormById(gThreadClient, location.actor);
|
||||
const source = await getSourceFormById(gThreadFront, location.actor);
|
||||
Assert.equal(source.url, SOURCE_URL);
|
||||
Assert.equal(location.line, 4);
|
||||
},
|
||||
async function onDebuggerStatementFrames(frames) {
|
||||
for (const frame of frames) {
|
||||
const source = await getSourceFormById(
|
||||
gThreadClient,
|
||||
frame.where.actor
|
||||
);
|
||||
const source = await getSourceFormById(gThreadFront, frame.where.actor);
|
||||
if (source.url == BLACK_BOXED_URL) {
|
||||
Assert.ok(source.isBlackBoxed);
|
||||
} else {
|
||||
@ -96,22 +87,19 @@ const testBlackBox = async function() {
|
||||
);
|
||||
|
||||
await unBlackBox(blackboxedSource);
|
||||
sourceForm = await getSourceForm(gThreadClient, BLACK_BOXED_URL);
|
||||
sourceForm = await getSourceForm(gThreadFront, BLACK_BOXED_URL);
|
||||
Assert.ok(!sourceForm.isBlackBoxed);
|
||||
|
||||
// Test that we can step into `doStuff` again.
|
||||
await runTest(
|
||||
async function onSteppedLocation(location) {
|
||||
const source = await getSourceFormById(gThreadClient, location.actor);
|
||||
const source = await getSourceFormById(gThreadFront, location.actor);
|
||||
Assert.equal(source.url, BLACK_BOXED_URL);
|
||||
Assert.equal(location.line, 2);
|
||||
},
|
||||
async function onDebuggerStatementFrames(frames) {
|
||||
for (const frame of frames) {
|
||||
const source = await getSourceFormById(
|
||||
gThreadClient,
|
||||
frame.where.actor
|
||||
);
|
||||
const source = await getSourceFormById(gThreadFront, frame.where.actor);
|
||||
Assert.ok(!source.isBlackBoxed);
|
||||
}
|
||||
}
|
||||
@ -154,25 +142,25 @@ function evalCode() {
|
||||
const runTest = async function(onSteppedLocation, onDebuggerStatementFrames) {
|
||||
let packet = await executeOnNextTickAndWaitForPause(
|
||||
gDebuggee.runTest,
|
||||
gThreadClient
|
||||
gThreadFront
|
||||
);
|
||||
Assert.equal(packet.why.type, "breakpoint");
|
||||
|
||||
await stepIn(gThreadClient);
|
||||
await stepIn(gThreadFront);
|
||||
|
||||
const location = await getCurrentLocation();
|
||||
await onSteppedLocation(location);
|
||||
|
||||
packet = await resumeAndWaitForPause(gThreadClient);
|
||||
packet = await resumeAndWaitForPause(gThreadFront);
|
||||
Assert.equal(packet.why.type, "debuggerStatement");
|
||||
|
||||
const { frames } = await getFrames(gThreadClient, 0, 100);
|
||||
const { frames } = await getFrames(gThreadFront, 0, 100);
|
||||
await onDebuggerStatementFrames(frames);
|
||||
|
||||
return resume(gThreadClient);
|
||||
return resume(gThreadFront);
|
||||
};
|
||||
|
||||
const getCurrentLocation = async function() {
|
||||
const response = await getFrames(gThreadClient, 0, 1);
|
||||
const response = await getFrames(gThreadFront, 0, 1);
|
||||
return response.frames[0].where;
|
||||
};
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
var gDebuggee;
|
||||
var gClient;
|
||||
var gThreadClient;
|
||||
var gThreadFront;
|
||||
|
||||
function run_test() {
|
||||
initTestDebuggerServer();
|
||||
@ -23,9 +23,9 @@ function run_test() {
|
||||
attachTestTabAndResume(gClient, "test-black-box", function(
|
||||
response,
|
||||
targetFront,
|
||||
threadClient
|
||||
threadFront
|
||||
) {
|
||||
gThreadClient = threadClient;
|
||||
gThreadFront = threadFront;
|
||||
test_black_box();
|
||||
});
|
||||
});
|
||||
@ -36,9 +36,9 @@ const BLACK_BOXED_URL = "http://example.com/blackboxme.js";
|
||||
const SOURCE_URL = "http://example.com/source.js";
|
||||
|
||||
function test_black_box() {
|
||||
gThreadClient.once("paused", async function(packet) {
|
||||
gThreadClient.setBreakpoint({ sourceUrl: BLACK_BOXED_URL, line: 2 }, {});
|
||||
gThreadClient.resume().then(test_black_box_breakpoint);
|
||||
gThreadFront.once("paused", async function(packet) {
|
||||
gThreadFront.setBreakpoint({ sourceUrl: BLACK_BOXED_URL, line: 2 }, {});
|
||||
gThreadFront.resume().then(test_black_box_breakpoint);
|
||||
});
|
||||
|
||||
/* eslint-disable no-undef */
|
||||
@ -72,21 +72,21 @@ function test_black_box() {
|
||||
}
|
||||
|
||||
function test_black_box_breakpoint() {
|
||||
gThreadClient.getSources().then(async function({ error, sources }) {
|
||||
gThreadFront.getSources().then(async function({ error, sources }) {
|
||||
Assert.ok(!error, "Should not get an error: " + error);
|
||||
const sourceFront = gThreadClient.source(
|
||||
const sourceFront = gThreadFront.source(
|
||||
sources.filter(s => s.url == BLACK_BOXED_URL)[0]
|
||||
);
|
||||
|
||||
await blackBox(sourceFront);
|
||||
|
||||
gThreadClient.once("paused", function(packet) {
|
||||
gThreadFront.once("paused", function(packet) {
|
||||
Assert.equal(
|
||||
packet.why.type,
|
||||
"debuggerStatement",
|
||||
"We should pass over the breakpoint since the source is black boxed."
|
||||
);
|
||||
gThreadClient
|
||||
gThreadFront
|
||||
.resume()
|
||||
.then(test_unblack_box_breakpoint.bind(null, sourceFront));
|
||||
});
|
||||
@ -96,7 +96,7 @@ function test_black_box_breakpoint() {
|
||||
|
||||
async function test_unblack_box_breakpoint(sourceFront) {
|
||||
await unBlackBox(sourceFront);
|
||||
gThreadClient.once("paused", async function(packet) {
|
||||
gThreadFront.once("paused", async function(packet) {
|
||||
Assert.equal(
|
||||
packet.why.type,
|
||||
"breakpoint",
|
||||
@ -105,11 +105,11 @@ async function test_unblack_box_breakpoint(sourceFront) {
|
||||
|
||||
// We will hit the debugger statement on resume, so do this
|
||||
// nastiness to skip over it.
|
||||
gThreadClient.once("paused", async () => {
|
||||
await gThreadClient.resume();
|
||||
gThreadFront.once("paused", async () => {
|
||||
await gThreadFront.resume();
|
||||
finishClient(gClient);
|
||||
});
|
||||
await gThreadClient.resume();
|
||||
await gThreadFront.resume();
|
||||
});
|
||||
gDebuggee.runTest();
|
||||
}
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
var gDebuggee;
|
||||
var gClient;
|
||||
var gThreadClient;
|
||||
var gThreadFront;
|
||||
|
||||
function run_test() {
|
||||
initTestDebuggerServer();
|
||||
@ -20,9 +20,9 @@ function run_test() {
|
||||
attachTestTabAndResume(gClient, "test-black-box", function(
|
||||
response,
|
||||
targetFront,
|
||||
threadClient
|
||||
threadFront
|
||||
) {
|
||||
gThreadClient = threadClient;
|
||||
gThreadFront = threadFront;
|
||||
test_black_box();
|
||||
});
|
||||
});
|
||||
@ -33,10 +33,10 @@ const BLACK_BOXED_URL = "http://example.com/blackboxme.js";
|
||||
const SOURCE_URL = "http://example.com/source.js";
|
||||
|
||||
function test_black_box() {
|
||||
gThreadClient.once("paused", async function(packet) {
|
||||
const source = await getSourceById(gThreadClient, packet.frame.where.actor);
|
||||
gThreadClient.setBreakpoint({ sourceUrl: source.url, line: 4 }, {});
|
||||
await gThreadClient.resume();
|
||||
gThreadFront.once("paused", async function(packet) {
|
||||
const source = await getSourceById(gThreadFront, packet.frame.where.actor);
|
||||
gThreadFront.setBreakpoint({ sourceUrl: source.url, line: 4 }, {});
|
||||
await gThreadFront.resume();
|
||||
test_black_box_dbg_statement();
|
||||
});
|
||||
|
||||
@ -71,22 +71,22 @@ function test_black_box() {
|
||||
}
|
||||
|
||||
async function test_black_box_dbg_statement() {
|
||||
await gThreadClient.getSources();
|
||||
const sourceFront = await getSource(gThreadClient, BLACK_BOXED_URL);
|
||||
await gThreadFront.getSources();
|
||||
const sourceFront = await getSource(gThreadFront, BLACK_BOXED_URL);
|
||||
|
||||
await blackBox(sourceFront);
|
||||
|
||||
gThreadClient.once("paused", async function(packet) {
|
||||
gThreadFront.once("paused", async function(packet) {
|
||||
Assert.equal(
|
||||
packet.why.type,
|
||||
"breakpoint",
|
||||
"We should pass over the debugger statement."
|
||||
);
|
||||
|
||||
const source = await getSourceById(gThreadClient, packet.frame.where.actor);
|
||||
gThreadClient.removeBreakpoint({ sourceUrl: source.url, line: 4 }, {});
|
||||
const source = await getSourceById(gThreadFront, packet.frame.where.actor);
|
||||
gThreadFront.removeBreakpoint({ sourceUrl: source.url, line: 4 }, {});
|
||||
|
||||
await gThreadClient.resume();
|
||||
await gThreadFront.resume();
|
||||
await test_unblack_box_dbg_statement(sourceFront);
|
||||
});
|
||||
gDebuggee.runTest();
|
||||
@ -95,13 +95,13 @@ async function test_black_box_dbg_statement() {
|
||||
async function test_unblack_box_dbg_statement(sourceFront) {
|
||||
await unBlackBox(sourceFront);
|
||||
|
||||
gThreadClient.once("paused", async function(packet) {
|
||||
gThreadFront.once("paused", async function(packet) {
|
||||
Assert.equal(
|
||||
packet.why.type,
|
||||
"debuggerStatement",
|
||||
"We should stop at the debugger statement again"
|
||||
);
|
||||
await gThreadClient.resume();
|
||||
await gThreadFront.resume();
|
||||
finishClient(gClient);
|
||||
});
|
||||
gDebuggee.runTest();
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
var gDebuggee;
|
||||
var gClient;
|
||||
var gThreadClient;
|
||||
var gThreadFront;
|
||||
|
||||
function run_test() {
|
||||
initTestDebuggerServer();
|
||||
@ -20,9 +20,9 @@ function run_test() {
|
||||
attachTestTabAndResume(gClient, "test-black-box", function(
|
||||
response,
|
||||
targetFront,
|
||||
threadClient
|
||||
threadFront
|
||||
) {
|
||||
gThreadClient = threadClient;
|
||||
gThreadFront = threadFront;
|
||||
test_black_box();
|
||||
});
|
||||
});
|
||||
@ -33,8 +33,8 @@ const BLACK_BOXED_URL = "http://example.com/blackboxme.js";
|
||||
const SOURCE_URL = "http://example.com/source.js";
|
||||
|
||||
function test_black_box() {
|
||||
gThreadClient.once("paused", function(packet) {
|
||||
gThreadClient.setBreakpoint({ sourceUrl: BLACK_BOXED_URL, line: 2 }, {});
|
||||
gThreadFront.once("paused", function(packet) {
|
||||
gThreadFront.setBreakpoint({ sourceUrl: BLACK_BOXED_URL, line: 2 }, {});
|
||||
test_black_box_paused();
|
||||
});
|
||||
|
||||
@ -74,9 +74,9 @@ function test_black_box() {
|
||||
}
|
||||
|
||||
function test_black_box_paused() {
|
||||
gThreadClient.getSources().then(async function({ error, sources }) {
|
||||
gThreadFront.getSources().then(async function({ error, sources }) {
|
||||
Assert.ok(!error, "Should not get an error: " + error);
|
||||
const sourceFront = gThreadClient.source(
|
||||
const sourceFront = gThreadFront.source(
|
||||
sources.filter(s => s.url == BLACK_BOXED_URL)[0]
|
||||
);
|
||||
|
||||
@ -85,7 +85,7 @@ function test_black_box_paused() {
|
||||
pausedInSource,
|
||||
"We should be notified that we are currently paused in this source"
|
||||
);
|
||||
await gThreadClient.resume();
|
||||
await gThreadFront.resume();
|
||||
finishClient(gClient);
|
||||
});
|
||||
}
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
var gDebuggee;
|
||||
var gClient;
|
||||
var gThreadClient;
|
||||
var gThreadFront;
|
||||
|
||||
function run_test() {
|
||||
initTestDebuggerServer();
|
||||
@ -20,9 +20,9 @@ function run_test() {
|
||||
attachTestTabAndResume(gClient, "test-black-box", function(
|
||||
response,
|
||||
targetFront,
|
||||
threadClient
|
||||
threadFront
|
||||
) {
|
||||
gThreadClient = threadClient;
|
||||
gThreadFront = threadFront;
|
||||
// XXX: We have to do an executeSoon so that the error isn't caught and
|
||||
// reported by DebuggerClient.requester (because we are using the local
|
||||
// transport and share a stack) which causes the test to fail.
|
||||
@ -38,7 +38,7 @@ const BLACK_BOXED_URL = "http://example.com/blackboxme.js";
|
||||
const SOURCE_URL = "http://example.com/source.js";
|
||||
|
||||
function test_black_box() {
|
||||
gThreadClient.once("paused", test_black_box_exception);
|
||||
gThreadFront.once("paused", test_black_box_exception);
|
||||
|
||||
/* eslint-disable no-multi-spaces, no-unreachable, no-undef */
|
||||
Cu.evalInSandbox(
|
||||
@ -77,15 +77,15 @@ function test_black_box() {
|
||||
}
|
||||
|
||||
function test_black_box_exception() {
|
||||
gThreadClient.getSources().then(async function({ error, sources }) {
|
||||
gThreadFront.getSources().then(async function({ error, sources }) {
|
||||
Assert.ok(!error, "Should not get an error: " + error);
|
||||
const sourceFront = await getSource(gThreadClient, BLACK_BOXED_URL);
|
||||
const sourceFront = await getSource(gThreadFront, BLACK_BOXED_URL);
|
||||
await blackBox(sourceFront);
|
||||
gThreadClient.pauseOnExceptions(true, false);
|
||||
gThreadFront.pauseOnExceptions(true, false);
|
||||
|
||||
gThreadClient.once("paused", async function(packet) {
|
||||
gThreadFront.once("paused", async function(packet) {
|
||||
const source = await getSourceById(
|
||||
gThreadClient,
|
||||
gThreadFront,
|
||||
packet.frame.where.actor
|
||||
);
|
||||
|
||||
@ -94,10 +94,10 @@ function test_black_box_exception() {
|
||||
SOURCE_URL,
|
||||
"We shouldn't pause while in the black boxed source."
|
||||
);
|
||||
await gThreadClient.resume();
|
||||
await gThreadFront.resume();
|
||||
finishClient(gClient);
|
||||
});
|
||||
|
||||
gThreadClient.resume();
|
||||
gThreadFront.resume();
|
||||
});
|
||||
}
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
var gDebuggee;
|
||||
var gClient;
|
||||
var gThreadClient;
|
||||
var gThreadFront;
|
||||
|
||||
function run_test() {
|
||||
initTestDebuggerServer();
|
||||
@ -20,9 +20,9 @@ function run_test() {
|
||||
attachTestTabAndResume(gClient, "test-black-box", function(
|
||||
response,
|
||||
targetFront,
|
||||
threadClient
|
||||
threadFront
|
||||
) {
|
||||
gThreadClient = threadClient;
|
||||
gThreadFront = threadFront;
|
||||
testBlackBox();
|
||||
});
|
||||
});
|
||||
@ -33,9 +33,9 @@ const BLACK_BOXED_URL = "http://example.com/black-boxed.min.js";
|
||||
const SOURCE_URL = "http://example.com/source.js";
|
||||
|
||||
const testBlackBox = async function() {
|
||||
await executeOnNextTickAndWaitForPause(evalCode, gThreadClient);
|
||||
await executeOnNextTickAndWaitForPause(evalCode, gThreadFront);
|
||||
|
||||
const { sources } = await getSources(gThreadClient);
|
||||
const { sources } = await getSources(gThreadFront);
|
||||
equal(sources.length, 2);
|
||||
|
||||
const blackBoxedSource = sources.filter(s => s.url === BLACK_BOXED_URL)[0];
|
||||
@ -44,7 +44,7 @@ const testBlackBox = async function() {
|
||||
const regularSource = sources.filter(s => s.url === SOURCE_URL)[0];
|
||||
equal(regularSource.isBlackBoxed, false);
|
||||
|
||||
await gThreadClient.resume();
|
||||
await gThreadFront.resume();
|
||||
finishClient(gClient);
|
||||
};
|
||||
|
||||
|
@ -7,46 +7,46 @@
|
||||
* Test blackbox ranges
|
||||
*/
|
||||
|
||||
async function testFinish({ threadClient, debuggerClient }) {
|
||||
await threadClient.resume();
|
||||
async function testFinish({ threadFront, debuggerClient }) {
|
||||
await threadFront.resume();
|
||||
await close(debuggerClient);
|
||||
|
||||
do_test_finished();
|
||||
}
|
||||
|
||||
async function invokeAndPause({ global, threadClient }, expression) {
|
||||
async function invokeAndPause({ global, threadFront }, expression) {
|
||||
return executeOnNextTickAndWaitForPause(
|
||||
() => Cu.evalInSandbox(expression, global),
|
||||
threadClient
|
||||
threadFront
|
||||
);
|
||||
}
|
||||
|
||||
function run_test() {
|
||||
return (async function() {
|
||||
const dbg = await setupTestFromUrl("stepping.js");
|
||||
const { threadClient } = dbg;
|
||||
const { threadFront } = dbg;
|
||||
|
||||
await invokeAndPause(dbg, `chaining()`);
|
||||
|
||||
const { sources } = await getSources(threadClient);
|
||||
const sourceFront = threadClient.source(sources[0]);
|
||||
const { sources } = await getSources(threadFront);
|
||||
const sourceFront = threadFront.source(sources[0]);
|
||||
|
||||
await setBreakpoint(threadClient, { sourceUrl: sourceFront.url, line: 7 });
|
||||
await setBreakpoint(threadClient, { sourceUrl: sourceFront.url, line: 11 });
|
||||
await setBreakpoint(threadFront, { sourceUrl: sourceFront.url, line: 7 });
|
||||
await setBreakpoint(threadFront, { sourceUrl: sourceFront.url, line: 11 });
|
||||
|
||||
// 1. lets blackbox function a, and assert that we pause in b
|
||||
const range = { start: { line: 6, column: 0 }, end: { line: 8, colum: 1 } };
|
||||
blackBox(sourceFront, range);
|
||||
await threadClient.resume();
|
||||
const paused = await waitForPause(threadClient);
|
||||
await threadFront.resume();
|
||||
const paused = await waitForPause(threadFront);
|
||||
equal(paused.frame.where.line, 11, "paused inside of b");
|
||||
await threadClient.resume();
|
||||
await threadFront.resume();
|
||||
|
||||
// 2. lets unblackbox function a, and assert that we pause in a
|
||||
unBlackBox(sourceFront, range);
|
||||
await invokeAndPause(dbg, `chaining()`);
|
||||
await threadClient.resume();
|
||||
const paused2 = await waitForPause(threadClient);
|
||||
await threadFront.resume();
|
||||
const paused2 = await waitForPause(threadFront);
|
||||
equal(paused2.frame.where.line, 7, "paused inside of a");
|
||||
|
||||
await testFinish(dbg);
|
||||
|
@ -9,21 +9,18 @@
|
||||
*/
|
||||
|
||||
add_task(
|
||||
threadClientTest(async ({ threadClient, debuggee }) => {
|
||||
threadFrontTest(async ({ threadFront, debuggee }) => {
|
||||
(async () => {
|
||||
info("Wait for the debugger statement to be hit");
|
||||
let packet = await waitForPause(threadClient);
|
||||
const source = await getSourceById(
|
||||
threadClient,
|
||||
packet.frame.where.actor
|
||||
);
|
||||
let packet = await waitForPause(threadFront);
|
||||
const source = await getSourceById(threadFront, packet.frame.where.actor);
|
||||
|
||||
const location = { sourceUrl: source.url, line: debuggee.line0 + 3 };
|
||||
|
||||
threadClient.setBreakpoint(location, {});
|
||||
threadFront.setBreakpoint(location, {});
|
||||
|
||||
await threadClient.resume();
|
||||
packet = await waitForPause(threadClient);
|
||||
await threadFront.resume();
|
||||
packet = await waitForPause(threadFront);
|
||||
|
||||
info("Paused at the breakpoint");
|
||||
Assert.equal(packet.type, "paused");
|
||||
@ -35,7 +32,7 @@ add_task(
|
||||
Assert.equal(debuggee.a, 1);
|
||||
Assert.equal(debuggee.b, undefined);
|
||||
|
||||
await threadClient.resume();
|
||||
await threadFront.resume();
|
||||
})();
|
||||
|
||||
/*
|
||||
@ -44,15 +41,15 @@ add_task(
|
||||
* along with the debuggee's.
|
||||
*/
|
||||
do_timeout(0, () => {
|
||||
/* eslint-disable */
|
||||
Cu.evalInSandbox(
|
||||
"var line0 = Error().lineNumber;\n" +
|
||||
"debugger;\n" + // line0 + 1
|
||||
"var a = 1;\n" + // line0 + 2
|
||||
"var b = 2;\n", // line0 + 3
|
||||
debuggee
|
||||
);
|
||||
/* eslint-enable */
|
||||
/* eslint-disable */
|
||||
Cu.evalInSandbox(
|
||||
"var line0 = Error().lineNumber;\n" +
|
||||
"debugger;\n" + // line0 + 1
|
||||
"var a = 1;\n" + // line0 + 2
|
||||
"var b = 2;\n", // line0 + 3
|
||||
debuggee
|
||||
);
|
||||
/* eslint-enable */
|
||||
});
|
||||
})
|
||||
);
|
||||
|
@ -9,24 +9,23 @@
|
||||
*/
|
||||
|
||||
add_task(
|
||||
threadClientTest(({ threadClient, client, debuggee }) => {
|
||||
threadFrontTest(({ threadFront, client, debuggee }) => {
|
||||
return new Promise(resolve => {
|
||||
threadClient.once("paused", async function(packet) {
|
||||
threadFront.once("paused", async function(packet) {
|
||||
const source = await getSourceById(
|
||||
threadClient,
|
||||
threadFront,
|
||||
packet.frame.where.actor
|
||||
);
|
||||
const location = { sourceUrl: source.url, line: debuggee.line0 + 3 };
|
||||
|
||||
await threadClient.resume();
|
||||
await threadFront.resume();
|
||||
|
||||
// Setting the breakpoint later should interrupt the debuggee.
|
||||
threadClient.once("paused", function(packet) {
|
||||
Assert.equal(packet.type, "paused");
|
||||
threadFront.once("paused", function(packet) {
|
||||
Assert.equal(packet.why.type, "interrupted");
|
||||
});
|
||||
|
||||
threadClient.setBreakpoint(location, {});
|
||||
threadFront.setBreakpoint(location, {});
|
||||
await client.waitForRequestsToSettle();
|
||||
executeSoon(resolve);
|
||||
});
|
||||
|
@ -21,12 +21,12 @@ var test_no_skip_breakpoint = async function(source, location, debuggee) {
|
||||
};
|
||||
|
||||
add_task(
|
||||
threadClientTest(({ threadClient, debuggee }) => {
|
||||
threadFrontTest(({ threadFront, debuggee }) => {
|
||||
return new Promise(resolve => {
|
||||
threadClient.once("paused", async function(packet) {
|
||||
threadFront.once("paused", async function(packet) {
|
||||
const location = { line: debuggee.line0 + 3 };
|
||||
const source = await getSourceById(
|
||||
threadClient,
|
||||
threadFront,
|
||||
packet.frame.where.actor
|
||||
);
|
||||
// First, make sure that we can disable sliding with the
|
||||
@ -39,9 +39,8 @@ add_task(
|
||||
Assert.equal(response.actualLocation.source.actor, source.actor);
|
||||
Assert.equal(response.actualLocation.line, location.line + 1);
|
||||
|
||||
threadClient.once("paused", function(packet) {
|
||||
threadFront.once("paused", function(packet) {
|
||||
// Check the return value.
|
||||
Assert.equal(packet.type, "paused");
|
||||
Assert.equal(packet.frame.where.actor, source.actor);
|
||||
Assert.equal(packet.frame.where.line, location.line + 1);
|
||||
Assert.equal(packet.why.type, "breakpoint");
|
||||
@ -52,11 +51,11 @@ add_task(
|
||||
|
||||
// Remove the breakpoint.
|
||||
bpClient.remove(function(response) {
|
||||
threadClient.resume().then(resolve);
|
||||
threadFront.resume().then(resolve);
|
||||
});
|
||||
});
|
||||
|
||||
threadClient.resume();
|
||||
threadFront.resume();
|
||||
});
|
||||
|
||||
// Use `evalInSandbox` to make the debugger treat it as normal
|
||||
|
@ -9,19 +9,19 @@
|
||||
*/
|
||||
|
||||
add_task(
|
||||
threadClientTest(({ threadClient, client, debuggee }) => {
|
||||
threadFrontTest(({ threadFront, client, debuggee }) => {
|
||||
return new Promise(resolve => {
|
||||
threadClient.once("paused", async function(packet) {
|
||||
threadFront.once("paused", async function(packet) {
|
||||
const source = await getSourceById(
|
||||
threadClient,
|
||||
threadFront,
|
||||
packet.frame.where.actor
|
||||
);
|
||||
const location = { sourceUrl: source.url, line: debuggee.line0 + 3 };
|
||||
|
||||
threadClient.setBreakpoint(location, {});
|
||||
threadFront.setBreakpoint(location, {});
|
||||
await client.waitForRequestsToSettle();
|
||||
|
||||
threadClient.once("paused", async function(packet) {
|
||||
threadFront.once("paused", async function(packet) {
|
||||
// Check the return value.
|
||||
Assert.equal(packet.frame.where.actor, source.actor);
|
||||
Assert.equal(packet.frame.where.line, location.line);
|
||||
@ -31,26 +31,26 @@ add_task(
|
||||
Assert.equal(debuggee.b, undefined);
|
||||
|
||||
// Remove the breakpoint.
|
||||
threadClient.removeBreakpoint(location);
|
||||
threadFront.removeBreakpoint(location);
|
||||
await client.waitForRequestsToSettle();
|
||||
threadClient.resume().then(resolve);
|
||||
threadFront.resume().then(resolve);
|
||||
});
|
||||
|
||||
// Continue until the breakpoint is hit.
|
||||
await threadClient.resume();
|
||||
await threadFront.resume();
|
||||
});
|
||||
|
||||
/* eslint-disable */
|
||||
Cu.evalInSandbox(
|
||||
"var line0 = Error().lineNumber;\n" +
|
||||
"function foo() {\n" + // line0 + 1
|
||||
" this.a = 1;\n" + // line0 + 2
|
||||
" this.b = 2;\n" + // line0 + 3
|
||||
"}\n" + // line0 + 4
|
||||
"debugger;\n" + // line0 + 5
|
||||
"foo();\n", // line0 + 6
|
||||
debuggee
|
||||
);
|
||||
Cu.evalInSandbox(
|
||||
"var line0 = Error().lineNumber;\n" +
|
||||
"function foo() {\n" + // line0 + 1
|
||||
" this.a = 1;\n" + // line0 + 2
|
||||
" this.b = 2;\n" + // line0 + 3
|
||||
"}\n" + // line0 + 4
|
||||
"debugger;\n" + // line0 + 5
|
||||
"foo();\n", // line0 + 6
|
||||
debuggee
|
||||
);
|
||||
/* eslint-enable */
|
||||
});
|
||||
})
|
||||
|
@ -10,11 +10,11 @@
|
||||
*/
|
||||
|
||||
add_task(
|
||||
threadClientTest(({ threadClient, debuggee }) => {
|
||||
threadFrontTest(({ threadFront, debuggee }) => {
|
||||
return new Promise(resolve => {
|
||||
threadClient.once("paused", async function(packet) {
|
||||
threadFront.once("paused", async function(packet) {
|
||||
const source = await getSourceById(
|
||||
threadClient,
|
||||
threadFront,
|
||||
packet.frame.where.actor
|
||||
);
|
||||
const location = { line: debuggee.line0 + 3 };
|
||||
@ -24,9 +24,8 @@ add_task(
|
||||
Assert.equal(response.actualLocation.source.actor, source.actor);
|
||||
Assert.equal(response.actualLocation.line, location.line + 1);
|
||||
|
||||
threadClient.once("paused", function(packet) {
|
||||
threadFront.once("paused", function(packet) {
|
||||
// Check the return value.
|
||||
Assert.equal(packet.type, "paused");
|
||||
Assert.equal(packet.frame.where.actor, source.actor);
|
||||
Assert.equal(packet.frame.where.line, location.line + 1);
|
||||
Assert.equal(packet.why.type, "breakpoint");
|
||||
@ -37,28 +36,28 @@ add_task(
|
||||
|
||||
// Remove the breakpoint.
|
||||
bpClient.remove(function(response) {
|
||||
threadClient.resume().then(resolve);
|
||||
threadFront.resume().then(resolve);
|
||||
});
|
||||
});
|
||||
|
||||
// Continue until the breakpoint is hit.
|
||||
threadClient.resume();
|
||||
threadFront.resume();
|
||||
});
|
||||
});
|
||||
|
||||
/* eslint-disable */
|
||||
Cu.evalInSandbox(
|
||||
"var line0 = Error().lineNumber;\n" +
|
||||
"function foo() {\n" + // line0 + 1
|
||||
" this.a = 1;\n" + // line0 + 2
|
||||
" // A comment.\n" + // line0 + 3
|
||||
" this.b = 2;\n" + // line0 + 4
|
||||
"}\n" + // line0 + 5
|
||||
"debugger;\n" + // line0 + 6
|
||||
"foo();\n", // line0 + 7
|
||||
debuggee
|
||||
);
|
||||
/* eslint-enable */
|
||||
Cu.evalInSandbox(
|
||||
"var line0 = Error().lineNumber;\n" +
|
||||
"function foo() {\n" + // line0 + 1
|
||||
" this.a = 1;\n" + // line0 + 2
|
||||
" // A comment.\n" + // line0 + 3
|
||||
" this.b = 2;\n" + // line0 + 4
|
||||
"}\n" + // line0 + 5
|
||||
"debugger;\n" + // line0 + 6
|
||||
"foo();\n", // line0 + 7
|
||||
debuggee
|
||||
);
|
||||
/* eslint-enable */
|
||||
});
|
||||
})
|
||||
);
|
||||
|
@ -10,11 +10,11 @@
|
||||
*/
|
||||
|
||||
add_task(
|
||||
threadClientTest(({ threadClient, debuggee }) => {
|
||||
threadFrontTest(({ threadFront, debuggee }) => {
|
||||
return new Promise(resolve => {
|
||||
threadClient.once("paused", async function(packet) {
|
||||
threadFront.once("paused", async function(packet) {
|
||||
const source = await getSourceById(
|
||||
threadClient,
|
||||
threadFront,
|
||||
packet.frame.where.actor
|
||||
);
|
||||
const location = { line: debuggee.line0 + 5 };
|
||||
@ -24,9 +24,8 @@ add_task(
|
||||
Assert.equal(response.actualLocation.source.actor, source.actor);
|
||||
Assert.equal(response.actualLocation.line, location.line + 1);
|
||||
|
||||
threadClient.once("paused", function(packet) {
|
||||
threadFront.once("paused", function(packet) {
|
||||
// Check the return value.
|
||||
Assert.equal(packet.type, "paused");
|
||||
Assert.equal(packet.frame.where.actor, source.actor);
|
||||
Assert.equal(packet.frame.where.line, location.line + 1);
|
||||
Assert.equal(packet.why.type, "breakpoint");
|
||||
@ -37,34 +36,34 @@ add_task(
|
||||
|
||||
// Remove the breakpoint.
|
||||
bpClient.remove(function(response) {
|
||||
threadClient.resume().then(resolve);
|
||||
threadFront.resume().then(resolve);
|
||||
});
|
||||
});
|
||||
|
||||
// Continue until the breakpoint is hit.
|
||||
threadClient.resume();
|
||||
threadFront.resume();
|
||||
});
|
||||
});
|
||||
|
||||
/* eslint-disable */
|
||||
Cu.evalInSandbox(
|
||||
"var line0 = Error().lineNumber;\n" +
|
||||
"function foo() {\n" + // line0 + 1
|
||||
" function bar() {\n" + // line0 + 2
|
||||
" function baz() {\n" + // line0 + 3
|
||||
" this.a = 1;\n" + // line0 + 4
|
||||
" // A comment.\n" + // line0 + 5
|
||||
" this.b = 2;\n" + // line0 + 6
|
||||
" }\n" + // line0 + 7
|
||||
" baz();\n" + // line0 + 8
|
||||
" }\n" + // line0 + 9
|
||||
" bar();\n" + // line0 + 10
|
||||
"}\n" + // line0 + 11
|
||||
"debugger;\n" + // line0 + 12
|
||||
"foo();\n", // line0 + 13
|
||||
debuggee
|
||||
);
|
||||
/* eslint-enable */
|
||||
Cu.evalInSandbox(
|
||||
"var line0 = Error().lineNumber;\n" +
|
||||
"function foo() {\n" + // line0 + 1
|
||||
" function bar() {\n" + // line0 + 2
|
||||
" function baz() {\n" + // line0 + 3
|
||||
" this.a = 1;\n" + // line0 + 4
|
||||
" // A comment.\n" + // line0 + 5
|
||||
" this.b = 2;\n" + // line0 + 6
|
||||
" }\n" + // line0 + 7
|
||||
" baz();\n" + // line0 + 8
|
||||
" }\n" + // line0 + 9
|
||||
" bar();\n" + // line0 + 10
|
||||
"}\n" + // line0 + 11
|
||||
"debugger;\n" + // line0 + 12
|
||||
"foo();\n", // line0 + 13
|
||||
debuggee
|
||||
);
|
||||
/* eslint-enable */
|
||||
});
|
||||
})
|
||||
);
|
||||
|
@ -10,11 +10,11 @@
|
||||
*/
|
||||
|
||||
add_task(
|
||||
threadClientTest(({ threadClient, debuggee }) => {
|
||||
threadFrontTest(({ threadFront, debuggee }) => {
|
||||
return new Promise(resolve => {
|
||||
threadClient.once("paused", async function(packet) {
|
||||
threadFront.once("paused", async function(packet) {
|
||||
const source = await getSourceById(
|
||||
threadClient,
|
||||
threadFront,
|
||||
packet.frame.where.actor
|
||||
);
|
||||
const location = { line: debuggee.line0 + 6 };
|
||||
@ -24,9 +24,8 @@ add_task(
|
||||
Assert.equal(response.actualLocation.source.actor, source.actor);
|
||||
Assert.equal(response.actualLocation.line, location.line + 1);
|
||||
|
||||
threadClient.once("paused", function(packet) {
|
||||
threadFront.once("paused", function(packet) {
|
||||
// Check the return value.
|
||||
Assert.equal(packet.type, "paused");
|
||||
Assert.equal(packet.frame.where.actor, source.actor);
|
||||
Assert.equal(packet.frame.where.line, location.line + 1);
|
||||
Assert.equal(packet.why.type, "breakpoint");
|
||||
@ -37,31 +36,31 @@ add_task(
|
||||
|
||||
// Remove the breakpoint.
|
||||
bpClient.remove(function(response) {
|
||||
threadClient.resume().then(resolve);
|
||||
threadFront.resume().then(resolve);
|
||||
});
|
||||
});
|
||||
|
||||
// Continue until the breakpoint is hit.
|
||||
threadClient.resume();
|
||||
threadFront.resume();
|
||||
});
|
||||
});
|
||||
|
||||
/* eslint-disable */
|
||||
Cu.evalInSandbox(
|
||||
"var line0 = Error().lineNumber;\n" +
|
||||
"function foo() {\n" + // line0 + 1
|
||||
" bar();\n" + // line0 + 2
|
||||
"}\n" + // line0 + 3
|
||||
"function bar() {\n" + // line0 + 4
|
||||
" this.a = 1;\n" + // line0 + 5
|
||||
" // A comment.\n" + // line0 + 6
|
||||
" this.b = 2;\n" + // line0 + 7
|
||||
"}\n" + // line0 + 8
|
||||
"debugger;\n" + // line0 + 9
|
||||
"foo();\n", // line0 + 10
|
||||
debuggee
|
||||
);
|
||||
/* eslint-enable */
|
||||
Cu.evalInSandbox(
|
||||
"var line0 = Error().lineNumber;\n" +
|
||||
"function foo() {\n" + // line0 + 1
|
||||
" bar();\n" + // line0 + 2
|
||||
"}\n" + // line0 + 3
|
||||
"function bar() {\n" + // line0 + 4
|
||||
" this.a = 1;\n" + // line0 + 5
|
||||
" // A comment.\n" + // line0 + 6
|
||||
" this.b = 2;\n" + // line0 + 7
|
||||
"}\n" + // line0 + 8
|
||||
"debugger;\n" + // line0 + 9
|
||||
"foo();\n", // line0 + 10
|
||||
debuggee
|
||||
);
|
||||
/* eslint-enable */
|
||||
});
|
||||
})
|
||||
);
|
||||
|
@ -10,17 +10,17 @@
|
||||
*/
|
||||
|
||||
add_task(
|
||||
threadClientTest(({ threadClient, debuggee }) => {
|
||||
threadFrontTest(({ threadFront, debuggee }) => {
|
||||
return new Promise(resolve => {
|
||||
threadClient.once("paused", async function(packet) {
|
||||
threadFront.once("paused", async function(packet) {
|
||||
const line = debuggee.line0 + 3;
|
||||
const source = await getSourceById(
|
||||
threadClient,
|
||||
threadFront,
|
||||
packet.frame.where.actor
|
||||
);
|
||||
|
||||
// this test has been disabled for a long time so the functionality doesn't work
|
||||
const response = await threadClient.setBreakpoint(
|
||||
const response = await threadFront.setBreakpoint(
|
||||
{ sourceUrl: source.url, line: line },
|
||||
{}
|
||||
);
|
||||
@ -28,9 +28,8 @@ add_task(
|
||||
assert.equal(response.actuallocation.source.actor, source.actor);
|
||||
Assert.equal(response.actualLocation.line, location.line + 1);
|
||||
|
||||
threadClient.once("paused", function(packet) {
|
||||
threadFront.once("paused", function(packet) {
|
||||
// Check the return value.
|
||||
Assert.equal(packet.type, "paused");
|
||||
Assert.equal(packet.frame.where.actor, source.actor);
|
||||
Assert.equal(packet.frame.where.line, location.line + 1);
|
||||
Assert.equal(packet.why.type, "breakpoint");
|
||||
@ -41,32 +40,32 @@ add_task(
|
||||
|
||||
// Remove the breakpoint.
|
||||
response.bpClient.remove(function(response) {
|
||||
threadClient.resume().then(resolve);
|
||||
threadFront.resume().then(resolve);
|
||||
});
|
||||
});
|
||||
|
||||
// Continue until the breakpoint is hit.
|
||||
threadClient.resume();
|
||||
threadFront.resume();
|
||||
});
|
||||
|
||||
/* eslint-disable */
|
||||
Cu.evalInSandbox("var line0 = Error().lineNumber;\n" +
|
||||
"function foo() {\n" + // line0 + 1
|
||||
" this.a = 1;\n" + // line0 + 2
|
||||
" // A comment.\n" + // line0 + 3
|
||||
" this.b = 2;\n" + // line0 + 4
|
||||
"}\n", // line0 + 5
|
||||
debuggee,
|
||||
"1.7",
|
||||
"script1.js");
|
||||
/* eslint-disable */
|
||||
Cu.evalInSandbox("var line0 = Error().lineNumber;\n" +
|
||||
"function foo() {\n" + // line0 + 1
|
||||
" this.a = 1;\n" + // line0 + 2
|
||||
" // A comment.\n" + // line0 + 3
|
||||
" this.b = 2;\n" + // line0 + 4
|
||||
"}\n", // line0 + 5
|
||||
debuggee,
|
||||
"1.7",
|
||||
"script1.js");
|
||||
|
||||
Cu.evalInSandbox("var line1 = Error().lineNumber;\n" +
|
||||
"debugger;\n" + // line1 + 1
|
||||
"foo();\n", // line1 + 2
|
||||
debuggee,
|
||||
"1.7",
|
||||
"script2.js");
|
||||
/* eslint-enable */
|
||||
Cu.evalInSandbox("var line1 = Error().lineNumber;\n" +
|
||||
"debugger;\n" + // line1 + 1
|
||||
"foo();\n", // line1 + 2
|
||||
debuggee,
|
||||
"1.7",
|
||||
"script2.js");
|
||||
/* eslint-enable */
|
||||
});
|
||||
})
|
||||
);
|
||||
|
@ -9,19 +9,19 @@
|
||||
*/
|
||||
|
||||
add_task(
|
||||
threadClientTest(({ threadClient, client, debuggee }) => {
|
||||
threadFrontTest(({ threadFront, client, debuggee }) => {
|
||||
return new Promise(resolve => {
|
||||
let done = false;
|
||||
threadClient.once("paused", async function(packet) {
|
||||
threadFront.once("paused", async function(packet) {
|
||||
const source = await getSourceById(
|
||||
threadClient,
|
||||
threadFront,
|
||||
packet.frame.where.actor
|
||||
);
|
||||
const location = { sourceUrl: source.url, line: debuggee.line0 + 2 };
|
||||
|
||||
threadClient.setBreakpoint(location, {});
|
||||
threadFront.setBreakpoint(location, {});
|
||||
await client.waitForRequestsToSettle();
|
||||
threadClient.once("paused", async function(packet) {
|
||||
threadFront.once("paused", async function(packet) {
|
||||
// Check the return value.
|
||||
Assert.equal(packet.frame.where.actor, source.actorID);
|
||||
Assert.equal(packet.frame.where.line, location.line);
|
||||
@ -30,35 +30,35 @@ add_task(
|
||||
Assert.equal(debuggee.a, undefined);
|
||||
|
||||
// Remove the breakpoint.
|
||||
threadClient.removeBreakpoint(location);
|
||||
threadFront.removeBreakpoint(location);
|
||||
await client.waitForRequestsToSettle();
|
||||
done = true;
|
||||
threadClient.once("paused", function(packet) {
|
||||
threadFront.once("paused", function(packet) {
|
||||
// The breakpoint should not be hit again.
|
||||
threadClient.resume().then(function() {
|
||||
threadFront.resume().then(function() {
|
||||
Assert.ok(false);
|
||||
});
|
||||
});
|
||||
await threadClient.resume();
|
||||
await threadFront.resume();
|
||||
resolve();
|
||||
});
|
||||
|
||||
// Continue until the breakpoint is hit.
|
||||
await threadClient.resume();
|
||||
await threadFront.resume();
|
||||
});
|
||||
|
||||
/* eslint-disable */
|
||||
Cu.evalInSandbox("var line0 = Error().lineNumber;\n" +
|
||||
"function foo(stop) {\n" + // line0 + 1
|
||||
" this.a = 1;\n" + // line0 + 2
|
||||
" if (stop) return;\n" + // line0 + 3
|
||||
" delete this.a;\n" + // line0 + 4
|
||||
" foo(true);\n" + // line0 + 5
|
||||
"}\n" + // line0 + 6
|
||||
"debugger;\n" + // line1 + 7
|
||||
"foo();\n", // line1 + 8
|
||||
debuggee);
|
||||
/* eslint-enable */
|
||||
Cu.evalInSandbox("var line0 = Error().lineNumber;\n" +
|
||||
"function foo(stop) {\n" + // line0 + 1
|
||||
" this.a = 1;\n" + // line0 + 2
|
||||
" if (stop) return;\n" + // line0 + 3
|
||||
" delete this.a;\n" + // line0 + 4
|
||||
" foo(true);\n" + // line0 + 5
|
||||
"}\n" + // line0 + 6
|
||||
"debugger;\n" + // line1 + 7
|
||||
"foo();\n", // line1 + 8
|
||||
debuggee);
|
||||
/* eslint-enable */
|
||||
if (!done) {
|
||||
Assert.ok(false);
|
||||
}
|
||||
|
@ -10,11 +10,11 @@
|
||||
*/
|
||||
|
||||
add_task(
|
||||
threadClientTest(({ threadClient, client, debuggee }) => {
|
||||
threadFrontTest(({ threadFront, client, debuggee }) => {
|
||||
return new Promise(resolve => {
|
||||
threadClient.once("paused", async function(packet) {
|
||||
threadFront.once("paused", async function(packet) {
|
||||
const source = await getSourceById(
|
||||
threadClient,
|
||||
threadFront,
|
||||
packet.frame.where.actor
|
||||
);
|
||||
const location = {
|
||||
@ -23,17 +23,17 @@ add_task(
|
||||
column: 5,
|
||||
};
|
||||
|
||||
threadClient.setBreakpoint(location, {});
|
||||
threadFront.setBreakpoint(location, {});
|
||||
await client.waitForRequestsToSettle();
|
||||
|
||||
threadClient.once("paused", async function(packet) {
|
||||
threadFront.once("paused", async function(packet) {
|
||||
// Check the return value.
|
||||
Assert.equal(packet.why.type, "breakpoint");
|
||||
// Check that the breakpoint worked.
|
||||
Assert.equal(debuggee.i, 0);
|
||||
|
||||
// Remove the breakpoint.
|
||||
threadClient.removeBreakpoint(location);
|
||||
threadFront.removeBreakpoint(location);
|
||||
await client.waitForRequestsToSettle();
|
||||
|
||||
const location2 = {
|
||||
@ -41,39 +41,39 @@ add_task(
|
||||
line: debuggee.line0 + 3,
|
||||
column: 12,
|
||||
};
|
||||
threadClient.setBreakpoint(location2, {});
|
||||
threadFront.setBreakpoint(location2, {});
|
||||
await client.waitForRequestsToSettle();
|
||||
|
||||
threadClient.once("paused", async function(packet) {
|
||||
threadFront.once("paused", async function(packet) {
|
||||
// Check the return value.
|
||||
Assert.equal(packet.why.type, "breakpoint");
|
||||
// Check that the breakpoint worked.
|
||||
Assert.equal(debuggee.i, 1);
|
||||
|
||||
// Remove the breakpoint.
|
||||
threadClient.removeBreakpoint(location2);
|
||||
threadFront.removeBreakpoint(location2);
|
||||
await client.waitForRequestsToSettle();
|
||||
|
||||
threadClient.resume().then(resolve);
|
||||
threadFront.resume().then(resolve);
|
||||
});
|
||||
|
||||
// Continue until the breakpoint is hit again.
|
||||
await threadClient.resume();
|
||||
await threadFront.resume();
|
||||
});
|
||||
|
||||
// Continue until the breakpoint is hit.
|
||||
await threadClient.resume();
|
||||
await threadFront.resume();
|
||||
});
|
||||
|
||||
/* eslint-disable */
|
||||
Cu.evalInSandbox("var line0 = Error().lineNumber;\n" +
|
||||
"debugger;\n" + // line0 + 1
|
||||
"var a, i = 0;\n" + // line0 + 2
|
||||
"for (i = 1; i <= 2; i++) {\n" + // line0 + 3
|
||||
" a = i;\n" + // line0 + 4
|
||||
"}\n", // line0 + 5
|
||||
debuggee);
|
||||
/* eslint-enable */
|
||||
Cu.evalInSandbox("var line0 = Error().lineNumber;\n" +
|
||||
"debugger;\n" + // line0 + 1
|
||||
"var a, i = 0;\n" + // line0 + 2
|
||||
"for (i = 1; i <= 2; i++) {\n" + // line0 + 3
|
||||
" a = i;\n" + // line0 + 4
|
||||
"}\n", // line0 + 5
|
||||
debuggee);
|
||||
/* eslint-enable */
|
||||
});
|
||||
})
|
||||
);
|
||||
|
@ -10,11 +10,11 @@
|
||||
*/
|
||||
|
||||
add_task(
|
||||
threadClientTest(({ threadClient, debuggee }) => {
|
||||
threadFrontTest(({ threadFront, debuggee }) => {
|
||||
return new Promise(resolve => {
|
||||
threadClient.once("paused", async function(packet) {
|
||||
threadFront.once("paused", async function(packet) {
|
||||
const source = await getSourceById(
|
||||
threadClient,
|
||||
threadFront,
|
||||
packet.frame.where.actor
|
||||
);
|
||||
const location = {
|
||||
@ -23,16 +23,16 @@ add_task(
|
||||
column: 8,
|
||||
};
|
||||
|
||||
threadClient.setBreakpoint(location, {});
|
||||
threadFront.setBreakpoint(location, {});
|
||||
|
||||
threadClient.once("paused", function(packet) {
|
||||
threadFront.once("paused", function(packet) {
|
||||
// Check the return value.
|
||||
Assert.equal(packet.why.type, "breakpoint");
|
||||
// Check that the breakpoint worked.
|
||||
Assert.equal(debuggee.a, undefined);
|
||||
|
||||
// Remove the breakpoint.
|
||||
threadClient.removeBreakpoint(location);
|
||||
threadFront.removeBreakpoint(location);
|
||||
|
||||
const location2 = {
|
||||
sourceUrl: source.url,
|
||||
@ -40,9 +40,9 @@ add_task(
|
||||
column: 32,
|
||||
};
|
||||
|
||||
threadClient.setBreakpoint(location2, {});
|
||||
threadFront.setBreakpoint(location2, {});
|
||||
|
||||
threadClient.once("paused", function(packet) {
|
||||
threadFront.once("paused", function(packet) {
|
||||
// Check the return value.
|
||||
Assert.equal(packet.why.type, "breakpoint");
|
||||
// Check that the breakpoint worked.
|
||||
@ -50,26 +50,26 @@ add_task(
|
||||
Assert.equal(debuggee.res, undefined);
|
||||
|
||||
// Remove the breakpoint.
|
||||
threadClient.removeBreakpoint(location2);
|
||||
threadFront.removeBreakpoint(location2);
|
||||
|
||||
threadClient.resume().then(resolve);
|
||||
threadFront.resume().then(resolve);
|
||||
});
|
||||
|
||||
// Continue until the breakpoint is hit again.
|
||||
threadClient.resume();
|
||||
threadFront.resume();
|
||||
});
|
||||
|
||||
// Continue until the breakpoint is hit.
|
||||
threadClient.resume();
|
||||
threadFront.resume();
|
||||
});
|
||||
|
||||
/* eslint-disable */
|
||||
Cu.evalInSandbox("var line0 = Error().lineNumber;\n" +
|
||||
"debugger;\n" + // line0 + 1
|
||||
"var a = { b: 1, f: function() { return 2; } };\n" + // line0+2
|
||||
"var res = a.f();\n", // line0 + 3
|
||||
debuggee);
|
||||
/* eslint-enable */
|
||||
Cu.evalInSandbox("var line0 = Error().lineNumber;\n" +
|
||||
"debugger;\n" + // line0 + 1
|
||||
"var a = { b: 1, f: function() { return 2; } };\n" + // line0+2
|
||||
"var res = a.f();\n", // line0 + 3
|
||||
debuggee);
|
||||
/* eslint-enable */
|
||||
});
|
||||
})
|
||||
);
|
||||
|
@ -14,11 +14,11 @@ var gBpActor;
|
||||
var gCount;
|
||||
|
||||
add_task(
|
||||
threadClientTest(({ threadClient, debuggee }) => {
|
||||
threadFrontTest(({ threadFront, debuggee }) => {
|
||||
return new Promise(resolve => {
|
||||
threadClient.once("paused", async function(packet) {
|
||||
threadFront.once("paused", async function(packet) {
|
||||
const source = await getSourceById(
|
||||
threadClient,
|
||||
threadFront,
|
||||
packet.frame.where.actor
|
||||
);
|
||||
const location = { line: debuggee.line0 + 3 };
|
||||
@ -65,9 +65,8 @@ add_task(
|
||||
|
||||
// After setting all the breakpoints, check that only one has effectively
|
||||
// remained.
|
||||
threadClient.once("paused", function(packet) {
|
||||
threadFront.once("paused", function(packet) {
|
||||
// Check the return value.
|
||||
Assert.equal(packet.type, "paused");
|
||||
Assert.equal(packet.frame.where.actor, source.actor);
|
||||
Assert.equal(packet.frame.where.line, location.line + 1);
|
||||
Assert.equal(packet.why.type, "breakpoint");
|
||||
@ -76,17 +75,17 @@ add_task(
|
||||
Assert.equal(debuggee.a, 1);
|
||||
Assert.equal(debuggee.b, undefined);
|
||||
|
||||
threadClient.once("paused", function(packet) {
|
||||
threadFront.once("paused", function(packet) {
|
||||
// We don't expect any more pauses after the breakpoint was hit once.
|
||||
Assert.ok(false);
|
||||
});
|
||||
threadClient.resume().then(function() {
|
||||
threadFront.resume().then(function() {
|
||||
// Give any remaining breakpoints a chance to trigger.
|
||||
do_timeout(1000, resolve);
|
||||
});
|
||||
});
|
||||
// Continue until the breakpoint is hit.
|
||||
threadClient.resume();
|
||||
threadFront.resume();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -10,16 +10,16 @@
|
||||
*/
|
||||
|
||||
add_task(
|
||||
threadClientTest(({ threadClient, debuggee }) => {
|
||||
threadFrontTest(({ threadFront, debuggee }) => {
|
||||
return new Promise(resolve => {
|
||||
threadClient.once("paused", async function(packet) {
|
||||
threadFront.once("paused", async function(packet) {
|
||||
const source = await getSourceById(
|
||||
threadClient,
|
||||
threadFront,
|
||||
packet.frame.where.actor
|
||||
);
|
||||
const location = { sourceUrl: source.url, line: debuggee.line0 + 2 };
|
||||
|
||||
threadClient.setBreakpoint(location, {});
|
||||
threadFront.setBreakpoint(location, {});
|
||||
|
||||
const testCallbacks = [
|
||||
function(packet) {
|
||||
@ -59,32 +59,32 @@ add_task(
|
||||
];
|
||||
|
||||
for (const callback of testCallbacks) {
|
||||
const waiter = waitForPause(threadClient);
|
||||
threadClient.stepIn();
|
||||
const waiter = waitForPause(threadFront);
|
||||
threadFront.stepIn();
|
||||
const packet = await waiter;
|
||||
callback(packet);
|
||||
}
|
||||
|
||||
// Remove the breakpoint and finish.
|
||||
const waiter = waitForPause(threadClient);
|
||||
threadClient.stepIn();
|
||||
const waiter = waitForPause(threadFront);
|
||||
threadFront.stepIn();
|
||||
await waiter;
|
||||
threadClient.removeBreakpoint(location);
|
||||
threadFront.removeBreakpoint(location);
|
||||
|
||||
threadClient.resume().then(resolve);
|
||||
threadFront.resume().then(resolve);
|
||||
});
|
||||
|
||||
/* eslint-disable */
|
||||
Cu.evalInSandbox("var line0 = Error().lineNumber;\n" +
|
||||
"function foo() {\n" + // line0 + 1
|
||||
" this.a = 1;\n" + // line0 + 2 <-- Breakpoint is set here.
|
||||
"}\n" + // line0 + 3
|
||||
"debugger;\n" + // line0 + 4
|
||||
"foo();\n" + // line0 + 5
|
||||
"debugger;\n" + // line0 + 6
|
||||
"var b = 2;\n", // line0 + 7
|
||||
debuggee);
|
||||
/* eslint-enable */
|
||||
Cu.evalInSandbox("var line0 = Error().lineNumber;\n" +
|
||||
"function foo() {\n" + // line0 + 1
|
||||
" this.a = 1;\n" + // line0 + 2 <-- Breakpoint is set here.
|
||||
"}\n" + // line0 + 3
|
||||
"debugger;\n" + // line0 + 4
|
||||
"foo();\n" + // line0 + 5
|
||||
"debugger;\n" + // line0 + 6
|
||||
"var b = 2;\n", // line0 + 7
|
||||
debuggee);
|
||||
/* eslint-enable */
|
||||
});
|
||||
})
|
||||
);
|
||||
|
@ -10,16 +10,16 @@
|
||||
*/
|
||||
|
||||
add_task(
|
||||
threadClientTest(({ threadClient, debuggee }) => {
|
||||
threadFrontTest(({ threadFront, debuggee }) => {
|
||||
return new Promise(resolve => {
|
||||
threadClient.once("paused", async function(packet) {
|
||||
threadFront.once("paused", async function(packet) {
|
||||
const source = await getSourceById(
|
||||
threadClient,
|
||||
threadFront,
|
||||
packet.frame.where.actor
|
||||
);
|
||||
const location = { sourceUrl: source.url, line: debuggee.line0 + 2 };
|
||||
|
||||
threadClient.setBreakpoint(location, {});
|
||||
threadFront.setBreakpoint(location, {});
|
||||
const testCallbacks = [
|
||||
function(packet) {
|
||||
// Check that the stepping worked.
|
||||
@ -57,31 +57,31 @@ add_task(
|
||||
];
|
||||
|
||||
for (const callback of testCallbacks) {
|
||||
const waiter = waitForPause(threadClient);
|
||||
threadClient.stepOver();
|
||||
const waiter = waitForPause(threadFront);
|
||||
threadFront.stepOver();
|
||||
const packet = await waiter;
|
||||
callback(packet);
|
||||
}
|
||||
|
||||
// Remove the breakpoint and finish.
|
||||
const waiter = waitForPause(threadClient);
|
||||
threadClient.stepOver();
|
||||
const waiter = waitForPause(threadFront);
|
||||
threadFront.stepOver();
|
||||
await waiter;
|
||||
threadClient.removeBreakpoint(location);
|
||||
threadClient.resume().then(resolve);
|
||||
threadFront.removeBreakpoint(location);
|
||||
threadFront.resume().then(resolve);
|
||||
});
|
||||
|
||||
/* eslint-disable */
|
||||
Cu.evalInSandbox("var line0 = Error().lineNumber;\n" +
|
||||
"function foo() {\n" + // line0 + 1
|
||||
" this.a = 1;\n" + // line0 + 2 <-- Breakpoint is set here.
|
||||
"}\n" + // line0 + 3
|
||||
"debugger;\n" + // line0 + 4
|
||||
"foo();\n" + // line0 + 5
|
||||
"debugger;\n" + // line0 + 6
|
||||
"var b = 2;\n", // line0 + 7
|
||||
debuggee);
|
||||
/* eslint-enable */
|
||||
Cu.evalInSandbox("var line0 = Error().lineNumber;\n" +
|
||||
"function foo() {\n" + // line0 + 1
|
||||
" this.a = 1;\n" + // line0 + 2 <-- Breakpoint is set here.
|
||||
"}\n" + // line0 + 3
|
||||
"debugger;\n" + // line0 + 4
|
||||
"foo();\n" + // line0 + 5
|
||||
"debugger;\n" + // line0 + 6
|
||||
"var b = 2;\n", // line0 + 7
|
||||
debuggee);
|
||||
/* eslint-enable */
|
||||
});
|
||||
})
|
||||
);
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
var gDebuggee;
|
||||
var gClient;
|
||||
var gThreadClient;
|
||||
var gThreadFront;
|
||||
|
||||
function run_test() {
|
||||
initTestDebuggerServer();
|
||||
@ -19,9 +19,9 @@ function run_test() {
|
||||
attachTestTabAndResume(gClient, "test-stack", function(
|
||||
response,
|
||||
targetFront,
|
||||
threadClient
|
||||
threadFront
|
||||
) {
|
||||
gThreadClient = threadClient;
|
||||
gThreadFront = threadFront;
|
||||
testSameBreakpoint();
|
||||
});
|
||||
});
|
||||
@ -31,11 +31,8 @@ function run_test() {
|
||||
const SOURCE_URL = "http://example.com/source.js";
|
||||
|
||||
const testSameBreakpoint = async function() {
|
||||
const packet = await executeOnNextTickAndWaitForPause(
|
||||
evalCode,
|
||||
gThreadClient
|
||||
);
|
||||
const source = await getSourceById(gThreadClient, packet.frame.where.actor);
|
||||
const packet = await executeOnNextTickAndWaitForPause(evalCode, gThreadFront);
|
||||
const source = await getSourceById(gThreadFront, packet.frame.where.actor);
|
||||
|
||||
// Whole line
|
||||
const wholeLineLocation = {
|
||||
|
@ -9,12 +9,12 @@
|
||||
*/
|
||||
|
||||
add_task(
|
||||
threadClientTest(({ threadClient, debuggee, client }) => {
|
||||
threadFrontTest(({ threadFront, debuggee, client }) => {
|
||||
return new Promise(resolve => {
|
||||
// Debugger statement
|
||||
threadClient.once("paused", async function(packet) {
|
||||
threadFront.once("paused", async function(packet) {
|
||||
const source = await getSourceById(
|
||||
threadClient,
|
||||
threadFront,
|
||||
packet.frame.where.actor
|
||||
);
|
||||
const location = {
|
||||
@ -24,9 +24,9 @@ add_task(
|
||||
};
|
||||
let timesBreakpointHit = 0;
|
||||
|
||||
threadClient.setBreakpoint(location, {});
|
||||
threadFront.setBreakpoint(location, {});
|
||||
|
||||
threadClient.on("paused", function onPaused(packet) {
|
||||
threadFront.on("paused", function onPaused(packet) {
|
||||
Assert.equal(packet.why.type, "breakpoint");
|
||||
Assert.equal(packet.frame.where.actor, source.actor);
|
||||
Assert.equal(packet.frame.where.line, location.line);
|
||||
@ -39,25 +39,25 @@ add_task(
|
||||
);
|
||||
|
||||
if (++timesBreakpointHit === 3) {
|
||||
threadClient.off("paused", onPaused);
|
||||
threadClient.removeBreakpoint(location);
|
||||
threadClient.resume().then(resolve);
|
||||
threadFront.off("paused", onPaused);
|
||||
threadFront.removeBreakpoint(location);
|
||||
threadFront.resume().then(resolve);
|
||||
} else {
|
||||
threadClient.resume();
|
||||
threadFront.resume();
|
||||
}
|
||||
});
|
||||
|
||||
// Continue until the breakpoint is hit.
|
||||
threadClient.resume();
|
||||
threadFront.resume();
|
||||
});
|
||||
|
||||
/* eslint-disable */
|
||||
Cu.evalInSandbox(
|
||||
"var line0 = Error().lineNumber;\n" +
|
||||
"(function () { debugger; this.acc = 0; for (var i = 0; i < 3; i++) this.acc++; }());",
|
||||
debuggee
|
||||
);
|
||||
/* eslint-enable */
|
||||
Cu.evalInSandbox(
|
||||
"var line0 = Error().lineNumber;\n" +
|
||||
"(function () { debugger; this.acc = 0; for (var i = 0; i < 3; i++) this.acc++; }());",
|
||||
debuggee
|
||||
);
|
||||
/* eslint-enable */
|
||||
});
|
||||
})
|
||||
);
|
||||
|
@ -32,12 +32,12 @@ const secondLocation = {
|
||||
};
|
||||
|
||||
add_task(
|
||||
threadClientTest(({ threadClient, debuggee }) => {
|
||||
threadFrontTest(({ threadFront, debuggee }) => {
|
||||
return new Promise(resolve => {
|
||||
threadClient.on("paused", async packet => {
|
||||
const [first, second] = await set_breakpoints(packet, threadClient);
|
||||
threadFront.on("paused", async packet => {
|
||||
const [first, second] = await set_breakpoints(packet, threadFront);
|
||||
test_different_actors(first, second);
|
||||
await test_remove_one(first, second, threadClient, debuggee);
|
||||
await test_remove_one(first, second, threadFront, debuggee);
|
||||
resolve();
|
||||
});
|
||||
|
||||
@ -46,10 +46,10 @@ add_task(
|
||||
})
|
||||
);
|
||||
|
||||
function set_breakpoints(packet, threadClient) {
|
||||
function set_breakpoints(packet, threadFront) {
|
||||
return new Promise(async resolve => {
|
||||
let first, second;
|
||||
const source = await getSourceById(threadClient, packet.frame.where.actor);
|
||||
const source = await getSourceById(threadFront, packet.frame.where.actor);
|
||||
|
||||
source
|
||||
.setBreakpoint(firstLocation)
|
||||
@ -77,13 +77,13 @@ function test_different_actors(first, second) {
|
||||
);
|
||||
}
|
||||
|
||||
function test_remove_one(first, second, threadClient, debuggee) {
|
||||
function test_remove_one(first, second, threadFront, debuggee) {
|
||||
return new Promise(resolve => {
|
||||
first.remove(function({ error }) {
|
||||
Assert.ok(!error, "Should not get an error removing a breakpoint");
|
||||
|
||||
let hitSecond;
|
||||
threadClient.on("paused", function _onPaused({ why, frame }) {
|
||||
threadFront.on("paused", function _onPaused({ why, frame }) {
|
||||
if (why.type == "breakpoint") {
|
||||
hitSecond = true;
|
||||
Assert.equal(
|
||||
@ -106,12 +106,12 @@ function test_remove_one(first, second, threadClient, debuggee) {
|
||||
secondLocation.column,
|
||||
"Should be at the right column"
|
||||
);
|
||||
threadClient.resume();
|
||||
threadFront.resume();
|
||||
return;
|
||||
}
|
||||
|
||||
if (why.type == "debuggerStatement") {
|
||||
threadClient.off("paused", _onPaused);
|
||||
threadFront.off("paused", _onPaused);
|
||||
Assert.ok(
|
||||
hitSecond,
|
||||
"We should still hit `second`, but not `first`."
|
||||
@ -124,7 +124,7 @@ function test_remove_one(first, second, threadClient, debuggee) {
|
||||
Assert.ok(false, "Should never get here");
|
||||
});
|
||||
|
||||
threadClient.resume().then(() => debuggee.foo());
|
||||
threadFront.resume().then(() => debuggee.foo());
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -9,23 +9,23 @@
|
||||
*/
|
||||
|
||||
add_task(
|
||||
threadClientTest(({ threadClient, debuggee, client }) => {
|
||||
threadFrontTest(({ threadFront, debuggee, client }) => {
|
||||
return new Promise(resolve => {
|
||||
// Expose console as the test script uses it
|
||||
debuggee.console = { log: x => void x };
|
||||
|
||||
// Inline all paused listeners as promises won't resolve when paused
|
||||
threadClient.once("paused", async packet1 => {
|
||||
await setBreakpoint(packet1, threadClient, client);
|
||||
threadFront.once("paused", async packet1 => {
|
||||
await setBreakpoint(packet1, threadFront, client);
|
||||
|
||||
threadClient.once("paused", ({ why }) => {
|
||||
threadFront.once("paused", ({ why }) => {
|
||||
Assert.equal(why.type, "breakpoint");
|
||||
|
||||
threadClient.once("paused", packet3 => {
|
||||
threadFront.once("paused", packet3 => {
|
||||
testDbgStatement(packet3);
|
||||
resolve();
|
||||
});
|
||||
threadClient.resume();
|
||||
threadFront.resume();
|
||||
});
|
||||
debuggee.test();
|
||||
});
|
||||
@ -45,14 +45,14 @@ add_task(
|
||||
})
|
||||
);
|
||||
|
||||
function setBreakpoint(packet, threadClient, client) {
|
||||
function setBreakpoint(packet, threadFront, client) {
|
||||
return new Promise(async resolve => {
|
||||
const source = await getSourceById(threadClient, packet.frame.where.actor);
|
||||
threadClient.once("resumed", resolve);
|
||||
const source = await getSourceById(threadFront, packet.frame.where.actor);
|
||||
threadFront.once("resumed", resolve);
|
||||
|
||||
threadClient.setBreakpoint({ sourceUrl: source.url, line: 3 }, {});
|
||||
threadFront.setBreakpoint({ sourceUrl: source.url, line: 3 }, {});
|
||||
await client.waitForRequestsToSettle();
|
||||
await threadClient.resume();
|
||||
await threadFront.resume();
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -26,18 +26,18 @@ function setUpCode(debuggee) {
|
||||
}
|
||||
|
||||
add_task(
|
||||
threadClientTest(async ({ threadClient, debuggee }) => {
|
||||
setBreakpoint(threadClient, { sourceUrl: URL, line: 2 });
|
||||
threadFrontTest(async ({ threadFront, debuggee }) => {
|
||||
setBreakpoint(threadFront, { sourceUrl: URL, line: 2 });
|
||||
|
||||
await executeOnNextTickAndWaitForPause(
|
||||
() => setUpCode(debuggee),
|
||||
threadClient
|
||||
threadFront
|
||||
);
|
||||
await resume(threadClient);
|
||||
await resume(threadFront);
|
||||
|
||||
const packet = await executeOnNextTickAndWaitForPause(
|
||||
debuggee.test,
|
||||
threadClient
|
||||
threadFront
|
||||
);
|
||||
equal(packet.why.type, "breakpoint");
|
||||
})
|
||||
|
@ -24,7 +24,7 @@ function run_test() {
|
||||
const testBreakpoint = async function(
|
||||
threadResponse,
|
||||
targetFront,
|
||||
threadClient,
|
||||
threadFront,
|
||||
tabResponse
|
||||
) {
|
||||
evalSetupCode();
|
||||
@ -40,10 +40,10 @@ const testBreakpoint = async function(
|
||||
|
||||
// Set a breakpoint in the test source.
|
||||
|
||||
const source = await getSource(threadClient, "test.js");
|
||||
setBreakpoint(threadClient, { sourceUrl: source.url, line: 3 });
|
||||
const source = await getSource(threadFront, "test.js");
|
||||
setBreakpoint(threadFront, { sourceUrl: source.url, line: 3 });
|
||||
|
||||
await resume(threadClient);
|
||||
await resume(threadFront);
|
||||
|
||||
// Load the test source again.
|
||||
|
||||
@ -59,7 +59,7 @@ const testBreakpoint = async function(
|
||||
|
||||
const bpPause1 = await executeOnNextTickAndWaitForPause(
|
||||
gDebuggee.functions[0],
|
||||
threadClient
|
||||
threadFront
|
||||
);
|
||||
equal(
|
||||
bpPause1.why.type,
|
||||
@ -67,22 +67,22 @@ const testBreakpoint = async function(
|
||||
"Should pause because of hitting our breakpoint (not debugger statement)."
|
||||
);
|
||||
const dbgStmtPause1 = await executeOnNextTickAndWaitForPause(
|
||||
() => resume(threadClient),
|
||||
threadClient
|
||||
() => resume(threadFront),
|
||||
threadFront
|
||||
);
|
||||
equal(
|
||||
dbgStmtPause1.why.type,
|
||||
"debuggerStatement",
|
||||
"And we should hit the debugger statement after the pause."
|
||||
);
|
||||
await resume(threadClient);
|
||||
await resume(threadFront);
|
||||
|
||||
// Should also hit our breakpoint in a script defined by the second instance
|
||||
// of the test source.
|
||||
|
||||
const bpPause2 = await executeOnNextTickAndWaitForPause(
|
||||
gDebuggee.functions[1],
|
||||
threadClient
|
||||
threadFront
|
||||
);
|
||||
equal(
|
||||
bpPause2.why.type,
|
||||
@ -90,8 +90,8 @@ const testBreakpoint = async function(
|
||||
"Should pause because of hitting our breakpoint (not debugger statement)."
|
||||
);
|
||||
const dbgStmtPause2 = await executeOnNextTickAndWaitForPause(
|
||||
() => resume(threadClient),
|
||||
threadClient
|
||||
() => resume(threadFront),
|
||||
threadFront
|
||||
);
|
||||
equal(
|
||||
dbgStmtPause2.why.type,
|
||||
|
@ -10,29 +10,29 @@
|
||||
*/
|
||||
|
||||
add_task(
|
||||
threadClientTest(async ({ threadClient, debuggee }) => {
|
||||
threadFrontTest(async ({ threadFront, debuggee }) => {
|
||||
// Populate the `ScriptStore` so that we only test that the script
|
||||
// is added through `onNewScript`
|
||||
await getSources(threadClient);
|
||||
await getSources(threadFront);
|
||||
|
||||
let packet = await executeOnNextTickAndWaitForPause(() => {
|
||||
evalCode(debuggee);
|
||||
}, threadClient);
|
||||
const source = await getSourceById(threadClient, packet.frame.where.actor);
|
||||
}, threadFront);
|
||||
const source = await getSourceById(threadFront, packet.frame.where.actor);
|
||||
const location = {
|
||||
sourceUrl: source.url,
|
||||
line: debuggee.line0 + 8,
|
||||
};
|
||||
|
||||
setBreakpoint(threadClient, location);
|
||||
setBreakpoint(threadFront, location);
|
||||
|
||||
await resume(threadClient);
|
||||
packet = await waitForPause(threadClient);
|
||||
await resume(threadFront);
|
||||
packet = await waitForPause(threadFront);
|
||||
Assert.equal(packet.why.type, "breakpoint");
|
||||
Assert.equal(packet.frame.where.actor, source.actor);
|
||||
Assert.equal(packet.frame.where.line, location.line);
|
||||
|
||||
await resume(threadClient);
|
||||
await resume(threadFront);
|
||||
})
|
||||
);
|
||||
|
||||
|
@ -9,15 +9,15 @@
|
||||
*/
|
||||
|
||||
add_task(
|
||||
threadClientTest(async ({ threadClient, debuggee }) => {
|
||||
threadFrontTest(async ({ threadFront, debuggee }) => {
|
||||
// Populate the `ScriptStore` so that we only test that the script
|
||||
// is added through `onNewScript`
|
||||
await getSources(threadClient);
|
||||
await getSources(threadFront);
|
||||
|
||||
const packet = await executeOnNextTickAndWaitForPause(() => {
|
||||
evalCode(debuggee);
|
||||
}, threadClient);
|
||||
const source = await getSourceById(threadClient, packet.frame.where.actor);
|
||||
}, threadFront);
|
||||
const source = await getSourceById(threadFront, packet.frame.where.actor);
|
||||
|
||||
const location = {
|
||||
line: debuggee.line0 + 2,
|
||||
@ -40,7 +40,7 @@ add_task(
|
||||
}
|
||||
);
|
||||
|
||||
await resume(threadClient);
|
||||
await resume(threadFront);
|
||||
})
|
||||
);
|
||||
|
||||
|
@ -9,8 +9,8 @@
|
||||
* scripts that contain a source url pragma.
|
||||
*/
|
||||
add_task(
|
||||
threadClientTest(async ({ threadClient, targetFront }) => {
|
||||
await threadClient.setBreakpoint(
|
||||
threadFrontTest(async ({ threadFront, targetFront }) => {
|
||||
await threadFront.setBreakpoint(
|
||||
{ sourceUrl: "http://example.com/code.js", line: 2, column: 1 },
|
||||
{}
|
||||
);
|
||||
@ -23,16 +23,16 @@ add_task(
|
||||
);
|
||||
await onEvaluationResult;
|
||||
|
||||
const sourcePacket = await waitForEvent(threadClient, "newSource");
|
||||
const sourcePacket = await waitForEvent(threadFront, "newSource");
|
||||
equal(sourcePacket.source.url, "http://example.com/code.js");
|
||||
|
||||
info("Evaluate f() and pause at line 2");
|
||||
onEvaluationResult = consoleFront.once("evaluationResult");
|
||||
consoleFront.evaluateJSAsync("f()");
|
||||
const pausedPacket = await waitForPause(threadClient);
|
||||
const pausedPacket = await waitForPause(threadFront);
|
||||
equal(pausedPacket.why.type, "breakpoint");
|
||||
equal(pausedPacket.frame.where.line, 2);
|
||||
resume(threadClient);
|
||||
resume(threadFront);
|
||||
await onEvaluationResult;
|
||||
})
|
||||
);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user