Page MenuHomePhabricator

Remove legacy javascript globals
Open, LowPublic

Description

For readers of Tech News (October 2019):

Gadgets and user scripts can access variables about the current page in JavaScript. In 2015, this information was moved from global variables named wg* to mw.config. The old way via wg* global variables will be removed later this year.

To find out if a gadget or user script that you use is affected by this change, open the JavaScript console in your browser. If you see warnings like the below, then you are using a gadget or script that will stop working if the issue is not fixed:

Use of "wgPageName" is deprecated. Use mw.config instead.

The following may help with finding the problem script or with fixing the issue once once found:

If you want your wiki to be one of the first to try the new way that no longer has these global variables, leave a comment below. This can help find new issues that we may have missed. If your wiki choose to enable the new way, you can let us know to undo it if a problem is found.


Timeline
  • Add option to disable legacy globals: wgLegacyJavaScriptGlobals. – T30916, 49ce5de7d94 (MediaWiki 1.17 in 2011)
  • Add deprecation notices for accessing mw.config.get() when wgLegacyJavaScriptGlobals is enabled. – T58550, 24f84b08cf91ef (MediaWiki 1.25 in 2014)
  • Migrate usage and gradually disable on Wikimedia wikis:
    • Turn it off on test2.wikipedia.org. – T67011, bbfba08d31 (2014)
    • Fix the Collection extension to not depend on these. T177259
    • Turn it off on group0 wikis. (test.wikipedia.org, mediawiki.org, and read-only wikis)
    • Turn it off for developers and in Continuous Integration for code merges. (DevelopmentSettings)
    • Turn it off on Beta Cluster for all wikis.
    • Turn it off on group1 wikis. (mostly non-Wikipedia)
    • Turn it off everywhere. (+group2: Wikipedia)
    • Turn it off by default in MediaWiki core. – T35837 (in release N)
  • Remove the feature. – (in release N+1 or later)

Details

Reference
bz70470

Event Timeline

bzimport raised the priority of this task from to Normal.Nov 22 2014, 3:53 AM
bzimport added a project: MediaWiki-JavaScript.
bzimport set Reference to bz70470.
bzimport added a subscriber: Unknown Object (MLST).
Krinkle created this task.Sep 5 2014, 10:44 PM
Krinkle claimed this task.Nov 24 2014, 10:10 PM
Krinkle updated the task description. (Show Details)
Krinkle set Security to None.
Krinkle removed a subscriber: Unknown Object (MLST).
Ricordisamoa added a subscriber: Ricordisamoa.
Krinkle removed Krinkle as the assignee of this task.Jul 8 2015, 7:13 AM
Krinkle lowered the priority of this task from Normal to Low.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJan 22 2016, 11:49 PM
Restricted Application added a subscriber: Luke081515. · View Herald TranscriptJan 29 2016, 7:37 PM
Krinkle changed the task status from Open to Stalled.Mar 7 2018, 8:23 PM
Krinkle updated the task description. (Show Details)Mar 7 2018, 8:32 PM

Updated the task description to formulate all the expected steps for major migrations of this sort. Also a copy here for the record:

  • Add option to disable.
  • Add deprecation notices. – (in release N)
  • Migrate usage and gradually disable on Wikimedia wikis:
    • Turn it off on test2.wikipedia.org.
    • Turn it off in Continuous Integration. (Jenkins mw-config)
    • Turn it off on Beta Cluster.
    • Turn it off on group0 wikis. (test.wikipedia.org, mediawiki.org, and read-only wikis)
    • Turn it off on group1 wikis. (mostly non-Wikipedia)
    • Turn it off everywhere. (+group2: Wikipedia)
  • Turn it off by default in MediaWiki core. – (in release N+1 or later)
  • Remove the feature. – (in release N+2 or later)
Krinkle updated the task description. (Show Details)Mar 7 2018, 8:35 PM
Krinkle moved this task from Inbox to Accepted Enhancement on the MediaWiki-ResourceLoader board.
Nirmos added a subscriber: Nirmos.Mar 7 2018, 8:36 PM
Ahecht added a subscriber: Ahecht.Aug 20 2018, 9:03 PM

We're still cleaning up the mess caused by switching from Tidy to RemexHTML, and on larger wikis such as enwiki tech-savvy editors will still be needed to working on the hundreds of thousands of pages with broken rendering for the forseeable future. Breaking all the old scripts and gadgets "soon" (as specified in the Tech News blurb) would be a disaster. This is only compounded by the roll out of the Interface Administrator group later this month, which means that gadgets and scripts in the mediawiki namespace or in the namespace of inactive users will only be able to be fixed by the very small number of editors granted this permission.

Krinkle changed the task status from Stalled to Open.Jun 6 2019, 8:42 AM

Proposing to resume this project after the 1.35 cycle starts, in October 2019. With the step of turning off for all WMF wikis happening somewhere between January and May 2020, and in MW core for third-parties after that, to be part of the 1.35.0 release in June 2020.

Krinkle updated the task description. (Show Details)Jul 13 2019, 12:25 AM

Change 524594 had a related patch set uploaded (by Jforrester; owner: Jforrester):
[mediawiki/core@master] DevelopmentSettings: Disable legacy javascript globals in CI and for devs

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

Change 524594 merged by jenkins-bot:
[mediawiki/core@master] DevelopmentSettings: Disable legacy javascript globals in CI and for devs

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

I'm confused. Shouldn't it be set to false?

Indeed. Thank you for noticing :)

Change 524683 had a related patch set uploaded (by Krinkle; owner: Jforrester):
[mediawiki/core@master] Follow-up ffd802a386: Actually disable legacy JS globals

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

Change 524683 merged by jenkins-bot:
[mediawiki/core@master] Follow-up ffd802a386: Actually disable legacy JS globals

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

Change 541581 had a related patch set uploaded (by Jforrester; owner: Jforrester):
[operations/mediawiki-config@master] [Beta Cluster] Disable wgLegacyJavaScriptGlobals

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

Change 541581 merged by jenkins-bot:
[operations/mediawiki-config@master] [Beta Cluster] Disable wgLegacyJavaScriptGlobals

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

Krinkle added a comment.EditedTue, Oct 8, 10:08 PM

For Tech News:

Gadgets and user scripts can access variables about the current page in JavaScript. In 2015, this information was moved from global variables named wg* to mw.config. The old global variables will be removed later this year. You can tell the developers if you want to try this out on your wiki first, at T72470.

I've added more details to the task description as well.

Krinkle updated the task description. (Show Details)Tue, Oct 8, 10:17 PM