Closed iu0v1 closed 6 years ago
Hello this is IT, have you tried turning it off and on again?
Hello this is IT, have you tried turning it off and on again?
Hi. I tried to: reload extension, restart browser, pray to Machine God and browser update (64 -> 65) :)
Hi
Oops, the "JavaScript Regular Expression" link from the extension options page works, I guess I never tried from the popup, even though it's the same code/markup. It should take you to: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions, I will push another release in a bit to fix that issue.
As for file://
being the auto-generated pattern... I'm wondering if it's some kind of Chrome on Windows error. If you open the JavaScript Console (Control+Shift+J), what's the output of: new URL(window.location).origin
?
For a URL like https://github.com/jswanner/DontFuckWithPaste
, it is supposed to suggest the pattern of just https://github.com
.
what's the output of: new URL(window.location).origin?
Returns what is expected of it: "https://github.com"
.
Thanks.
I remembered that I have a Windows VM on my laptop. I installed Chrome on it (Chrome version 65), the extension is working as expected so far.
@skyfeature Weird... The extension correctly prevents the blocking of paste on https://retail.onlinesbi.com/retail/login.htm when I use Chrome on macOS, but that's not the case for Chrome on Windows.
@skyfeature, I see what's happening...
On https://retail.onlinesbi.com/retail/login.htm, in addition to blocking paste
events, they are also preventing Ctrl+v. With the extension disabled on the site, Edit -> Paste doesn't work; with the extension enabled on the site, Edit -> Paste works.
There are many ways that a website creator can prevent copy/paste. I don't want this extension to go down the path of listening to all keyboard events in order to circumvent these other nefarious things that website creators do.
I remembered that I have a Windows VM on my laptop. I installed Chrome on it (Chrome version 65), the extension is working as expected so far.
In my case, I'm using Chromium (not Chrome) builds. Can this be the source of the problem? Сan there be some kind of magic debugging console for extensions, where I'm such a pew pew and see some error messages? :)
@iu0v1: If you enabled "Developer mode" on chrome://extensions, then click on the "background page" link from chrome://extensions/?id=nkgllhigpcljnhoakjkgaieabnkmgdkb, you can then look at the extension's console.
Ok. There is a first result. Appeared after trying to save the rule.
Error in response to tabs.query: TypeError: Cannot read property 'addEventListener' of null
Oh ok, I can work around that easily enough.
I've started the process of publishing a new version via the Chrome Web Store, but it can take an hour or more for it to finish.
The extension was updated, and the errors were gone. But it did not begin to work. After trying to conduct my amateur investigation, I was able to find out that the tab.url
(from here) always returns the same value for any checks. And after a while I found what it was - it was a local tab address that was located in another browser window. This window is nominally considered first in the system. And if you view/switch tabs in it, then everything works as it should. But if you try to view tabs in other windows - tab.url
always returns the address of the last active tab of the first window. Therefore, in the field for the new rule, I always get file: //
, because the active tab of the first window had a link like file:///E:/src/gogs/work/workbench/...
.
What do you think about it?
it was a local tab address that was located in another browser window
Ah, that helped a lot, thanks. I've published a fix to address this problem.
Was updated to 2.2. Now the "new rule" correctly shows the domain, but in general the extension does not work correctly with several windows (rules apply only in the "first" window).
The live dev mode shows that the code remained the same as it was. And I can not verify this for sure, because version 2.2 is not yet available on the github. Judging by the docs for solving this problem, all calls of the chrome.tabs.query
must be called with an additional parameter ("currentWindow": true
or "lastFocusedWindow": true
).
And I can not verify this for sure, because version 2.2 is not yet available on the github.
Whoops, in my rush to publish the update, I forgot to push changes to GitHub.
same issue with me, stopped working after the update :'(
EDIT: Issues in version 2.2
@iu0v1:
Now the "new rule" correctly shows the domain
That's good, as that's what I was fixing.
in general the extension does not work correctly with several windows (rules apply only in the "first" window).
I cannot reproduce this problem, I'm not sure if it's due to Chromium or not.
Judging by the docs for solving this problem, all calls of the chrome.tabs.query must be called with an additional parameter ("currentWindow": true or "lastFocusedWindow": true)
The fix for the popup involved specifying the tab ID -- it seems like chrome.tabs.getCurrent
should work, but it didn't work for me. Limiting the windows in that call to chrome.tabs.query
in background.js
doesn't seem like it will help your issue, as you are having problems when using many windows.
@5AbhishekSaxena: can you be more specific about what's not working?
I checked it on other computers with Chrome - there is a problem there too.
My steps to reproducing the issue:
Open the window number 1, goto https://web.skype.com
(the site itself does not matter, but this is a real example), add a new rule for this site, everything works as it should (the icon is active, copying is "fixed"). After that I open a new tab (google.com, for example) and leave it active in this window. Then I open window number 2, goto https://web.skype.com
and watch that the extension does not work here (the icon is not active, copying with substitution is not "fixed").
Thanks for the steps to reproduce the error. Just published version 2.3.
Oooh yeah! Looks like everything works as it should. Thanks for the fixes, patience and your time! :)
Thanks for providing context and reproduction steps, I would have taken me much longer to find the bugs otherwise.
Hey. The extension stopped working for me. When you try to add a rule, nothing happens after pressing the save button. The icon indicates that the extension is always in an inactive state. What information could I provide to help resolve this issue? Chromium x64 65.0.3325.146
ps: after clicking "add rule" I get
file: //
URI scheme by default (as far as I understand it should automatically insert the link of the current site?)ps2: "JavaScript Regular Expression" is clickable, but it does not open anything