Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

Commit

Permalink
Fix #8109: Don't call fetch promotions on uninitialized rewards servi…
Browse files Browse the repository at this point in the history
…ces (#8110)

Calling rewards engine APIs before the engine has been initialized can cause a crash because the `WhenReady` method used inside `RewardsEngineImpl` will queue up what is assumed a `SingleThreadedTaskRunner`. This is not the case for iOS which uses a standard sequenced task runner.

This call to fetch promotions happens when showing the rewards panel but the rewards engine may not be initialized until the panel is shown (a sec/privacy requirement to not make API calls to rewards services until a user interacts with the feature), so it was being scheduled instead of executing immediately, thus hitting the threading issue on the brave-core side
  • Loading branch information
kylehickinson authored Sep 20, 2023
1 parent 0d29cf1 commit 5160b5c
Showing 1 changed file with 0 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,6 @@ extension BrowserViewController {
}
// Hide the current tab
rewards.rewardsAPI?.selectedTabId = 0
// Fetch new promotions
rewards.rewardsAPI?.fetchPromotions(nil)
}

func claimPendingPromotions() {
Expand Down

0 comments on commit 5160b5c

Please sign in to comment.