-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Optimize multiple initializations of content_cosmetics.bundle.js during frame load #17935
Comments
@atuchin-m / @iefremov perhaps you can verify, but I believe this is fixed by brave/brave-core#9995: |
@atuchin-m the description of the issue is incorrect. The bundle isn't injected on every frame at all. We do that only in the main frame https://github.com/brave/brave-core/blob/master/components/cosmetic_filters/renderer/cosmetic_filters_js_handler.cc#L341 |
@pes10k |
Verified
Steps:
Confirmed:
to
Verified
Steps:
Confirmed:We went from Verification passed on
Steps:
Confirmed:We went from
|
Description
The problem is content_cosmetics.bundle.js sometimes is injected and initialized twice during each main frame load.
(see the picture in attachment)
The reason is that webpack bundle mechanisms aren't designed for multiple injections.
In addition, some caching mechanisms don't work correctly (for example _parseDomainCache).
The bundle should be injected once, with no double execution/code-optimization during frame load.
The native code should call some exported functions.
Steps to Reproduce
Actual result:
See two large tasks spawned by injecting content_cosmetics.bundle.js (better to use built from source version to see the stack details). The script was injected from native code: https://github.com/brave/brave-core/blob/713692eb65af2adf39c9375d5c6f87f5afd830a6/components/cosmetic_filters/renderer/cosmetic_filters_js_handler.cc#L196-L198
Expected result:
Only one such task.
Reproduces how often:
Easily reproduced
The text was updated successfully, but these errors were encountered: