SHARE
TWEET

Untitled

a guest Feb 22nd, 2019 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. diff --git a/devtools/client/debugger/new/src/client/firefox/commands.js b/devtools/client/debugger/new/src/client/firefox/commands.js
  2. index adfb5a5593a2..412b2ae5dbe1 100644
  3. --- a/devtools/client/debugger/new/src/client/firefox/commands.js
  4. +++ b/devtools/client/debugger/new/src/client/firefox/commands.js
  5. @@ -166,20 +166,35 @@ function locationKey(location) {
  6.    return `${(sourceUrl: any)}:${(sourceId: any)}:${line}:${(column: any)}`;
  7.  }
  8.  
  9. -function* getAllThreadClients() {
  10. -  yield threadClient;
  11. -  for (const { thread } of (Object.values(workerClients): any)) {
  12. -    yield thread;
  13. -  }
  14. +function getAllThreadClients() {
  15. +  return [threadClient, ...Object.values(workerClients).map(({thread}) => thread)]
  16. +}
  17. +
  18. +function getThreadActors() {
  19. +  return [threadClient.actor, ...Object.values(workerClients).map(worker => worker.thread.actor)]
  20.  }
  21.  
  22. +
  23. +
  24.  async function setBreakpoint(
  25.    location: BreakpointLocation,
  26.    options: BreakpointOptions
  27.  ) {
  28. -  breakpoints[locationKey(location)] = { location, options };
  29. -  for (const thread of getAllThreadClients()) {
  30. -    await thread.setBreakpoint(location, options);
  31. +  try {
  32. +    breakpoints[locationKey(location)] = { location, options };
  33. +    console.log(`> setBreakpoint `, getThreadActors())
  34. +    // for (const thread of getAllThreadClients()) {
  35. +    //   console.log(`> client setBreakpoint start`, thread.actor, location.line)
  36. +    //   await thread.setBreakpoint(location, options);
  37. +    //   console.log(`> client setBreakpoint done`, thread.actor, location.line)
  38. +    // }
  39. +
  40. +    return Promise.all(
  41. +      getAllThreadClients()
  42. +      .map(thread => thread.setBreakpoint(location, options))
  43. +    )
  44. +  } catch (e) {
  45. +    console.log("> client setBreakpoint exception: ", e);
  46.    }
  47.  }
  48.  
  49. @@ -365,9 +380,9 @@ async function fetchWorkers(): Promise<Worker[]> {
  50.        if (!workerClients[actor]) {
  51.          const client = newWorkerClients[actor].thread;
  52.          createSources(client);
  53. -        for (const { location, options } of (Object.values(breakpoints): any)) {
  54. -          client.setBreakpoint(location, options);
  55. -        }
  56. +        // for (const { location, options } of (Object.values(breakpoints): any)) {
  57. +        //   client.setBreakpoint(location, options);
  58. +        // }
  59.        }
  60.      }
  61.  
  62. diff --git a/devtools/client/debugger/new/src/client/index.js b/devtools/client/debugger/new/src/client/index.js
  63. index 743d28a3dde1..273cce4117ca 100644
  64. --- a/devtools/client/debugger/new/src/client/index.js
  65. +++ b/devtools/client/debugger/new/src/client/index.js
  66. @@ -31,11 +31,15 @@ function loadFromPrefs(actions: Object) {
  67.  
  68.  async function syncBreakpoints() {
  69.    const breakpoints = await asyncStore.pendingBreakpoints;
  70. +
  71.    const breakpointValues = (Object.values(breakpoints): any);
  72. -  breakpointValues.forEach(({ disabled, options, generatedLocation }) => {
  73. +  console.log(`client syncBreakpoints ${JSON.stringify(breakpointValues.map(b => b.generatedLocation.line))}`)
  74. +  breakpointValues.forEach(async ({ disabled, options, generatedLocation }) => {
  75. +    console.log(`client syncBreakpoints (start)`)
  76.      if (!disabled) {
  77. -      firefox.clientCommands.setBreakpoint(generatedLocation, options);
  78. +      await firefox.clientCommands.setBreakpoint(generatedLocation, options);
  79.      }
  80. +    console.log(`client syncBreakpoints (end)`)
  81.    });
  82.  }
  83.  
  84. diff --git a/devtools/server/actors/thread.js b/devtools/server/actors/thread.js
  85. index 7663a7903081..dc2a5637cc0d 100644
  86. --- a/devtools/server/actors/thread.js
  87. +++ b/devtools/server/actors/thread.js
  88. @@ -314,6 +314,7 @@ const ThreadActor = ActorClassWithSpec(threadSpec, {
  89.    },
  90.  
  91.    setBreakpoint(location, options) {
  92. +    console.log(`> setBreakpoint`, this.actorID, location.line)
  93.      const actor = this.breakpointActorMap.getOrCreateBreakpointActor(location);
  94.      actor.setOptions(options);
  95.  
  96. @@ -328,11 +329,14 @@ const ThreadActor = ActorClassWithSpec(threadSpec, {
  97.          sourceActor.applyBreakpoint(actor);
  98.        }
  99.      }
  100. +    console.log(`> setBreakpoint (done)`, this.actorID, location.line)
  101.    },
  102.  
  103.    removeBreakpoint(location) {
  104. +    console.log(`> removeBreakpoint`, this.actorID, location.line)
  105.      const actor = this.breakpointActorMap.getOrCreateBreakpointActor(location);
  106.      actor.delete();
  107. +    console.log(`> removeBreakpoint (done)`, this.actorID, location.line)
  108.    },
  109.  
  110.    removeXHRBreakpoint: function(path, method) {
  111. @@ -1798,6 +1802,7 @@ const ThreadActor = ActorClassWithSpec(threadSpec, {
  112.      }
  113.  
  114.      if (this._onLoadBreakpointURLs.has(source.url)) {
  115. +      console.log(`> _onLoadBreakpointURLs...`)
  116.        this.setBreakpoint({ sourceUrl: source.url, line: 1 }, {});
  117.      }
  118.  
  119. diff --git a/devtools/shared/client/debugger-client.js b/devtools/shared/client/debugger-client.js
  120. index 999b6da8f700..c08749624e67 100644
  121. --- a/devtools/shared/client/debugger-client.js
  122. +++ b/devtools/shared/client/debugger-client.js
  123. @@ -112,7 +112,9 @@ DebuggerClient.requester = function(packetSkeleton, config = {}) {
  124.        outgoingPacket = before.call(this, outgoingPacket);
  125.      }
  126.  
  127. +    console.log(`requester: ${outgoingPacket.type} ${outgoingPacket.to}\n`)
  128.      return this.request(outgoingPacket, DevToolsUtils.makeInfallible((response) => {
  129. +      console.log(`requester (done): ${outgoingPacket.type} ${outgoingPacket.to}\n`)
  130.        if (after) {
  131.          const { from } = response;
  132.          response = after.call(this, response);
  133. @@ -572,6 +574,7 @@ DebuggerClient.prototype = {
  134.      if (!this._activeRequests.has(actor)) {
  135.        this._sendRequest(request);
  136.      } else {
  137. +      console.log(`_queueRequest ${request.request.type} ${request.request.to}`)
  138.        this._queueRequest(request);
  139.      }
  140.    },
  141. @@ -801,6 +804,7 @@ DebuggerClient.prototype = {
  142.     *        the stream.
  143.     */
  144.    onClosed: function() {
  145. +    console.log(`> on closed!`)
  146.      if (this._closed) {
  147.        return;
  148.      }
  149. @@ -840,6 +844,7 @@ DebuggerClient.prototype = {
  150.     *        is cancelled on the server.
  151.     */
  152.    purgeRequests(prefix = "") {
  153. +    console.log(`> purgeRequests`)
  154.      const reject = function(type, request) {
  155.        // Server can send packets on its own and client only pass a callback
  156.        // to expectReply, so that there is no request object.
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top