| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The way ResourceLoaderModule is currently set up, when packagedFiles
are used to declare files, only a "main" script is initially executed,
and other files are executed with require("./file path"). This is not
the same with using "scripts" to declare your module files. Such
scripts are concatenated together into one large script, and require()
can only load modules in this instant.
When you use require() in such script (outside a package file),
we directly use mw.loader.require().
What this fix does is, if require("./*") is encountered in
mw.loader.require(), it throws a descriptive error early, instead of
later in a more confusing way as `Module "." is not loaded`.
Bug: T386833
Change-Id: I97a572c9fefa41e6b97db1d9fd86706490da5c4f
|
|
|
|
|
| |
Depends-On: Ia5b7ebab3dd16ffb463b0d55979e0c094aa6b5ab
Change-Id: Ib34a15f9c8e2d1e6e4488fe3523a2babb7174b08
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The environment checks in QUnit.begin() are important to run always,
even when e.g. running with component=EventLogging as filter.
However, the "testrunner" tests are only useful when changing
the assert methods themselves. There is no need to re-run those,
just as there as no need to run any other MediaWiki core tests,
when testing a non-core component.
By moving these out to their own file, part of the 'test.MediaWiki'
module, these still run by default and when selecting "MediaWiki core"
component, but not when selecting another component. Previously,
if you selected e.g. component "EventLogging" the output contained
a visible "testrunner" result, which was not part of that component
which seems surprising/confusing and certainly not needed.
Bug: T250045
Change-Id: I350adf0f9a39796f7052fd5b900acc0ca1a4d4e8
|
|\| |
|
| |
| |
| |
| |
| | |
Bug: T250045
Change-Id: I53ec35a9b61c5fb8d6bba2cba4dfa21078f8ca2d
|
|\| |
|
| |
| |
| |
| |
| | |
Bug: T250045
Change-Id: Ic8372862cb64cb64919e7dee174558243f33324f
|
|/
|
|
| |
Change-Id: I34bb289e941751ae4722c708511326a2a5431bfc
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Allows passing a user agent in the constructor, which will be sent
in the Api-User-Agent header (changing the User-Agent header is
not possible under the browser security policy, and it also holds
its own valuable information).
Setting Api-User-Agent was possible already via the `headers` option,
but was uglier and less obvious. Also, this patch adds a default of
"MediaWiki-JS/<version>"
* different from the MediaWiki PHP user agent ("MediaWiki/<version>"),
* clearly related to MediaWiki frontend JavaScript
* avoid generic words like "mw.Api" which are easily mistaken for
any number of "MediaWiki" "API" things.
Usage:
const api = new mw.Api( { userAgent: 'MyGadget/1.0.1' } );
This allows gadgets, user scripts, MediaWiki core, and extension code
to easily identify which client makes an API request.
Identifying the client helps:
* WMF and other sysadmins, to debug and find the source of a problem.
* MediaWiki maintainers, to assess what disruption would be caused
by backwards-incompatible changes in the API response or with
proactively fixing clients before such changes.
* Gadget and extension maintainers, by enabling them to use
Special:ApiFeatureUsage to check whether they rely on deprecated
APIs.
Bug: T373874
Change-Id: I08cbe95675c7e3b6b3a20875f3d061afdc04efd6
|
| |
| |
| |
| |
| |
| | |
Disable all new issues for now.
Change-Id: Ib145e2cd4f455355bb11857ae68cd05cb432924e
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Why:
- mw.language.convertGrammar is responsible for implementing grammatical
transformations for inflected languages, similar to its backend
counterpart Language::convertGrammar.
- The default implementation may be overridden by language-specific
implementations loaded dynamically based on the user language.
- Both the default implementation and all language-specific
implementations suffer from a bug where requesting a case
transformation for which word-specific casing rules are defined will
return "undefined" if the case transformation was requested for a word
for which no word-specific casing rule exists.
- There are QUnit tests for the logic, but they only run if the user
language matches the language being tested. This means they never run
in CI and cannot even be run locally, since Special:JavaScriptTest has
been forcing the user language to "qqx" for more than five years.
What:
- Place language-specific convertGrammar overrides into a new
convertGrammarMapping property keyed by language code to allow
loading more than one simultaneously.
- Introduce and use a new 'mediawiki.language.grammar.testdata'
test-only RL module that loads every language-specific convertGrammar
override.
- Introduce and use a new 'mediawiki.language.testdata' test-only RL
module that loads language-specific rules for languages that we have
QUnit tests for. Since this only covers less than two dozen languages,
there'd be no value in loading this data for all 300+ languages
supported by MediaWiki.
- Update QUnit tests for convertGrammar to override the user language
and language rules before each case.
- Ensure word-specific casing rules always take precedence over
language-specific convertGrammar implementations to avoid repeated
boilerplate in language-specific code.
- Don't attempt to use word-specific casing rules for words that do not
have one.
- As we're here, add matching PHPUnit tests for Language* subclasses
that had preexisting QUnit tests but no PHPUnit tests.
Bug: T388370
Change-Id: I3f2432f5f801c2a7e4390c2ff2038363a36e2ed9
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
When called, registering hook handlers will log a deprecation warning
via mw.log.makeDeprecated() with the key 'hook_myhookname'.
Deprecation warnings are logged for every handler, only if there is at
least one handler.
Bug: T383381
Co-authored-by: Timo Tijhof <krinkle@fastmail.com>
Change-Id: Ia8717563d09d7076cee0a1344fc82c66dc0a1e10
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Why:
- We would like to make the user links associated with expired temporary
accounts visually distinguishable from non-expired ones using
strikethrough styling and an information tooltip.
- The designs call for using Codex tooltips for the latter. Using the
Vue directive for this would require us to take a dependency on Codex
and Vue for every page that renders user links, and render a small
Vue.js app for each expired temporary user link, which does not seem
practical.
- We can, however, use Codex styles and implement our own simple tooltip
functionality without taking on unnecessary dependencies.
- This requires adding a new RL module to every page that uses
userLink(), so we should update userLink() to do this for us instead
of having to update every core and extension page that needs this.
What:
- Add a strikethrough to expired temporary account links
as per the design specification.
- Render a tooltip, hidden by default, for expired temporary account
links that is styled using Codex styles.
- Implement a simple jQuery tooltip handler for expired temporary
account links.
- Avoid caching expired temporary account link in UserLinkRenderer to
ensure each of them receives a unique ID.
- Add required ResourceLoader modules directly to the output in
userLink().
Bug: T358469
Change-Id: I4f70ff15becbc4991c4f1b0307a14d5354c79dc1
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
> WARNING: (sort-rowspan-error)
This is contributing to warning fatigue in CI, with other stuff
slipping in and being missed because it is missed in the normalcy
and the noise.
This test case is confirming that invalid rowspans degrade gracefully,
which may indeed emit a warning.
Bug: T250045
Change-Id: I002b5f68078dee5821d20451131bbffe878684ea
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This is contributing to warning fatigue in CI, with other stuff
slipping and being missed because it's normal.
> Skipped unavailable module test.load.circleC
> Skipped unavailable module test.load.circle
> Skipped unavailable module test.load.missingdep
These are expected warnings for these specific error handling tests.
The test already silenced the "error" to avoid a test failure,
but it did not yet silence the warning that goes along with it.
Bug: T250045
Change-Id: I492e31f2fc2e3342742a10d9fe14a00badca5657
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The following warnings are logged to the browser console (and e.g.
on the CLI from `npm run qunit` in MediaWiki):
> Use of the "options" token is deprecated. Use "csrf" instead.
> Use of the "email" token is deprecated. Use "csrf" instead.
This is contributing to warning fatigue in CI, with other stuff
slipping and being missed because it's normal.
We could call suppressWarnings(), or sinon.stub(mw.log, 'warn').
But, in this case I think we can just remove it at the source as
the warning isn't helping anyone.
These types are part of the stable interface for mw.Api, and have been
for 10+ years. Remove the obsolete logging code.
Bug: T250045
Change-Id: Ibcbc32e3ad9e0afe14199d220757801bae9ad0a4
|
|
|
|
|
|
| |
Follows-up If16d0a3682047537d0a089cddaec58b7c1dec7c8.
Change-Id: I725bb89cfa8330ce29876f3e3f6720c92a72b020
|
|
|
|
|
|
|
| |
I noticed these tests failing locally on Special:JavaScriptTest.
We already follow a similar pattern in other tests in this file.
Change-Id: Ibf6c6cfc4ab9bde4323ca1b253e98d8b9874f2fc
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Follows-up Iec338e9f595b452c1, which added calls to a non-existent
`assert.fail()` function. We can use assert.rejects() on any promise
to assert that it must be rejected, and thus will fail the test for
us if that promise gets resolved/succeeds instead.
https://qunitjs.com/api/assert/rejects/
* Remove most nesting and chaining so that assertions all remain
directly and flat inside the test function, for improved confidence
and readability of the test. This is similar to how
mediawiki.rest.test.js was mostly written already.
* Replace loose partial regex checks, which are prone to false positives
and produce little to no debugging information when they fail, with
strict full assertions.
https://timotijhof.net/posts/2015/qunit-anti-patterns/
Change-Id: If16d0fe50230eae69e39eed93ea1d6715ad9e865
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously it ran one with a conditional for the current browser,
which means in practice the fallback is never tested during development
nor in CI.
Split it up with the native test conditional on browser support,
and the fallback always run as well.
Replace loose partial regex checks, which are prone to false positives
and produce little to no debugging information when they fail, with
strict full assertions.
Change-Id: I3fb63ff4850216652b95a3c3ab9122a9788820fa
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Add a `signal` option to mw.Api#ajax and related methods, which allows
the HTTP request(s) to be cancelled. The interface is inspired by the
Fetch API, and uses the same AbortController/AbortSignal classes.
Cancelling a request this way rejects it with a DOMException rather
than a 'http' error code, similarly to native fetch() function.
For compatibility (some browsers we support may not have a working
AbortController; it's a weird situation, see comments in the code),
provide our own implementation at mw.Api.AbortController.
Add better documentation for the existing style of cancelling promises
too, documented as mw.Api~AbortablePromise. It's not an actual class,
since the 'abort' method is added ad-hoc, just an alias for the docs.
mw.Api extensions can support both AbortSignal and AbortablePromise,
but it's a bit tricky to do. Add mw.Api.makeAbortablePromise()
to help with that, and explain how to do it in its documentation.
Update a few uses of the previous style, which either chained promises
in a complex way, or complained about the 'abort' method in comments.
I've left the simple cases unchanged, to show it's still supported.
(By the way, everything is called "abortable"/"aborted" rather than
"cancellable"/"cancelled", even though that's a nicer term, to avoid
confusion about whether these words have one or two 'l's.)
Depends-On: I7ff705af79760e33200a2dfbfdd05138c18bb110
Needed-By: I3a3ca1b32af58f396b66802a3d435b4c9d137e14
Needed-By: Ia803b4eab766768c2c8a096c308958b48eb34af2
Bug: T346984
Change-Id: Iec338e9f595b452c19ce8e74eb81339fbce11640
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Why:
* The mediawiki.widgets.UserInputWidget was updated in
00f2cd7eb3e75f47f2db2549f8daed24e1138780 to prevent autocomplete
if only IPs are accepted.
* However, this fix seems to either not have worked or broken
since the merge and as such API requests which will never
return any usernames are made.
* This commit fixes this issue and adds a regression test to
verify that this fix continues to work.
What:
* Update mw.widgets.UserInputWidget to override the
::setLookupsDisabled method, such that if the configuration
passed in the constructor excludes temporary accounts and
named accounts the method will ignore attempts to re-enable
lookups.
* Add QUnit tests for the JS file which was previously untested,
so that the fix can be verified to continue to work.
Bug: T380407
Change-Id: I0aed79bd23ea4e77345ae5ecc750d40defd165cd
|
|
|
|
|
|
|
|
| |
Add support for the `{{fullurl:}}` magic word to jqueryMsg so
that it may be used in JavaScript messages.
Bug: T379425
Change-Id: If646731874c8cd5e64328795273dfd27d0d65027
|
|
|
|
|
|
|
|
|
| |
The latter was only added in Chrome 103, as opposed to Chrome 80.
'deflate-raw' just removes the header and checksum which we
can do manually.
Change-Id: Ia26768e080663be3615184e117bed20e978a91fa
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
To avoid a breaking change, introduce a new function name
as CompressionStream is asynchronous.
Once mw.deflate can be removed, we can add skip function for pako
based on the availability of CompressionStream.
Bug: T235237
Change-Id: I722ebb03c0db7c7b3ee16cc8881e41909142cee9
|
| |
| |
| |
| |
| | |
Bug: T355837
Change-Id: I020d1a157423a2f50836ff8e164760692a994d94
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This exposed the internal queue structure, which thus means that
future changes to this structure are noticable through the public
interface (mw.trackSubscribe callbacks). Those callbacks could rely
on the presence of a specific property, or perhaps modify or merge
it with something else, and thus also rely on the absence of certain
properties that they added themselves before or after that merge.
Avoid this by removing support for it.
It was introduced in 2013 with I8c7af097e6 (873b60f194), but never
used:
https://codesearch.wmcloud.org/deployed/?q=mw.trackSubscribe%7Cthis%5C.topic%5Cb&files=js%24&excludeFiles=test%7Cnode_modules
Change-Id: I2d9bc9b7228ab5f2df2160181f41c40cce8f42b6
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When parsing wikitext like `{{func:a|b|c}}`, jqueryMsg accepted
multiple expressions in the parameters following '|' (which are
handled by templateParam()), but not in the first parameter
following ':' (which is handled by templateWithOutReplacement()).
So, `{{#FORMAL:Informal hello|{{GENDER:|Formal}} hello}}` worked,
but `{{#FORMAL:{{GENDER:|Informal}} hello|Formal hello}}` didn't.
Now they both work.
Bug: T379418
Change-Id: Ia4d57fd953dbd34e45789208ec8e765cce6ddf15
|
|
|
|
| |
Change-Id: I52fdc5e5bc64bbe7ea895b9d7106dd3c99b0a908
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Namespace select inputs already support an 'exclude' parameter, ignoring
any namespaces that match ids in that array. For
Special:GlobalContributions, it would be useful to have the opposite -
an array of namespaces to be included, as it only wants to support
filtering on common namespaces.
- Allow an 'include' parameter to be passed through to the namespace
select input
- Support 'include' in Html inputs and OOUI inputs
TODO: Support 'include in Codex inputs (see T378582)
Bug: T378179
Change-Id: I4170beb588292fbec26926ca3afe559c25de9f55
|
|/
|
|
|
|
|
| |
Follow up to Ic262b6c5ce5032f04a950299fb88b606d5c6c881
Bug: T376390
Change-Id: Ib3fce566184ab00eb329d465d640430ed2b6db7e
|
|
|
|
|
|
|
|
|
| |
Add support for the new {{#FORMAL:}} syntax in jqueryMsg.
Add formalityIndex to mw.language.data, and add parsing for
this syntax mediawiki.jqueryMsg.js.
Bug: T366602
Change-Id: Idc6ce0d590729830fd734cccae860f2430b8475c
|
|
|
|
|
|
|
|
| |
Changes to the use statements and some additions
are done automatically via script
This also updates @covers tag for the namespaced classes
Change-Id: I859ba6d05018c99710b744e2becab432410d3bca
|
|
|
|
|
|
| |
Follow-up to 7675004bbec95990b20b4fc96aa34beeecc32d5e.
Change-Id: Ic0f9acdb0d4ee53fb198c2c0c5ff61c738dd2089
|
|
|
|
| |
Change-Id: I551cdcc1b115b3f30178e35968419714cdf87fca
|
|
|
|
| |
Change-Id: Ic7f37dee01dfcf62ecade4bd9277188e27540443
|
|
|
|
|
|
|
|
|
|
|
| |
The value of wgPageContentLanguage was changed to "page view language"
rather than "page content language" in 44725333f.
The naming is confusing and should be renamed to wgPageViewLanguage.
This change reverts d2aa7d594945edbe5d597da6b89ac59a1b2dde79.
Bug: T303375
Change-Id: Ibe0ed6ec2a7fe042482564970e05d360b89841fe
|
|
|
|
|
|
|
|
|
|
|
|
| |
The stable API mw.util.messageBox is added. This matches the existing
Html::messageBox method and provides a stable way to render messages
on the client going forward. Since these are often used by gadgets
and in extensions this seems like a good idea to allow us to easily
change the HTML in future without breaking things and to detect usage
more easily.
Bug: T375519
Change-Id: If864607cbece899222afba57ca4bfe2f72f9dcfe
|
|\ |
|
| |
| |
| |
| | |
Change-Id: I537f5948e9d8e4b0f420705df806307f5535d681
|
|/
|
|
|
|
|
| |
Follow-up to 380d398f1d0cc86dd5f1b008d2dd3e792b003b30,
7c81d82d764eec99ff59c008270c7d66556d8f92.
Change-Id: I53e9f51e178087725afbc1ed681113807aa58110
|
|
|
|
|
|
|
| |
doesQueryContainRecognizedParams of UriProcessor doesn't seem
to be used anywhere.
Change-Id: I8ad54297c41f21bf74f9bb9aac96a616a09a2402
|
|\ |
|
| |
| |
| |
| | |
Change-Id: Id7ccd48e3bf626095e2d3929831b5d87ed0be948
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Use an empty object, which is fast to create, instead of deep clone
that preserves and restores the initial server response for mw.messages
On mediawiki-wmf-quibble with 2000 tests, reduces newMwEnvironment_beforeEach
from 3.7s to 0.7s, saving 3 whole seconds on the CI run.
The total for QUnit is ~37s after this, down from ~40s.
ResourceLoader runs tests with lang=qqx so tests shouldn't rely on
these anyway since all mw.messages contains is thousands of key-value
pairs with qqx placeholder data like `{"foo":"(foo)"}`.
== Changes ==
* Fix qqx mode to work for non-existent messages,
for consistency with how MediaWiki does this in PHP.
Otherwise, tests that expect "(foo)" or "(foo: abc)" as part of
an assertion, would start to fail. As of writing, no frontend tests
in MediaWiki core assert data containing localisation messages, but
there are 27 tests in bundled/WMF-deployed extensions that do so,
including CheckUser (ext.checkUser.checkuser.getUsersBlockForm),
Wikibase (jquery.wikibase.descriptionview),
and VisualEditor (ve.ui.MWAddParameterPage).
* Document why this code checks for "(foo)",
which was added in I3f2a6ceb24 (616b6176db, T222944).
Bug: T225730
Bug: T250045
Depends-On: I6348e5ae00776c2c01d91fa90a431b6ffe3da25d
Change-Id: I3a4024ccf90e50558152d4ee012e492f49e14a0e
|