Page MenuHomePhabricator

jquery.cookie alias removed in MediaWiki 1.42
Open, Needs TriagePublic

Description

The jquery.cookie ResourceLoader Resource Loader module was merged with the mediawiki.cookie ResourceLoader module in June 2023 (T271995). When we did this we retained an alias to support gadgets referencing the old ResourceLoader module. The deprecation has followed the Frontend stable policy.

The alias will be removed next week via the MediaWiki deployment train (Week Jan 15-19th): T338637.

To avoid disruption, a script was run to migrate impacted code we detected. Here is an example:
If the script missed your code https://meta.wikimedia.org/w/index.php?title=User:He7d3r/Tools.js&diff=prev&oldid=26055575
We were unable to patch minified JS.
This is an FYI. For most editors no action is needed, but if you suspect your script is one of the 18 broken by this change you can see this URL for confirmation: https://global-search.toolforge.org/?q=%5B%22%27%5Djquery%5C.cookie%5B%22%27%5D&regex=1&namespaces=2%2C8&title=.*%5C.js

If you do encounter issues with scripts that might be related the solution is to replace code referencing the string 'jquery.cookie' with the string 'mediawiki.cookie'

Feel free to ask questions here.

Event Timeline

When looking for usage on huwiki, I found https://hu.wikiquote.org/wiki/MediaWiki:Common.js, which uses $.cookie. It’s not minified, not obfuscated in any way, just uses the usual $ alias. Please fix those as well before the deploy train reaches the affected wikis.

While usage of mw.cookie is recommended over $.cookie, the latter has not been removed for now, only the jquery.cookie ResourceLoader module alias so https://hu.wikiquote.org/wiki/MediaWiki:Common.js is not impacted by this change.

e.g.

Won't work Will work
mw.loader.using('jquery.cookie').then(()=> $.cookie('foo', 'bar' )) mw.loader.using('mediawiki.cookie').then(()=> $.cookie('foo', 'bar' ))

Okay, thanks for the clarification. However, please note that not everyone uses single quotes, so you should search for double quotes as well: https://global-search.toolforge.org/?q=%5B%22%27%5Djquery%5C.cookie%5B%22%27%5D&regex=1&namespaces=2%2C8&title=.*%5C.js. (Plus usage in MediaWiki:Gadgets-definition, and exotic patterns like template strings, string concatenation etc. – but these exotic patterns are nearly impossible to find and on the other hand should be very rare.)

Change 995439 had a related patch set uploaded (by Jack Phoenix; author: Jack Phoenix):

[mediawiki/extensions/ArticleFeedbackv5@master] Swap uses of the deprecated RL module (alias) jquery.cookie to mediawiki.cookie

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

Change 995439 merged by jenkins-bot:

[mediawiki/extensions/ArticleFeedbackv5@master] Swap uses of the deprecated RL module (alias) jquery.cookie to mediawiki.cookie

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