Page MenuHomePhabricator

Triple apostrophe fails
Closed, ResolvedPublic

Description

Given I have a text like '''Foo''' ('''bar''') ping pong(this example)
When I set the cursor inside a triple apostrophe and hit [space]
Then I expect a space to be inserted

Right now nothing happens, and I get the error

TypeError: readyTokens[readyTokens.length] is undefined
https://no.wikipedia.org/w/extensions/CodeMirror/resources/mode/mediawiki/mediawiki.js?96137
Line 928

This line is first statement after this test clause (readyTokens[ readyTokens.length ].pos++; )

					if ( readyTokens.length > 0 ) { // it contains tickets before the point of rollback
						readyTokens[ readyTokens.length ].pos++; // add one apostrophe, next token will be italic (two apostrophes)
						mTokens = readyTokens; // for sending tokens till the point of rollback
					} else { // there are no tikets before the point of rollback

This failure will then halt the execution and further editing will be blocked. Due to this I'll set the priority as high. (Ie. the editor can't progress after this error.)

Event Timeline

jeblad triaged this task as High priority.Aug 24 2017, 5:53 PM
jeblad updated the task description. (Show Details)
Niharika added a subscriber: Pastakhov.

Thanks for reporting, @jeblad. This is indeed high priority.
CC @Pastakhov (just in case you're back from vacation :)

@jeblad Can you try and reproduce this on English or any other wiki? I couldn't.

There are a couple of badly behaving gadgets at nowiki, I would not be surprised if this has something to do with any of them.

Enwiki is on another cluster, that could imply there are something locally on the cluster.

I'll try some wikis…

It also happen on nnwiki, testpage. Same on meta, testpage. Same on enwiki, testpage.

This testing is with "Firefox 54.0 (64-bits)" on Ubuntu 16.10 (64 bits)

Strange, if I set the cursor in the triple apos, then hit a [space], then it will not show up. If I set the cursor again, and then hit [space], then both this and the previous will show up.

This only happen with WikitextEditor (VisualEditor for plain wikicode).

Changing to the account "Jeblad (bot)" did not change anything, the bug is still there. This account is pretty plain as it is used for bot editing.

In Chromium the content in the edit frame disappears when I turn on syntax highlight. Another bug, T174123, and it blocks me from testing this bug.

I can do additional Win10 testing if necessary.

There's definitely something wrong going on there. Even in the first line on https://en.wikipedia.org/w/index.php?title=User:Jeblad/test_of_syntax_highlight when you enter a few spaces between the apostrophes and then try to delete them, the cursor position is not consistent with the point where characters are being deleted from.

I created a sandbox here: https://en.wikipedia.org/wiki/User:NKohli_(WMF)/Syntax_highlight_test and I can't reproduce the bug there. Same for when I tried on another page yesterday. But I can surely reproduce on the ones you created, @jeblad. Can you also test the page above?

No bug while writing in your sandbox! That is weird!

I tried it out on an en.wp article page: https://en.wikipedia.org/w/index.php?title=Frog&action=edit

I can reproduce the bug by trying to add space between triple apostrophes.

This is a page in the main space on nowiki.
Both my account "jeblad" and "jeblad (bot)" shows the bug.

This comment was removed by DannyH.

Changed to "English", still got the bug.

Did a "restore to default settings" and still got the bug.

FWIW, I was also able to reproduce what Jebald describes using the testcase:

'''1''' 2'''3'''

(https://en.wikipedia.org/w/index.php?title=User:Bawolff/sandbox&action=edit)

Change 373980 had a related patch set uploaded (by MaxSem; owner: MaxSem):
[mediawiki/extensions/CodeMirror@master] Fix exception on some combination of quotes

https://gerrit.wikimedia.org/r/373980

The patch seems a likely fix, but still won't explain why it happens to only some users.

Change 373980 merged by jenkins-bot:
[mediawiki/extensions/CodeMirror@master] Fix exception on some combination of quotes

https://gerrit.wikimedia.org/r/373980

This should be fixed on the Beta Cluster now. @jeblad, @Niharika: If you want to test: http://simple.wikipedia.beta.wmflabs.org/.

Seems like it is working, testpage. Any idea why only some editors observed the problem? I assumed the array was out of bounds, forgot to mention that.

Still there are other bugs at the beta cluster. If those exists on simplewiki then they should be weeded out. (Logs out new accounts during editing, abuse warnings on ordinary wikicode, etc.)

Still there are other bugs at the beta cluster. If those exists on simplewiki then they should be weeded out. (Logs out new accounts during editing, abuse warnings on ordinary wikicode, etc.)

We have not heard about such bugs. They don't sound CodeMirror related. Logging out/abuse filter warnings should have nothing to do with CodeMirror. If you can reliably reproduce them with CodeMirror and it works fine without it, please file tickets. Thanks!

Oh, no! ;)

It is something I observed when I logged in with a new account, then it seems like I got logged out each time I tried to save, then got a warning before I could save, but then was returned to a logged in page, and then looped around again. Not sure what caused it, but a hard reload seems to fix it. I have not seen this in production, and because a hard reload fixed it, I would guess some libs and/or cookie are out of sync. (Testing on simplewiki at wmflabs it seems like something is gong on, I'm being logged out and back in.)

There is also an abuse warning, not sure if it is copied from simplewiki or something at wmflabs. During testing I often name the account after the site, ie. "jeblad-wmflabs", but that throw a warning in this case. Not really a bug, but probably someone that has added a rule thinking "wmf" in the account name should always be banned.

None of those are related to CodeMirror.

There is although an error related to CodeMirror, or I guess it is related, where you can copy-paste before CodeMirror is fully loaded. In those cases it seems like only a single line is pasted, even if several lines are copied. It could be something else that creates this, but I guess it is the (re)creation of the editable dom, where the copy is done from a partial dom tree. If I remember right I had this problem before the hard reload. (I can't reproduce this)

Change 374367 had a related patch set uploaded (by MaxSem; owner: MaxSem):
[mediawiki/extensions/CodeMirror@wmf/1.30.0-wmf.15] Fix exception on some combination of quotes

https://gerrit.wikimedia.org/r/374367

Change 374367 merged by jenkins-bot:
[mediawiki/extensions/CodeMirror@wmf/1.30.0-wmf.15] Fix exception on some combination of quotes

https://gerrit.wikimedia.org/r/374367

Mentioned in SAL (#wikimedia-operations) [2017-08-28T19:03:09Z] <niharika29@tin> Synchronized php-1.30.0-wmf.15/extensions/CodeMirror/: Fix exception on some combination of quotes T174060 (duration: 00m 44s)

MaxSem claimed this task.