-
Notifications
You must be signed in to change notification settings - Fork 5
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 a checkmark and the ability to toggle the permission #8
Conversation
Things to look forward: https://blog.chromium.org/2018/10/trustworthy-chrome-extensions-by-default.html
|
How can I test this without having access to GitHub Enterprise? |
The injection part hasn’t changed, but the permission management has |
Testing this via refined-github/refined-github#1774 If I'm on GH, I see it checked, I remove it, RGH is disabled, but if I reenable it on GH, it doesn't turn on, but the checkmark says it's enabled. Testing on GHE, for a domain that was previously added to permissions, first load RGH is working. Disable it, RGH is disabled. Also, I noticed if I disable it, it's coming back as checked on the next page load, but RGH is disabled. The extension tells me I need to refresh the page, even though I did. I used the extension to refresh, still shows as checked, but RGH is not working. It shows a weird state: I can see the permissions exist for GH and GHE but it's not working on either: |
That’s… not right. This module only handles the permissions; if you can see your domain as officially allowed in the chrome page then it really is, and the content scripts should be automatically injected by the other module (unrelated, untouched by this PR) |
Can you check again? The github.com permission cannot be programmatically revoked and there’s nothing we can do to prevent its injection, so if you don’t see RGH there there’s something bigger at play (Chrome bug or you’re testing it wrong) 😅 Alternatively you might have disabled it from the native “Page access” menu, hence the red X on the icon. |
Retested. It's again working when I enable it, not sure what happened. I can still "disable" it on GitHub, it doesn't actually disabled RGH, but the checkbox is missing. With that said, when it's not enabled on the domain and we click the icon, we get "Refresh Required" message and I find it confusing. Refreshing the page doesn't matter if I haven't enabled it for the domain yet. Can we tie the "Ok, Refresh" button to also asking for the domain permission if it's not there? |
The check is already there. In my case I never see the red X on the icon and that might be throwing off the system. At every step I verify that we have permanent permission to the domain. If not, the check will be hidden. In my case, I receive an Alert saying that I can’t disable it on GitHub.com What Chrome version are you on? Can you make sure no flags are enabled in chrome://flags? |
The issue is likely Chrome versions, I'm locked to 64 currently when using GHE. This requires a change to the manifest and to update the |
Alright, there are indeed some yucky Chrome bugs:
Also after clicking that context menu item we will still have access to the current tab until we navigate away from the current domain (thanks to This might have caused some issues to your testing and it means I'll have to rewrite https://github.com/bfred-it/webext-dynamic-content-scripts to have the browser inject the scripts where they're permanently allowed, and not on Closing for now until fregante/webext-dynamic-content-scripts#4 is done. |
Beautiful Chrome extensions bug:
Edit: note to future self: this can probably be fixed by checking whether a domain is declared in the manifest, via Also that |
https://github.com/bfred-it/webext-dynamic-content-scripts/releases/tag/v6.0.0-0 This should make the injection more reliable and avoid issues like what happened in fregante/webext-permission-toggle#8
Will test version |
chrome.runtime.onInstalled isn't called when it's installed locally
Fixes #4
Fixes refined-github/refined-github#1509
Full rewrite sadly necessary to enable that little checkmark:
I looked into a few simpler methods but they didn't work:
contextMenus
lets you pick which origins to show the item on, but not where to show/hide its checkbox. Also no way to exclude pagesdeclarativeContent
can only toggle the wholepageAction
icon or load files; nothing else, no custom functionsAlso I couldn't find anything simpler than these to pick which domain to enable it on:
https://github.com/bfred-it/webext-domain-permission-toggle/blob/325b814979d0e803532ead364848f5ac8a823152/webext-domain-permission-toggle.js#L98-L103
https://github.com/bfred-it/webext-domain-permission-toggle/blob/325b814979d0e803532ead364848f5ac8a823152/webext-domain-permission-toggle.js#L45-L56