Last modified: 2014-08-05 10:23:06 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T69302, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 67302 - MultimediaViewer thumbnailBeforeProduceHTML hook breaks other extensions parser tests
MultimediaViewer thumbnailBeforeProduceHTML hook breaks other extensions pars...
Product: MediaWiki extensions
Classification: Unclassified
MultimediaViewer (Other open bugs)
All All
: High normal (vote)
: ---
Assigned To: Nobody - You can work on this!
: 68649 (view as bug list)
Depends on:
Blocks: 67216
  Show dependency treegraph
Reported: 2014-06-30 13:57 UTC by Antoine "hashar" Musso (WMF)
Modified: 2014-08-05 10:23 UTC (History)
6 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---

Failing Cite parser test output (1.97 KB, text/plain)
2014-06-30 13:57 UTC, Antoine "hashar" Musso (WMF)

Description Antoine "hashar" Musso (WMF) 2014-06-30 13:57:38 UTC
Created attachment 15782 [details]
Failing Cite parser test output

In gallery, the MultimediaViewer extensions inserts additional metadata such as: data-file-width="1941" data-file-height="220".

When having both Cite and MultimediaViewer extensions installed, the Cite parser test fails for gallery.

The test is '<references> after <gallery> (bug 6164)'

Attaching my output.
Comment 1 Antoine "hashar" Musso (WMF) 2014-06-30 14:08:38 UTC
We really need tests to pass when all wmf extensions are installed together. That is preventing us from progression toward the HHVM migrating. Raising priority to High.
Comment 2 Tisza Gergő 2014-06-30 17:43:12 UTC
Sounds like those tests are too rigid. Maybe they could use some sort of DOM parsing and then check only for the elements which are actually used by the Cite extension, instead of trying to match the exact HTML.

As a more fragile but simpler solution, just replace the parts between <ul>...</ul> with .*? and do a regex match.
Comment 3 Antoine "hashar" Musso (WMF) 2014-07-07 15:14:05 UTC
A bit more detail.

The MultimediaViewer extension registers ThumbnailBeforeProduceHTML , which injects additional elements to the thumb <img> element such as:

  data-file-width="1941" data-file-height="220" 

Cite on its own has now knowledge about that.

A hack would be to have Cite parser tests to clear up registered ThumbnailBeforeProduceHTML hooks and restore them after.  I am wondering whether that sounds acceptable, should I raise the issue on wikitech?

I found out ProofReadpage inserts additional data that badly interact.

A test result with most WMF extensions installed can be found at
Comment 4 Krinkle 2014-07-19 06:59:51 UTC
Modifications to the parser like this will most likely never be supported in Parsoid, and they also make html output less consistent between wikis, and its  imho a bad practice anyway.

I'd recommend finding another way to communicate this data or justify its general usefulness and put it in mediawiki-core.

If that's too complicated for the short term, the test could be simplified by either using a regex for the html output (with wildcards for additional attributes), as implementing a DOM tester is fair amount of extra overhead that requires research/implementation that is unlikely to be devotes to such a minor thing.

Unregistering the hook should be a last resort as it is effectively the same as not running the tests with extensions installed, which is exactly the opposite of what bug 67216 tries to achieve. Such change should leave a FIXME comment and file a bug.
Comment 5 Antoine "hashar" Musso (WMF) 2014-08-05 10:20:47 UTC
*** Bug 68649 has been marked as a duplicate of this bug. ***
Comment 6 Antoine "hashar" Musso (WMF) 2014-08-05 10:22:47 UTC
Lets rephrase the bug.  The MultimediaViewer extension register a thumbnailBeforeProduceHTML hook which ends up breaking other extensions parser tests because the HTML is altered.

We can make parser tests to support regex and adjust the expected HTML with some wildcard regex.
Comment 7 Gerrit Notification Bot 2014-08-05 10:23:03 UTC
Change 151833 had a related patch set uploaded by Hashar:
Support regex to match parser tests output

Note You need to log in before you can comment on or make changes to this bug.