Bug 1534772 - Evaluate expressions when selecting new threads, r=jlast.
authorBrian Hackett <bhackett1024@gmail.com>
Tue, 12 Mar 2019 10:11:48 -1000
changeset 524831 40e72c7f3223724404fdece1357fcfda0b12fb56
parent 524830 703a4bccfbe81ae850a59c2c34c16e59754be1f7
child 524832 9b16f651358bba0661de7a864b2adb3d5e6c60cb
push id2032
push userffxbld-merge
push dateMon, 13 May 2019 09:36:57 +0000
treeherdermozilla-release@455c1065dcbe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjlast
bugs1534772
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1534772 - Evaluate expressions when selecting new threads, r=jlast.
devtools/client/debugger/new/src/actions/pause/commands.js
devtools/client/debugger/new/src/actions/types/index.js
devtools/client/debugger/new/src/reducers/expressions.js
devtools/client/debugger/new/src/reducers/pause.js
--- a/devtools/client/debugger/new/src/actions/pause/commands.js
+++ b/devtools/client/debugger/new/src/actions/pause/commands.js
@@ -9,25 +9,29 @@ import {
   getIsPaused,
   getCurrentThread,
   getSource,
   getTopFrame
 } from "../../selectors";
 import { PROMISE } from "../utils/middleware/promise";
 import { getNextStep } from "../../workers/parser";
 import { addHiddenBreakpoint } from "../breakpoints";
+import { evaluateExpressions } from "../expressions";
 import { features } from "../../utils/prefs";
 import { recordEvent } from "../../utils/telemetry";
 
 import type { Source, ThreadId } from "../../types";
 import type { ThunkArgs } from "../types";
 import type { Command } from "../../reducers/types";
 
 export function selectThread(thread: ThreadId) {
-  return { type: "SELECT_THREAD", thread };
+  return async ({ dispatch, getState, client }: ThunkArgs) => {
+    await dispatch({ type: "SELECT_THREAD", thread });
+    dispatch(evaluateExpressions());
+  };
 }
 
 /**
  * Debugger commands like stepOver, stepIn, stepUp
  *
  * @param string $0.type
  * @memberof actions/pause
  * @static
--- a/devtools/client/debugger/new/src/actions/types/index.js
+++ b/devtools/client/debugger/new/src/actions/types/index.js
@@ -1,15 +1,15 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
 
 // @flow
 
-import type { Frame, Scope, Why, WorkerList, MainThread } from "../../types";
+import type { WorkerList, MainThread } from "../../types";
 import type { State } from "../../reducers/types";
 import type { MatchedLocations } from "../../reducers/file-search";
 import type { TreeNode } from "../../utils/sources-tree/types";
 import type { SearchOperation } from "../../reducers/project-text-search";
 
 import type { BreakpointAction } from "./BreakpointAction";
 import type { SourceAction } from "./SourceAction";
 import type { UIAction } from "./UIAction";
@@ -59,35 +59,16 @@ type AddTabAction = {|
 type UpdateTabAction = {|
   +type: "UPDATE_TAB",
   +url: string,
   +framework?: string,
   +isOriginal?: boolean,
   +sourceId?: string
 |};
 
-type ReplayAction =
-  | {|
-      +type: "TRAVEL_TO",
-      +data: {
-        paused: {
-          why: Why,
-          scopes: Scope[],
-          frames: Frame[],
-          selectedFrameId: string,
-          loadedObjects: Object
-        },
-        expressions?: Object[]
-      },
-      +position: number
-    |}
-  | {|
-      +type: "CLEAR_HISTORY"
-    |};
-
 type NavigateAction =
   | {| +type: "CONNECT", +mainThread: MainThread, +canRewind: boolean |}
   | {| +type: "NAVIGATE", +mainThread: MainThread |};
 
 export type FocusItem = {
   thread: string,
   item: TreeNode
 };
@@ -171,10 +152,9 @@ export type Action =
   | PauseAction
   | NavigateAction
   | UIAction
   | ASTAction
   | QuickOpenAction
   | FileTextSearchAction
   | ProjectTextSearchAction
   | DebugeeAction
-  | ReplayAction
   | SourceTreeAction;
--- a/devtools/client/debugger/new/src/reducers/expressions.js
+++ b/devtools/client/debugger/new/src/reducers/expressions.js
@@ -79,52 +79,32 @@ function update(
       );
 
     case "DELETE_EXPRESSION":
       return deleteExpression(state, action.input);
 
     case "CLEAR_EXPRESSION_ERROR":
       return state.set("expressionError", false);
 
-    // respond to time travel
-    case "TRAVEL_TO":
-      return travelTo(state, action);
-
     case "AUTOCOMPLETE":
       const { matchProp, matches } = action.result;
 
       return state
         .updateIn(["autocompleteMatches", matchProp], list => matches)
         .set("currentAutocompleteInput", matchProp);
 
     case "CLEAR_AUTOCOMPLETE":
       return state
         .updateIn(["autocompleteMatches", ""], list => [])
         .set("currentAutocompleteInput", "");
   }
 
   return state;
 }
 
-function travelTo(state, action) {
-  const { expressions } = action.data;
-  if (!expressions) {
-    return state;
-  }
-  return expressions.reduce(
-    (finalState, previousState) =>
-      updateExpressionInList(finalState, previousState.input, {
-        input: previousState.input,
-        value: previousState.value,
-        updating: false
-      }),
-    state
-  );
-}
-
 function restoreExpressions() {
   const exprs = prefs.expressions;
   if (exprs.length == 0) {
     return;
   }
   return exprs;
 }
 
--- a/devtools/client/debugger/new/src/reducers/pause.js
+++ b/devtools/client/debugger/new/src/reducers/pause.js
@@ -188,19 +188,16 @@ function update(
       return updateThreadState({
         frameScopes: {
           ...threadState().frameScopes,
           generated
         }
       });
     }
 
-    case "TRAVEL_TO":
-      return updateThreadState({ ...action.data.paused });
-
     case "MAP_SCOPES": {
       const { frame, status, value } = action;
       const selectedFrameId = frame.id;
 
       const original = {
         ...threadState().frameScopes.original,
         [selectedFrameId]: {
           pending: status !== "done",