Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/devtools/client/debugger/new/src/client/firefox/commands.js b/devtools/client/debugger/new/src/client/firefox/commands.js
- index adfb5a5593a2..412b2ae5dbe1 100644
- --- a/devtools/client/debugger/new/src/client/firefox/commands.js
- +++ b/devtools/client/debugger/new/src/client/firefox/commands.js
- @@ -166,20 +166,35 @@ function locationKey(location) {
- return `${(sourceUrl: any)}:${(sourceId: any)}:${line}:${(column: any)}`;
- }
- -function* getAllThreadClients() {
- - yield threadClient;
- - for (const { thread } of (Object.values(workerClients): any)) {
- - yield thread;
- - }
- +function getAllThreadClients() {
- + return [threadClient, ...Object.values(workerClients).map(({thread}) => thread)]
- +}
- +
- +function getThreadActors() {
- + return [threadClient.actor, ...Object.values(workerClients).map(worker => worker.thread.actor)]
- }
- +
- +
- async function setBreakpoint(
- location: BreakpointLocation,
- options: BreakpointOptions
- ) {
- - breakpoints[locationKey(location)] = { location, options };
- - for (const thread of getAllThreadClients()) {
- - await thread.setBreakpoint(location, options);
- + try {
- + breakpoints[locationKey(location)] = { location, options };
- + console.log(`> setBreakpoint `, getThreadActors())
- + // for (const thread of getAllThreadClients()) {
- + // console.log(`> client setBreakpoint start`, thread.actor, location.line)
- + // await thread.setBreakpoint(location, options);
- + // console.log(`> client setBreakpoint done`, thread.actor, location.line)
- + // }
- +
- + return Promise.all(
- + getAllThreadClients()
- + .map(thread => thread.setBreakpoint(location, options))
- + )
- + } catch (e) {
- + console.log("> client setBreakpoint exception: ", e);
- }
- }
- @@ -365,9 +380,9 @@ async function fetchWorkers(): Promise<Worker[]> {
- if (!workerClients[actor]) {
- const client = newWorkerClients[actor].thread;
- createSources(client);
- - for (const { location, options } of (Object.values(breakpoints): any)) {
- - client.setBreakpoint(location, options);
- - }
- + // for (const { location, options } of (Object.values(breakpoints): any)) {
- + // client.setBreakpoint(location, options);
- + // }
- }
- }
- diff --git a/devtools/client/debugger/new/src/client/index.js b/devtools/client/debugger/new/src/client/index.js
- index 743d28a3dde1..273cce4117ca 100644
- --- a/devtools/client/debugger/new/src/client/index.js
- +++ b/devtools/client/debugger/new/src/client/index.js
- @@ -31,11 +31,15 @@ function loadFromPrefs(actions: Object) {
- async function syncBreakpoints() {
- const breakpoints = await asyncStore.pendingBreakpoints;
- +
- const breakpointValues = (Object.values(breakpoints): any);
- - breakpointValues.forEach(({ disabled, options, generatedLocation }) => {
- + console.log(`client syncBreakpoints ${JSON.stringify(breakpointValues.map(b => b.generatedLocation.line))}`)
- + breakpointValues.forEach(async ({ disabled, options, generatedLocation }) => {
- + console.log(`client syncBreakpoints (start)`)
- if (!disabled) {
- - firefox.clientCommands.setBreakpoint(generatedLocation, options);
- + await firefox.clientCommands.setBreakpoint(generatedLocation, options);
- }
- + console.log(`client syncBreakpoints (end)`)
- });
- }
- diff --git a/devtools/server/actors/thread.js b/devtools/server/actors/thread.js
- index 7663a7903081..dc2a5637cc0d 100644
- --- a/devtools/server/actors/thread.js
- +++ b/devtools/server/actors/thread.js
- @@ -314,6 +314,7 @@ const ThreadActor = ActorClassWithSpec(threadSpec, {
- },
- setBreakpoint(location, options) {
- + console.log(`> setBreakpoint`, this.actorID, location.line)
- const actor = this.breakpointActorMap.getOrCreateBreakpointActor(location);
- actor.setOptions(options);
- @@ -328,11 +329,14 @@ const ThreadActor = ActorClassWithSpec(threadSpec, {
- sourceActor.applyBreakpoint(actor);
- }
- }
- + console.log(`> setBreakpoint (done)`, this.actorID, location.line)
- },
- removeBreakpoint(location) {
- + console.log(`> removeBreakpoint`, this.actorID, location.line)
- const actor = this.breakpointActorMap.getOrCreateBreakpointActor(location);
- actor.delete();
- + console.log(`> removeBreakpoint (done)`, this.actorID, location.line)
- },
- removeXHRBreakpoint: function(path, method) {
- @@ -1798,6 +1802,7 @@ const ThreadActor = ActorClassWithSpec(threadSpec, {
- }
- if (this._onLoadBreakpointURLs.has(source.url)) {
- + console.log(`> _onLoadBreakpointURLs...`)
- this.setBreakpoint({ sourceUrl: source.url, line: 1 }, {});
- }
- diff --git a/devtools/shared/client/debugger-client.js b/devtools/shared/client/debugger-client.js
- index 999b6da8f700..c08749624e67 100644
- --- a/devtools/shared/client/debugger-client.js
- +++ b/devtools/shared/client/debugger-client.js
- @@ -112,7 +112,9 @@ DebuggerClient.requester = function(packetSkeleton, config = {}) {
- outgoingPacket = before.call(this, outgoingPacket);
- }
- + console.log(`requester: ${outgoingPacket.type} ${outgoingPacket.to}\n`)
- return this.request(outgoingPacket, DevToolsUtils.makeInfallible((response) => {
- + console.log(`requester (done): ${outgoingPacket.type} ${outgoingPacket.to}\n`)
- if (after) {
- const { from } = response;
- response = after.call(this, response);
- @@ -572,6 +574,7 @@ DebuggerClient.prototype = {
- if (!this._activeRequests.has(actor)) {
- this._sendRequest(request);
- } else {
- + console.log(`_queueRequest ${request.request.type} ${request.request.to}`)
- this._queueRequest(request);
- }
- },
- @@ -801,6 +804,7 @@ DebuggerClient.prototype = {
- * the stream.
- */
- onClosed: function() {
- + console.log(`> on closed!`)
- if (this._closed) {
- return;
- }
- @@ -840,6 +844,7 @@ DebuggerClient.prototype = {
- * is cancelled on the server.
- */
- purgeRequests(prefix = "") {
- + console.log(`> purgeRequests`)
- const reject = function(type, request) {
- // Server can send packets on its own and client only pass a callback
- // to expectReply, so that there is no request object.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement