Reproduce debugger.html PR 5809 in mc draft
authorLogan Smyth <loganfsmyth@gmail.com>
Thu, 29 Mar 2018 16:32:21 -0700
changeset 775094 7c6d4d42aef40f506e33b27933f90ab1f8a4f655
parent 773797 a456475502b80a1264642d9eaee9394a8fad8315
child 775095 a5452b72cfcfd8f0e82b721dde508525b13fc655
push id104598
push userbmo:loganfsmyth@gmail.com
push dateFri, 30 Mar 2018 00:08:52 +0000
milestone61.0a1
Reproduce debugger.html PR 5809 in mc MozReview-Commit-ID: KTAxi4kNUtJ
devtools/client/debugger/new/debugger.js
--- a/devtools/client/debugger/new/debugger.js
+++ b/devtools/client/debugger/new/debugger.js
@@ -6331,24 +6331,24 @@ function evaluateExpression(expression) 
       console.warn("Expressions should not be empty");
       return;
     }
 
     let input = expression.input;
     const frame = (0, _selectors.getSelectedFrame)(getState());
 
     if (frame) {
-      const { location, generatedLocation } = frame;
+      const { location } = frame;
       const source = (0, _selectors.getSource)(getState(), location.sourceId);
       const sourceId = source.get("id");
 
       const selectedSource = (0, _selectors.getSelectedSource)(getState());
 
       if (selectedSource && !(0, _devtoolsSourceMap.isGeneratedId)(sourceId) && !(0, _devtoolsSourceMap.isGeneratedId)(selectedSource.get("id"))) {
-        input = await getMappedExpression({ getState, sourceMaps }, generatedLocation, input);
+        input = await dispatch(getMappedExpression(input));
       }
     }
 
     const frameId = (0, _selectors.getSelectedFrameId)(getState());
 
     return dispatch({
       type: "EVALUATE_EXPRESSION",
       input: expression.input,
@@ -6356,23 +6356,28 @@ function evaluateExpression(expression) 
     });
   };
 }
 
 /**
  * Gets information about original variable names from the source map
  * and replaces all posible generated names.
  */
-async function getMappedExpression({ getState, sourceMaps }, generatedLocation, expression) {
-  const mappings = (0, _selectors.getSelectedScopeMappings)(getState());
-  if (!mappings) {
-    return expression;
-  }
-
-  return await parser.mapOriginalExpression(expression, mappings);
+function getMappedExpression(expression) {
+  return async function({ dispatch, getState, client, sourceMaps }) {
+    const mappings = (0, _selectors.getSelectedScopeMappings)(getState());
+    if (!mappings) {
+      return expression;
+    }
+
+    return await dispatch({
+      type: "MAP_EXPRESSION_RESULT",
+      [_promise.PROMISE]: parser.mapOriginalExpression(expression, mappings)
+    });
+  };
 }
 
 /***/ }),
 
 /***/ 1399:
 /***/ (function(module, exports, __webpack_require__) {
 
 "use strict";
@@ -30301,19 +30306,17 @@ function setPreview(expression, location
   return async ({ dispatch, getState, client, sourceMaps }) => {
     await dispatch({
       type: "SET_PREVIEW",
       [_promise.PROMISE]: async function () {
         const source = (0, _selectors.getSelectedSource)(getState());
 
         const sourceId = source.get("id");
         if (location && !(0, _devtoolsSourceMap.isGeneratedId)(sourceId)) {
-          const generatedLocation = await sourceMaps.getGeneratedLocation(_extends({}, location.start, { sourceId }), source.toJS());
-
-          expression = await (0, _expressions.getMappedExpression)({ sourceMaps, getState }, generatedLocation, expression);
+          expression = await dispatch((0, _expressions.getMappedExpression)(expression));
         }
 
         const selectedFrame = (0, _selectors.getSelectedFrame)(getState());
         if (!selectedFrame) {
           return;
         }
 
         const { result } = await client.evaluateInFrame(selectedFrame.id, expression);
@@ -33719,18 +33722,16 @@ function updateTree({
 Object.defineProperty(exports, "__esModule", {
   value: true
 });
 
 var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
 
 exports.setupHelper = setupHelper;
 
-var _redux = __webpack_require__(3593);
-
 var _timings = __webpack_require__(1657);
 
 var timings = _interopRequireWildcard(_timings);
 
 var _prefs = __webpack_require__(226);
 
 var _devtoolsConfig = __webpack_require__(1355);
 
@@ -33776,20 +33777,18 @@ function getCM() {
 function _formatPausePoints(dbg, url) {
   const source = dbg.helpers.findSource(url);
   const pausePoints = dbg.selectors.getPausePoints(source);
   console.log((0, _pausePoints.formatPausePoints)(source.text, pausePoints));
 }
 
 function setupHelper(obj) {
   const selectors = bindSelectors(obj);
-  const actions = (0, _redux.bindActionCreators)(obj.actions, obj.store.dispatch);
   const dbg = _extends({}, obj, {
     selectors,
-    actions,
     prefs: _prefs.prefs,
     features: _prefs.features,
     timings,
     getCM,
     helpers: {
       findSource: url => findSource(dbg, url),
       evaluate: (expression, cbk) => evaluate(dbg, expression, cbk),
       sendPacketToThread: (packet, cbk) => sendPacketToThread(dbg, packet, cbk),