Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not request permission when autoplay is allowed for the page #520

Merged
merged 1 commit into from
Sep 28, 2018

Conversation

yrliou
Copy link
Member

@yrliou yrliou commented Sep 28, 2018

Fix brave/brave-browser#1120

When we allow autoplay for a page and reload it, if there are frames from different origins in this page need the autoplay permission, it will prompt the "autoplay is blocked" message in the URL bar.
The URL being shown in that bubble will always be this page's origin per https://github.com/brave/brave-core/blob/master/browser/ui/content_settings/brave_autoplay_content_setting_bubble_model.cc#L58.
The expected behavior here should be that we only need to allow for the entire page.

To fix this, this PR revise the logic in AllowAutoplay so we won't request permission when autoplay is already allowed per content setting, so those confusing prompt for subframes in different origin won't be there after the page's origin (primary_url) is allowed.

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.
  • Add appropriate QA labels (QA/Needed or QA/No-QA-Needed) to include the closed issue in milestone

Test Plan:

Reddit

  1. Navigate to reddit.com/r/gifs
  2. Get a autoplay block prompt and choose to allow autoplay for this domain
  3. Refresh the page
  4. Check that there is no autoplay block prompt and videos in the page are playing

Google Drive

  1. Login to Google Drive
  2. Attempt to play an .mp4 file --> see notification in URL bar about autoplay being blocked.
  3. Choose to allow https://drive.google.com and refresh the page
  4. Check that there is no autoplay block prompt
    (Please note that we still cannot play mp4 files from google drive, there seems to be a separate issue causing that, which won't be fixed by this PR)

Reviewer Checklist:

  • New files have MPL-2.0 license header.
  • Request a security/privacy review as needed.
  • Adequate test coverage exists to prevent regressions
  • Verify test plan is specified in PR before merging to source

@yrliou yrliou self-assigned this Sep 28, 2018
@yrliou yrliou requested a review from darkdh September 28, 2018 05:02
@yrliou yrliou changed the title Do not request permission when autoplay is allowed. Do not request permission when autoplay is allowed for the page Sep 28, 2018
@darkdh
Copy link
Member

darkdh commented Sep 28, 2018

clicking allow still requires manual refresh is also a different issue
brave/brave-browser#1338

@yrliou yrliou merged commit 8ce903f into master Sep 28, 2018
yrliou added a commit that referenced this pull request Sep 28, 2018
Do not request permission when autoplay is allowed for the page
yrliou added a commit that referenced this pull request Sep 28, 2018
Do not request permission when autoplay is allowed for the page
@yrliou
Copy link
Member Author

yrliou commented Sep 28, 2018

master: 8ce903f
0.55.x: 1de55ad
0.56.x: 3443192

@yrliou yrliou deleted the fix_autoplay_prompt branch September 28, 2018 05:19
@bbondy bbondy added this to the 0.55.x - Release milestone Jan 14, 2019
fmarier pushed a commit that referenced this pull request Oct 29, 2019
Fix product_logo in chrome://versions and default_browser_infobar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

autoplay allowed but URL bar still reads autoplay blocked
3 participants