Page MenuHomePhabricator

MobileFrontend editor crashes on certain block messages due to issue with .jqueryMsg.parser
Closed, ResolvedPublic3 Estimated 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 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 Web-Team-Backlog; removed Language-Team.

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. :)

^ @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 set the point value for this task to 3.Apr 24 2018, 4:17 PM

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 moved this task from Doing to Needs Code Review on the Readers-Web-Kanbanana-Board-Old board.
pmiazga subscribed.

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.

@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!

Looks good. Checked editing on beta as well.