Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Return 0% when download totalBytes is 0 or undefined #10652

Merged
merged 2 commits into from
Sep 9, 2017

Conversation

diracdeltas
Copy link
Member

@diracdeltas diracdeltas commented Aug 24, 2017

Fix #10264

Submitter Checklist:

  • Submitted a ticket for my issue if one did not already exist.
  • Used Github auto-closing keywords in the commit message.
  • Added/updated tests for this change (for new code or code which already has tests).
  • Ran git rebase -i to squash commits (if needed).
  • Tagged reviewers and labelled the pull request as needed.

Test Plan:
Download a large file and hit 'pause' immediately. It should not show Infinity% downloaded.

Reviewer Checklist:

Tests

  • Adequate test coverage exists to prevent regressions
  • Tests should be independent and work correctly when run individually or as a suite ref
  • New files have MPL2 license header

@diracdeltas diracdeltas added this to the 0.21.x (Nightly Channel) milestone Aug 24, 2017
@diracdeltas diracdeltas self-assigned this Aug 24, 2017
@diracdeltas diracdeltas requested a review from bsclifton August 24, 2017 23:48
@codecov-io
Copy link

codecov-io commented Aug 25, 2017

Codecov Report

Merging #10652 into master will increase coverage by 0.01%.
The diff coverage is 100%.

@@            Coverage Diff             @@
##           master   #10652      +/-   ##
==========================================
+ Coverage   54.16%   54.17%   +0.01%     
==========================================
  Files         247      247              
  Lines       21554    21558       +4     
  Branches     3338     3342       +4     
==========================================
+ Hits        11674    11679       +5     
+ Misses       9880     9879       -1
Flag Coverage Δ
#unittest 54.17% <100%> (+0.01%) ⬆️
Impacted Files Coverage Δ
js/state/downloadUtil.js 100% <100%> (+1.56%) ⬆️

@bbondy
Copy link
Member

bbondy commented Sep 2, 2017

++

@bbondy
Copy link
Member

bbondy commented Sep 2, 2017

Actually I think we didn't used to show anything at all. Will this show 0% always for downloads that don't specify a content length in the reply?

@diracdeltas
Copy link
Member Author

@bbondy i think it would have shown NaN% or Infinity% previously

@bbondy
Copy link
Member

bbondy commented Sep 8, 2017

I mean originally we didn't show anything at all. There is a case where there is no known % because we don't know the content length being downloaded. For example if that happens with a 3GB file we shouldn't show 0% the whole time it is downloading. Do you know if that will happen?

@diracdeltas
Copy link
Member Author

@bbondy pretty sure that is unaffected by this PR. looks like that check happens in app/renderer/components/download/downloadItem.js using totalBytes

Copy link
Member

@bsclifton bsclifton left a comment

Choose a reason for hiding this comment

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

Looks and works great! 😄

I updated the method to check for falsey input and then added some more tests in general (thanks for creating tests for this module!) 😄

@bsclifton bsclifton merged commit ad624a5 into master Sep 9, 2017
@bsclifton bsclifton deleted the fix/download-inf branch September 9, 2017 06:22
@bbondy bbondy modified the milestones: 0.21.x (Developer Channel), 0.20.x (Beta Channel) Oct 25, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants