Can't copy comments on Stack Overflow

Users and developers helping users with generic and technical Pale Moon issues on all operating systems.

Moderator: trava90

Forum rules
This board is for technical/general usage questions and troubleshooting for the Pale Moon browser only.
Technical issues and questions not related to the Pale Moon browser should be posted in other boards!
Please keep off-topic and general discussion out of this board, thank you!
User avatar
Lunokhod
Lunatic
Lunatic
Posts: 469
Joined: 2017-04-20, 21:25
Contact:

Can't copy comments on Stack Overflow

Unread post by Lunokhod » 2019-10-26, 19:01

https://stackoverflow.com/questions/2240162/how-do-i-find-a-stack-overflow-problem-in-linux
I can copy the questions and answers, but if I highlight and right click copy the comments, when I paste there is nothing there. I tried the latest unstable Pale Moon with a clean profile and it is the same. Copy pasting the comments works in Chromium though. It seemed a bit unusual.
Wait, it's all Ohio? Always has been...

User avatar
athenian200
Contributing developer
Contributing developer
Posts: 1536
Joined: 2018-10-28, 19:56
Location: Georgia

Re: Can't copy comments on Stack Overflow

Unread post by athenian200 » 2019-10-26, 20:58

I've been able to reproduce this bug on Solaris and Windows, but it's very much worth noting that it requires a specific set of circumstances.

You have to select the entire comment in order to trigger the bug, otherwise copy/paste works fine. So for instance, I can do this:

Code: Select all

really - why -1?. sizeof(ben) = 8000, ben has 8000 slots – pm100 Feb 10 '10 at 20:5
But if I try to copy the entire line, including the 4 at the end, it goes blank. It's mostly likely to show up when trying to select and copy multiple comments at once, sometimes doing just one comment won't trigger the bug.

It's like there's some kind of hidden character at the end of each comment that's causing the copy/paste function to fail, or forcing it to clear itself out. OP, can you confirm that you can also work around this issue by avoiding selecting the last character of each comment?

EDIT: One other thing worth noting... PM did not inherit this bug from Mozilla. I tested in Firefox 52.6 ESR, and this issue does not appear there. It does appear in Basilisk. So whatever is causing this, it's definitely UXP-specific, and appears to be platform-independent.
"The Athenians, however, represent the unity of these opposites; in them, mind or spirit has emerged from the Theban subjectivity without losing itself in the Spartan objectivity of ethical life. With the Athenians, the rights of the State and of the individual found as perfect a union as was possible at all at the level of the Greek spirit." -- Hegel's philosophy of Mind

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35620
Joined: 2011-08-28, 17:27
Location: Motala, SE
Contact:

Re: Can't copy comments on Stack Overflow

Unread post by Moonchild » 2019-10-26, 21:57

I'm unable to reproduce.

I tried to select various parts including comments and surrounding text, and it pasts perfectly in notepad++ every time.
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

User avatar
athenian200
Contributing developer
Contributing developer
Posts: 1536
Joined: 2018-10-28, 19:56
Location: Georgia

Re: Can't copy comments on Stack Overflow

Unread post by athenian200 » 2019-10-26, 22:46

It seems slightly easier to reproduce with the comments on the answer with -4 votes near the bottom.

If I select all comments and surrounding text, everything except the comments gets copied. If I select part of a comment omitting the final character in the timestamp, that comment can be copied. But if I select multiple comments or include the final character in the timestamp, it doesn't work.

The weird thing about it is that with comments other than the bottom one with all the downvotes, it occasionally works and occasionally doesn't.

Two of the three browsers I tested on were absolutely stock installs with nothing added. I started wondering if myself and the OP have a hardware problem in common, so I even tested it on my Surface Book running Windows 10, the problem appears there as well. There's no extensions at all installed on Pale Moon on that machine, it's a fresh install.
"The Athenians, however, represent the unity of these opposites; in them, mind or spirit has emerged from the Theban subjectivity without losing itself in the Spartan objectivity of ethical life. With the Athenians, the rights of the State and of the individual found as perfect a union as was possible at all at the level of the Greek spirit." -- Hegel's philosophy of Mind

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35620
Joined: 2011-08-28, 17:27
Location: Motala, SE
Contact:

Re: Can't copy comments on Stack Overflow

Unread post by Moonchild » 2019-10-26, 22:51

Still unable to reproduce.

Code: Select all


That's a very suspicious line, I think that should have been

memset(&ben, 0, sizeof(ben) - 1);

You got memset to go one over on the array....

Hope this helps, Best regards, Tom.
shareeditflag
answered Feb 10 '10 at 20:46 
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

New Tobin Paradigm

Re: Can't copy comments on Stack Overflow

Unread post by New Tobin Paradigm » 2019-10-26, 22:53

Gremlins. They are targeting you specifically, my friend.

User avatar
athenian200
Contributing developer
Contributing developer
Posts: 1536
Joined: 2018-10-28, 19:56
Location: Georgia

Re: Can't copy comments on Stack Overflow

Unread post by athenian200 » 2019-10-26, 23:45

https://www.dailymotion.com/video/x7n3hll

Here's a video of me reproducing the bug, in case it helps anyone.
"The Athenians, however, represent the unity of these opposites; in them, mind or spirit has emerged from the Theban subjectivity without losing itself in the Spartan objectivity of ethical life. With the Athenians, the rights of the State and of the individual found as perfect a union as was possible at all at the level of the Greek spirit." -- Hegel's philosophy of Mind

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35620
Joined: 2011-08-28, 17:27
Location: Motala, SE
Contact:

Re: Can't copy comments on Stack Overflow

Unread post by Moonchild » 2019-10-27, 00:35

Yes it helped. At least I know how to reproduce this now.

Not sure why this happens, although the entire UL of comments has stacked event handlers for both clicks and keypresses that have preventDefault(); this might cancel the clipboard operation on click/keypress? More research required, I'm afraid.
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

User avatar
Lunokhod
Lunatic
Lunatic
Posts: 469
Joined: 2017-04-20, 21:25
Contact:

Re: Can't copy comments on Stack Overflow

Unread post by Lunokhod » 2019-10-27, 00:56

Yes, it does seem to be the last character, I can copy this:

There's nothing wrong with the line, but it's completely unnecessary, since ={0} already guarantees that the memory will be filled with zeroes. – Porculus Feb 10 '10 at 21:07

But if I highlight it beyond the pencil symbol it won't copy. I tried saving the page and copying that bit of comment section of html into tryit editor:
https://www.w3schools.com/tryit/tryit.asp?filename=tryhtml_default
from <li to /li> and it showed a pencil at the end but didn't cause the problem, although Linux text editors tend to auto convert Mac and Windows line endings, and possibly strip out null characters and ASCII escape codes etc. I think.
Off-topic:
The thing with gremlins is once you know what they look like you see how many there are... :mrgreen:
https://www.youtube.com/watch?v=6ZaEh4s1Iw4
Wait, it's all Ohio? Always has been...

User avatar
athenian200
Contributing developer
Contributing developer
Posts: 1536
Joined: 2018-10-28, 19:56
Location: Georgia

Re: Can't copy comments on Stack Overflow

Unread post by athenian200 » 2019-10-27, 01:48

All right, I decided to do my testing with archived Basilisk versions since that won't require me to restart Pale Moon (and because it uses date stamps rather than versions). I don't think it will change the results for this kind of bug, but I can test old PM versions for completeness later on.

This bug first appears in Basilisk in the December 18, 2018 build. The bug does not exist in the November 7th build from that year, or any earlier build all the way back to Firefox 52.6 ESR. So whatever caused this happened between November 7th and December 18th of 2018.

So that gives us a timeline, at least, though that's likely still a lot of commits to sift through.

EDIT: I've checked Pale Moon builds, they give a similar but slightly different timeline that appears to overlap with the Basilisk timeline. The last Pale Moon version without the bug is 28.1.0, apparently released on/around September 17th. The first one with it is Pale Moon 28.2.0, released on November 11th 2018. If my theory is correct, the same piece of code is likely causing the same problem in both browsers, since it is reproducible in both and they share a codebase (kind of an arrogant assumption on my part given how new I am to this, but feel free to shoot it down if I'm dead wrong).

So if I'm right about this... that means we can use the release dates of both browsers to narrow this down further. Since the November 7th build of Basilisk worked, and the November 11th build of Pale Moon didn't, that actually places the commit in question between approximate November 7th and November 11th 2018 (assuming the upload dates in the Pale Moon archives are close to the actual release date).

EDIT2: I checked the news page, and it shows different release dates for PM versions than the archives do. September 20th for Pale Moon 28.1.0, and November 13th for Pale Moon 28.2.0. If THOSE dates are actually the correct ones, then the issue would have appeared between November 7th and November 13th.
"The Athenians, however, represent the unity of these opposites; in them, mind or spirit has emerged from the Theban subjectivity without losing itself in the Spartan objectivity of ethical life. With the Athenians, the rights of the State and of the individual found as perfect a union as was possible at all at the level of the Greek spirit." -- Hegel's philosophy of Mind

User avatar
therube
Board Warrior
Board Warrior
Posts: 1651
Joined: 2018-06-08, 17:02

Re: Can't copy comments on Stack Overflow

Unread post by therube » 2019-10-27, 12:48

When you copy in PM (SM), CLCL shows the copied "text" as "(UNICODE TEXT)".

Now just not sure what that means, but I've see it before, enough, to know that when that is said, what(ever it is) cannot be pasted (into places where I would normally paste stuff). Perhaps if you were using a unicode text editor, it would paste as expected? (Sometimes I'll triple-click a "title", & whatever happened to get selected, actually extends past the expected end of the title & whatever that "extra" part is, does not allow the paste. If I explicitly copy the text of the title, it can be pasted as expected.)


This only happens (on stackoverflow) where there are comments made to a particular reply, & where your copy selection extends past 1 of those comments.

Note that each comment is demarcated with a "line" separator.

Perhaps it is that that is causing the issue?

You only need to copy from the last character of a particular comment (which in this case would be the last digit of the time of the post) & the first character of the following comment (which in this case is the @ symbol) to duplicate this issue.


FF Quantum looks to ignore this "UNICODE TEXT" part & only copies the textual parts, such that it can be pasted as expected.

User avatar
athenian200
Contributing developer
Contributing developer
Posts: 1536
Joined: 2018-10-28, 19:56
Location: Georgia

Re: Can't copy comments on Stack Overflow

Unread post by athenian200 » 2019-10-28, 08:03

Okay, I found out why older versions don't have the bug, and I also found a very good workaround, but I don't know enough about web development to understand the root of it. One weird thing I noticed is that the bug does show up on older versions if you DON'T use a clean profile. I noticed you have to use a clean profile on the older binaries to have it work, any profile that's touched a newer version is "contaminated." That was weird to me, probably should have signaled to me it was a profile/preference default issue, but I didn't have the experience to come to that conclusion.

I don't recommend trying this at home, but I took the working Pale Moon 28.1.0 and the broken 28.2.0 and swapped files between them. I found that I could swap almost every file in from 28.2.0 into 28.1.0 and still have it work. Except for one, and I got really lucky with which file it was: omni.ja

So I extracted both .jar files and ran a diff on them. Several preferences in all.js were changed between versions while everything else was the same (confirming what I'd seen in the repos but decided was too minor to be that significant), so I went down the list and I was honestly shocked at which one did the trick...

general.useragent.compatMode.version has to be set back to 52.9 for copy/pasting comments on Stack Overflow to work! And you also have to enable gecko compat and firefox compat mode for this to work. So whatever they're using, Stack Overflow needs to believe we're Firefox 52 in order to do whatever it does to prevent this issue from occuring. Which makes sense because I knew it wasn't occuring in Firefox 52 itself, but that is apparently because sites sniff for Firefox 52 to prevent this issue from occurring in the first place.

I probably should have just trusted my original reasoning and not dismissed this commit as irrelevant when it was basically the only one that came up on this view that changed a file:

https://github.com/MoonchildProductions ... 2f6dfde1fe

But basically I followed the old "What, when, and where?" methodology. First I established what was happening (the video), then I tried to establish when it happened (hence testing multiple versions), and finally I tried to figure out where it was happening (swapping files around between the working and non-working version to figure out where the broken component is).
"The Athenians, however, represent the unity of these opposites; in them, mind or spirit has emerged from the Theban subjectivity without losing itself in the Spartan objectivity of ethical life. With the Athenians, the rights of the State and of the individual found as perfect a union as was possible at all at the level of the Greek spirit." -- Hegel's philosophy of Mind

User avatar
Cassette
Lunatic
Lunatic
Posts: 395
Joined: 2015-05-08, 14:30
Location: Wichita, KS

Re: Can't copy comments on Stack Overflow

Unread post by Cassette » 2019-10-28, 09:34

To boil that down to something a little more digestible, you can make it work by creating a custom user agent override for stackoverflow.com and use something like

Code: Select all

Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.9) Gecko/20100101 Firefox/52.9 (Pale Moon)
Obviously in Linux it would be a little different. I don't currently have a Linux environment setup to test.

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35620
Joined: 2011-08-28, 17:27
Location: Motala, SE
Contact:

Re: Can't copy comments on Stack Overflow

Unread post by Moonchild » 2019-10-28, 10:30

So, ultimately it's because some javascript on stackoverflow gets in the way.
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

_yuyu_
Lunatic
Lunatic
Posts: 253
Joined: 2015-03-02, 14:18

Re: Can't copy comments on Stack Overflow

Unread post by _yuyu_ » 2019-10-28, 10:51

Cassette wrote:
2019-10-28, 09:34
you can make it work by creating a custom user agent override for stackoverflow.com and use something like

Code: Select all

Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.9) Gecko/20100101 Firefox/52.9 (Pale Moon)
It works on Windows, great!
Pale Moon 32-bit on Win 7 x64

User avatar
athenian200
Contributing developer
Contributing developer
Posts: 1536
Joined: 2018-10-28, 19:56
Location: Georgia

Re: Can't copy comments on Stack Overflow

Unread post by athenian200 » 2019-10-28, 18:14

Cassette wrote:
2019-10-28, 09:34
Obviously in Linux it would be a little different. I don't currently have a Linux environment setup to test.
The UA strings for Solaris and Linux would look like this:

Code: Select all

Mozilla/5.0 (X11; SunOS i86pc; rv:52.9) Gecko/20100101 Firefox/52.9 (Pale Moon)

Code: Select all

Mozilla/5.0 (X11; Linux i686; rv:52.9) Gecko/20100101 Firefox/52.9 (Pale Moon)
"The Athenians, however, represent the unity of these opposites; in them, mind or spirit has emerged from the Theban subjectivity without losing itself in the Spartan objectivity of ethical life. With the Athenians, the rights of the State and of the individual found as perfect a union as was possible at all at the level of the Greek spirit." -- Hegel's philosophy of Mind

Locked