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

Prevent borkiness when session-store file is missing perWindowState[].closedFrames #13265

Merged
merged 4 commits into from
Mar 1, 2018

Conversation

petemill
Copy link
Member

This would then cause the app never recover, even after restart. Especially with an about:error tab in the session-store, which would immediately cause appActions.removeHistorySite to fire when it fails to load. The reducer of that action relied on windowState.closedFrames being there. This changes it to not rely on that.

Fix #13261, although since that's not reproducible I'm not sure the moving-tab keyboard shortcut necessarily caused it, but something did, and this will allow recovery in that situation.

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.
  • Request a security/privacy review as needed. (Ask a Brave employee to help if you cannot access this document.)

Test Plan:

Reviewer Checklist:

  • Request a security/privacy review as needed if one was not already requested.

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

@petemill petemill added the bug label Feb 23, 2018
@petemill petemill self-assigned this Feb 23, 2018
@petemill petemill requested a review from bsclifton February 23, 2018 00:22
@petemill petemill modified the milestones: 0.21.x (Beta Channel - CR 65), 0.21.x (Beta Channel) Feb 23, 2018
@codecov-io
Copy link

codecov-io commented Feb 23, 2018

Codecov Report

Merging #13265 into master will increase coverage by 0.23%.
The diff coverage is 35%.

@@            Coverage Diff             @@
##           master   #13265      +/-   ##
==========================================
+ Coverage   56.01%   56.24%   +0.23%     
==========================================
  Files         282      282              
  Lines       28211    28221      +10     
  Branches     4642     4646       +4     
==========================================
+ Hits        15801    15873      +72     
+ Misses      12410    12348      -62
Flag Coverage Δ
#unittest 56.24% <35%> (+0.23%) ⬆️
Impacted Files Coverage Δ
app/sessionStore.js 88.2% <100%> (+0.13%) ⬆️
js/stores/appStore.js 27.98% <30.55%> (+11.41%) ⬆️
js/stores/windowStore.js 28.78% <66.66%> (+1.11%) ⬆️

…o perWindowState[].closedFrames property, which would then cause the app never recover, even after restart.

Fix #13261, although since that's not reproducible I'm not sure the moving-tab keyboard shortcut neccessarily caused it, but something did, and this will allow recovery in that situation.
@bsclifton bsclifton force-pushed the fix/13261-borked-closedframes branch from 52e4baf to 9fb671b Compare February 28, 2018 20:51
- Add unit tests for APP_SHOW_NOTIFICATION and APP_HIDE_NOTIFICATION
- deregister mock from previous commit (windowStateTest). Forgot that :)

Auditors: @petemill
if (style) {
const styleIndex = notifications.findLastIndex((notification) => {
return notification.get('options').get('style') === style
{
Copy link
Member

Choose a reason for hiding this comment

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

added { so that variables defined here are scoped


// Insert notification next to those with the same style, or at the end
let insertIndex = notifications.size
const style = action.detail
Copy link
Member

Choose a reason for hiding this comment

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

updated this to handle detail being falsey

return notification.get('message') === action.message
}))
break
{
Copy link
Member

Choose a reason for hiding this comment

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

{ for scope (same as above)

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.

Great changes 😄 👍 Added some tests here. Take a peek, let me know what you think!

@petemill petemill merged commit e08caca into master Mar 1, 2018
@petemill petemill deleted the fix/13261-borked-closedframes branch March 1, 2018 20:07
petemill added a commit that referenced this pull request Mar 1, 2018
Prevent borkiness when session-store file is missing perWindowState[].closedFrames
@petemill
Copy link
Member Author

petemill commented Mar 1, 2018

0.22.x 4388e3c

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bad session state can result in permanently borked profile
3 participants