brave / brave-browser

Brave browser for Android, iOS, Linux, macOS, Windows.
https://brave.com
Mozilla Public License 2.0
18k stars 2.36k forks source link

[iOS] Issue with sometimes the resources on the engine not being set #38697

Closed cuba closed 5 months ago

cuba commented 6 months ago

Description

There are some cases we've seen that the resources are not set. This seems to be caused only during branch switching and results from the resources updated callback only triggering if the resources were updated.

Edit: This may in fact be a larger issue than just in development.

As a precaution, we should ensure that the callback is triggered at least once when subscribing regardless if resources have been updated or not. This will not cause any unforeseen performance issues as the engines will ignore any resource updates that are of a lower or same version but will ensure the resources are set if they weren't.

Steps to reproduce

Unfortunately the steps to reproduce this are impossible to define. However we should test youtube ad-blocking on launch (new install) and re-launch (after termination)

  1. Install the app from scratch
  2. Wait a moment for resources to download
  3. Go directly to https://dev-pages.brave.software/filtering/scriptlets.html
  4. Refresh the page

Actual result

nil is shown in the "This frame" column

Sometimes youtube ads are not blocked (again seems to only happen in isolated development cases)

Expected result

Eventually (after resources are downloaded) true should be shown in "This frame" column

Reproduces how often

Intermittent

Brave version

1.67 (The code that caused this issue wasn't in 1.67 and this must have been a typo) 1.68

Device/iOS version

Any

Affected browser versions

Reproducibility

Miscellaneous information

No response

kjozwiak commented 4 months ago

The above requires 1.68.127 or higher for 1.68.x verification 👍

hffvld commented 4 months ago

Verified on iPhone 14 using version(s):

Device/OS: iPhone 14 / iOS 17.6
Brave build: 1.68 (128)
BraveCore: 1.68.128 (127.0.6533.73)

STEPS:

  1. Follow the STR/TP from https://github.com/brave/brave-browser/issues/38697#issue-2325450519
  2. Verify

ACTUAL RESULTS:


https://github.com/user-attachments/assets/83ff9f52-efb5-4211-bef0-e7e64b7ca43e