-
Notifications
You must be signed in to change notification settings - Fork 128
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
Migrate to web_accessible_resources and scriptlets.js #50
Conversation
9a39e66
to
3460597
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me, one nit on the data structure for resource lookup
also given the complexity of resource handling has also grown we might want to separate it into a submodule instead of having a bunch of them at the top level
3460597
to
f288830
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
6b95651
to
2d91c04
Compare
2d91c04
to
c24a045
Compare
c24a045
to
cfc4e3e
Compare
cfc4e3e
to
2e8d81e
Compare
2e8d81e
to
f0ef7fc
Compare
Closes brave/brave-browser#4564
With the deprecation of the
resources.txt
file, this allowsadblock-rust
to pull resources from uBlock Origin's newerweb_accessible_resources
directory andscriptlets.js
file. Redirectable resources fromweb_accessible_resources
and resources for cosmetic injection fromscriptlets.js
can both be represented asResource
structs.Snippet from
src/resources.rs
:The resulting
Resource
s can be loaded into the engine directly, or serialized to JSON for transfer to another instance. The equivalent data structures in JSON are as follows:A new Javascript function
uBlockResources
is exposed throughadblock-rust
's neon bindings. This function takes 3 string arguments, namely:web_accessible_resources
directoryredirect-engine.js
filescriptlets.js
fileand will return a list of corresponding
Resource
JavaScript objects. In combination with a locally checked out version of the uBlock Origin source repo, this function can be used to produce a new set of resources for the adblocking engine.