brave / brave-ios

Brave iOS Browser
https://brave.com
Mozilla Public License 2.0
1.7k stars 441 forks source link

[Follow up to 6320] Can take 6 hours on a fresh install to download new ad-block rules #6348

Open Uni-verse opened 2 years ago

Uni-verse commented 2 years ago

Description:

[Follow up] It's been discovered that the fetch tasks for getting files sleep for 6 hours before actually doing a download. This could result in new installs not having the ad-block rules for up to 6 hours (or longer if the app is not used frequently).

Steps to Reproduce

  1. Delete the app
  2. Install the app and run it
  3. Run the test here: https://test-pages.privacytests.org/tracking_content.html

Actual result: Google tag manager is not blocked (this is because the bundled rules don't block it)

Requires app relaunch to block this

0

Expected result: Google tag manager should be blocked

Note: Facebook tracker is not being blocked instead. This is an issue that is being investigated separately and is the reason why this issue has been discovered.

Reproduces how often: [Easily reproduced, Intermittent Issue] Easily reproduced

Brave Version: 1.45.x

Device details: Any

Website problems only:

Additional Information

This is caused by a sleep that happens before the download is performed instead of after

cuba commented 2 years ago

@Uni-verse this looks like a duplicate of this: https://github.com/brave/brave-ios/issues/6320

cuba commented 1 year ago

@Uni-verse I cannot reproduce this: "Requires app relaunch to fix this". A simple refresh of the page will fix the issue. No app relaunch is needed. Could you please verify this and close if this is no longer an issue.

Note: the bundled file has been updated so you will not see any difference In the test pages during initial launch and refreshing or relaunching. so you will need to change how you test this issue. Fortunately you can test if you're using the downloaded or the bundled file like so:

  1. Uninstall the application and reinstall it
  2. Open the application
  3. Go to https://test-pages.privacytests.org/tracking_content.html
  4. Open shields on initial launch
  5. Should see 0 trackers blocked on initial launch (if you see 19, you were too slow or your internet was too quick. but you can still stop at this moment. Everything is as it should be: Test has passed)
  6. Wait a bit (Usually takes seconds. But could be longer if you have a slower connection)
  7. Refresh the page
  8. Open the stats. You should now see that 19 trackers were blocked.

You can also refresh the page and test the stats multiple times...eventually (not too long..definitely not 6 hours) you should see trackers being blocked.

This is because our stats come from the downloaded files (which contains more info) and not the bundled file so on the bundled file we cannot tell which trackers were blocked (hence the 0). No relaunch should be necessary. But a refresh after a wait should be enough, no relaunch should be necessary.