Skip to content
This repository was archived by the owner on Jan 11, 2023. It is now read-only.

[stepping] Do not evaluate expressions on stepping#3530

Merged
jasonLaster merged 3 commits into
firefox-devtools:masterfrom
bomsy:no-eval-on-step
Aug 7, 2017
Merged

[stepping] Do not evaluate expressions on stepping#3530
jasonLaster merged 3 commits into
firefox-devtools:masterfrom
bomsy:no-eval-on-step

Conversation

@bomsy
Copy link
Copy Markdown
Contributor

@bomsy bomsy commented Aug 2, 2017

Associated Issue: #3493

Here's the Pull Request Doc
https://devtools-html.github.io/debugger.html/CONTRIBUTING.html#pull-requests

Summary of Changes

  • Added a new command property to the pause reducer
  • Added isStepping to enable us know when we are stepping
  • Do not evaluate expressions when we resume, if we are stepping

Test Plan

  • Add breakpoint
  • Pause on breakpoint
  • Click step over button
  • See how long it takes to step

Copy link
Copy Markdown
Contributor

@jasonLaster jasonLaster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

couple of thoughts

Comment thread src/reducers/pause.js
});

case "COMMAND":
return { ...state, command: action.value.type };
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should clear this field when it's done.

Comment thread src/actions/pause.js
dispatch(evaluateExpressions(null));
if (!isStepping(getState())) {
dispatch(evaluateExpressions(null));
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks

Comment thread src/actions/pause.js
return dispatch({
type: "COMMAND",
value: undefined
value: { type }
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets add some jest unit tests to demonstrate that command is set and then cleared when the command is done.

I think we can do something like:

it("lala", async () => {
  let resolve = null;
  const slowClient = {
     stepIn: () => new Promise(_resolve => {resolve = _resolve})
  }
  
  await actions.paused()
  actions.stepIn()
  
  expect(isStepping(state)).toBeTruthy()
  resolve();
  expect(isStepping(state)).toBeFalsey()
}

@codecov
Copy link
Copy Markdown

codecov Bot commented Aug 4, 2017

Codecov Report

Merging #3530 into master will increase coverage by 0.42%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #3530      +/-   ##
=========================================
+ Coverage   51.97%   52.4%   +0.42%     
=========================================
  Files         110     110              
  Lines        4529    4536       +7     
  Branches      936     939       +3     
=========================================
+ Hits         2354    2377      +23     
+ Misses       2175    2159      -16
Impacted Files Coverage Δ
src/actions/pause.js 42.59% <100%> (+23.72%) ⬆️
src/reducers/pause.js 43.37% <100%> (+8.3%) ⬆️
src/actions/ast.js 78.57% <0%> (+1.78%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bbc889d...a6e9269. Read the comment docs.

@codecov
Copy link
Copy Markdown

codecov Bot commented Aug 4, 2017

Codecov Report

Merging #3530 into master will decrease coverage by 0.03%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3530      +/-   ##
==========================================
- Coverage   51.97%   51.94%   -0.04%     
==========================================
  Files         110      110              
  Lines        4529     4534       +5     
  Branches      936      938       +2     
==========================================
+ Hits         2354     2355       +1     
- Misses       2175     2179       +4
Impacted Files Coverage Δ
src/actions/pause.js 18.51% <0%> (-0.35%) ⬇️
src/reducers/pause.js 33.33% <0%> (-1.74%) ⬇️
src/actions/ast.js 78.57% <0%> (+1.78%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bbc889d...0aa33ee. Read the comment docs.

Copy link
Copy Markdown
Contributor

@jasonLaster jasonLaster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great.

Comment thread src/actions/pause.js

dispatch(evaluateExpressions(null));
if (!isStepping(getState())) {
dispatch(evaluateExpressions(null));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be nice to have a test here too:

+ describe("pause", () => {
+   it("should set and clear the command", async () => {
+     const client = { evaluate: jest.fn() };
+     const { dispatch, getState } = createStore(client);
+     dispatch(actions.stepIn());
+     await dispatch(actions.resumed());
+     expect(client.evaluate.calls.length).toEqual(0)
+   });
+ });
  

@jasonLaster jasonLaster merged commit 4426f62 into firefox-devtools:master Aug 7, 2017
@jasonLaster jasonLaster changed the title Do not evaluate expressions on stepping [stepping] Do not evaluate expressions on stepping Aug 8, 2017
@bomsy bomsy deleted the no-eval-on-step branch August 9, 2017 09:40
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants