Page MenuHomePhabricator

addPortletLink function throws uncaught error when called by reference
Closed, ResolvedPublic

Description

Follows-up T253938 / https://gerrit.wikimedia.org/r/615321, which caused the function to no longer work when called by reference, or as callback, or by a variable, or in a different utility class.

Reported at https://en.wikipedia.org/wiki/Wikipedia:Village_pump_(technical)#Scripts_do_not_show_up.

Users are finding that the global function addPortletLink no longer works, and is causing other code in those gadgets and scripts to be cancelled as a result as well (the global is a mw.log.deprecate alias to mw.util.addPortletLink).

For example:

var add = mw.util.addPortletLink;

add(); // throws

function init(add) {
  add(); // throws
}
init(mw.util.addPortletLink);

var skinUtils = {
  addLink: mw.util.addPortletLink
}

skinUtils.addLink(); // throws

Event Timeline

Izno added a subscriber: Izno.
Jdlrobson triaged this task as Medium priority.
Jdlrobson moved this task from Incoming to Needs Prioritization on the Readers-Web-Backlog board.

Change 636090 had a related patch set uploaded (by Jdlrobson; owner: Jdlrobson):
[mediawiki/core@master] Use mw.util rather than this

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

Change 635981 had a related patch set uploaded (by Krinkle; owner: Jdlrobson):
[mediawiki/core@wmf/1.36.0-wmf.14] mediawiki.util: Use mw.util rather than 'this'

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

Change 636090 merged by jenkins-bot:
[mediawiki/core@master] mediawiki.util: Use mw.util rather than 'this'

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

I forgot to roll this out on Friday.. I'll do this now.

Change 635981 merged by jenkins-bot:
[mediawiki/core@wmf/1.36.0-wmf.14] mediawiki.util: Use mw.util rather than 'this'

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

Mentioned in SAL (#wikimedia-operations) [2020-10-26T17:39:31Z] <krinkle@deploy1001> Synchronized php-1.36.0-wmf.13/resources/src/mediawiki.util/: T265809, I1011f63ae61f5a6 (duration: 01m 00s)

This got backported but interestingly there are still instances of the error on zh-yue and zh. I can also replicate this using:
https://logstash.wikimedia.org/app/kibana#/doc/logstash-*/logstash-2020.10.28/clienterror/?id=AXVuysYj2lgCwKx7ovAA

mw.log.deprecate( window, 'addPortletLink', mw.util.addPortletLink, 'Use mw.util.addPortletLink instead' );
addPortletLink( 'p-cactions', "javascript:twinkleprod.callback()", "prod", "tw-prod", "Propose deletion via WP:PROD", "");

I can confirm the old code is still present in this url waaa?

I see this patch was backported to wmf13. WAs that meant to be wmf14? That is the live wiki.

We'll skip the backport and let this roll out in next week's train.

Being bold.

Feel free to reopen this task if errors continue to occur after this week's train.