This makes the code easier to read to avoid jumps and improves
encapsulation by not allowing the rest of the class having access to the
logic. Of course, if needed then some code can be refactored out again
but for now let's not do YAGNI.
Change-Id: Ic37524e386fc04fd67e33768417ff8425f85b0ca
Due to a botched signature change on the Parsoid side, in -a8 Parsoid
only accepts `string|int` for ContentMetadataCollector::addCategory()
and in -a9 Parsoid only accept `LinkTarget`. The ParserOutput in
core, of course, accepts both. So move the code which merges
categories into the section of ContentMetadataCollector::collectMetadata()
where we know that the CMC we're merging with is really a ParserOutput.
Change-Id: I0715f4fbc870e401e5759dd7c7a3c19077c40a6a
With the migration to JSDoc, the documentation for
`mw.notification.defaults` was no longer visible. Make it visible again
by using `@type` instead of `@property` and document its fields in a
machine-readable form. Put this machine-readable documentation in a
`@typedef` so that it can be referred to from the documentation of
`mw.notification.notify` and `Notification`.
Bug: T352308
Change-Id: If9762d040289cdc57d9153dc1fccba8047986713
Update the book sources (lots of rotten links), add new special
page name translations (and fix a few old ones), and add more
characters used in Norwegian words to the linktrail for
Norwegian Bokmål and Norwegian Nynorsk.
Change-Id: I8dc1cc416ce939887f464c00cc30dff4d6819b63
mediawiki.page.ready is marked as not to be migrated to JSDoc, but it is
where several commonly used hooks are first fired. For now, we document
these in jsdocs.types.js so that other places in JSDoc we can reference
the hook with @fires.
Bug: T352308
Change-Id: I255e1ee96703b31605abcd596b3113e96d684b90
API modules are high level request handler, lower level code should not
depend on them.
This patch solves the problem only partially, since it leaves references
to ApiUpload in AssembleUploadChunksJob and PublishStashedFileJob. These
jobs were already accessing ApiMain, so while this does not fully resolve
the problem, it reduces it.
Change-Id: I39c9e30cfb2860c573eed8a791f1a292a83cbd76
Changes:
* Switch from mixed to string|null since cookies always cast
to a string. For example `mw.cookie.set('foo',6)` results in '6'
and `mw.cookie.set('foo',[1,2,3])` results in '1,2,3'.
Bug: T35230
Change-Id: I4a27abe6b430fef75506df129f3168dcc4bbd565
The previous implementation was using an ad-hoc regular expression which
was matching inside the data-mw attribute of Parsoid output, eg:
<sup about="#mwt42" [...] typeof="mw:Extension/ref mw:Error" data-mw="{"name":"ref","attrs":{"name":"infobox_stats_ref_rail"},"body":{"html":"<style data-mw-deduplicate=\"TemplateStyles:r1133582631\" typeof=\"...">
After substitution, the <link> element inserted contained " instead of
" and so broke out of the attribute.
Instead use a proper HTML tokenizer (via wikimedia/remex-html) so that
we don't allow bogus matches inside attribute values.
To fix up tests:
* Don't deduplicate styles when parsing UX messages (also helps performance)
* Don't deduplicate styles in ContentHandler integration tests
* Don't deduplicate styles by default in parser tests
(unless explicit option is set)
Depends-On: Id9801a9ff540bd818a32bc6fa35c48a9cff12d3a
Depends-On: I5111f1fdb7140948b82113adbc774af286174ab3
Followup-To: Ic0b17e361bf6eb0e71c498abc17f5f67f82318f8
Change-Id: I32d3d1772243c3819e1e1486351d16871b6e21c4