-
Notifications
You must be signed in to change notification settings - Fork 892
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
Move Greaselion handling into Brave extension #6978
Conversation
057ec27
to
43d7afe
Compare
e0e044c
to
a35628d
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.
inline tipping is not shown
- clean profile
- go to https://twitter.com/emerick
- no inline tipping button
@NejcZdovc Fixed problem with Twitter inline tips not showing up (scripts need to handle |
86a8ee3
to
cbb4d99
Compare
@@ -400,8 +400,6 @@ void RewardsServiceImpl::OnPreferenceChanged(const std::string& key) { | |||
return; | |||
} | |||
|
|||
EnableGreaseLion(); |
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.
It would be dangerous to do this in response to a preference change, as this currently ends up unloading and reinstalling the Greaselion extension yet leaves the related content script injected and in a non-functional state. It seemed odd that this preference callback was being called at all, but it's due to StateMigration::FreshInstall
which sets the three inline tip preferences to true
.
I think not calling this here is the safest way forward until/unless Greaselion is changed to be a bit smarter about how it handles this scenario. For the time being, we may want to suggest to the user that a browser restart is required when updating these settings.
@NejcZdovc Should be ready for review again. I left a comment regarding the fix I made. Open to other suggestions too, of course; it just seemed like the most expedient approach for 1.18. |
19a2739
to
220739b
Compare
"ids": [ | ||
"*" | ||
], |
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.
If we don't specify this, no extensions/apps will be able to communicate with the Brave extension per https://developer.chrome.com/extensions/manifest/externally_connectable
220739b
to
7755775
Compare
|
||
chrome.runtime.onMessageExternal.addListener( | ||
function (msg: any, sender: chrome.runtime.MessageSender, sendResponse: any) { | ||
if (!msg) { |
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.
Do we need to filter extensions here (e.g. filter for rewards extension or greaselion extensions), for security reasons?
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.
Do you mean similar to what we do in the onConnectExternal
listener?
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.
Right - given that we have externally_connectable
opened up, is there any way that some random extension could send a message through this listener?
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.
Will enter a follow-up issue to address 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.
This will absolutely be required and needs to be uplifted to wherever this PR is ASAP
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.
Agreed, will get it in tomorrow.
3ca3764
to
dbd5a2d
Compare
CI had expected test failures on Mac and passed on all other platforms but Windows. Will restart for Windows. |
dbd5a2d
to
8c8562c
Compare
Windows CI passed. |
@@ -19,9 +19,13 @@ | |||
"web_accessible_resources": [ | |||
], | |||
"background": { | |||
"scripts": ["out/brave_extension_background.bundle.js"] | |||
"scripts": ["out/brave_extension_background.bundle.js"], | |||
"persistent": true |
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.
Why do we need this? If it uses an API that needs the background script to be alive won't that just happen automatically?
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.
It's needed by the webRequest
API. I'm not sure if it will stay alive automatically, it's called out in the docs to make it persisent here: https://developers.chrome.com/extensions/background_pages ("The webRequest API is incompatible with non-persistent background pages.")
Resolves brave/brave-browser#12307
Resolves brave/brave-browser#6462
Related Greaselion PR: brave/brave-site-specific-scripts#25
Submitter Checklist:
npm run lint
,npm run gn_check
)git rebase master
(if needed).git rebase -i
to squash commits (if needed).QA/Yes
orQA/No
) to the associated issuerelease-notes/include
orrelease-notes/exclude
) to the associated issueTest Plan:
Rewards panel test
Tipping test
Extension test
Ideally, this should be tested for all of our supported publishers. In addition, we should verify that this works with YouTube on 1.16.
Reviewer Checklist:
After-merge Checklist:
changes has landed on.