Page MenuHomePhabricator

Parsoid needs a way to unregister extension modules for testing
Open, MediumPublic

Description

Core associates tag extensions with a particular Parser instance. That's probably *too* fine-grained.

Parsoid associates extension modules with a SiteConfig. That may be too coarse-grained -- perhaps an extension would like to register a new tag, but only for recursive parses inside its own tag, like:

vanilla wikitext
<my-tag-extension>
this is ''also'' wikitext, but in here <this-new-tag>works</this-new-tag>!
</my-tag-extension>

That would push extension registration all the way into the parseOpts passed to wikitextToDOM. That might be too far.

*Anyway*, in the short term we can just add a method to unregister extension modules in the SiteConfig. Then callers who want to temporarily register an extension (for example, in a test case) have a way to clean up after themselves. (Alternatively the test case could replace the ParsoidSiteConfig service to substitute their own SiteConfig and throw it away afterward?) Longer term we should figure out if extension registration should move from SiteConfig -- perhaps a one-time registration can stay at top-level but there's a way to enable/disable registered extensions on a finer-grained basis.

Event Timeline

ssastry triaged this task as Medium priority.Dec 16 2020, 4:37 PM
ssastry moved this task from Needs Triage to Testing on the Parsoid board.

Change 649953 had a related patch set uploaded (by C. Scott Ananian; owner: C. Scott Ananian):
[mediawiki/services/parsoid@master] Allow Parsoid extension modules to be unregistered

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

Change 649953 merged by jenkins-bot:
[mediawiki/services/parsoid@master] Allow Parsoid extension modules to be unregistered

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

Change 651570 had a related patch set uploaded (by Subramanya Sastry; owner: Subramanya Sastry):
[mediawiki/vendor@master] Bump wikimedia/parsoid to 0.13.0-a21

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

Change 651570 merged by jenkins-bot:
[mediawiki/vendor@master] Bump wikimedia/parsoid to 0.13.0-a21

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