Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upMigrate to web_accessible_resources and scriptlets.js #50
Conversation
|
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 |
|
lgtm |
6b95651
to
2d91c04
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
antonok-edm commentedSep 26, 2019
•
edited
Closes brave/brave-browser#4564
With the deprecation of the
resources.txtfile, this allowsadblock-rustto pull resources from uBlock Origin's newerweb_accessible_resourcesdirectory andscriptlets.jsfile. Redirectable resources fromweb_accessible_resourcesand resources for cosmetic injection fromscriptlets.jscan both be represented asResourcestructs.Snippet from
src/resources.rs:The resulting
Resources 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
uBlockResourcesis exposed throughadblock-rust's neon bindings. This function takes 3 string arguments, namely:web_accessible_resourcesdirectoryredirect-engine.jsfilescriptlets.jsfileand will return a list of corresponding
ResourceJavaScript 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.