Set $wgIncludeLegacyJavaScript = false by default
OpenPublic

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.

bzimport added a subscriber: wikibugs-l.
bzimport set Reference to bz33836.
He7d3r created this task.Via LegacyJan 20 2012, 12:44 PM
Edokter added a comment.Via ConduitJan 20 2012, 4:24 PM

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.

He7d3r added a comment.Via ConduitJan 20 2012, 6:42 PM

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.

Krinkle added a comment.Via ConduitJan 20 2012, 11:16 PM

(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.
Krinkle added a comment.Via ConduitJan 20 2012, 11:17 PM

(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.

Schnark added a comment.Via ConduitJan 21 2012, 9:38 AM

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.

He7d3r added a comment.Via ConduitJan 24 2012, 7:40 PM

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

Krinkle added a comment.Via ConduitMar 10 2012, 10:05 PM

Removed dependency

Krinkle added a comment.Via ConduitMar 10 2012, 10:06 PM

Removed dependency on bug 27281, added bug 34958

Krinkle added a comment.Via ConduitMay 11 2012, 5:28 PM

(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 edited the task description. (Show Details)Via WebNov 25 2014, 8:51 PM
Krinkle removed a subscriber: wikibugs-l.
Krinkle removed a project: Future-Release.
Krinkle set Security to None.
Krinkle edited projects, added MediaWiki-Configuration; removed MediaWiki-JavaScript.

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.

matmarex edited projects, added Technical-Debt; removed MediaWiki-JavaScript.Via WebDec 21 2014, 5:50 PM

Add Comment

Column Prototype
This is a very early prototype of a persistent column. It is not expected to work yet, and leaving it open will activate other new features which will break things. Press "\" (backslash) on your keyboard to close it now.