Page MenuHomePhabricator

Set $wgIncludeLegacyJavaScript = false by default
Closed, ResolvedPublic

Description

The JavaScript Deprecations page says that wikibits.js functions will be removed eventually.

If anyone knows if this is already scheduled to be done in some specific future version of MediaWiki, please inform us below (and update the Target milestone from "Mysterious future" to something more appropriated).

Anyway, I'm creating this bug so that people (me included) can be notified about the progress on this and avoid being caught by surprise.

Event Timeline

bzimport raised the priority of this task from to Low.Nov 22 2014, 12:07 AM
bzimport set Reference to bz33836.
bzimport added a subscriber: Unknown Object (MLST).

From [[mw:ResourceLoader/Migration guide (users)]]:

"There are a few old wikibits functions that don't have a simple drop-in replacement yet (such as importScript()). importScriptURI does have a simple successor: mw.loader.load. Recommendation: Keep using importScript the way you do, the way you know they work. They won't go away anytime soon, certainly not before there is a good replacement."

The old wikibits.js is now a module (mediawiki.legacy.wikibits) which even relies on mediawiki.util. There are no plans to deprecate wikibits in any time soon.

For the record, the legacy wikibits is included by these lines:
if ( $wgIncludeLegacyJavaScript ){

$this->addModules( 'mediawiki.legacy.wikibits' );

}
from
http://svn.wikimedia.org/viewvc/mediawiki/trunk/phase3/includes/OutputPage.php?view=markup#l2452

So, this bug is about changing $wgIncludeLegacyJavaScript to false once we have replacements for the legacy functions.

(In reply to comment #2)

For the record, the legacy wikibits is included by these lines:
if ( $wgIncludeLegacyJavaScript ){

$this->addModules( 'mediawiki.legacy.wikibits' );

}
from
http://svn.wikimedia.org/viewvc/mediawiki/trunk/phase3/includes/OutputPage.php?view=markup#l2452

So, this bug is about changing $wgIncludeLegacyJavaScript to false once we have
replacements for the legacy functions.

Yep, and even after that default is changed:

  • wikis can still set it to true
  • any extension module or gadget can list it as a dependency and ResourceLoader will make sure it's loaded before the rest of the module.

(In reply to comment #3)

  • any extension module or gadget can list it as a dependency and ResourceLoader

will make sure it's loaded before the rest of the module.

.. regardless of what $wgIncludeLegacyJavaScript is set to.

Even when $wgIncludeLegacyJavaScript is set to false by default, wikibits.js will be loaded in a standard installation: $wgUseAjax is true by default, this loads the legacy ajax.js (though at least the ajax features in core don't need it anymore), which has wikibits.js as dependency.

Adding T27845 as a dependency since the request from T29475 to have an equivalent to importScript was marked as a duplicated of the first bug (see also T29535).

Removed dependency on bug 27281, added bug 34958

(In reply to comment #5)

Even when $wgIncludeLegacyJavaScript is set to false by default, wikibits.js
will be loaded in a standard installation: $wgUseAjax is true by default, this
loads the legacy ajax.js (though at least the ajax features in core don't need
it anymore), which has wikibits.js as dependency.

Yes, but one must never depend on another module's dependency.

wgIncludeLegacyJavaScript is intended for scripts that are not resource loader modules (yet) so that those (usually older) scripts may assume presence of wikibits methods.

If wgIncludeLegacyJavaScript is false, eventhough it may end up being loaded, you can't know for sure if it will be loaded when you need it.

For example, if wgIncludeLegacyJavaScript is false, and your module loads before ajax.js then you won't have wikibits.

(unless you add mediawiki.legacy.wikibits to your module dependencies, see comment 3)

Krinkle removed a project: Future-Release.
Krinkle set Security to None.
Krinkle edited projects, added MediaWiki-Configuration; removed MediaWiki-JavaScript.
Krinkle edited projects, added MediaWiki-General; removed MediaWiki-Configuration.
Krinkle removed a subscriber: Unknown Object (MLST).

Users might subscribe to projects MediaWiki-JavaScript or JavaScript and expect to know about tasks like this. I suggest having this task in at least one of them.

Change 277739 had a related patch set uploaded (by Krinkle):
Set $wgIncludeLegacyJavaScript false by default

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

Change 277739 merged by jenkins-bot:
Set $wgIncludeLegacyJavaScript false by default

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

Jdforrester-WMF claimed this task.
Jdforrester-WMF subscribed.

This is now done in master and will ship in MW 1.27.0. Announcement e-mail to come.

@Johan I'll announce this to Wikitech-l first. That'll give you basis for a summary line in Tech News.

@Krinkle I'm writing Tech/News this week. I'll keep an eye on wikitech-l. Thanks! :)