-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Add FXIOS-10667 Content blocklist support via Remote Settings #23342
Add FXIOS-10667 Content blocklist support via Remote Settings #23342
Conversation
…s well as old content blocker script, and update the bootstrap to no longer call it
…ault disconnect (blocklist) files
…ings APIs rather than directly as bundle resource
… new JSON utility func.
@@ -46,6 +46,3 @@ cp -r .githooks/* .git/hooks/ | |||
|
|||
# Make the hooks are executable | |||
chmod +x .git/hooks/* | |||
|
|||
# Run and update content blocker | |||
./content_blocker_update.sh |
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.
cc @clarmso Just a quick heads up that we are removing this content blocker update script from the bootstrap.sh.
I'm not aware of any issues this should cause on Bitrise but wanted to make sure you were looped in. Thanks
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.
I just noticed that this script is also responsible for running the code that generates our MainFrameAtDocument*.js
files. So I'm fixing this right now, should have an update pushed soon.
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.
(Update: the above issue should be fixed now.)
a082a72
to
0634f95
Compare
Client.app: Coverage: 31.58
Generated by 🚫 Danger Swift against 6ccd1bb |
I believe the way the script is removed currently will break the generation of our |
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.
This looks @mattreaganmozilla. Thanks. I see some stuff we can improve in the future, but this a really good place to start.
guard let data = try? lists.loadLocalSettingsFileAsJSON(fileName: list) else { continue } | ||
guard let newHash = calculateHash(for: data) else { continue } |
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.
Not really something we can support right now, but once we figure out caching we can also get the file digest from RS for attachments.
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.
Yes and I believe there is some overlap between the current caching and RS so we may be able to clean up and/or remove some of this later down the road.
} | ||
} | ||
|
||
/// Loads the local settings for the given data type record, returning the | ||
/// decoded objects. | ||
/// - Returns: settings decoded to their RemoteDataTypeRecord. |
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.
Eventually I think we would want to converge to the desktop implementation where a record
and attachment
is a one to one mapping. So the API might look like record.get_attachment
. But this also works.
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.
The way this was sort of grafted onto the RS code isn't great and it's a bit clunky, but it's just the initial step in cleaning up the previous shavar scripts. I'm happy to revisit/update anything here. We can definitely sync further on this.
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.
@issammani Once this lands, I can add a patch for you two to review the attachment portion where yes you can do some part in python however locally it should all work out in terms of record.getAttachment(...name)
# Install Node.js dependencies and build user scripts | ||
npm install | ||
npm run build |
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.
Nice catch. Not sure why npm was part of content_blocker_update.sh
before 🤔
cd BrowserKit | ||
swift run || true | ||
swift run |
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.
Note: I believe removal of this also means we can clean up some of the related code in BrowserKit (e.g. ContentBlockerGenerator
)?
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.
Yes. I converted it to a much simpler python script. My initial plan was to use it as is and have docker multistage build ( like I did in this tmp repo ) to build a binary from swift and use it, but that overcomplicates the build process. We don't need that code anymore.
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.
Ok thanks, I might create a follow-up task for that cleanup and just put up a quick separate PR to remove it.
📜 Tickets
Jira ticket
Github issue
💡 Description
Initial updates to support Remote Settings for content blocking lists in iOS client. Changes:
bootstrap.sh
disconnect-*
filesThis is still a work-in-progress and there are a few areas that will need to be updated further (I have not added or updated tests etc.).
Result
📝 Checklist
You have to check all boxes before merging
@Mergifyio backport release/v120
)