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

Trigger refresh of Click to Load placeholders on request block #1738

Merged
merged 1 commit into from
Mar 7, 2023

Conversation

kzar
Copy link
Collaborator

@kzar kzar commented Feb 27, 2023

Historically, the Click to Load placeholders were only drawn once at
the point page load completed. That had two problems:

  1. Sometimes placeholders would take too long to display, if the page
    took a long time to load fully.
  2. Sometimes placeholders would not be displayed at all, if the
    blocked content was only created after page load had finished.

To fix that, let's send a message to the content-scope-script to
ensure that placeholders are refreshed each time a Click to Load
request is blocked.

Also tweak the response messages to be inline with the recent
content-scope-script changes to make response messages easier to
identify.

Unfortunately the YouTube Click to Load integration tests need to be
disabled for now, since we had to disable the "hideTrackingElement"
option for now which breaks some of the YouTube SDK integration.

Reviewer: @ladamski
CC: @franfaccin

Steps to test this PR:

  1. These changes depends on these content-scope-scripts changes.

  2. Open the options page, change "options.html" in the URL to "devtools-panel.html", click the tiny config icon in the top-right, select "config" in the drop-down, search for "clickToPlay" and add update the config to enable YouTube Click to Load:

    "clickToPlay": {
      "exceptions": [],
      "settings": {
        "Facebook": {
          "ruleActions": [
            "block-ctl-fb"
          ],
          "state": "enabled"
        },
        "Youtube": {
          "ruleActions": [
            "block-ctl-yt"
          ],
          "state": "enabled"
        }
      }
    }
  1. Navigate to this post and click to play the video. Ensure the Click to Load placeholder is displayed. (Ignore styling issues, that's unrelated.)
  2. Navigate to the YouTube test page. Ensure the placeholders are displayed immediately, not after a long pause. (Ignore placeholders being displayed twice, or load button not working. Those are unrelated issues.)
  3. Navigate to the Facebook test page and ensure Facebook Click to Load works correctly still.

Automated tests:

  • Unit tests
  • Integration tests
Reviewer Checklist:
  • Ensure the PR solves the problem
  • Review every line of code
  • Ensure the PR does no harm by testing the changes thoroughly
  • Get help if you're uncomfortable with any of the above!
  • Determine if there are any quick wins that improve the implementation
PR Author Checklist:
  • Get advice or leverage existing code
  • Agree on technical approach with reviewer (if the changes are nuanced)
  • Ensure that there is a testing strategy (and documented non-automated tests)
  • Ensure there is a documented monitoring strategy (if necessary)
  • Consider systems implications

@kzar kzar force-pushed the ctl-placeholder-on-block branch 7 times, most recently from e8cb17f to a8249ab Compare March 6, 2023 17:00
Historically, the Click to Load placeholders were only drawn once at
the point page load completed. That had two problems:
1. Sometimes placeholders would take too long to display, if the page
   took a long time to load fully.
2. Sometimes placeholders would not be displayed at all, if the
   blocked content was only created after page load had finished.

To fix that, let's send a message to the content-scope-script to
ensure that placeholders are refreshed each time a Click to Load
request is blocked.

Also tweak the response messages to be inline with the recent
content-scope-script changes to make response messages easier to
identify.

Unfortunately the YouTube Click to Load integration tests need to be
disabled for now, since we had to disable the "hideTrackingElement"
option for now which breaks some of the YouTube SDK integration.
@kzar kzar force-pushed the ctl-placeholder-on-block branch from a8249ab to 5b545a1 Compare March 6, 2023 22:13
@kzar kzar marked this pull request as ready for review March 6, 2023 22:18
Copy link
Contributor

@ladamski ladamski left a comment

Choose a reason for hiding this comment

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

Tests all pass and LGTM

@kzar kzar merged commit 73a9baa into duckduckgo:main Mar 7, 2023
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.

None yet

2 participants