Page MenuHomePhabricator

Flow: JS load of topic with garbled post breaks board interactivity
Closed, ResolvedPublic

Description

At https://en.wikipedia.org/wiki/Wikipedia_talk:Flow/Developer_test_page
If I scroll all the way to the bottom, it stops loading just before this topic, which contains some (garbled/breaking) content:
https://en.wikipedia.org/w/index.php?title=Wikipedia_talk:Flow/Developer_test_page&workflow=050fede1069023bf2b5f90b11c2788f0

Possibly related to the older bug 59939 ("a garbled post must not prevent loading its topic or Board")

Possibly related to the current bug 61066 (only an issue at MediaWiki.org) ("Loading new topics broken on MediaWiki.org")


Version: unspecified
Severity: major
URL: https://en.wikipedia.org/wiki/Wikipedia_talk:Flow/Developer_test_page
See Also:
T61798: $wgCategoryTreeDynamicTag totally broken displaying no results
T70932: Flow: Parsoid should strip inline JavaScript from user posts

Details

Reference
bz61097

Event Timeline

bzimport raised the priority of this task from to High.Nov 22 2014, 2:53 AM
bzimport set Reference to bz61097.
bzimport added a subscriber: Unknown Object (MLST).
Quiddity created this task.Feb 8 2014, 10:00 PM

The function not defined may be a red herring.
The permalink to the post with it is
https://en.wikipedia.org/w/index.php?title=Wikipedia_talk:Flow/Developer_test_page&topic[postId]=050feeb6ed311f2cb98d782bcb072868&workflow=050fede1069023bf2b5f90b11c2788f0#flow-post-050feeb6ed311f2cb98d782bcb072868

; load this alone and you get the error. Bug 59798 mentions that extension CategoryTree inserts JS invocations of these missing functions.

But I can cause a similar JS error by inserting a call to <categorytree> in a post, e.g. https://en.wikipedia.org/wiki/Wikipedia_talk:Flow/Developer_test_page?topic[postId]=0510585577ed50dfae2e842b2b77e916&workflow=0510585577ed50dfae2e842b2b77e916
, and when I do it it doesn't stop older topics from loading.

So perhaps MZMcBride included code in a different fashion, or it's some other nearby post that's breaking pagination.

CategoryTree's ext.categoryTree ResourceLoader module isn't loaded on Flow boards, this could be an issue with other extensions that insert script tags.

The bug in Flow is this: When infinite scroll appends topics into the current Flow board, any JavaScript errors in the HTML of posts that it inserts halt JS execution and so the code to set up pagination of the next 10 topics isn't executed. In more detail, the error occurs in paging.js click() > readTopicList() > done callback > $output.append( topic.rendered), and so the rest of the done() callback doesn't execute. If the problematic post is on the initial page load, the order of execution must be different.

One fix is to append the topic.rendered HTML in a try-catch block, and display an 'Error loading topic _<UUID>(link)_: Exception' in its place. Another is to reorder the done callback so that the pagination is added before appending untrusted blocks of HTML, but that might lead to extra unwanted scroll events.

CategoryTree's ext.categoryTree ResourceLoader module isn't loaded on Flow >boards, this could be an issue with other extensions that insert script tags.

categoryTreeExpandNode is not a function in the ext.categoryTree module (Because categorytree is borked), so not loading it won't affect anything :)

Change 114187 had a related patch set uploaded by Bsitu:
Ignore non-flow javascript error

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

Change 114187 merged by jenkins-bot:
Ignore non-flow javascript error

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

I think we lost this defensive code described in comment #3 in the Flow front-end rewrite. If you visit https://en.wikipedia.org/wiki/Wikipedia_talk:Flow/Developer_test_page?topiclist_offset-dir=fwd&topiclist_limit=10&topiclist_offset-id=rq0wujqfuhwmya82 , note that "ReferenceError: categoryTreeLoadChildren is not defined" appears in the browser console as you scroll down. Starting at "category tree test" the topic reply form isn't collapsed because Flow's JS didn't enhance the topics.

Note this only happens when the Flow JavaScript loads additional topics -- you have to start displaying "before" the set of posts with the bad JS in it. Recreating https://gerrit.wikimedia.org/r/114187 should fix this bug again.

The effect of not guarding against JS errors in loaded code has changed. Instead of older topics not loading, you now get endless loading of the same set of pages, see bug 68932.

Change 155474 had a related patch set uploaded by Bsitu:
JS load of topic with garbled post breaks board interactivity

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

Change 155474 merged by jenkins-bot:
JS load of topic with garbled post breaks board interactivity

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

(In reply to Gerrit Notification Bot from comment #9)

Change 155474 merged by jenkins-bot:
JS load of topic with garbled post breaks board interactivity

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

Patch was merged - assuming this bug is FIXED. If that is not the case: Please reopen and elaborate what is left to do here to get this report fixed.

Mattflaschen-WMF set Security to None.
Quiddity removed a subscriber: Maryana.Dec 19 2014, 1:25 AM