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

Don't call unique() in content scripts when right clicking #2043

Merged
merged 1 commit into from
Mar 25, 2019

Conversation

bsclifton
Copy link
Member

@bsclifton bsclifton commented Mar 23, 2019

Don't call unique() in content scripts when right clicking

unique call (to get selector for target) can be expensive; now only called when user chooses Block element via selector

Fixes brave/brave-browser#2410

Can likely be uplifted to 0.62.x since this fixes a perf issue

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).
  • Verified that these changes build without errors on
    • Windows
    • macOS
    • Linux
  • Verified that these changes pass automated tests (npm test brave_unit_tests && npm test brave_browser_tests && npm run test-security) on
    • Windows
    • macOS
    • Linux
  • Verified that all lint errors/warnings are resolved (npm run lint)
  • Ran git rebase master (if needed).
  • 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/Yes or QA/No) to include the closed issue in milestone

Test Plan:

  1. Navigate to https://clifton.io/
  2. Right click around the screen; verify context menu shows immediately
  3. Right click something on the page and choose Brave => Block element via selector
  4. Verify selector is shown in the modal
  5. Navigate to https://mobile.twitter.com/welcomet0nature/status/1108858756018909185
  6. Right click around the screen; verify context menu shows immediately
  7. Right click something on the page and choose Brave => Block element via selector
  8. Wait a REALLY long time
  9. If the "Page is unresponsive. Continue waiting?" prompt shows, click "Wait"
  10. Finally (maybe a minute later on debug builds), verify the selector is shown in the modal

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

`unique` call (to get selector for target) can be expensive; now only called when user chooses `Block element via selector`

Fixes brave/brave-browser#2410
@reaktivo
Copy link

@bsclifton This looks like a better solution. Hope this one get's merged soon.

@bsclifton
Copy link
Member Author

Went through pipeline steps in Jenkins and verified the only step that failed was the security check (failing on js-yaml). Build on all platforms worked fine, tests passed. Security fix was handled by @jumde with brave/crypto#21

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.

mobile.twitter.com right click hang
3 participants