Open Bison700 opened 7 months ago
Hey @Bison700! Thanks for opening this issue with such a detailed write-up.
So the extension uses the built-in browser navigator clipboard API to write to the clipboard. The permissions for both read/write are lumped together unfortunately, but the extension definitely doesn't read any data from the clipboard, just writes to it.
Now, as for the reason it prompts for permissions to access the clipboard at all. When using the extension icon to copy text, no special permissions are needed to write to the clipboard. But when using the shortcut, there is a separate piece of code that copies the HTML to the clipboard from the page itself. This is what's triggering the permissions prompt.
Maybe as an alternative, and to solve this issue overall, I can change the extension to automatically execute copying HTML when clicking the extension icon or when using the "Activate extension" shortcut, and then I could make this behavior configurable in options. That way I can remove the "Copy the page's HTML element to the clipboard" shortcut and have only the one shortcut, "Activate extension".
I think that would solve the issue overall. Thoughts?
Was responding to your message via email, but just saw your edit above. Looks like we both have the same idea :) I'll make these changes next when I have some free time to put into the extension
Hey, that sounds great. Funny that we had the same idea ;-) I think it probably is the best possible workaround. I suspected, that it had to something with the icon-click granting more rights.
Greetings
Just a heads up. I published a new version to address this issue and it's currently under review. Usually takes 1-2 days to pass review and go public.
@Bison700 The new version is live!
Please give it a shot and let me know how it goes
Nice, I will look into it!
So I used it a fair bit and I think it works quite well like this, nice. The extension is very fast to retrieve the DOM as well.
Two small suggestions: Currently the extension window stays active after using. An option to have it automatically fade out some time after it says »copied« might be useful.
Secondly in about 5 % of uses I had the issue where the copying did not work. In those cases, half of the times the extension still gave the message »HTML copied to clipboard«, but the clipboard just stayed empty/as is. The other half there was no message that code was copied, so the extension opened like before the update and I had to click the button or reengage the extension via shortcut. (In one single case I had an error message as well, so that works and is not the problem here.) This happened often, but no exclusively, in cases where the page loading finished shortly beforehand. Don’t know what’s the case there and it sure is not a super critical issue, but maybe it is fixable with having the extension try to retrieve the DOM multiple times until success?
This extension works flawslessly when you click on the extension icon (as far as I can tell), but it behaves buggy when a shortcut for »Copy the page's HTML element to the clipboard« is set and used.
So when you press the shortcut, sometimes it still works and copies the DOM to the clipboard.
Most of the time however it does not work. Half of the time it just does not work at all, half of the time the page requests clipboard access:
When you block this, it stops working. When you gain access, it does work. But it works without this clipboard access when you click on the extension icon. Why should the website have clipboard access anyway? And the extension should only copy stuff to the clipboard, not read from it.
Needless to say it does not work when you block websites from asking for clipboard access altogether (chrome://settings/content/clipboard).
As it sometimes works with the shortcut and always works flawlessly when you click on the icon, this seems to be a bug. Additionally there is another extension (Copy DOM Content) that is able to do this without clipboard access of the website (but has other drawbacks as well).
I have verified that it behaves like that on different PCs/Chrome profiles.
Edit: When the extension would copy the DOM right away after click on the icon, one could assign a shortcut for »Activate the extension« and workaround this issue.
It is very useful, but the keyboard shortcut functionality working correctly would make it far better and useful for automation.