Page MenuHomePhabricator

MobileFrontend editor crashes on certain block messages due to issue with .jqueryMsg.parser
Closed, ResolvedPublic3 Story Points

Description

When I click the editor the editor fails to load. It appears to relate to a specific block message and its unparseable (by JavaScript) wikitext. You can replicate this by clicking mobile edit button on https://reading-web-staging.wmflabs.org/wiki/San_Francisco#/editor/0

Expected: It should show a generic toast telling the user they are blocked

More information

Problematic block reason:

"__NOEDITSECTION____NOTOC__↵{| id="mw-blocked-text" style="border:2px solid #000; width:100%; margin:0 auto 6px auto;"↵|↵<div style="width:100%; margin:auto; text-align:center;"><div style="font-size:180%; color:#ff0000;"><br>'''You are currently unable to edit Wikipedia.'''</div>↵'''''You are still able to view pages''', but you are not currently able to edit, move, or create them.''↵</div>↵<div style="margin:auto; width:70%;">↵<div style="text-align:justify;">↵Editing without an account from <ip> is disabled as it is a [[private IP]] range. This is probably a result of a problem with your Internet connection.↵↵You may be able to edit if you [[Special:UserLogin|log in]] or [[Special:CreateAccount|create an account]].↵</div>↵</div>↵|}"
id
:
0

Error:

VM2867:65 Uncaught Error: Parse error at position 27 in input: __NOEDITSECTION____NOTOC__
{| id="mw-blocked-text" style="border:2px solid #000; width:100%; margin:0 auto 6px auto;"
|
<div style="width:100%; margin:auto; text-align:center;"><div style="font-size:180%; color:#ff0000;"><br>'''You are currently unable to edit Wikipedia.'''</div>
'''''You are still able to view pages''', but you are not currently able to edit, move, or create them.''
</div>
<div style="margin:auto; width:70%;">
<div style="text-align:justify;">
Editing without an account from 10.68.16.75 is disabled as it is a [[private IP]] range. This is probably a result of a problem with your Internet connection.

You may be able to edit if you [[Special:UserLogin|log in]] or [[Special:CreateAccount|create an account]].
</div>
</div>
|}
    at mw.jqueryMsg.parser.wikiTextToAst (<anonymous>:65:430)
    at <anonymous>:86:262
    at fire (load.php?debug=false&lang=en&modules=jquery%2Cmediawiki&only=scripts&skin=minerva&version=1oy6i1n:46)
    at Object.fireWith [as resolveWith] (load.php?debug=false&lang=en&modules=jquery%2Cmediawiki&only=scripts&skin=minerva&version=1oy6i1n:47)
    at Object.deferred.(anonymous function) [as resolve] (https://reading-web-staging.wmflabs.org/w/load.php?debug=false&lang=en&modules=jquery%2Cmediawiki&only=scripts&skin=minerva&version=1oy6i1n:51:337)
    at <anonymous>:131:154
    at fire (load.php?debug=false&lang=en&modules=jquery%2Cmediawiki&only=scripts&skin=minerva&version=1oy6i1n:46)
    at Object.fireWith [as resolveWith] (load.php?debug=false&lang=en&modules=jquery%2Cmediawiki&only=scripts&skin=minerva&version=1oy6i1n:47)
    at Object.deferred.(anonymous function) [as resolve] (https://reading-web-staging.wmflabs.org/w/load.php?debug=false&lang=en&modules=jquery%2Cmediawiki&only=scripts&skin=minerva&version=1oy6i1n:51:337)
    at Object.<anonymous> (<anonymous>:16:410)

Developer notes

This is tricky. I've setup T191939 to fix the root cause of the problem.
In the mean time I think we need to wrap this in a try/catch and default to a standard error message for this kind of block.

Event Timeline

Jdlrobson created this task.Apr 4 2018, 8:43 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptApr 4 2018, 8:43 PM
Jdlrobson updated the task description. (Show Details)Apr 4 2018, 8:44 PM
Jdlrobson updated the task description. (Show Details)
Jdlrobson renamed this task from MobileFrontend editor crashes on certain block messages due to issue with .jqueryMsg.parser to Regression: MobileFrontend editor crashes on certain block messages due to issue with .jqueryMsg.parser.Apr 4 2018, 8:46 PM
Jdlrobson edited projects, added Readers-Web-Backlog; removed Language-Team.
ovasileva triaged this task as High priority.Apr 5 2018, 10:24 AM

The change in T190901 was to MinervaNeue not MobileFrontend.

Additionally, by the time it reaches the changed line the wikitext has already been parsed and you only have access to the parsed HTML, this change simply strips the HTML that has already been given.

Lastly, I can't find any calls to the wikiTextToAst() method within MinervaNeue.

Not saying this shouldn't be fixed (it should) but from the backtrace I don't see how it could possibly be related to T190901.

Right. This code is showing up in EditorOverlay so is not going through the exact same code path. Sorry to jump to that assumption! The issue looks like its in EditorOverlay::_loadContent

Now I look more closely this is what's happening:

const blockReason = "__NOEDITSECTION____NOTOC__↵{| id=\"mw-blocked-text\" style=\"border:2px solid #000; width:100%; margin:0 auto 6px auto;\"↵|↵<div style=\"width:100%; margin:auto; text-align:center;\"><div style=\"font-size:180%; color:#ff0000;\"><br>'''You are currently unable to edit Wikipedia.'''</div>↵'''''You are still able to view pages''', but you are not currently able to edit, move, or create them.''↵</div>↵<div style=\"margin:auto; width:70%;\">↵<div style=\"text-align:justify;\">↵Editing without an account from 10.68.16.75 is disabled as it is a [[private IP]] range. This is probably a result of a problem with your Internet connection.↵↵You may be able to edit if you [[Special:UserLogin|log in]] or [[Special:CreateAccount|create an account]].↵</div>↵</div>↵|}"
parser = new mw.jqueryMsg.parser();
ast = parser.wikiTextToAst( blockReason );

So looks like a lot of people who are blocked are getting no feedback whatsoever that they are blocked :-S

Jdlrobson renamed this task from Regression: MobileFrontend editor crashes on certain block messages due to issue with .jqueryMsg.parser to MobileFrontend editor crashes on certain block messages due to issue with .jqueryMsg.parser.Apr 5 2018, 2:45 PM

Hey @TBolliger will your team be working on this as part of your sprint? Just trying to plan some work our side.

The Anti-Harassment Tools team does have a quarterly goal to improve the experience for blocked users on mobile web, which we are planning to accomplish with T165535: Block notices on mobile web for logged-in users provide insufficient information about the block. Fixing this defect would also achieve that goal.

We could take this on when we're finished with T165535, but I would prefer your team to tackle it, if possible. :)

Restricted Application added a subscriber: MGChecker. · View Herald TranscriptApr 10 2018, 4:48 PM
Jdlrobson updated the task description. (Show Details)Apr 10 2018, 11:14 PM

^ @TBolliger to keep this simple I suggest we just catch this error. I've opened another task T191939 to try and find a better solution.

Jdlrobson updated the task description. (Show Details)Apr 11 2018, 4:18 PM
Jdlrobson set the point value for this task to 3.Apr 24 2018, 4:17 PM
pmiazga claimed this task.Apr 26 2018, 3:56 PM
pmiazga moved this task from To Do to Doing on the Readers-Web-Kanbanana-Board-Old board.

Change 429528 had a related patch set uploaded (by Pmiazga; owner: Pmiazga):
[mediawiki/extensions/MobileFrontend@master] Show generic error message when we cannot decode block reason

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

pmiazga removed pmiazga as the assignee of this task.Apr 27 2018, 10:40 PM
pmiazga moved this task from Doing to Needs Code Review on the Readers-Web-Kanbanana-Board-Old board.
pmiazga added a subscriber: pmiazga.

Change 429528 merged by jenkins-bot:
[mediawiki/extensions/MobileFrontend@master] Show generic error message when we cannot decode block reason

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

This can be tested on http://reading-web-staging.wmflabs.org/wiki/Louisiana_Purchase_Exposition_dollar
Any click to edit should result in a toast message saying you are blocked.

This can be tested on http://reading-web-staging.wmflabs.org/wiki/Louisiana_Purchase_Exposition_dollar

Any click to edit should result in a toast message saying you are blocked.

@Jdlrobson not seeing the toast there. However I do see it when clicking the edit pen on https://reading-web-staging.wmflabs.org/wiki/San_Francisco#/editor/0.

Also let me know if it's just the functionality we're testing, or if there's anything else I should be looking at/for

Weird, maybe it's IP related. Just wanted to make sure you saw this. I think we can move this to sign off it's rare enough that this shouldn't happen too often.

alexhollender added a subscriber: alexhollender.

@Jdlrobson - should this go through QA - I'm not entirely sure how to test.

No need for QA at this IMO. This is a rare problem and temporary solution. I'd suggest QAing T165535 when that's done instead. If you don't feel comfortable with that, a quick QA on the beta cluster to check editing is still working should suffice, otherwise feel free to close!

ovasileva closed this task as Resolved.May 3 2018, 10:16 AM

Looks good. Checked editing on beta as well.