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

Fixes undefined synopsis for media publishers #12706

Merged
merged 1 commit into from
Jan 18, 2018

Conversation

NejcZdovc
Copy link
Contributor

@NejcZdovc NejcZdovc commented Jan 18, 2018

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.)

Resolves #12591

Auditors:

Test Plan:

  • I don't have STR, but I added unit tests for it
  • can you please just do regular ledger check with focus on the youtube

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

@NejcZdovc NejcZdovc added this to the 0.19.x Hotfix 13 milestone Jan 18, 2018
@NejcZdovc NejcZdovc self-assigned this Jan 18, 2018
@@ -2400,7 +2400,7 @@ const onMediaRequest = (state, xhr, type, tabId) => {
if (!cache.isEmpty()) {
const publisherKey = cache.get('publisher')
const publisher = ledgerState.getPublisher(state, publisherKey)
if (!publisher.isEmpty()) {
if (!publisher.isEmpty() && publisher.has('providerName')) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This line checks if data is corrupted and if that is the case we don't use cache, but fetch is again

@@ -2449,19 +2449,13 @@ const onMediaPublisher = (state, mediaKey, response, duration, revisited) => {
const publisherURL = response.get('publisherURL')
const providerName = response.get('providerName')

if (publisher.isEmpty()) {
revisited = false
if (!synopsis.publishers[publisherKey] || publisher.isEmpty()) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We always check for synopsis as well. If synopsis or publisher in the state are missing, we initialize it again, so that we don't have corrupted data.

@codecov-io
Copy link

codecov-io commented Jan 18, 2018

Codecov Report

Merging #12706 into master will increase coverage by <.01%.
The diff coverage is 92.85%.

@@            Coverage Diff             @@
##           master   #12706      +/-   ##
==========================================
+ Coverage    56.2%   56.21%   +<.01%     
==========================================
  Files         278      278              
  Lines       27137    27133       -4     
  Branches     4398     4399       +1     
==========================================
- Hits        15253    15252       -1     
+ Misses      11884    11881       -3
Flag Coverage Δ
#unittest 56.21% <92.85%> (ø) ⬆️
Impacted Files Coverage Δ
app/browser/api/ledger.js 55.4% <92.85%> (+0.06%) ⬆️

@NejcZdovc NejcZdovc force-pushed the hotfix/#12591-error branch from d0d74d2 to b1cc0bc Compare January 18, 2018 08:23
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.

LGTM 😄 👍

@bsclifton bsclifton merged commit 15403ef into brave:master Jan 18, 2018
bsclifton added a commit that referenced this pull request Jan 18, 2018
Fixes undefined synopsis for media publishers
bsclifton added a commit that referenced this pull request Jan 18, 2018
Fixes undefined synopsis for media publishers
bsclifton added a commit that referenced this pull request Jan 18, 2018
Fixes undefined synopsis for media publishers
@bsclifton
Copy link
Member

master 15403ef
0.21.x f63a55a
0.20.x b30f016
0.19.x 9654ef4

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.

3 participants